diff --git a/assets/ccip-18a01d4f.js b/assets/ccip-70098440.js similarity index 97% rename from assets/ccip-18a01d4f.js rename to assets/ccip-70098440.js index 3b748f61..ad4f5215 100644 --- a/assets/ccip-18a01d4f.js +++ b/assets/ccip-70098440.js @@ -1 +1 @@ -import{as as f,at as w,au as y,av as p,aw as h,ax as g,ay as k,az as O,aA as L,aB as m,aC as E}from"./index-cfc0b18f.js";class x extends f{constructor({callbackSelector:e,cause:t,data:n,extraData:c,sender:d,urls:a}){var i;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(i=t.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(u=>` ${w(u)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class M extends f{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${y(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class R extends f{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function $(s,e){if(!p(s))throw new h({address:s});if(!p(e))throw new h({address:e});return s.toLowerCase()===e.toLowerCase()}const C="0x556f1830",A={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function P(s,{blockNumber:e,blockTag:t,data:n,to:c}){const{args:d}=g({data:n,abi:[A]}),[a,i,u,r,o]=d;try{if(!$(c,a))throw new R({sender:a,to:c});const l=await S({data:u,sender:a,urls:i}),{data:b}=await k(s,{blockNumber:e,blockTag:t,data:O([r,L([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return b}catch(l){throw new x({callbackSelector:r,cause:l,data:n,extraData:o,sender:a,urls:i})}}async function S({data:s,sender:e,urls:t}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d` ${w(u)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class M extends f{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${y(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class R extends f{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function $(s,e){if(!p(s))throw new h({address:s});if(!p(e))throw new h({address:e});return s.toLowerCase()===e.toLowerCase()}const C="0x556f1830",A={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function P(s,{blockNumber:e,blockTag:t,data:n,to:c}){const{args:d}=g({data:n,abi:[A]}),[a,i,u,r,o]=d;try{if(!$(c,a))throw new R({sender:a,to:c});const l=await S({data:u,sender:a,urls:i}),{data:b}=await k(s,{blockNumber:e,blockTag:t,data:O([r,L([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return b}catch(l){throw new x({callbackSelector:r,cause:l,data:n,extraData:o,sender:a,urls:i})}}async function S({data:s,sender:e,urls:t}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function N(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=N.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():R(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;r0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function N(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=N.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():R(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;rMath.min(Math.max(r,e),t),H={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},he=e=>typeof e=="number",Et=e=>Array.isArray(e)&&!he(e[0]),jo=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Wo(e,t){return Et(e)?e[jo(0,e.length,t)]:e}const no=(e,t,r)=>-r*e+r*t+e,io=()=>{},it=e=>e,pr=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function so(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=pr(0,t,n);e.push(no(r,1,o))}}function Ho(e){const t=[0];return so(t,e-1),t}function zo(e,t=Ho(e.length),r=it){const n=e.length,o=n-t.length;return o>0&&so(t,o),i=>{let s=0;for(;sArray.isArray(e)&&he(e[0]),sr=e=>typeof e=="object"&&!!e.createAnimation,Ot=e=>typeof e=="function",Fo=e=>typeof e=="string",zt={ms:e=>e*1e3,s:e=>e/1e3},lo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Vo=12;function Ko(e,t,r,n,o){let i,s,a=0;do s=t+(r-t)/2,i=lo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++aKo(i,0,1,e,r);return i=>i===0||i===1?i:lo(o(i),t,n)}const qo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return oo(0,1,o/e)},Ar={ease:Ht(.25,.1,.25,1),"ease-in":Ht(.42,0,1,1),"ease-in-out":Ht(.42,0,.58,1),"ease-out":Ht(0,0,.58,1)},Yo=/\((.*?)\)/;function _r(e){if(Ot(e))return e;if(ao(e))return Ht(...e);if(Ar[e])return Ar[e];if(e.startsWith("steps")){const t=Yo.exec(e);if(t){const r=t[1].split(",");return qo(parseFloat(r[0]),r[1].trim())}}return it}class co{constructor(t,r=[0,1],{easing:n,duration:o=H.duration,delay:i=H.delay,endDelay:s=H.endDelay,repeat:a=H.repeat,offset:l,direction:c="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=it,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((b,h)=>{this.resolve=b,this.reject=h}),n=n||H.easing,sr(n)){const b=n.createAnimation(r);n=b.easing,r=b.keyframes||r,o=b.duration||o}this.repeat=a,this.easing=Et(n)?it:_r(n),this.updateDuration(o);const d=zo(r,l,Et(n)?n.map(_r):it);this.tick=b=>{var h;i=i;let u=0;this.pauseTime!==void 0?u=this.pauseTime:u=(b-this.startTime)*this.rate,this.t=u,u/=1e3,u=Math.max(u-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(u=this.totalDuration);const p=u/this.duration;let g=Math.floor(p),$=p%1;!$&&p>=1&&($=1),$===1&&g--;const f=g%2;(c==="reverse"||c==="alternate"&&f||c==="alternate-reverse"&&!f)&&($=1-$);const y=u>=this.totalDuration?1:Math.min($,1),v=d(this.easing(y));t(v),this.pauseTime===void 0&&(this.playState==="finished"||u>=this.totalDuration+s)?(this.playState="finished",(h=this.resolve)===null||h===void 0||h.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}class Go{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const Ce=new WeakMap;function ho(e){return Ce.has(e)||Ce.set(e,{transforms:[],values:new Map}),Ce.get(e)}function Qo(e,t){return e.has(t)||e.set(t,new Go),e.get(t)}const Jo=["","X","Y","Z"],Xo=["translate","scale","rotate","skew"],ue={x:"translateX",y:"translateY",z:"translateZ"},Or={syntax:"",initialValue:"0deg",toDefaultUnit:e=>e+"deg"},tn={translate:{syntax:"",initialValue:"0px",toDefaultUnit:e=>e+"px"},rotate:Or,scale:{syntax:"",initialValue:1,toDefaultUnit:it},skew:Or},Zt=new Map,wr=e=>`--motion-${e}`,me=["x","y","z"];Xo.forEach(e=>{Jo.forEach(t=>{me.push(e+t),Zt.set(wr(e+t),tn[e])})});const en=(e,t)=>me.indexOf(e)-me.indexOf(t),rn=new Set(me),uo=e=>rn.has(e),on=(e,t)=>{ue[t]&&(t=ue[t]);const{transforms:r}=ho(e);Uo(r,t),e.style.transform=nn(r)},nn=e=>e.sort(en).reduce(sn,"").trim(),sn=(e,t)=>`${e} ${t}(var(${wr(t)}))`,ar=e=>e.startsWith("--"),kr=new Set;function an(e){if(!kr.has(e)){kr.add(e);try{const{syntax:t,initialValue:r}=Zt.has(e)?Zt.get(e):{};CSS.registerProperty({name:e,inherits:!1,syntax:t,initialValue:r})}catch{}}}const Ee=(e,t)=>document.createElement("div").animate(e,t),Ir={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Ee({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Ee({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Ee({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Ae={},Ct={};for(const e in Ir)Ct[e]=()=>(Ae[e]===void 0&&(Ae[e]=Ir[e]()),Ae[e]);const ln=.015,cn=(e,t)=>{let r="";const n=Math.round(t/ln);for(let o=0;oOt(e)?Ct.linearEasing()?`linear(${cn(e,t)})`:H.easing:ao(e)?dn(e):e,dn=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`;function hn(e,t){for(let r=0;rArray.isArray(e)?e:[e];function lr(e){return ue[e]&&(e=ue[e]),uo(e)?wr(e):e}const Xt={get:(e,t)=>{t=lr(t);let r=ar(t)?e.style.getPropertyValue(t):getComputedStyle(e)[t];if(!r&&r!==0){const n=Zt.get(t);n&&(r=n.initialValue)}return r},set:(e,t,r)=>{t=lr(t),ar(t)?e.style.setProperty(t,r):e.style[t]=r}};function mo(e,t=!0){if(!(!e||e.playState==="finished"))try{e.stop?e.stop():(t&&e.commitStyles(),e.cancel())}catch{}}function mn(e,t){var r;let n=(t==null?void 0:t.toDefaultUnit)||it;const o=e[e.length-1];if(Fo(o)){const i=((r=o.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";i&&(n=s=>s+i)}return n}function gn(){return window.__MOTION_DEV_TOOLS_RECORD}function fn(e,t,r,n={},o){const i=gn(),s=n.record!==!1&&i;let a,{duration:l=H.duration,delay:c=H.delay,endDelay:d=H.endDelay,repeat:b=H.repeat,easing:h=H.easing,persist:u=!1,direction:p,offset:g,allowWebkitAcceleration:$=!1}=n;const f=ho(e),y=uo(t);let v=Ct.waapi();y&&on(e,t);const w=lr(t),k=Qo(f.values,w),I=Zt.get(w);return mo(k.animation,!(sr(h)&&k.generator)&&n.record!==!1),()=>{const R=()=>{var P,F;return(F=(P=Xt.get(e,w))!==null&&P!==void 0?P:I==null?void 0:I.initialValue)!==null&&F!==void 0?F:0};let T=hn(un(r),R);const z=mn(T,I);if(sr(h)){const P=h.createAnimation(T,t!=="opacity",R,w,k);h=P.easing,T=P.keyframes||T,l=P.duration||l}if(ar(w)&&(Ct.cssRegisterProperty()?an(w):v=!1),y&&!Ct.linearEasing()&&(Ot(h)||Et(h)&&h.some(Ot))&&(v=!1),v){I&&(T=T.map(Z=>he(Z)?I.toDefaultUnit(Z):Z)),T.length===1&&(!Ct.partialKeyframes()||s)&&T.unshift(R());const P={delay:zt.ms(c),duration:zt.ms(l),endDelay:zt.ms(d),easing:Et(h)?void 0:Tr(h,l),direction:p,iterations:b+1,fill:"both"};a=e.animate({[w]:T,offset:g,easing:Et(h)?h.map(Z=>Tr(Z,l)):void 0},P),a.finished||(a.finished=new Promise((Z,V)=>{a.onfinish=Z,a.oncancel=V}));const F=T[T.length-1];a.finished.then(()=>{u||(Xt.set(e,w,F),a.cancel())}).catch(io),$||(a.playbackRate=1.000001)}else if(o&&y)T=T.map(P=>typeof P=="string"?parseFloat(P):P),T.length===1&&T.unshift(parseFloat(R())),a=new o(P=>{Xt.set(e,w,z?z(P):P)},T,Object.assign(Object.assign({},n),{duration:l,easing:h}));else{const P=T[T.length-1];Xt.set(e,w,I&&he(P)?I.toDefaultUnit(P):P)}return s&&i(e,t,T,{duration:l,delay:c,easing:h,repeat:b,offset:g},"motion-one"),k.setAnimation(a),a}}const pn=(e,t)=>e[t]?Object.assign(Object.assign({},e),e[t]):Object.assign({},e);function wn(e,t){var r;return typeof e=="string"?t?((r=t[e])!==null&&r!==void 0||(t[e]=document.querySelectorAll(e)),e=t[e]):e=document.querySelectorAll(e):e instanceof Element&&(e=[e]),Array.from(e||[])}const vn=e=>e(),go=(e,t,r=H.duration)=>new Proxy({animations:e.map(vn).filter(Boolean),duration:r,options:t},yn),bn=e=>e.animations[0],yn={get:(e,t)=>{const r=bn(e);switch(t){case"duration":return e.duration;case"currentTime":return zt.s((r==null?void 0:r[t])||0);case"playbackRate":case"playState":return r==null?void 0:r[t];case"finished":return e.finished||(e.finished=Promise.all(e.animations.map(xn)).catch(io)),e.finished;case"stop":return()=>{e.animations.forEach(n=>mo(n))};case"forEachNative":return n=>{e.animations.forEach(o=>n(o,e))};default:return typeof(r==null?void 0:r[t])>"u"?void 0:()=>e.animations.forEach(n=>n[t]())}},set:(e,t,r)=>{switch(t){case"currentTime":r=zt.ms(r);case"playbackRate":for(let n=0;ne.finished;function $n(e,t,r){return Ot(e)?e(t,r):e}function Cn(e){return function(r,n,o={}){r=wn(r);const i=r.length,s=[];for(let a=0;aMath.min(Math.max(r,e),t),H={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},he=e=>typeof e=="number",Et=e=>Array.isArray(e)&&!he(e[0]),jo=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Wo(e,t){return Et(e)?e[jo(0,e.length,t)]:e}const no=(e,t,r)=>-r*e+r*t+e,io=()=>{},it=e=>e,pr=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function so(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=pr(0,t,n);e.push(no(r,1,o))}}function Ho(e){const t=[0];return so(t,e-1),t}function zo(e,t=Ho(e.length),r=it){const n=e.length,o=n-t.length;return o>0&&so(t,o),i=>{let s=0;for(;sArray.isArray(e)&&he(e[0]),sr=e=>typeof e=="object"&&!!e.createAnimation,Ot=e=>typeof e=="function",Fo=e=>typeof e=="string",zt={ms:e=>e*1e3,s:e=>e/1e3},lo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Vo=12;function Ko(e,t,r,n,o){let i,s,a=0;do s=t+(r-t)/2,i=lo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++aKo(i,0,1,e,r);return i=>i===0||i===1?i:lo(o(i),t,n)}const qo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return oo(0,1,o/e)},Ar={ease:Ht(.25,.1,.25,1),"ease-in":Ht(.42,0,1,1),"ease-in-out":Ht(.42,0,.58,1),"ease-out":Ht(0,0,.58,1)},Yo=/\((.*?)\)/;function _r(e){if(Ot(e))return e;if(ao(e))return Ht(...e);if(Ar[e])return Ar[e];if(e.startsWith("steps")){const t=Yo.exec(e);if(t){const r=t[1].split(",");return qo(parseFloat(r[0]),r[1].trim())}}return it}class co{constructor(t,r=[0,1],{easing:n,duration:o=H.duration,delay:i=H.delay,endDelay:s=H.endDelay,repeat:a=H.repeat,offset:l,direction:c="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=it,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((b,h)=>{this.resolve=b,this.reject=h}),n=n||H.easing,sr(n)){const b=n.createAnimation(r);n=b.easing,r=b.keyframes||r,o=b.duration||o}this.repeat=a,this.easing=Et(n)?it:_r(n),this.updateDuration(o);const d=zo(r,l,Et(n)?n.map(_r):it);this.tick=b=>{var h;i=i;let u=0;this.pauseTime!==void 0?u=this.pauseTime:u=(b-this.startTime)*this.rate,this.t=u,u/=1e3,u=Math.max(u-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(u=this.totalDuration);const p=u/this.duration;let g=Math.floor(p),$=p%1;!$&&p>=1&&($=1),$===1&&g--;const f=g%2;(c==="reverse"||c==="alternate"&&f||c==="alternate-reverse"&&!f)&&($=1-$);const y=u>=this.totalDuration?1:Math.min($,1),v=d(this.easing(y));t(v),this.pauseTime===void 0&&(this.playState==="finished"||u>=this.totalDuration+s)?(this.playState="finished",(h=this.resolve)===null||h===void 0||h.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}class Go{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const Ce=new WeakMap;function ho(e){return Ce.has(e)||Ce.set(e,{transforms:[],values:new Map}),Ce.get(e)}function Qo(e,t){return e.has(t)||e.set(t,new Go),e.get(t)}const Jo=["","X","Y","Z"],Xo=["translate","scale","rotate","skew"],ue={x:"translateX",y:"translateY",z:"translateZ"},Or={syntax:"",initialValue:"0deg",toDefaultUnit:e=>e+"deg"},tn={translate:{syntax:"",initialValue:"0px",toDefaultUnit:e=>e+"px"},rotate:Or,scale:{syntax:"",initialValue:1,toDefaultUnit:it},skew:Or},Zt=new Map,wr=e=>`--motion-${e}`,me=["x","y","z"];Xo.forEach(e=>{Jo.forEach(t=>{me.push(e+t),Zt.set(wr(e+t),tn[e])})});const en=(e,t)=>me.indexOf(e)-me.indexOf(t),rn=new Set(me),uo=e=>rn.has(e),on=(e,t)=>{ue[t]&&(t=ue[t]);const{transforms:r}=ho(e);Uo(r,t),e.style.transform=nn(r)},nn=e=>e.sort(en).reduce(sn,"").trim(),sn=(e,t)=>`${e} ${t}(var(${wr(t)}))`,ar=e=>e.startsWith("--"),kr=new Set;function an(e){if(!kr.has(e)){kr.add(e);try{const{syntax:t,initialValue:r}=Zt.has(e)?Zt.get(e):{};CSS.registerProperty({name:e,inherits:!1,syntax:t,initialValue:r})}catch{}}}const Ee=(e,t)=>document.createElement("div").animate(e,t),Ir={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Ee({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Ee({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Ee({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Ae={},Ct={};for(const e in Ir)Ct[e]=()=>(Ae[e]===void 0&&(Ae[e]=Ir[e]()),Ae[e]);const ln=.015,cn=(e,t)=>{let r="";const n=Math.round(t/ln);for(let o=0;oOt(e)?Ct.linearEasing()?`linear(${cn(e,t)})`:H.easing:ao(e)?dn(e):e,dn=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`;function hn(e,t){for(let r=0;rArray.isArray(e)?e:[e];function lr(e){return ue[e]&&(e=ue[e]),uo(e)?wr(e):e}const Xt={get:(e,t)=>{t=lr(t);let r=ar(t)?e.style.getPropertyValue(t):getComputedStyle(e)[t];if(!r&&r!==0){const n=Zt.get(t);n&&(r=n.initialValue)}return r},set:(e,t,r)=>{t=lr(t),ar(t)?e.style.setProperty(t,r):e.style[t]=r}};function mo(e,t=!0){if(!(!e||e.playState==="finished"))try{e.stop?e.stop():(t&&e.commitStyles(),e.cancel())}catch{}}function mn(e,t){var r;let n=(t==null?void 0:t.toDefaultUnit)||it;const o=e[e.length-1];if(Fo(o)){const i=((r=o.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";i&&(n=s=>s+i)}return n}function gn(){return window.__MOTION_DEV_TOOLS_RECORD}function fn(e,t,r,n={},o){const i=gn(),s=n.record!==!1&&i;let a,{duration:l=H.duration,delay:c=H.delay,endDelay:d=H.endDelay,repeat:b=H.repeat,easing:h=H.easing,persist:u=!1,direction:p,offset:g,allowWebkitAcceleration:$=!1}=n;const f=ho(e),y=uo(t);let v=Ct.waapi();y&&on(e,t);const w=lr(t),k=Qo(f.values,w),I=Zt.get(w);return mo(k.animation,!(sr(h)&&k.generator)&&n.record!==!1),()=>{const R=()=>{var P,F;return(F=(P=Xt.get(e,w))!==null&&P!==void 0?P:I==null?void 0:I.initialValue)!==null&&F!==void 0?F:0};let T=hn(un(r),R);const z=mn(T,I);if(sr(h)){const P=h.createAnimation(T,t!=="opacity",R,w,k);h=P.easing,T=P.keyframes||T,l=P.duration||l}if(ar(w)&&(Ct.cssRegisterProperty()?an(w):v=!1),y&&!Ct.linearEasing()&&(Ot(h)||Et(h)&&h.some(Ot))&&(v=!1),v){I&&(T=T.map(Z=>he(Z)?I.toDefaultUnit(Z):Z)),T.length===1&&(!Ct.partialKeyframes()||s)&&T.unshift(R());const P={delay:zt.ms(c),duration:zt.ms(l),endDelay:zt.ms(d),easing:Et(h)?void 0:Tr(h,l),direction:p,iterations:b+1,fill:"both"};a=e.animate({[w]:T,offset:g,easing:Et(h)?h.map(Z=>Tr(Z,l)):void 0},P),a.finished||(a.finished=new Promise((Z,V)=>{a.onfinish=Z,a.oncancel=V}));const F=T[T.length-1];a.finished.then(()=>{u||(Xt.set(e,w,F),a.cancel())}).catch(io),$||(a.playbackRate=1.000001)}else if(o&&y)T=T.map(P=>typeof P=="string"?parseFloat(P):P),T.length===1&&T.unshift(parseFloat(R())),a=new o(P=>{Xt.set(e,w,z?z(P):P)},T,Object.assign(Object.assign({},n),{duration:l,easing:h}));else{const P=T[T.length-1];Xt.set(e,w,I&&he(P)?I.toDefaultUnit(P):P)}return s&&i(e,t,T,{duration:l,delay:c,easing:h,repeat:b,offset:g},"motion-one"),k.setAnimation(a),a}}const pn=(e,t)=>e[t]?Object.assign(Object.assign({},e),e[t]):Object.assign({},e);function wn(e,t){var r;return typeof e=="string"?t?((r=t[e])!==null&&r!==void 0||(t[e]=document.querySelectorAll(e)),e=t[e]):e=document.querySelectorAll(e):e instanceof Element&&(e=[e]),Array.from(e||[])}const vn=e=>e(),go=(e,t,r=H.duration)=>new Proxy({animations:e.map(vn).filter(Boolean),duration:r,options:t},yn),bn=e=>e.animations[0],yn={get:(e,t)=>{const r=bn(e);switch(t){case"duration":return e.duration;case"currentTime":return zt.s((r==null?void 0:r[t])||0);case"playbackRate":case"playState":return r==null?void 0:r[t];case"finished":return e.finished||(e.finished=Promise.all(e.animations.map(xn)).catch(io)),e.finished;case"stop":return()=>{e.animations.forEach(n=>mo(n))};case"forEachNative":return n=>{e.animations.forEach(o=>n(o,e))};default:return typeof(r==null?void 0:r[t])>"u"?void 0:()=>e.animations.forEach(n=>n[t]())}},set:(e,t,r)=>{switch(t){case"currentTime":r=zt.ms(r);case"playbackRate":for(let n=0;ne.finished;function $n(e,t,r){return Ot(e)?e(t,r):e}function Cn(e){return function(r,n,o={}){r=wn(r);const i=r.length,s=[];for(let a=0;a"data"in d)||t.walk():{};let f=t;return t instanceof Zb?f=new yye({functionName:s}):[xye,vd.code].includes(a)&&(c||l||u)&&(f=new R3({abi:e,data:typeof c=="object"?c.data:c,functionName:s,message:u??l})),new mye(f,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:o})}class Vd extends le{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join(` -`),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class Eye extends le{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d}){const h=pp({from:r==null?void 0:r.address,to:f,value:typeof d<"u"&&`${V4(d)} ${(i==null?void 0:i.nativeCurrency.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ii(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ii(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ii(l)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}function nS(t,e){const r=(t.details||"").toLowerCase(),n=t.walk(i=>i.code===wf.code);return n instanceof le?new wf({cause:t,message:n.details}):wf.nodeMessage.test(r)?new wf({cause:t,message:t.details}):Xy.nodeMessage.test(r)?new Xy({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):C3.nodeMessage.test(r)?new C3({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):S3.nodeMessage.test(r)?new S3({cause:t,nonce:e==null?void 0:e.nonce}):k3.nodeMessage.test(r)?new k3({cause:t,nonce:e==null?void 0:e.nonce}):A3.nodeMessage.test(r)?new A3({cause:t,nonce:e==null?void 0:e.nonce}):_3.nodeMessage.test(r)?new _3({cause:t}):P3.nodeMessage.test(r)?new P3({cause:t,gas:e==null?void 0:e.gas}):T3.nodeMessage.test(r)?new T3({cause:t,gas:e==null?void 0:e.gas}):I3.nodeMessage.test(r)?new I3({cause:t}):Zy.nodeMessage.test(r)?new Zy({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Jb({cause:t})}function Cye(t,{docsPath:e,...r}){let n=nS(t,r);return n instanceof Jb&&(n=t),new Eye(n,{docsPath:e,...r})}function iS(t,{format:e}){return e?Object.keys(e({})).reduce((n,i)=>(t!=null&&t.hasOwnProperty(i)&&(n[i]=t[i]),n),{}):{}}function bp(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?ts(e):void 0;if(o&&!pd(o.address))throw new v1({address:o.address});if(s&&!pd(s))throw new v1({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new ome;if(n&&n>2n**256n-1n)throw new Xy({maxFeePerGas:n});if(i&&n&&i>n)throw new Zy({maxFeePerGas:n,maxPriorityFeePerGas:i})}class Sye extends le{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class sS extends le{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class kye extends le{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ii(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class Aye extends le{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function Rc(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var u,f,d;const s=n??"latest",o=i??!1,a=r!==void 0?ze(r):void 0;let c=null;if(e?c=await t.request({method:"eth_getBlockByHash",params:[e,o]}):c=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]}),!c)throw new Aye({blockHash:e,blockNumber:r});return(((d=(f=(u=t.chain)==null?void 0:u.formatters)==null?void 0:f.block)==null?void 0:d.format)||WU)(c)}async function oS(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _ye(t,e){return cz(t,e)}async function cz(t,e){var s,o,a;const{block:r,chain:n=t.chain,request:i}=e||{};if(typeof((s=n==null?void 0:n.fees)==null?void 0:s.defaultPriorityFee)=="function"){const c=r||await Rc(t);return n.fees.defaultPriorityFee({block:c,client:t,request:i})}else if((o=n==null?void 0:n.fees)!=null&&o.defaultPriorityFee)return(a=n==null?void 0:n.fees)==null?void 0:a.defaultPriorityFee;try{const c=await t.request({method:"eth_maxPriorityFeePerGas"});return Qb(c)}catch{const[c,l]=await Promise.all([r?Promise.resolve(r):Rc(t),oS(t)]);if(typeof c.baseFeePerGas!="bigint")throw new sS;const u=l-c.baseFeePerGas;return u<0n?0n:u}}async function Pye(t,e){return M3(t,e)}async function M3(t,e){var d;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var h,p;return typeof((h=n==null?void 0:n.fees)==null?void 0:h.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((p=n==null?void 0:n.fees)==null?void 0:p.baseFeeMultiplier)??1.2})();if(o<1)throw new Sye;const c=10**o.toString().split(".")[1].length,l=h=>h*BigInt(o*c)/BigInt(c),u=r||await Rc(t);if(typeof((d=n==null?void 0:n.fees)==null?void 0:d.estimateFeesPerGas)=="function")return n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new sS;const h=i!=null&&i.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await cz(t,{block:u,chain:n,request:i}),p=l(u.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??p+h,maxPriorityFeePerGas:h}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await oS(t))}}async function lz(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?ze(n):r]});return Fn(i)}async function n2(t,e){const{account:r=t.account,chain:n,gas:i,nonce:s,type:o}=e;if(!r)throw new Vd;const a=ts(r),c=await Rc(t,{blockTag:"latest"}),l={...e,from:a.address};if(typeof s>"u"&&(l.nonce=await lz(t,{address:a.address,blockTag:"pending"})),typeof o>"u")try{l.type=ume(l)}catch{l.type=typeof c.baseFeePerGas=="bigint"?"eip1559":"legacy"}if(l.type==="eip1559"){const{maxFeePerGas:u,maxPriorityFeePerGas:f}=await M3(t,{block:c,chain:n,request:l});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(l.gas=await aS(t,{...l,account:{address:a.address,type:"json-rpc"}})),bp(l),l}async function aS(t,e){var i,s,o;const r=e.account??t.account;if(!r)throw new Vd({docsPath:"/docs/actions/public/estimateGas"});const n=ts(r);try{const{accessList:a,blockNumber:c,blockTag:l,data:u,gas:f,gasPrice:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:v,to:m,value:g,...y}=n.type==="local"?await n2(t,e):e,C=(c?ze(c):void 0)||l;bp(e);const A=((o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format)||Yb,O=A({...iS(y,{format:A}),from:n.address,accessList:a,data:u,gas:f,gasPrice:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:v,to:m,value:g}),w=await t.request({method:"eth_estimateGas",params:C?[O,C]:[O]});return BigInt(w)}catch(a){throw Cye(a,{...e,account:n,chain:t.chain})}}async function Tye(t,{abi:e,address:r,args:n,functionName:i,...s}){const o=Kc({abi:e,args:n,functionName:i});try{return await aS(t,{data:o,to:r,...s})}catch(a){const c=s.account?ts(s.account):void 0;throw T1(a,{abi:e,address:r,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:c==null?void 0:c.address})}}const gx="/docs/contract/decodeFunctionResult";function Gd({abi:t,args:e,functionName:r,data:n}){let i=t[0];if(r&&(i=yp({abi:t,args:e,name:r}),!i))throw new eg(r,{docsPath:gx});if(i.type!=="function")throw new eg(void 0,{docsPath:gx});if(!i.outputs)throw new Cme(i.name,{docsPath:gx});const s=r2(i.outputs,n);if(s&&s.length>1)return s;if(s&&s.length===1)return s[0]}const Iye="modulepreload",Oye=function(t,e){return new URL(t,e).href},mP={},cS=function(e,r,n){if(!r||r.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(r.map(s=>{if(s=Oye(s,n),s in mP)return;mP[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!n)for(let u=i.length-1;u>=0;u--){const f=i[u];if(f.href===s&&(!o||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":Iye,o||(l.as="script",l.crossOrigin=""),l.href=s,document.head.appendChild(l),o)return new Promise((u,f)=>{l.addEventListener("load",u),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})},N3=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],uz=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],fz=[...uz,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Rye=[...uz,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],yP=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],gP=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],$ye=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],Mye="0x82ad56cb";function Nye(t,{docsPath:e,...r}){let n=nS(t,r);return n instanceof Jb&&(n=t),new az(n,{docsPath:e,...r})}const bx=new Map;function lS({fn:t,id:e,shouldSplitBatch:r,wait:n=0}){const i=async()=>{const l=a();s();const u=l.map(({args:f})=>f);u.length!==0&&t(u).then(f=>{l.forEach(({pendingPromise:d},h)=>{var p;return(p=d.resolve)==null?void 0:p.call(d,[f[h],f])})}).catch(f=>{l.forEach(({pendingPromise:d})=>{var h;return(h=d.reject)==null?void 0:h.call(d,f)})})},s=()=>bx.delete(e),o=()=>a().map(({args:l})=>l),a=()=>bx.get(e)||[],c=l=>bx.set(e,[...a(),l]);return{flush:s,async schedule(l){const u={},f=new Promise((p,v)=>{u.resolve=p,u.reject=v});return(r==null?void 0:r([...o(),l]))&&i(),a().length>0?(c({args:l,pendingPromise:u}),f):(c({args:l,pendingPromise:u}),setTimeout(i,n),f)}}}async function i2(t,e){var g,y,b,C;const{account:r=t.account,batch:n=!!((g=t.batch)!=null&&g.multicall),blockNumber:i,blockTag:s="latest",accessList:o,data:a,gas:c,gasPrice:l,maxFeePerGas:u,maxPriorityFeePerGas:f,nonce:d,to:h,value:p,...v}=e,m=r?ts(r):void 0;try{bp(e);const O=(i?ze(i):void 0)||s,w=((C=(b=(y=t.chain)==null?void 0:y.formatters)==null?void 0:b.transactionRequest)==null?void 0:C.format)||Yb,I=w({...iS(v,{format:w}),from:m==null?void 0:m.address,accessList:o,data:a,gas:c,gasPrice:l,maxFeePerGas:u,maxPriorityFeePerGas:f,nonce:d,to:h,value:p});if(n&&Dye({request:I}))try{return await Lye(t,{...I,blockNumber:i,blockTag:s})}catch(z){if(!(z instanceof DU)&&!(z instanceof E3))throw z}const B=await t.request({method:"eth_call",params:O?[I,O]:[I]});return B==="0x"?{data:void 0}:{data:B}}catch(A){const O=Bye(A),{offchainLookup:w,offchainLookupSignature:I}=await cS(()=>import("./ccip-18a01d4f.js"),[],import.meta.url);if((O==null?void 0:O.slice(0,10))===I&&h)return{data:await w(t,{data:O,to:h})};throw Nye(A,{...e,account:m,chain:t.chain})}}function Dye({request:t}){const{data:e,to:r,...n}=t;return!(!e||e.startsWith(Mye)||!r||Object.values(n).filter(i=>typeof i<"u").length>0)}async function Lye(t,e){var v;const{batchSize:r=1024,wait:n=0}=typeof((v=t.batch)==null?void 0:v.multicall)=="object"?t.batch.multicall:{},{blockNumber:i,blockTag:s="latest",data:o,multicallAddress:a,to:c}=e;let l=a;if(!l){if(!t.chain)throw new DU;l=zd({blockNumber:i,chain:t.chain,contract:"multicall3"})}const f=(i?ze(i):void 0)||s,{schedule:d}=lS({id:`${t.uid}.${f}`,wait:n,shouldSplitBatch(m){return m.reduce((y,{data:b})=>y+(b.length-2),0)>r*2},fn:async m=>{const g=m.map(C=>({allowFailure:!0,callData:C.data,target:C.to})),y=Kc({abi:N3,args:[g],functionName:"aggregate3"}),b=await t.request({method:"eth_call",params:[{data:y,to:l},f]});return Gd({abi:N3,args:[g],functionName:"aggregate3",data:b||"0x"})}}),[{returnData:h,success:p}]=await d({data:o,to:c});if(!p)throw new tS({data:h});return h==="0x"?{data:void 0}:{data:h}}function Bye(t){if(!(t instanceof le))return;const e=t.walk();return typeof e.data=="object"?e.data.data:e.data}async function $c(t,{abi:e,address:r,args:n,functionName:i,...s}){const o=Kc({abi:e,args:n,functionName:i});try{const{data:a}=await i2(t,{data:o,to:r,...s});return Gd({abi:e,args:n,functionName:i,data:a||"0x"})}catch(a){throw T1(a,{abi:e,address:r,args:n,docsPath:"/docs/contract/readContract",functionName:i})}}async function Fye(t,{abi:e,address:r,args:n,dataSuffix:i,functionName:s,...o}){const a=o.account?ts(o.account):void 0,c=Kc({abi:e,args:n,functionName:s});try{const{data:l}=await i2(t,{batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...o});return{result:Gd({abi:e,args:n,functionName:s,data:l||"0x"}),request:{abi:e,address:r,args:n,dataSuffix:i,functionName:s,...o}}}catch(l){throw T1(l,{abi:e,address:r,args:n,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const wx=new Map,bP=new Map;let jye=0;function Kd(t,e,r){const n=++jye,i=()=>wx.get(t)||[],s=()=>{const u=i();wx.set(t,u.filter(f=>f.id!==n))},o=()=>{const u=bP.get(t);i().length===1&&u&&u(),s()},a=i();if(wx.set(t,[...a,{id:n,fns:e}]),a&&a.length>0)return o;const c={};for(const u in e)c[u]=(...f)=>{const d=i();d.length!==0&&d.forEach(h=>{var p,v;return(v=(p=h.fns)[u])==null?void 0:v.call(p,...f)})};const l=r(c);return typeof l=="function"&&bP.set(t,l),o}async function rg(t){return new Promise(e=>setTimeout(e,t))}function wp(t,{emitOnBegin:e,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let a;e&&(a=await t({unpoll:s}));const c=await(r==null?void 0:r(a))??n;await rg(c);const l=async()=>{i&&(await t({unpoll:s}),await rg(n),l())};l()})(),s}const wP="/docs/contract/decodeEventLog";function xp({abi:t,data:e,strict:r,topics:n}){const i=r??!0,[s,...o]=n;if(!s)throw new xme({docsPath:wP});const a=t.find(p=>p.type==="event"&&s===Y4(Gc(p)));if(!(a&&"name"in a)||a.type!=="event")throw new Eme(s,{docsPath:wP});const{name:c,inputs:l}=a,u=l==null?void 0:l.some(p=>!("name"in p&&p.name));let f=u?[]:{};const d=l.filter(p=>"indexed"in p&&p.indexed);if(o.length>0)for(let p=0;p!("indexed"in p&&p.indexed));if(h.length>0){if(e&&e!=="0x")try{const p=r2(h,e);if(p)if(u)f=[...f,...p];else for(let v=0;v0?f:void 0}}function Uye({param:t,value:e}){return t.type==="string"||t.type==="bytes"||t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/)?e:(r2([t],e)||[])[0]}const zye=new Map,Wye=new Map;function Hye(t){const e=(i,s)=>({clear:()=>s.delete(i),get:()=>s.get(i),set:o=>s.set(i,o)}),r=e(t,zye),n=e(t,Wye);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function qye(t,{cacheKey:e,cacheTime:r=1/0}){const n=Hye(e),i=n.response.get();if(i&&r>0&&new Date().getTime()-i.created.getTime()`blockNumber.${t}`;async function Ep(t,{cacheTime:e=t.cacheTime,maxAge:r}={}){const n=await qye(()=>t.request({method:"eth_blockNumber"}),{cacheKey:Vye(t.uid),cacheTime:r??e});return BigInt(n)}async function s2(t,{filter:e}){const r="strict"in e&&e.strict;return(await e.request({method:"eth_getFilterChanges",params:[e.id]})).map(i=>{var s;if(typeof i=="string")return i;try{const{eventName:o,args:a}="abi"in e&&e.abi?xp({abi:e.abi,data:i.data,topics:i.topics,strict:r}):{eventName:void 0,args:void 0};return Os(i,{args:a,eventName:o})}catch(o){let a,c;if(o instanceof su||o instanceof Hd){if("strict"in e&&e.strict)return;a=o.abiItem.name,c=(s=o.abiItem.inputs)==null?void 0:s.some(l=>!("name"in l&&l.name))}return Os(i,{args:c?[]:{},eventName:a})}}).filter(Boolean)}async function uS(t,{address:e,blockHash:r,fromBlock:n,toBlock:i,event:s,events:o,args:a,strict:c}={}){const l=c??!1,u=o??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(h=>gp({abi:[h],eventName:h.name,args:a}))],s&&(f=f[0]));let d;return r?d=await t.request({method:"eth_getLogs",params:[{address:e,topics:f,blockHash:r}]}):d=await t.request({method:"eth_getLogs",params:[{address:e,topics:f,fromBlock:typeof n=="bigint"?ze(n):n,toBlock:typeof i=="bigint"?ze(i):i}]}),d.map(h=>{var p;try{const{eventName:v,args:m}=u?xp({abi:u,data:h.data,topics:h.topics,strict:l}):{eventName:void 0,args:void 0};return Os(h,{args:m,eventName:v})}catch(v){let m,g;if(v instanceof su||v instanceof Hd){if(l)return;m=v.abiItem.name,g=(p=v.abiItem.inputs)==null?void 0:p.some(y=>!("name"in y&&y.name))}return Os(h,{args:g?[]:{},eventName:m})}}).filter(Boolean)}async function o2(t,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}function Gye(t,{abi:e,address:r,args:n,batch:i=!0,eventName:s,onError:o,onLogs:a,poll:c,pollingInterval:l=t.pollingInterval,strict:u}){return(typeof c<"u"?c:t.transport.type!=="webSocket")?(()=>{const p=Un(["watchContractEvent",r,n,i,t.uid,s,l]),v=u??!1;return Kd(p,{onLogs:a,onError:o},m=>{let g,y,b=!1;const C=wp(async()=>{var A;if(!b){try{y=await iz(t,{abi:e,address:r,args:n,eventName:s,strict:v})}catch{}b=!0;return}try{let O;if(y)O=await s2(t,{filter:y});else{const w=await Ep(t);g&&g!==w?O=await uS(t,{address:r,args:n,fromBlock:g+1n,toBlock:w,event:yp({abi:e,name:s})}):O=[],g=w}if(O.length===0)return;i?m.onLogs(O):O.forEach(w=>m.onLogs([w]))}catch(O){y&&O instanceof ou&&(b=!1),(A=m.onError)==null||A.call(m,O)}},{emitOnBegin:!0,interval:l});return async()=>{y&&await o2(t,{filter:y}),C()}})})():(()=>{let p=!0,v=()=>p=!1;return(async()=>{try{const m=s?gp({abi:e,eventName:s,args:n}):[],{unsubscribe:g}=await t.transport.subscribe({params:["logs",{address:r,topics:m}],onData(y){var C;if(!p)return;const b=y.result;try{const{eventName:A,args:O}=xp({abi:e,data:b.data,topics:b.topics,strict:u}),w=Os(b,{args:O,eventName:A});a([w])}catch(A){let O,w;if(A instanceof su||A instanceof Hd){if(u)return;O=A.abiItem.name,w=(C=A.abiItem.inputs)==null?void 0:C.some(B=>!("name"in B&&B.name))}const I=Os(b,{args:w?[]:{},eventName:O});a([I])}},onError(y){o==null||o(y)}});v=g,p||v()}catch(m){o==null||o(m)}})(),v})()}function Kye(t,{docsPath:e,...r}){let n=nS(t,r);return n instanceof Jb&&(n=t),new cme(n,{docsPath:e,...r})}async function I1(t){const e=await t.request({method:"eth_chainId"});return Fn(e)}async function fS(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]})}async function dS(t,e){var v,m,g;const{account:r=t.account,chain:n=t.chain,accessList:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d,...h}=e;if(!r)throw new Vd({docsPath:"/docs/actions/wallet/sendTransaction"});const p=ts(r);try{bp(e);let y;if(n!==null&&(y=await I1(t),LU({currentChainId:y,chain:n})),p.type==="local"){const A=await n2(t,{account:p,accessList:i,chain:n,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d,...h});y||(y=await I1(t));const O=(v=n==null?void 0:n.serializers)==null?void 0:v.transaction,w=await p.signTransaction({...A,chainId:y},{serializer:O});return await fS(t,{serializedTransaction:w})}const b=((g=(m=n==null?void 0:n.formatters)==null?void 0:m.transactionRequest)==null?void 0:g.format)||Yb,C=b({...iS(h,{format:b}),accessList:i,data:s,from:p.address,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d});return await t.request({method:"eth_sendTransaction",params:[C]})}catch(y){throw Kye(y,{...e,account:p,chain:e.chain||void 0})}}async function Qye(t,{abi:e,address:r,args:n,dataSuffix:i,functionName:s,...o}){const a=Kc({abi:e,args:n,functionName:s});return await dS(t,{data:`${a}${i?i.replace("0x",""):""}`,to:r,...o})}async function Yye(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:ze(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]})}const D3=256;let Ev=D3,Cv;function Jye(t=11){if(!Cv||Ev+t>D3*2){Cv="",Ev=0;for(let e=0;e{const g=m(v);for(const b in h)delete g[b];const y={...v,...g};return Object.assign(y,{extend:p(y)})}}return Object.assign(h,{extend:p(h)})}function hz(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const c=async({error:l})=>{const u=typeof e=="function"?e({count:a,error:l}):e;u&&await rg(u),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a"code"in t?t.code!==-1&&t.code!==-32004&&t.code!==-32005&&t.code!==-32042&&t.code!==-32603:t instanceof C0&&t.status?t.status!==403&&t.status!==408&&t.status!==413&&t.status!==429&&t.status!==500&&t.status!==502&&t.status!==503&&t.status!==504:!1;function Xye(t,{retryDelay:e=150,retryCount:r=3}={}){return async n=>hz(async()=>{try{return await t(n)}catch(i){const s=i;switch(s.code){case m1.code:throw new m1(s);case y1.code:throw new y1(s);case g1.code:throw new g1(s);case b1.code:throw new b1(s);case vd.code:throw new vd(s);case ou.code:throw new ou(s);case w1.code:throw new w1(s);case Oc.code:throw new Oc(s);case x1.code:throw new x1(s);case E1.code:throw new E1(s);case C1.code:throw new C1(s);case S1.code:throw new S1(s);case Or.code:throw new Or(s);case k1.code:throw new k1(s);case A1.code:throw new A1(s);case _1.code:throw new _1(s);case P1.code:throw new P1(s);case aa.code:throw new aa(s);case 5e3:throw new Or(s);default:throw i instanceof le?i:new wye(s)}}},{delay:({count:i,error:s})=>{var o;if(s&&s instanceof C0){const a=(o=s==null?void 0:s.headers)==null?void 0:o.get("Retry-After");if(a!=null&&a.match(/\d/))return parseInt(a)*1e3}return~~(1<!pz(i)})}function a2({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:Xye(r,{retryCount:n,retryDelay:i}),value:a}}function c2(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>a2({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}function xP(t,e={}){const{key:r="fallback",name:n="Fallback",rank:i=!1,retryCount:s,retryDelay:o}=e;return({chain:a,pollingInterval:c=4e3,timeout:l})=>{let u=t,f=()=>{};const d=a2({key:r,name:n,async request({method:h,params:p}){const v=async(m=0)=>{const g=u[m]({chain:a,retryCount:0,timeout:l});try{const y=await g.request({method:h,params:p});return f({method:h,params:p,response:y,transport:g,status:"success"}),y}catch(y){if(f({error:y,method:h,params:p,transport:g,status:"error"}),pz(y)||m===u.length-1)throw y;return v(m+1)}};return v()},retryCount:s,retryDelay:o,type:"fallback"},{onResponse:h=>f=h,transports:u.map(h=>h({chain:a,retryCount:0}))});if(i){const h=typeof i=="object"?i:{};Zye({chain:a,interval:h.interval??c,onTransports:p=>u=p,sampleCount:h.sampleCount,timeout:h.timeout,transports:u,weights:h.weights})}return d}}function Zye({chain:t,interval:e=4e3,onTransports:r,sampleCount:n=10,timeout:i=1e3,transports:s,weights:o={}}){const{stability:a=.7,latency:c=.3}=o,l=[],u=async()=>{const f=await Promise.all(s.map(async p=>{const v=p({chain:t,retryCount:0,timeout:i}),m=Date.now();let g,y;try{await v.request({method:"net_listening"}),y=1}catch{y=0}finally{g=Date.now()}return{latency:g-m,success:y}}));l.push(f),l.length>n&&l.shift();const d=Math.max(...l.map(p=>Math.max(...p.map(({latency:v})=>v)))),h=s.map((p,v)=>{const m=l.map(A=>A[v].latency),y=1-m.reduce((A,O)=>A+O,0)/m.length/d,b=l.map(A=>A[v].success),C=b.reduce((A,O)=>A+O,0)/b.length;return C===0?[0,v]:[c*y+a*C,v]}).sort((p,v)=>v[0]-p[0]);r(h.map(([,p])=>s[p])),await rg(e),u()};u()}class vz extends le{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}var Yu=null;typeof WebSocket<"u"?Yu=WebSocket:typeof MozWebSocket<"u"?Yu=MozWebSocket:typeof global<"u"?Yu=global.WebSocket||global.MozWebSocket:typeof window<"u"?Yu=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Yu=self.WebSocket||self.MozWebSocket);const EP=Yu;function mz(t,{errorInstance:e,timeout:r,signal:n}){return new Promise((i,s)=>{(async()=>{let o;try{const a=new AbortController;r>0&&(o=setTimeout(()=>{n?a.abort():s(e)},r)),i(await t({signal:a==null?void 0:a.signal}))}catch(a){a.name==="AbortError"&&s(e),s(a)}finally{clearTimeout(o)}})()})}let L3=0;async function ege(t,{body:e,fetchOptions:r={},timeout:n=1e4}){var a;const{headers:i,method:s,signal:o}=r;try{const c=await mz(async({signal:u})=>await fetch(t,{...r,body:Array.isArray(e)?Un(e.map(d=>({jsonrpc:"2.0",id:d.id??L3++,...d}))):Un({jsonrpc:"2.0",id:e.id??L3++,...e}),headers:{...i,"Content-Type":"application/json"},method:s||"POST",signal:o||(n>0?u:void 0)}),{errorInstance:new $3({body:e,url:t}),timeout:n,signal:!0});let l;if((a=c.headers.get("Content-Type"))!=null&&a.startsWith("application/json")?l=await c.json():l=await c.text(),!c.ok)throw new C0({body:e,details:Un(l.error)||c.statusText,headers:c.headers,status:c.status,url:t});return l}catch(c){throw c instanceof C0||c instanceof $3?c:new C0({body:e,details:c.message,url:t})}}const xx=new Map;async function Ex(t){let e=xx.get(t);if(e)return e;const{schedule:r}=lS({id:t,fn:async()=>{const s=new EP(t),o=new Map,a=new Map,c=({data:u})=>{const f=JSON.parse(u),d=f.method==="eth_subscription",h=d?f.params.subscription:f.id,p=d?a:o,v=p.get(h);v&&v({data:u}),d||p.delete(h)},l=()=>{xx.delete(t),s.removeEventListener("close",l),s.removeEventListener("message",c)};return s.addEventListener("close",l),s.addEventListener("message",c),s.readyState===EP.CONNECTING&&await new Promise((u,f)=>{s&&(s.onopen=u,s.onerror=f)}),e=Object.assign(s,{requests:o,subscriptions:a}),xx.set(t,e),[e]}}),[n,[i]]=await r();return i}function tge(t,{body:e,onResponse:r}){if(t.readyState===t.CLOSED||t.readyState===t.CLOSING)throw new gye({body:e,url:t.url,details:"Socket is closed."});const n=L3++,i=({data:s})=>{var a;const o=JSON.parse(s);typeof o.id=="number"&&n!==o.id||(r==null||r(o),e.method==="eth_subscribe"&&typeof o.result=="string"&&t.subscriptions.set(o.result,i),e.method==="eth_unsubscribe"&&t.subscriptions.delete((a=e.params)==null?void 0:a[0]))};return t.requests.set(n,i),t.send(JSON.stringify({jsonrpc:"2.0",...e,id:n})),t}async function rge(t,{body:e,timeout:r=1e4}){return mz(()=>new Promise(n=>jf.webSocket(t,{body:e,onResponse:n})),{errorInstance:new $3({body:e,url:t.url}),timeout:r})}const jf={http:ege,webSocket:tge,webSocketAsync:rge};function yz(t,e={}){const{batch:r,fetchOptions:n,key:i="http",name:s="HTTP JSON-RPC",retryDelay:o}=e;return({chain:a,retryCount:c,timeout:l})=>{const{batchSize:u=1e3,wait:f=0}=typeof r=="object"?r:{},d=e.retryCount??c,h=l??e.timeout??1e4,p=t||(a==null?void 0:a.rpcUrls.default.http[0]);if(!p)throw new vz;return a2({key:i,name:s,async request({method:v,params:m}){const g={method:v,params:m},{schedule:y}=lS({id:`${t}`,wait:f,shouldSplitBatch(O){return O.length>u},fn:O=>jf.http(p,{body:O,fetchOptions:n,timeout:h})}),b=async O=>r?y(O):[await jf.http(p,{body:O,fetchOptions:n,timeout:h})],[{error:C,result:A}]=await b(g);if(C)throw new rS({body:g,error:C,url:p});return A},retryCount:d,retryDelay:o,timeout:h,type:"http"},{url:t})}}function hS(t,e){var n,i,s;if(!(t instanceof le))return!1;const r=t.walk(o=>o instanceof R3);return r instanceof R3?!!(((n=r.data)==null?void 0:n.errorName)==="ResolverNotFound"||((i=r.data)==null?void 0:i.errorName)==="ResolverWildcardNotSupported"||(s=r.reason)!=null&&s.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&r.reason===sz[50]):!1}function gz(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return So(e)?e:null}function mm(t){let e=new Uint8Array(32).fill(0);if(!t)return p1(e);const r=t.split(".");for(let n=r.length-1;n>=0;n-=1){const i=gz(r[n]),s=i?iu(i):ei(Vo(r[n]),"bytes");e=ei(oa([e,s]),"bytes")}return p1(e)}function nge(t){return`[${t.slice(2)}]`}function ige(t){const e=new Uint8Array(32).fill(0);return t?gz(t)||ei(Vo(t)):p1(e)}function l2(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const r=new Uint8Array(Vo(e).byteLength+2);let n=0;const i=e.split(".");for(let s=0;s255&&(o=Vo(nge(ige(i[s])))),r[n]=o.length,r.set(o,n+1),n+=o.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}async function sge(t,{blockNumber:e,blockTag:r,coinType:n,name:i,universalResolverAddress:s}){let o=s;if(!o){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=zd({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const a=Kc({abi:gP,functionName:"addr",...n!=null?{args:[mm(i),BigInt(n)]}:{args:[mm(i)]}}),c=await $c(t,{address:o,abi:fz,functionName:"resolve",args:[Ca(l2(i)),a],blockNumber:e,blockTag:r});if(c[0]==="0x")return null;const l=Gd({abi:gP,args:n!=null?[mm(i),BigInt(n)]:void 0,functionName:"addr",data:c[0]});return l==="0x"||Bf(l)==="0x00"?null:l}catch(a){if(hS(a,"resolve"))return null;throw a}}class oge extends le{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class Ah extends le{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class pS extends le{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class age extends le{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const cge=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,lge=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,uge=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,fge=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function dge(t){try{const e=await fetch(t,{method:"HEAD"});if(e.status===200){const r=e.headers.get("content-type");return r==null?void 0:r.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(r=>{const n=new Image;n.onload=()=>{r(!0)},n.onerror=()=>{r(!1)},n.src=t})}}function CP(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function bz({uri:t,gatewayUrls:e}){const r=uge.test(t);if(r)return{uri:t,isOnChain:!0,isEncoded:r};const n=CP(e==null?void 0:e.ipfs,"https://ipfs.io"),i=CP(e==null?void 0:e.arweave,"https://arweave.net"),s=t.match(cge),{protocol:o,subpath:a,target:c,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=o==="ipns:/"||a==="ipns/",f=o==="ipfs:/"||a==="ipfs/"||lge.test(t);if(t.startsWith("http")&&!u&&!f){let h=t;return e!=null&&e.arweave&&(h=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:h,isOnChain:!1,isEncoded:!1}}if((u||f)&&c)return{uri:`${n}/${u?"ipns":"ipfs"}/${c}${l}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${i}/${c}${l||""}`,isOnChain:!1,isEncoded:!1};let d=t.replace(fge,"");if(d.startsWith("i.json());return await vS({gatewayUrls:t,uri:wz(r)})}catch{throw new pS({uri:e})}}async function vS({gatewayUrls:t,uri:e}){const{uri:r,isOnChain:n}=bz({uri:e,gatewayUrls:t});if(n||await dge(r))return r;throw new pS({uri:e})}function pge(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=e.split("/"),[s,o]=r.split(":"),[a,c]=n.split(":");if(!s||s.toLowerCase()!=="eip155")throw new Ah({reason:"Only EIP-155 supported"});if(!o)throw new Ah({reason:"Chain ID not found"});if(!c)throw new Ah({reason:"Contract address not found"});if(!i)throw new Ah({reason:"Token ID not found"});if(!a)throw new Ah({reason:"ERC namespace not found"});return{chainID:parseInt(o),namespace:a.toLowerCase(),contractAddress:c,tokenID:i}}async function vge(t,{nft:e}){if(e.namespace==="erc721")return $c(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return $c(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new age({namespace:e.namespace})}async function mge(t,{gatewayUrls:e,record:r}){return/eip155:/i.test(r)?yge(t,{gatewayUrls:e,record:r}):vS({uri:r,gatewayUrls:e})}async function yge(t,{gatewayUrls:e,record:r}){const n=pge(r),i=await vge(t,{nft:n}),{uri:s,isOnChain:o,isEncoded:a}=bz({uri:i,gatewayUrls:e});if(o&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const l=a?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(l);return vS({uri:wz(u),gatewayUrls:e})}let c=n.tokenID;return n.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),hge({gatewayUrls:e,uri:s.replace(/(?:0x)?{id}/,c)})}async function xz(t,{blockNumber:e,blockTag:r,name:n,key:i,universalResolverAddress:s}){let o=s;if(!o){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=zd({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const a=await $c(t,{address:o,abi:fz,functionName:"resolve",args:[Ca(l2(n)),Kc({abi:yP,functionName:"text",args:[mm(n),i]})],blockNumber:e,blockTag:r});if(a[0]==="0x")return null;const c=Gd({abi:yP,functionName:"text",data:a[0]});return c===""?null:c}catch(a){if(hS(a,"resolve"))return null;throw a}}async function gge(t,{blockNumber:e,blockTag:r,gatewayUrls:n,name:i,universalResolverAddress:s}){const o=await xz(t,{blockNumber:e,blockTag:r,key:"avatar",name:i,universalResolverAddress:s});if(!o)return null;try{return await mge(t,{record:o,gatewayUrls:n})}catch{return null}}async function bge(t,{address:e,blockNumber:r,blockTag:n,universalResolverAddress:i}){let s=i;if(!s){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=zd({blockNumber:r,chain:t.chain,contract:"ensUniversalResolver"})}const o=`${e.toLowerCase().substring(2)}.addr.reverse`;try{return(await $c(t,{address:s,abi:Rye,functionName:"reverse",args:[Ca(l2(o))],blockNumber:r,blockTag:n}))[0]}catch(a){if(hS(a,"reverse"))return null;throw a}}async function wge(t,{blockNumber:e,blockTag:r,name:n,universalResolverAddress:i}){let s=i;if(!s){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=zd({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}const[o]=await $c(t,{address:s,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Ca(l2(n))],blockNumber:e,blockTag:r});return o}async function xge(t){const e=t2(t,{method:"eth_newBlockFilter"}),r=await t.request({method:"eth_newBlockFilter"});return{id:r,request:e(r),type:"block"}}async function Ez(t,{address:e,args:r,event:n,events:i,fromBlock:s,strict:o,toBlock:a}={}){const c=i??(n?[n]:void 0),l=t2(t,{method:"eth_newFilter"});let u=[];c&&(u=[c.flatMap(d=>gp({abi:[d],eventName:d.name,args:r}))],n&&(u=u[0]));const f=await t.request({method:"eth_newFilter",params:[{address:e,fromBlock:typeof s=="bigint"?ze(s):s,toBlock:typeof a=="bigint"?ze(a):a,...u.length?{topics:u}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:s,id:f,request:l(f),strict:o,toBlock:a,type:"event"}}async function Cz(t){const e=t2(t,{method:"eth_newPendingTransactionFilter"}),r=await t.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:e(r),type:"transaction"}}async function Ege(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?ze(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function Cge(t,{blockHash:e,blockNumber:r,blockTag:n="latest"}={}){const i=r!==void 0?ze(r):void 0;let s;return e?s=await t.request({method:"eth_getBlockTransactionCountByHash",params:[e]}):s=await t.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]}),Fn(s)}async function Sge(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r!==void 0?ze(r):void 0,s=await t.request({method:"eth_getCode",params:[e,i||n]});if(s!=="0x")return s}function kge(t){var e;return{baseFeePerGas:t.baseFeePerGas.map(r=>BigInt(r)),gasUsedRatio:t.gasUsedRatio,oldestBlock:BigInt(t.oldestBlock),reward:(e=t.reward)==null?void 0:e.map(r=>r.map(n=>BigInt(n)))}}async function Age(t,{blockCount:e,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const s=r?ze(r):void 0,o=await t.request({method:"eth_feeHistory",params:[ze(e),s||n,i]});return kge(o)}async function _ge(t,{filter:e}){const r=e.strict??!1;return(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(i=>{var s;try{const{eventName:o,args:a}="abi"in e&&e.abi?xp({abi:e.abi,data:i.data,topics:i.topics,strict:r}):{eventName:void 0,args:void 0};return Os(i,{args:a,eventName:o})}catch(o){let a,c;if(o instanceof su||o instanceof Hd){if("strict"in e&&e.strict)return;a=o.abiItem.name,c=(s=o.abiItem.inputs)==null?void 0:s.some(l=>!("name"in l&&l.name))}return Os(i,{args:c?[]:{},eventName:a})}}).filter(Boolean)}async function Pge(t,{address:e,blockNumber:r,blockTag:n="latest",slot:i}){const s=r!==void 0?ze(r):void 0;return await t.request({method:"eth_getStorageAt",params:[e,i,s||n]})}async function mS(t,{blockHash:e,blockNumber:r,blockTag:n,hash:i,index:s}){var u,f,d;const o=n||"latest",a=r!==void 0?ze(r):void 0;let c=null;if(i?c=await t.request({method:"eth_getTransactionByHash",params:[i]}):e?c=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,ze(s)]}):(a||o)&&(c=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[a||o,ze(s)]})),!c)throw new qU({blockHash:e,blockNumber:r,blockTag:o,hash:i,index:s});return(((d=(f=(u=t.chain)==null?void 0:u.formatters)==null?void 0:f.transaction)==null?void 0:d.format)||zU)(c)}async function Tge(t,{hash:e,transactionReceipt:r}){const[n,i]=await Promise.all([Ep(t),e?mS(t,{hash:e}):void 0]),s=(r==null?void 0:r.blockNumber)||(i==null?void 0:i.blockNumber);return s?n-s+1n:0n}async function B3(t,{hash:e}){var i,s,o;const r=await t.request({method:"eth_getTransactionReceipt",params:[e]});if(!r)throw new VU({hash:e});return(((o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionReceipt)==null?void 0:o.format)||eme)(r)}async function Ige(t,e){var v;const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:s,contracts:o,multicallAddress:a}=e,c=n??(typeof((v=t.batch)==null?void 0:v.multicall)=="object"&&t.batch.multicall.batchSize||1024);let l=a;if(!l){if(!t.chain)throw new Error("client chain not configured. multicallAddress is required.");l=zd({blockNumber:i,chain:t.chain,contract:"multicall3"})}const u=[[]];let f=0,d=0;for(let m=0;m0&&d>c&&u[f].length>0&&(f++,d=(A.length-2)/2,u[f]=[]),u[f]=[...u[f],{allowFailure:!0,callData:A,target:y}]}catch(A){const O=T1(A,{abi:g,address:y,args:b,docsPath:"/docs/contract/multicall",functionName:C});if(!r)throw O;u[f]=[...u[f],{allowFailure:!0,callData:"0x",target:y}]}}const h=await Promise.allSettled(u.map(m=>$c(t,{abi:N3,address:l,args:[m],blockNumber:i,blockTag:s,functionName:"aggregate3"}))),p=[];for(let m=0;m"u"?{}:t,s={EIP712Domain:Tz({domain:i}),...n};Pz({domain:i,message:e,primaryType:r,types:s});const o=["0x1901"];return i&&o.push(Mge({domain:i,types:s})),r!=="EIP712Domain"&&o.push(Sz({data:e,primaryType:r,types:s})),ei(oa(o))}function Mge({domain:t,types:e}){return Sz({data:t,primaryType:"EIP712Domain",types:e})}function Sz({data:t,primaryType:e,types:r}){const n=kz({data:t,primaryType:e,types:r});return ei(n)}function kz({data:t,primaryType:e,types:r}){const n=[{type:"bytes32"}],i=[Nge({primaryType:e,types:r})];for(const s of r[e]){const[o,a]=_z({types:r,name:s.name,type:s.type,value:t[s.name]});n.push(o),i.push(a)}return mp(n,i)}function Nge({primaryType:t,types:e}){const r=Ca(Dge({primaryType:t,types:e}));return ei(r)}function Dge({primaryType:t,types:e}){let r="";const n=Az({primaryType:t,types:e});n.delete(t);const i=[t,...Array.from(n).sort()];for(const s of i)r+=`${s}(${e[s].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return r}function Az({primaryType:t,types:e},r=new Set){const n=t.match(/^\w*/u),i=n==null?void 0:n[0];if(r.has(i)||e[i]===void 0)return r;r.add(i);for(const s of e[i])Az({primaryType:s.type,types:e},r);return r}function _z({types:t,name:e,type:r,value:n}){if(t[r]!==void 0)return[{type:"bytes32"},ei(kz({data:n,primaryType:r,types:t}))];if(r==="bytes")return n=`0x${(n.length%2?"0":"")+n.slice(2)}`,[{type:"bytes32"},ei(n)];if(r==="string")return[{type:"bytes32"},ei(Ca(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),s=n.map(o=>_z({name:e,type:i,types:t,value:o}));return[{type:"bytes32"},ei(mp(s.map(([o])=>o),s.map(([,o])=>o)))]}return[{type:r},n]}function Pz({domain:t,message:e,primaryType:r,types:n}){const i=n,s=(o,a)=>{for(const c of o){const{name:l,type:u}=c,f=u,d=a[l],h=f.match(Rge);if(h&&(typeof d=="number"||typeof d=="bigint")){const[m,g,y]=h;ze(d,{signed:g==="int",size:parseInt(y)/8})}if(f==="address"&&typeof d=="string"&&!pd(d))throw new v1({address:d});const p=f.match(Oge);if(p){const[m,g]=p;if(g&&Wr(d)!==parseInt(g))throw new Sme({expectedSize:parseInt(g),givenSize:Wr(d)})}const v=i[f];v&&s(v,d)}};if(i.EIP712Domain&&t&&s(i.EIP712Domain,t),r!=="EIP712Domain"){const o=i[r];s(o,e)}}function Tz({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const Cx="/docs/contract/encodeDeployData";function Iz({abi:t,args:e,bytecode:r}){if(!e||e.length===0)return r;const n=t.find(s=>"type"in s&&s.type==="constructor");if(!n)throw new yme({docsPath:Cx});if(!("inputs"in n))throw new uP({docsPath:Cx});if(!n.inputs||n.inputs.length===0)throw new uP({docsPath:Cx});const i=mp(n.inputs,e);return q4([r,i])}function Lge(t,e){const r=(()=>typeof t=="string"?Vo(t):t.raw instanceof Uint8Array?t.raw:iu(t.raw))(),n=Vo(`Ethereum Signed Message: +`),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class Eye extends le{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d}){const h=pp({from:r==null?void 0:r.address,to:f,value:typeof d<"u"&&`${V4(d)} ${(i==null?void 0:i.nativeCurrency.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${ii(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ii(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ii(l)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}function nS(t,e){const r=(t.details||"").toLowerCase(),n=t.walk(i=>i.code===wf.code);return n instanceof le?new wf({cause:t,message:n.details}):wf.nodeMessage.test(r)?new wf({cause:t,message:t.details}):Xy.nodeMessage.test(r)?new Xy({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):C3.nodeMessage.test(r)?new C3({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):S3.nodeMessage.test(r)?new S3({cause:t,nonce:e==null?void 0:e.nonce}):k3.nodeMessage.test(r)?new k3({cause:t,nonce:e==null?void 0:e.nonce}):A3.nodeMessage.test(r)?new A3({cause:t,nonce:e==null?void 0:e.nonce}):_3.nodeMessage.test(r)?new _3({cause:t}):P3.nodeMessage.test(r)?new P3({cause:t,gas:e==null?void 0:e.gas}):T3.nodeMessage.test(r)?new T3({cause:t,gas:e==null?void 0:e.gas}):I3.nodeMessage.test(r)?new I3({cause:t}):Zy.nodeMessage.test(r)?new Zy({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new Jb({cause:t})}function Cye(t,{docsPath:e,...r}){let n=nS(t,r);return n instanceof Jb&&(n=t),new Eye(n,{docsPath:e,...r})}function iS(t,{format:e}){return e?Object.keys(e({})).reduce((n,i)=>(t!=null&&t.hasOwnProperty(i)&&(n[i]=t[i]),n),{}):{}}function bp(t){const{account:e,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,o=e?ts(e):void 0;if(o&&!pd(o.address))throw new v1({address:o.address});if(s&&!pd(s))throw new v1({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof i<"u"))throw new ome;if(n&&n>2n**256n-1n)throw new Xy({maxFeePerGas:n});if(i&&n&&i>n)throw new Zy({maxFeePerGas:n,maxPriorityFeePerGas:i})}class Sye extends le{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class sS extends le{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class kye extends le{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ii(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class Aye extends le{constructor({blockHash:e,blockNumber:r}){let n="Block";e&&(n=`Block at hash "${e}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function Rc(t,{blockHash:e,blockNumber:r,blockTag:n,includeTransactions:i}={}){var u,f,d;const s=n??"latest",o=i??!1,a=r!==void 0?ze(r):void 0;let c=null;if(e?c=await t.request({method:"eth_getBlockByHash",params:[e,o]}):c=await t.request({method:"eth_getBlockByNumber",params:[a||s,o]}),!c)throw new Aye({blockHash:e,blockNumber:r});return(((d=(f=(u=t.chain)==null?void 0:u.formatters)==null?void 0:f.block)==null?void 0:d.format)||WU)(c)}async function oS(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function _ye(t,e){return cz(t,e)}async function cz(t,e){var s,o,a;const{block:r,chain:n=t.chain,request:i}=e||{};if(typeof((s=n==null?void 0:n.fees)==null?void 0:s.defaultPriorityFee)=="function"){const c=r||await Rc(t);return n.fees.defaultPriorityFee({block:c,client:t,request:i})}else if((o=n==null?void 0:n.fees)!=null&&o.defaultPriorityFee)return(a=n==null?void 0:n.fees)==null?void 0:a.defaultPriorityFee;try{const c=await t.request({method:"eth_maxPriorityFeePerGas"});return Qb(c)}catch{const[c,l]=await Promise.all([r?Promise.resolve(r):Rc(t),oS(t)]);if(typeof c.baseFeePerGas!="bigint")throw new sS;const u=l-c.baseFeePerGas;return u<0n?0n:u}}async function Pye(t,e){return M3(t,e)}async function M3(t,e){var d;const{block:r,chain:n=t.chain,request:i,type:s="eip1559"}=e||{},o=await(async()=>{var h,p;return typeof((h=n==null?void 0:n.fees)==null?void 0:h.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:t,request:i}):((p=n==null?void 0:n.fees)==null?void 0:p.baseFeeMultiplier)??1.2})();if(o<1)throw new Sye;const c=10**o.toString().split(".")[1].length,l=h=>h*BigInt(o*c)/BigInt(c),u=r||await Rc(t);if(typeof((d=n==null?void 0:n.fees)==null?void 0:d.estimateFeesPerGas)=="function")return n.fees.estimateFeesPerGas({block:r,client:t,multiply:l,request:i,type:s});if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new sS;const h=i!=null&&i.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await cz(t,{block:u,chain:n,request:i}),p=l(u.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??p+h,maxPriorityFeePerGas:h}}return{gasPrice:(i==null?void 0:i.gasPrice)??l(await oS(t))}}async function lz(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?ze(n):r]});return Fn(i)}async function n2(t,e){const{account:r=t.account,chain:n,gas:i,nonce:s,type:o}=e;if(!r)throw new Vd;const a=ts(r),c=await Rc(t,{blockTag:"latest"}),l={...e,from:a.address};if(typeof s>"u"&&(l.nonce=await lz(t,{address:a.address,blockTag:"pending"})),typeof o>"u")try{l.type=ume(l)}catch{l.type=typeof c.baseFeePerGas=="bigint"?"eip1559":"legacy"}if(l.type==="eip1559"){const{maxFeePerGas:u,maxPriorityFeePerGas:f}=await M3(t,{block:c,chain:n,request:l});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(l.gas=await aS(t,{...l,account:{address:a.address,type:"json-rpc"}})),bp(l),l}async function aS(t,e){var i,s,o;const r=e.account??t.account;if(!r)throw new Vd({docsPath:"/docs/actions/public/estimateGas"});const n=ts(r);try{const{accessList:a,blockNumber:c,blockTag:l,data:u,gas:f,gasPrice:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:v,to:m,value:g,...y}=n.type==="local"?await n2(t,e):e,C=(c?ze(c):void 0)||l;bp(e);const A=((o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:o.format)||Yb,O=A({...iS(y,{format:A}),from:n.address,accessList:a,data:u,gas:f,gasPrice:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:v,to:m,value:g}),w=await t.request({method:"eth_estimateGas",params:C?[O,C]:[O]});return BigInt(w)}catch(a){throw Cye(a,{...e,account:n,chain:t.chain})}}async function Tye(t,{abi:e,address:r,args:n,functionName:i,...s}){const o=Kc({abi:e,args:n,functionName:i});try{return await aS(t,{data:o,to:r,...s})}catch(a){const c=s.account?ts(s.account):void 0;throw T1(a,{abi:e,address:r,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:c==null?void 0:c.address})}}const gx="/docs/contract/decodeFunctionResult";function Gd({abi:t,args:e,functionName:r,data:n}){let i=t[0];if(r&&(i=yp({abi:t,args:e,name:r}),!i))throw new eg(r,{docsPath:gx});if(i.type!=="function")throw new eg(void 0,{docsPath:gx});if(!i.outputs)throw new Cme(i.name,{docsPath:gx});const s=r2(i.outputs,n);if(s&&s.length>1)return s;if(s&&s.length===1)return s[0]}const Iye="modulepreload",Oye=function(t,e){return new URL(t,e).href},mP={},cS=function(e,r,n){if(!r||r.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(r.map(s=>{if(s=Oye(s,n),s in mP)return;mP[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!n)for(let u=i.length-1;u>=0;u--){const f=i[u];if(f.href===s&&(!o||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const l=document.createElement("link");if(l.rel=o?"stylesheet":Iye,o||(l.as="script",l.crossOrigin=""),l.href=s,document.head.appendChild(l),o)return new Promise((u,f)=>{l.addEventListener("load",u),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})},N3=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],uz=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],fz=[...uz,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Rye=[...uz,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],yP=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],gP=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],$ye=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],Mye="0x82ad56cb";function Nye(t,{docsPath:e,...r}){let n=nS(t,r);return n instanceof Jb&&(n=t),new az(n,{docsPath:e,...r})}const bx=new Map;function lS({fn:t,id:e,shouldSplitBatch:r,wait:n=0}){const i=async()=>{const l=a();s();const u=l.map(({args:f})=>f);u.length!==0&&t(u).then(f=>{l.forEach(({pendingPromise:d},h)=>{var p;return(p=d.resolve)==null?void 0:p.call(d,[f[h],f])})}).catch(f=>{l.forEach(({pendingPromise:d})=>{var h;return(h=d.reject)==null?void 0:h.call(d,f)})})},s=()=>bx.delete(e),o=()=>a().map(({args:l})=>l),a=()=>bx.get(e)||[],c=l=>bx.set(e,[...a(),l]);return{flush:s,async schedule(l){const u={},f=new Promise((p,v)=>{u.resolve=p,u.reject=v});return(r==null?void 0:r([...o(),l]))&&i(),a().length>0?(c({args:l,pendingPromise:u}),f):(c({args:l,pendingPromise:u}),setTimeout(i,n),f)}}}async function i2(t,e){var g,y,b,C;const{account:r=t.account,batch:n=!!((g=t.batch)!=null&&g.multicall),blockNumber:i,blockTag:s="latest",accessList:o,data:a,gas:c,gasPrice:l,maxFeePerGas:u,maxPriorityFeePerGas:f,nonce:d,to:h,value:p,...v}=e,m=r?ts(r):void 0;try{bp(e);const O=(i?ze(i):void 0)||s,w=((C=(b=(y=t.chain)==null?void 0:y.formatters)==null?void 0:b.transactionRequest)==null?void 0:C.format)||Yb,I=w({...iS(v,{format:w}),from:m==null?void 0:m.address,accessList:o,data:a,gas:c,gasPrice:l,maxFeePerGas:u,maxPriorityFeePerGas:f,nonce:d,to:h,value:p});if(n&&Dye({request:I}))try{return await Lye(t,{...I,blockNumber:i,blockTag:s})}catch(z){if(!(z instanceof DU)&&!(z instanceof E3))throw z}const B=await t.request({method:"eth_call",params:O?[I,O]:[I]});return B==="0x"?{data:void 0}:{data:B}}catch(A){const O=Bye(A),{offchainLookup:w,offchainLookupSignature:I}=await cS(()=>import("./ccip-70098440.js"),[],import.meta.url);if((O==null?void 0:O.slice(0,10))===I&&h)return{data:await w(t,{data:O,to:h})};throw Nye(A,{...e,account:m,chain:t.chain})}}function Dye({request:t}){const{data:e,to:r,...n}=t;return!(!e||e.startsWith(Mye)||!r||Object.values(n).filter(i=>typeof i<"u").length>0)}async function Lye(t,e){var v;const{batchSize:r=1024,wait:n=0}=typeof((v=t.batch)==null?void 0:v.multicall)=="object"?t.batch.multicall:{},{blockNumber:i,blockTag:s="latest",data:o,multicallAddress:a,to:c}=e;let l=a;if(!l){if(!t.chain)throw new DU;l=zd({blockNumber:i,chain:t.chain,contract:"multicall3"})}const f=(i?ze(i):void 0)||s,{schedule:d}=lS({id:`${t.uid}.${f}`,wait:n,shouldSplitBatch(m){return m.reduce((y,{data:b})=>y+(b.length-2),0)>r*2},fn:async m=>{const g=m.map(C=>({allowFailure:!0,callData:C.data,target:C.to})),y=Kc({abi:N3,args:[g],functionName:"aggregate3"}),b=await t.request({method:"eth_call",params:[{data:y,to:l},f]});return Gd({abi:N3,args:[g],functionName:"aggregate3",data:b||"0x"})}}),[{returnData:h,success:p}]=await d({data:o,to:c});if(!p)throw new tS({data:h});return h==="0x"?{data:void 0}:{data:h}}function Bye(t){if(!(t instanceof le))return;const e=t.walk();return typeof e.data=="object"?e.data.data:e.data}async function $c(t,{abi:e,address:r,args:n,functionName:i,...s}){const o=Kc({abi:e,args:n,functionName:i});try{const{data:a}=await i2(t,{data:o,to:r,...s});return Gd({abi:e,args:n,functionName:i,data:a||"0x"})}catch(a){throw T1(a,{abi:e,address:r,args:n,docsPath:"/docs/contract/readContract",functionName:i})}}async function Fye(t,{abi:e,address:r,args:n,dataSuffix:i,functionName:s,...o}){const a=o.account?ts(o.account):void 0,c=Kc({abi:e,args:n,functionName:s});try{const{data:l}=await i2(t,{batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...o});return{result:Gd({abi:e,args:n,functionName:s,data:l||"0x"}),request:{abi:e,address:r,args:n,dataSuffix:i,functionName:s,...o}}}catch(l){throw T1(l,{abi:e,address:r,args:n,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const wx=new Map,bP=new Map;let jye=0;function Kd(t,e,r){const n=++jye,i=()=>wx.get(t)||[],s=()=>{const u=i();wx.set(t,u.filter(f=>f.id!==n))},o=()=>{const u=bP.get(t);i().length===1&&u&&u(),s()},a=i();if(wx.set(t,[...a,{id:n,fns:e}]),a&&a.length>0)return o;const c={};for(const u in e)c[u]=(...f)=>{const d=i();d.length!==0&&d.forEach(h=>{var p,v;return(v=(p=h.fns)[u])==null?void 0:v.call(p,...f)})};const l=r(c);return typeof l=="function"&&bP.set(t,l),o}async function rg(t){return new Promise(e=>setTimeout(e,t))}function wp(t,{emitOnBegin:e,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let a;e&&(a=await t({unpoll:s}));const c=await(r==null?void 0:r(a))??n;await rg(c);const l=async()=>{i&&(await t({unpoll:s}),await rg(n),l())};l()})(),s}const wP="/docs/contract/decodeEventLog";function xp({abi:t,data:e,strict:r,topics:n}){const i=r??!0,[s,...o]=n;if(!s)throw new xme({docsPath:wP});const a=t.find(p=>p.type==="event"&&s===Y4(Gc(p)));if(!(a&&"name"in a)||a.type!=="event")throw new Eme(s,{docsPath:wP});const{name:c,inputs:l}=a,u=l==null?void 0:l.some(p=>!("name"in p&&p.name));let f=u?[]:{};const d=l.filter(p=>"indexed"in p&&p.indexed);if(o.length>0)for(let p=0;p!("indexed"in p&&p.indexed));if(h.length>0){if(e&&e!=="0x")try{const p=r2(h,e);if(p)if(u)f=[...f,...p];else for(let v=0;v0?f:void 0}}function Uye({param:t,value:e}){return t.type==="string"||t.type==="bytes"||t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/)?e:(r2([t],e)||[])[0]}const zye=new Map,Wye=new Map;function Hye(t){const e=(i,s)=>({clear:()=>s.delete(i),get:()=>s.get(i),set:o=>s.set(i,o)}),r=e(t,zye),n=e(t,Wye);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function qye(t,{cacheKey:e,cacheTime:r=1/0}){const n=Hye(e),i=n.response.get();if(i&&r>0&&new Date().getTime()-i.created.getTime()`blockNumber.${t}`;async function Ep(t,{cacheTime:e=t.cacheTime,maxAge:r}={}){const n=await qye(()=>t.request({method:"eth_blockNumber"}),{cacheKey:Vye(t.uid),cacheTime:r??e});return BigInt(n)}async function s2(t,{filter:e}){const r="strict"in e&&e.strict;return(await e.request({method:"eth_getFilterChanges",params:[e.id]})).map(i=>{var s;if(typeof i=="string")return i;try{const{eventName:o,args:a}="abi"in e&&e.abi?xp({abi:e.abi,data:i.data,topics:i.topics,strict:r}):{eventName:void 0,args:void 0};return Os(i,{args:a,eventName:o})}catch(o){let a,c;if(o instanceof su||o instanceof Hd){if("strict"in e&&e.strict)return;a=o.abiItem.name,c=(s=o.abiItem.inputs)==null?void 0:s.some(l=>!("name"in l&&l.name))}return Os(i,{args:c?[]:{},eventName:a})}}).filter(Boolean)}async function uS(t,{address:e,blockHash:r,fromBlock:n,toBlock:i,event:s,events:o,args:a,strict:c}={}){const l=c??!1,u=o??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(h=>gp({abi:[h],eventName:h.name,args:a}))],s&&(f=f[0]));let d;return r?d=await t.request({method:"eth_getLogs",params:[{address:e,topics:f,blockHash:r}]}):d=await t.request({method:"eth_getLogs",params:[{address:e,topics:f,fromBlock:typeof n=="bigint"?ze(n):n,toBlock:typeof i=="bigint"?ze(i):i}]}),d.map(h=>{var p;try{const{eventName:v,args:m}=u?xp({abi:u,data:h.data,topics:h.topics,strict:l}):{eventName:void 0,args:void 0};return Os(h,{args:m,eventName:v})}catch(v){let m,g;if(v instanceof su||v instanceof Hd){if(l)return;m=v.abiItem.name,g=(p=v.abiItem.inputs)==null?void 0:p.some(y=>!("name"in y&&y.name))}return Os(h,{args:g?[]:{},eventName:m})}}).filter(Boolean)}async function o2(t,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}function Gye(t,{abi:e,address:r,args:n,batch:i=!0,eventName:s,onError:o,onLogs:a,poll:c,pollingInterval:l=t.pollingInterval,strict:u}){return(typeof c<"u"?c:t.transport.type!=="webSocket")?(()=>{const p=Un(["watchContractEvent",r,n,i,t.uid,s,l]),v=u??!1;return Kd(p,{onLogs:a,onError:o},m=>{let g,y,b=!1;const C=wp(async()=>{var A;if(!b){try{y=await iz(t,{abi:e,address:r,args:n,eventName:s,strict:v})}catch{}b=!0;return}try{let O;if(y)O=await s2(t,{filter:y});else{const w=await Ep(t);g&&g!==w?O=await uS(t,{address:r,args:n,fromBlock:g+1n,toBlock:w,event:yp({abi:e,name:s})}):O=[],g=w}if(O.length===0)return;i?m.onLogs(O):O.forEach(w=>m.onLogs([w]))}catch(O){y&&O instanceof ou&&(b=!1),(A=m.onError)==null||A.call(m,O)}},{emitOnBegin:!0,interval:l});return async()=>{y&&await o2(t,{filter:y}),C()}})})():(()=>{let p=!0,v=()=>p=!1;return(async()=>{try{const m=s?gp({abi:e,eventName:s,args:n}):[],{unsubscribe:g}=await t.transport.subscribe({params:["logs",{address:r,topics:m}],onData(y){var C;if(!p)return;const b=y.result;try{const{eventName:A,args:O}=xp({abi:e,data:b.data,topics:b.topics,strict:u}),w=Os(b,{args:O,eventName:A});a([w])}catch(A){let O,w;if(A instanceof su||A instanceof Hd){if(u)return;O=A.abiItem.name,w=(C=A.abiItem.inputs)==null?void 0:C.some(B=>!("name"in B&&B.name))}const I=Os(b,{args:w?[]:{},eventName:O});a([I])}},onError(y){o==null||o(y)}});v=g,p||v()}catch(m){o==null||o(m)}})(),v})()}function Kye(t,{docsPath:e,...r}){let n=nS(t,r);return n instanceof Jb&&(n=t),new cme(n,{docsPath:e,...r})}async function I1(t){const e=await t.request({method:"eth_chainId"});return Fn(e)}async function fS(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]})}async function dS(t,e){var v,m,g;const{account:r=t.account,chain:n=t.chain,accessList:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d,...h}=e;if(!r)throw new Vd({docsPath:"/docs/actions/wallet/sendTransaction"});const p=ts(r);try{bp(e);let y;if(n!==null&&(y=await I1(t),LU({currentChainId:y,chain:n})),p.type==="local"){const A=await n2(t,{account:p,accessList:i,chain:n,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d,...h});y||(y=await I1(t));const O=(v=n==null?void 0:n.serializers)==null?void 0:v.transaction,w=await p.signTransaction({...A,chainId:y},{serializer:O});return await fS(t,{serializedTransaction:w})}const b=((g=(m=n==null?void 0:n.formatters)==null?void 0:m.transactionRequest)==null?void 0:g.format)||Yb,C=b({...iS(h,{format:b}),accessList:i,data:s,from:p.address,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:f,value:d});return await t.request({method:"eth_sendTransaction",params:[C]})}catch(y){throw Kye(y,{...e,account:p,chain:e.chain||void 0})}}async function Qye(t,{abi:e,address:r,args:n,dataSuffix:i,functionName:s,...o}){const a=Kc({abi:e,args:n,functionName:s});return await dS(t,{data:`${a}${i?i.replace("0x",""):""}`,to:r,...o})}async function Yye(t,{chain:e}){const{id:r,name:n,nativeCurrency:i,rpcUrls:s,blockExplorers:o}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:ze(r),chainName:n,nativeCurrency:i,rpcUrls:s.default.http,blockExplorerUrls:o?Object.values(o).map(({url:a})=>a):void 0}]})}const D3=256;let Ev=D3,Cv;function Jye(t=11){if(!Cv||Ev+t>D3*2){Cv="",Ev=0;for(let e=0;e{const g=m(v);for(const b in h)delete g[b];const y={...v,...g};return Object.assign(y,{extend:p(y)})}}return Object.assign(h,{extend:p(h)})}function hz(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const c=async({error:l})=>{const u=typeof e=="function"?e({count:a,error:l}):e;u&&await rg(u),o({count:a+1})};try{const l=await t();i(l)}catch(l){if(a"code"in t?t.code!==-1&&t.code!==-32004&&t.code!==-32005&&t.code!==-32042&&t.code!==-32603:t instanceof C0&&t.status?t.status!==403&&t.status!==408&&t.status!==413&&t.status!==429&&t.status!==500&&t.status!==502&&t.status!==503&&t.status!==504:!1;function Xye(t,{retryDelay:e=150,retryCount:r=3}={}){return async n=>hz(async()=>{try{return await t(n)}catch(i){const s=i;switch(s.code){case m1.code:throw new m1(s);case y1.code:throw new y1(s);case g1.code:throw new g1(s);case b1.code:throw new b1(s);case vd.code:throw new vd(s);case ou.code:throw new ou(s);case w1.code:throw new w1(s);case Oc.code:throw new Oc(s);case x1.code:throw new x1(s);case E1.code:throw new E1(s);case C1.code:throw new C1(s);case S1.code:throw new S1(s);case Or.code:throw new Or(s);case k1.code:throw new k1(s);case A1.code:throw new A1(s);case _1.code:throw new _1(s);case P1.code:throw new P1(s);case aa.code:throw new aa(s);case 5e3:throw new Or(s);default:throw i instanceof le?i:new wye(s)}}},{delay:({count:i,error:s})=>{var o;if(s&&s instanceof C0){const a=(o=s==null?void 0:s.headers)==null?void 0:o.get("Retry-After");if(a!=null&&a.match(/\d/))return parseInt(a)*1e3}return~~(1<!pz(i)})}function a2({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:o},a){return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:o},request:Xye(r,{retryCount:n,retryDelay:i}),value:a}}function c2(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>a2({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}function xP(t,e={}){const{key:r="fallback",name:n="Fallback",rank:i=!1,retryCount:s,retryDelay:o}=e;return({chain:a,pollingInterval:c=4e3,timeout:l})=>{let u=t,f=()=>{};const d=a2({key:r,name:n,async request({method:h,params:p}){const v=async(m=0)=>{const g=u[m]({chain:a,retryCount:0,timeout:l});try{const y=await g.request({method:h,params:p});return f({method:h,params:p,response:y,transport:g,status:"success"}),y}catch(y){if(f({error:y,method:h,params:p,transport:g,status:"error"}),pz(y)||m===u.length-1)throw y;return v(m+1)}};return v()},retryCount:s,retryDelay:o,type:"fallback"},{onResponse:h=>f=h,transports:u.map(h=>h({chain:a,retryCount:0}))});if(i){const h=typeof i=="object"?i:{};Zye({chain:a,interval:h.interval??c,onTransports:p=>u=p,sampleCount:h.sampleCount,timeout:h.timeout,transports:u,weights:h.weights})}return d}}function Zye({chain:t,interval:e=4e3,onTransports:r,sampleCount:n=10,timeout:i=1e3,transports:s,weights:o={}}){const{stability:a=.7,latency:c=.3}=o,l=[],u=async()=>{const f=await Promise.all(s.map(async p=>{const v=p({chain:t,retryCount:0,timeout:i}),m=Date.now();let g,y;try{await v.request({method:"net_listening"}),y=1}catch{y=0}finally{g=Date.now()}return{latency:g-m,success:y}}));l.push(f),l.length>n&&l.shift();const d=Math.max(...l.map(p=>Math.max(...p.map(({latency:v})=>v)))),h=s.map((p,v)=>{const m=l.map(A=>A[v].latency),y=1-m.reduce((A,O)=>A+O,0)/m.length/d,b=l.map(A=>A[v].success),C=b.reduce((A,O)=>A+O,0)/b.length;return C===0?[0,v]:[c*y+a*C,v]}).sort((p,v)=>v[0]-p[0]);r(h.map(([,p])=>s[p])),await rg(e),u()};u()}class vz extends le{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}var Yu=null;typeof WebSocket<"u"?Yu=WebSocket:typeof MozWebSocket<"u"?Yu=MozWebSocket:typeof global<"u"?Yu=global.WebSocket||global.MozWebSocket:typeof window<"u"?Yu=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Yu=self.WebSocket||self.MozWebSocket);const EP=Yu;function mz(t,{errorInstance:e,timeout:r,signal:n}){return new Promise((i,s)=>{(async()=>{let o;try{const a=new AbortController;r>0&&(o=setTimeout(()=>{n?a.abort():s(e)},r)),i(await t({signal:a==null?void 0:a.signal}))}catch(a){a.name==="AbortError"&&s(e),s(a)}finally{clearTimeout(o)}})()})}let L3=0;async function ege(t,{body:e,fetchOptions:r={},timeout:n=1e4}){var a;const{headers:i,method:s,signal:o}=r;try{const c=await mz(async({signal:u})=>await fetch(t,{...r,body:Array.isArray(e)?Un(e.map(d=>({jsonrpc:"2.0",id:d.id??L3++,...d}))):Un({jsonrpc:"2.0",id:e.id??L3++,...e}),headers:{...i,"Content-Type":"application/json"},method:s||"POST",signal:o||(n>0?u:void 0)}),{errorInstance:new $3({body:e,url:t}),timeout:n,signal:!0});let l;if((a=c.headers.get("Content-Type"))!=null&&a.startsWith("application/json")?l=await c.json():l=await c.text(),!c.ok)throw new C0({body:e,details:Un(l.error)||c.statusText,headers:c.headers,status:c.status,url:t});return l}catch(c){throw c instanceof C0||c instanceof $3?c:new C0({body:e,details:c.message,url:t})}}const xx=new Map;async function Ex(t){let e=xx.get(t);if(e)return e;const{schedule:r}=lS({id:t,fn:async()=>{const s=new EP(t),o=new Map,a=new Map,c=({data:u})=>{const f=JSON.parse(u),d=f.method==="eth_subscription",h=d?f.params.subscription:f.id,p=d?a:o,v=p.get(h);v&&v({data:u}),d||p.delete(h)},l=()=>{xx.delete(t),s.removeEventListener("close",l),s.removeEventListener("message",c)};return s.addEventListener("close",l),s.addEventListener("message",c),s.readyState===EP.CONNECTING&&await new Promise((u,f)=>{s&&(s.onopen=u,s.onerror=f)}),e=Object.assign(s,{requests:o,subscriptions:a}),xx.set(t,e),[e]}}),[n,[i]]=await r();return i}function tge(t,{body:e,onResponse:r}){if(t.readyState===t.CLOSED||t.readyState===t.CLOSING)throw new gye({body:e,url:t.url,details:"Socket is closed."});const n=L3++,i=({data:s})=>{var a;const o=JSON.parse(s);typeof o.id=="number"&&n!==o.id||(r==null||r(o),e.method==="eth_subscribe"&&typeof o.result=="string"&&t.subscriptions.set(o.result,i),e.method==="eth_unsubscribe"&&t.subscriptions.delete((a=e.params)==null?void 0:a[0]))};return t.requests.set(n,i),t.send(JSON.stringify({jsonrpc:"2.0",...e,id:n})),t}async function rge(t,{body:e,timeout:r=1e4}){return mz(()=>new Promise(n=>jf.webSocket(t,{body:e,onResponse:n})),{errorInstance:new $3({body:e,url:t.url}),timeout:r})}const jf={http:ege,webSocket:tge,webSocketAsync:rge};function yz(t,e={}){const{batch:r,fetchOptions:n,key:i="http",name:s="HTTP JSON-RPC",retryDelay:o}=e;return({chain:a,retryCount:c,timeout:l})=>{const{batchSize:u=1e3,wait:f=0}=typeof r=="object"?r:{},d=e.retryCount??c,h=l??e.timeout??1e4,p=t||(a==null?void 0:a.rpcUrls.default.http[0]);if(!p)throw new vz;return a2({key:i,name:s,async request({method:v,params:m}){const g={method:v,params:m},{schedule:y}=lS({id:`${t}`,wait:f,shouldSplitBatch(O){return O.length>u},fn:O=>jf.http(p,{body:O,fetchOptions:n,timeout:h})}),b=async O=>r?y(O):[await jf.http(p,{body:O,fetchOptions:n,timeout:h})],[{error:C,result:A}]=await b(g);if(C)throw new rS({body:g,error:C,url:p});return A},retryCount:d,retryDelay:o,timeout:h,type:"http"},{url:t})}}function hS(t,e){var n,i,s;if(!(t instanceof le))return!1;const r=t.walk(o=>o instanceof R3);return r instanceof R3?!!(((n=r.data)==null?void 0:n.errorName)==="ResolverNotFound"||((i=r.data)==null?void 0:i.errorName)==="ResolverWildcardNotSupported"||(s=r.reason)!=null&&s.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&r.reason===sz[50]):!1}function gz(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return So(e)?e:null}function mm(t){let e=new Uint8Array(32).fill(0);if(!t)return p1(e);const r=t.split(".");for(let n=r.length-1;n>=0;n-=1){const i=gz(r[n]),s=i?iu(i):ei(Vo(r[n]),"bytes");e=ei(oa([e,s]),"bytes")}return p1(e)}function nge(t){return`[${t.slice(2)}]`}function ige(t){const e=new Uint8Array(32).fill(0);return t?gz(t)||ei(Vo(t)):p1(e)}function l2(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const r=new Uint8Array(Vo(e).byteLength+2);let n=0;const i=e.split(".");for(let s=0;s255&&(o=Vo(nge(ige(i[s])))),r[n]=o.length,r.set(o,n+1),n+=o.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}async function sge(t,{blockNumber:e,blockTag:r,coinType:n,name:i,universalResolverAddress:s}){let o=s;if(!o){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=zd({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const a=Kc({abi:gP,functionName:"addr",...n!=null?{args:[mm(i),BigInt(n)]}:{args:[mm(i)]}}),c=await $c(t,{address:o,abi:fz,functionName:"resolve",args:[Ca(l2(i)),a],blockNumber:e,blockTag:r});if(c[0]==="0x")return null;const l=Gd({abi:gP,args:n!=null?[mm(i),BigInt(n)]:void 0,functionName:"addr",data:c[0]});return l==="0x"||Bf(l)==="0x00"?null:l}catch(a){if(hS(a,"resolve"))return null;throw a}}class oge extends le{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class Ah extends le{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class pS extends le{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class age extends le{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const cge=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,lge=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,uge=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,fge=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function dge(t){try{const e=await fetch(t,{method:"HEAD"});if(e.status===200){const r=e.headers.get("content-type");return r==null?void 0:r.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(r=>{const n=new Image;n.onload=()=>{r(!0)},n.onerror=()=>{r(!1)},n.src=t})}}function CP(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function bz({uri:t,gatewayUrls:e}){const r=uge.test(t);if(r)return{uri:t,isOnChain:!0,isEncoded:r};const n=CP(e==null?void 0:e.ipfs,"https://ipfs.io"),i=CP(e==null?void 0:e.arweave,"https://arweave.net"),s=t.match(cge),{protocol:o,subpath:a,target:c,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=o==="ipns:/"||a==="ipns/",f=o==="ipfs:/"||a==="ipfs/"||lge.test(t);if(t.startsWith("http")&&!u&&!f){let h=t;return e!=null&&e.arweave&&(h=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:h,isOnChain:!1,isEncoded:!1}}if((u||f)&&c)return{uri:`${n}/${u?"ipns":"ipfs"}/${c}${l}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${i}/${c}${l||""}`,isOnChain:!1,isEncoded:!1};let d=t.replace(fge,"");if(d.startsWith("i.json());return await vS({gatewayUrls:t,uri:wz(r)})}catch{throw new pS({uri:e})}}async function vS({gatewayUrls:t,uri:e}){const{uri:r,isOnChain:n}=bz({uri:e,gatewayUrls:t});if(n||await dge(r))return r;throw new pS({uri:e})}function pge(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=e.split("/"),[s,o]=r.split(":"),[a,c]=n.split(":");if(!s||s.toLowerCase()!=="eip155")throw new Ah({reason:"Only EIP-155 supported"});if(!o)throw new Ah({reason:"Chain ID not found"});if(!c)throw new Ah({reason:"Contract address not found"});if(!i)throw new Ah({reason:"Token ID not found"});if(!a)throw new Ah({reason:"ERC namespace not found"});return{chainID:parseInt(o),namespace:a.toLowerCase(),contractAddress:c,tokenID:i}}async function vge(t,{nft:e}){if(e.namespace==="erc721")return $c(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return $c(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new age({namespace:e.namespace})}async function mge(t,{gatewayUrls:e,record:r}){return/eip155:/i.test(r)?yge(t,{gatewayUrls:e,record:r}):vS({uri:r,gatewayUrls:e})}async function yge(t,{gatewayUrls:e,record:r}){const n=pge(r),i=await vge(t,{nft:n}),{uri:s,isOnChain:o,isEncoded:a}=bz({uri:i,gatewayUrls:e});if(o&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const l=a?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(l);return vS({uri:wz(u),gatewayUrls:e})}let c=n.tokenID;return n.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),hge({gatewayUrls:e,uri:s.replace(/(?:0x)?{id}/,c)})}async function xz(t,{blockNumber:e,blockTag:r,name:n,key:i,universalResolverAddress:s}){let o=s;if(!o){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=zd({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const a=await $c(t,{address:o,abi:fz,functionName:"resolve",args:[Ca(l2(n)),Kc({abi:yP,functionName:"text",args:[mm(n),i]})],blockNumber:e,blockTag:r});if(a[0]==="0x")return null;const c=Gd({abi:yP,functionName:"text",data:a[0]});return c===""?null:c}catch(a){if(hS(a,"resolve"))return null;throw a}}async function gge(t,{blockNumber:e,blockTag:r,gatewayUrls:n,name:i,universalResolverAddress:s}){const o=await xz(t,{blockNumber:e,blockTag:r,key:"avatar",name:i,universalResolverAddress:s});if(!o)return null;try{return await mge(t,{record:o,gatewayUrls:n})}catch{return null}}async function bge(t,{address:e,blockNumber:r,blockTag:n,universalResolverAddress:i}){let s=i;if(!s){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=zd({blockNumber:r,chain:t.chain,contract:"ensUniversalResolver"})}const o=`${e.toLowerCase().substring(2)}.addr.reverse`;try{return(await $c(t,{address:s,abi:Rye,functionName:"reverse",args:[Ca(l2(o))],blockNumber:r,blockTag:n}))[0]}catch(a){if(hS(a,"reverse"))return null;throw a}}async function wge(t,{blockNumber:e,blockTag:r,name:n,universalResolverAddress:i}){let s=i;if(!s){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=zd({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}const[o]=await $c(t,{address:s,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Ca(l2(n))],blockNumber:e,blockTag:r});return o}async function xge(t){const e=t2(t,{method:"eth_newBlockFilter"}),r=await t.request({method:"eth_newBlockFilter"});return{id:r,request:e(r),type:"block"}}async function Ez(t,{address:e,args:r,event:n,events:i,fromBlock:s,strict:o,toBlock:a}={}){const c=i??(n?[n]:void 0),l=t2(t,{method:"eth_newFilter"});let u=[];c&&(u=[c.flatMap(d=>gp({abi:[d],eventName:d.name,args:r}))],n&&(u=u[0]));const f=await t.request({method:"eth_newFilter",params:[{address:e,fromBlock:typeof s=="bigint"?ze(s):s,toBlock:typeof a=="bigint"?ze(a):a,...u.length?{topics:u}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:s,id:f,request:l(f),strict:o,toBlock:a,type:"event"}}async function Cz(t){const e=t2(t,{method:"eth_newPendingTransactionFilter"}),r=await t.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:e(r),type:"transaction"}}async function Ege(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?ze(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function Cge(t,{blockHash:e,blockNumber:r,blockTag:n="latest"}={}){const i=r!==void 0?ze(r):void 0;let s;return e?s=await t.request({method:"eth_getBlockTransactionCountByHash",params:[e]}):s=await t.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]}),Fn(s)}async function Sge(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r!==void 0?ze(r):void 0,s=await t.request({method:"eth_getCode",params:[e,i||n]});if(s!=="0x")return s}function kge(t){var e;return{baseFeePerGas:t.baseFeePerGas.map(r=>BigInt(r)),gasUsedRatio:t.gasUsedRatio,oldestBlock:BigInt(t.oldestBlock),reward:(e=t.reward)==null?void 0:e.map(r=>r.map(n=>BigInt(n)))}}async function Age(t,{blockCount:e,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const s=r?ze(r):void 0,o=await t.request({method:"eth_feeHistory",params:[ze(e),s||n,i]});return kge(o)}async function _ge(t,{filter:e}){const r=e.strict??!1;return(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(i=>{var s;try{const{eventName:o,args:a}="abi"in e&&e.abi?xp({abi:e.abi,data:i.data,topics:i.topics,strict:r}):{eventName:void 0,args:void 0};return Os(i,{args:a,eventName:o})}catch(o){let a,c;if(o instanceof su||o instanceof Hd){if("strict"in e&&e.strict)return;a=o.abiItem.name,c=(s=o.abiItem.inputs)==null?void 0:s.some(l=>!("name"in l&&l.name))}return Os(i,{args:c?[]:{},eventName:a})}}).filter(Boolean)}async function Pge(t,{address:e,blockNumber:r,blockTag:n="latest",slot:i}){const s=r!==void 0?ze(r):void 0;return await t.request({method:"eth_getStorageAt",params:[e,i,s||n]})}async function mS(t,{blockHash:e,blockNumber:r,blockTag:n,hash:i,index:s}){var u,f,d;const o=n||"latest",a=r!==void 0?ze(r):void 0;let c=null;if(i?c=await t.request({method:"eth_getTransactionByHash",params:[i]}):e?c=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,ze(s)]}):(a||o)&&(c=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[a||o,ze(s)]})),!c)throw new qU({blockHash:e,blockNumber:r,blockTag:o,hash:i,index:s});return(((d=(f=(u=t.chain)==null?void 0:u.formatters)==null?void 0:f.transaction)==null?void 0:d.format)||zU)(c)}async function Tge(t,{hash:e,transactionReceipt:r}){const[n,i]=await Promise.all([Ep(t),e?mS(t,{hash:e}):void 0]),s=(r==null?void 0:r.blockNumber)||(i==null?void 0:i.blockNumber);return s?n-s+1n:0n}async function B3(t,{hash:e}){var i,s,o;const r=await t.request({method:"eth_getTransactionReceipt",params:[e]});if(!r)throw new VU({hash:e});return(((o=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionReceipt)==null?void 0:o.format)||eme)(r)}async function Ige(t,e){var v;const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:s,contracts:o,multicallAddress:a}=e,c=n??(typeof((v=t.batch)==null?void 0:v.multicall)=="object"&&t.batch.multicall.batchSize||1024);let l=a;if(!l){if(!t.chain)throw new Error("client chain not configured. multicallAddress is required.");l=zd({blockNumber:i,chain:t.chain,contract:"multicall3"})}const u=[[]];let f=0,d=0;for(let m=0;m0&&d>c&&u[f].length>0&&(f++,d=(A.length-2)/2,u[f]=[]),u[f]=[...u[f],{allowFailure:!0,callData:A,target:y}]}catch(A){const O=T1(A,{abi:g,address:y,args:b,docsPath:"/docs/contract/multicall",functionName:C});if(!r)throw O;u[f]=[...u[f],{allowFailure:!0,callData:"0x",target:y}]}}const h=await Promise.allSettled(u.map(m=>$c(t,{abi:N3,address:l,args:[m],blockNumber:i,blockTag:s,functionName:"aggregate3"}))),p=[];for(let m=0;m"u"?{}:t,s={EIP712Domain:Tz({domain:i}),...n};Pz({domain:i,message:e,primaryType:r,types:s});const o=["0x1901"];return i&&o.push(Mge({domain:i,types:s})),r!=="EIP712Domain"&&o.push(Sz({data:e,primaryType:r,types:s})),ei(oa(o))}function Mge({domain:t,types:e}){return Sz({data:t,primaryType:"EIP712Domain",types:e})}function Sz({data:t,primaryType:e,types:r}){const n=kz({data:t,primaryType:e,types:r});return ei(n)}function kz({data:t,primaryType:e,types:r}){const n=[{type:"bytes32"}],i=[Nge({primaryType:e,types:r})];for(const s of r[e]){const[o,a]=_z({types:r,name:s.name,type:s.type,value:t[s.name]});n.push(o),i.push(a)}return mp(n,i)}function Nge({primaryType:t,types:e}){const r=Ca(Dge({primaryType:t,types:e}));return ei(r)}function Dge({primaryType:t,types:e}){let r="";const n=Az({primaryType:t,types:e});n.delete(t);const i=[t,...Array.from(n).sort()];for(const s of i)r+=`${s}(${e[s].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return r}function Az({primaryType:t,types:e},r=new Set){const n=t.match(/^\w*/u),i=n==null?void 0:n[0];if(r.has(i)||e[i]===void 0)return r;r.add(i);for(const s of e[i])Az({primaryType:s.type,types:e},r);return r}function _z({types:t,name:e,type:r,value:n}){if(t[r]!==void 0)return[{type:"bytes32"},ei(kz({data:n,primaryType:r,types:t}))];if(r==="bytes")return n=`0x${(n.length%2?"0":"")+n.slice(2)}`,[{type:"bytes32"},ei(n)];if(r==="string")return[{type:"bytes32"},ei(Ca(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),s=n.map(o=>_z({name:e,type:i,types:t,value:o}));return[{type:"bytes32"},ei(mp(s.map(([o])=>o),s.map(([,o])=>o)))]}return[{type:r},n]}function Pz({domain:t,message:e,primaryType:r,types:n}){const i=n,s=(o,a)=>{for(const c of o){const{name:l,type:u}=c,f=u,d=a[l],h=f.match(Rge);if(h&&(typeof d=="number"||typeof d=="bigint")){const[m,g,y]=h;ze(d,{signed:g==="int",size:parseInt(y)/8})}if(f==="address"&&typeof d=="string"&&!pd(d))throw new v1({address:d});const p=f.match(Oge);if(p){const[m,g]=p;if(g&&Wr(d)!==parseInt(g))throw new Sme({expectedSize:parseInt(g),givenSize:Wr(d)})}const v=i[f];v&&s(v,d)}};if(i.EIP712Domain&&t&&s(i.EIP712Domain,t),r!=="EIP712Domain"){const o=i[r];s(o,e)}}function Tz({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const Cx="/docs/contract/encodeDeployData";function Iz({abi:t,args:e,bytecode:r}){if(!e||e.length===0)return r;const n=t.find(s=>"type"in s&&s.type==="constructor");if(!n)throw new yme({docsPath:Cx});if(!("inputs"in n))throw new uP({docsPath:Cx});if(!n.inputs||n.inputs.length===0)throw new uP({docsPath:Cx});const i=mp(n.inputs,e);return q4([r,i])}function Lge(t,e){const r=(()=>typeof t=="string"?Vo(t):t.raw instanceof Uint8Array?t.raw:iu(t.raw))(),n=Vo(`Ethereum Signed Message: ${r.length}`);return ei(oa([n,r]),e)}const Bge="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0);BigInt(1);BigInt(2);function Fge(t,e){if(t.length!==e.length)return!1;for(let r=0;r{const f=Un(["watchBlockNumber",t.uid,e,r,o]);return Kd(f,{onBlockNumber:n,onError:i},d=>wp(async()=>{var h;try{const p=await Ep(t,{cacheTime:0});if(c){if(p===c)return;if(p-c>1&&r)for(let v=c+1n;vc)&&(d.onBlockNumber(p,c),c=p)}catch(p){(h=d.onError)==null||h.call(d,p)}},{emitOnBegin:e,interval:o}))})():(()=>{let f=!0,d=()=>f=!1;return(async()=>{try{const{unsubscribe:h}=await t.transport.subscribe({params:["newHeads"],onData(p){var m;if(!f)return;const v=Qb((m=p.result)==null?void 0:m.number);n(v,c),c=v},onError(p){i==null||i(p)}});d=h,f||d()}catch(h){i==null||i(h)}})(),d})()}async function Wge(t,{confirmations:e=1,hash:r,onReplaced:n,pollingInterval:i=t.pollingInterval,timeout:s}){const o=Un(["waitForTransactionReceipt",t.uid,r]);let a,c,l,u=!1;return new Promise((f,d)=>{s&&setTimeout(()=>d(new lme({hash:r})),s);const h=Kd(o,{onReplaced:n,resolve:f,reject:d},p=>{const v=Rz(t,{emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(m){if(u)return;let g=m;const y=b=>{v(),b(),h()};try{if(l){if(g-l.blockNumber+1np.resolve(l));return}if(a||(u=!0,await hz(async()=>{a=await mS(t,{hash:r}),a.blockNumber&&(g=a.blockNumber)},{delay:({count:b})=>~~(1<0&&g-l.blockNumber+1np.resolve(l))}catch(b){if(a&&(b instanceof qU||b instanceof VU))try{c=a;const A=(await Rc(t,{blockNumber:g,includeTransactions:!0})).transactions.find(({from:w,nonce:I})=>w===c.from&&I===c.nonce);if(!A||(l=await B3(t,{hash:A.hash}),g-l.blockNumber+1n{var w;(w=p.onReplaced)==null||w.call(p,{reason:O,replacedTransaction:c,transaction:A,transactionReceipt:l}),p.resolve(l)})}catch(C){y(()=>p.reject(C))}else y(()=>p.reject(b))}}})})})}function Hge(t,{blockTag:e="latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:s,includeTransactions:o,poll:a,pollingInterval:c=t.pollingInterval}){const l=typeof a<"u"?a:t.transport.type!=="webSocket",u=o??!1;let f;return l?(()=>{const p=Un(["watchBlocks",t.uid,r,n,u,c]);return Kd(p,{onBlock:i,onError:s},v=>wp(async()=>{var m;try{const g=await Rc(t,{blockTag:e,includeTransactions:u});if(g.number&&(f!=null&&f.number)){if(g.number===f.number)return;if(g.number-f.number>1&&r)for(let y=(f==null?void 0:f.number)+1n;yf.number)&&(v.onBlock(g,f),f=g)}catch(g){(m=v.onError)==null||m.call(v,g)}},{emitOnBegin:n,interval:c}))})():(()=>{let p=!0,v=()=>p=!1;return(async()=>{try{const{unsubscribe:m}=await t.transport.subscribe({params:["newHeads"],onData(g){var C,A,O;if(!p)return;const b=(((O=(A=(C=t.chain)==null?void 0:C.formatters)==null?void 0:A.block)==null?void 0:O.format)||WU)(g.result);i(b,f),f=b},onError(g){s==null||s(g)}});v=m,p||v()}catch(m){s==null||s(m)}})(),v})()}function qge(t,{address:e,args:r,batch:n=!0,event:i,events:s,onError:o,onLogs:a,poll:c,pollingInterval:l=t.pollingInterval,strict:u}){const f=typeof c<"u"?c:t.transport.type!=="webSocket",d=u??!1;return f?(()=>{const v=Un(["watchEvent",e,r,n,t.uid,i,l]);return Kd(v,{onLogs:a,onError:o},m=>{let g,y,b=!1;const C=wp(async()=>{var A;if(!b){try{y=await Ez(t,{address:e,args:r,event:i,events:s,strict:d})}catch{}b=!0;return}try{let O;if(y)O=await s2(t,{filter:y});else{const w=await Ep(t);g&&g!==w?O=await uS(t,{address:e,args:r,event:i,events:s,fromBlock:g+1n,toBlock:w}):O=[],g=w}if(O.length===0)return;n?m.onLogs(O):O.forEach(w=>m.onLogs([w]))}catch(O){y&&O instanceof ou&&(b=!1),(A=m.onError)==null||A.call(m,O)}},{emitOnBegin:!0,interval:l});return async()=>{y&&await o2(t,{filter:y}),C()}})})():(()=>{let v=!0,m=()=>v=!1;return(async()=>{try{const g=s??(i?[i]:void 0);let y=[];g&&(y=[g.flatMap(C=>gp({abi:[C],eventName:C.name,args:r}))],i&&(y=y[0]));const{unsubscribe:b}=await t.transport.subscribe({params:["logs",{address:e,topics:y}],onData(C){var O;if(!v)return;const A=C.result;try{const{eventName:w,args:I}=xp({abi:g,data:A.data,topics:A.topics,strict:d}),B=Os(A,{args:I,eventName:w});a([B])}catch(w){let I,B;if(w instanceof su||w instanceof Hd){if(u)return;I=w.abiItem.name,B=(O=w.abiItem.inputs)==null?void 0:O.some(H=>!("name"in H&&H.name))}const z=Os(A,{args:B?[]:{},eventName:I});a([z])}},onError(C){o==null||o(C)}});m=b,v||m()}catch(g){o==null||o(g)}})(),m})()}function Vge(t,{batch:e=!0,onError:r,onTransactions:n,poll:i,pollingInterval:s=t.pollingInterval}){return(typeof i<"u"?i:t.transport.type!=="webSocket")?(()=>{const l=Un(["watchPendingTransactions",t.uid,e,s]);return Kd(l,{onTransactions:n,onError:r},u=>{let f;const d=wp(async()=>{var h;try{if(!f)try{f=await Cz(t);return}catch(v){throw d(),v}const p=await s2(t,{filter:f});if(p.length===0)return;e?u.onTransactions(p):p.forEach(v=>u.onTransactions([v]))}catch(p){(h=u.onError)==null||h.call(u,p)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await o2(t,{filter:f}),d()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:f}=await t.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!l)return;const h=d.result;n([h])},onError(d){r==null||r(d)}});u=f,l||u()}catch(f){r==null||r(f)}})(),u})()}function Gge(t){return{call:e=>i2(t,e),createBlockFilter:()=>xge(t),createContractEventFilter:e=>iz(t,e),createEventFilter:e=>Ez(t,e),createPendingTransactionFilter:()=>Cz(t),estimateContractGas:e=>Tye(t,e),estimateGas:e=>aS(t,e),getBalance:e=>Ege(t,e),getBlock:e=>Rc(t,e),getBlockNumber:e=>Ep(t,e),getBlockTransactionCount:e=>Cge(t,e),getBytecode:e=>Sge(t,e),getChainId:()=>I1(t),getEnsAddress:e=>sge(t,e),getEnsAvatar:e=>gge(t,e),getEnsName:e=>bge(t,e),getEnsResolver:e=>wge(t,e),getEnsText:e=>xz(t,e),getFeeHistory:e=>Age(t,e),estimateFeesPerGas:e=>Pye(t,e),getFilterChanges:e=>s2(t,e),getFilterLogs:e=>_ge(t,e),getGasPrice:()=>oS(t),getLogs:e=>uS(t,e),estimateMaxPriorityFeePerGas:e=>_ye(t,e),getStorageAt:e=>Pge(t,e),getTransaction:e=>mS(t,e),getTransactionConfirmations:e=>Tge(t,e),getTransactionCount:e=>lz(t,e),getTransactionReceipt:e=>B3(t,e),multicall:e=>Ige(t,e),prepareTransactionRequest:e=>n2(t,e),readContract:e=>$c(t,e),sendRawTransaction:e=>fS(t,e),simulateContract:e=>Fye(t,e),verifyMessage:e=>Uge(t,e),verifyTypedData:e=>zge(t,e),uninstallFilter:e=>o2(t,e),waitForTransactionReceipt:e=>Wge(t,e),watchBlocks:e=>Hge(t,e),watchBlockNumber:e=>Rz(t,e),watchContractEvent:e=>Gye(t,e),watchEvent:e=>qge(t,e),watchPendingTransactions:e=>Vge(t,e)}}function SP(t){const{key:e="public",name:r="Public Client"}=t;return dz({...t,key:e,name:r,type:"publicClient"}).extend(Gge)}function Kge(t,{abi:e,args:r,bytecode:n,...i}){const s=Iz({abi:e,args:r,bytecode:n});return dS(t,{...i,data:s})}async function Qge(t){return(await t.request({method:"eth_accounts"})).map(r=>eS(r))}async function Yge(t){return await t.request({method:"wallet_getPermissions"})}async function Jge(t){return(await t.request({method:"eth_requestAccounts"})).map(r=>jn(r))}async function Xge(t,e){return t.request({method:"wallet_requestPermissions",params:[e]})}async function Zge(t,{account:e=t.account,message:r}){if(!e)throw new Vd({docsPath:"/docs/actions/wallet/signMessage"});const n=ts(e);if(n.type==="local")return n.signMessage({message:r});const i=(()=>typeof r=="string"?W4(r):r.raw instanceof Uint8Array?Ca(r.raw):r.raw)();return t.request({method:"personal_sign",params:[i,n.address]})}async function ebe(t,e){var l,u,f,d;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new Vd({docsPath:"/docs/actions/wallet/signTransaction"});const s=ts(r);bp({account:s,...e});const o=await I1(t);n!==null&&LU({currentChainId:o,chain:n});const a=(n==null?void 0:n.formatters)||((l=t.chain)==null?void 0:l.formatters),c=((u=a==null?void 0:a.transactionRequest)==null?void 0:u.format)||Yb;return s.type==="local"?s.signTransaction({chainId:o,...i},{serializer:(d=(f=t.chain)==null?void 0:f.serializers)==null?void 0:d.transaction}):await t.request({method:"eth_signTransaction",params:[{...c(i),chainId:ze(o),from:s.address}]})}async function tbe(t,{account:e=t.account,domain:r,message:n,primaryType:i,types:s}){if(!e)throw new Vd({docsPath:"/docs/actions/wallet/signTypedData"});const o=ts(e),a={EIP712Domain:Tz({domain:r}),...s};if(Pz({domain:r,message:n,primaryType:i,types:a}),o.type==="local")return o.signTypedData({domain:r,primaryType:i,types:a,message:n});const c=Un({domain:r??{},primaryType:i,types:a,message:n},(l,u)=>So(u)?u.toLowerCase():u);return t.request({method:"eth_signTypedData_v4",params:[o.address,c]})}async function rbe(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:ze(e)}]})}async function nbe(t,e){return await t.request({method:"wallet_watchAsset",params:e})}function ibe(t){return{addChain:e=>Yye(t,e),deployContract:e=>Kge(t,e),getAddresses:()=>Qge(t),getChainId:()=>I1(t),getPermissions:()=>Yge(t),prepareTransactionRequest:e=>n2(t,e),requestAddresses:()=>Jge(t),requestPermissions:e=>Xge(t,e),sendRawTransaction:e=>fS(t,e),sendTransaction:e=>dS(t,e),signMessage:e=>Zge(t,e),signTransaction:e=>ebe(t,e),signTypedData:e=>tbe(t,e),switchChain:e=>rbe(t,e),watchAsset:e=>nbe(t,e),writeContract:e=>Qye(t,e)}}function Cp(t){const{key:e="wallet",name:r="Wallet Client",transport:n}=t;return dz({...t,key:e,name:r,transport:s=>n({...s,retryCount:0}),type:"walletClient"}).extend(ibe)}function sbe(t,e={}){const{key:r="webSocket",name:n="WebSocket JSON-RPC",retryDelay:i}=e;return({chain:s,retryCount:o,timeout:a})=>{var f;const c=e.retryCount??o,l=a??e.timeout??1e4,u=t||((f=s==null?void 0:s.rpcUrls.default.webSocket)==null?void 0:f[0]);if(!u)throw new vz;return a2({key:r,name:n,async request({method:d,params:h}){const p={method:d,params:h},v=await Ex(u),{error:m,result:g}=await jf.webSocketAsync(v,{body:p,timeout:l});if(m)throw new rS({body:p,error:m,url:u});return g},retryCount:c,retryDelay:i,timeout:l,type:"webSocket"},{getSocket(){return Ex(u)},async subscribe({params:d,onData:h,onError:p}){const v=await Ex(u),{result:m}=await new Promise((g,y)=>jf.webSocket(v,{body:{method:"eth_subscribe",params:d},onResponse(b){if(b.error){y(b.error),p==null||p(b.error);return}if(typeof b.id=="number"){g(b);return}b.method==="eth_subscription"&&h(b.params)}}));return{subscriptionId:m,async unsubscribe(){return new Promise(g=>jf.webSocket(v,{body:{method:"eth_unsubscribe",params:[m]},onResponse:g}))}}}})}}function obe(t){var r;if(!t)return"Injected";const e=n=>{if(n.isApexWallet)return"Apex Wallet";if(n.isAvalanche)return"Core Wallet";if(n.isBackpack)return"Backpack";if(n.isBifrost)return"Bifrost Wallet";if(n.isBitKeep)return"BitKeep";if(n.isBitski)return"Bitski";if(n.isBlockWallet)return"BlockWallet";if(n.isBraveWallet)return"Brave Wallet";if(n.isCoinbaseWallet)return"Coinbase Wallet";if(n.isDawn)return"Dawn Wallet";if(n.isDefiant)return"Defiant";if(n.isEnkrypt)return"Enkrypt";if(n.isExodus)return"Exodus";if(n.isFrame)return"Frame";if(n.isFrontier)return"Frontier Wallet";if(n.isGamestop)return"GameStop Wallet";if(n.isHaqqWallet)return"HAQQ Wallet";if(n.isHyperPay)return"HyperPay Wallet";if(n.isImToken)return"ImToken";if(n.isHaloWallet)return"Halo Wallet";if(n.isKuCoinWallet)return"KuCoin Wallet";if(n.isMathWallet)return"MathWallet";if(n.isNovaWallet)return"Nova Wallet";if(n.isOkxWallet||n.isOKExWallet)return"OKX Wallet";if(n.isOneInchIOSWallet||n.isOneInchAndroidWallet)return"1inch Wallet";if(n.isOpera)return"Opera";if(n.isPhantom)return"Phantom";if(n.isPortal)return"Ripio Portal";if(n.isRabby)return"Rabby Wallet";if(n.isRainbow)return"Rainbow";if(n.isStatus)return"Status";if(n.isTalisman)return"Talisman";if(n.isTally)return"Taho";if(n.isTokenPocket)return"TokenPocket";if(n.isTokenary)return"Tokenary";if(n.isTrust||n.isTrustWallet)return"Trust Wallet";if(n.isTTWallet)return"TTWallet";if(n.isXDEFI)return"XDEFI Wallet";if(n.isZerion)return"Zerion";if(n.isMetaMask)return"MetaMask"};if((r=t.providers)!=null&&r.length){const n=new Set;let i=1;for(const o of t.providers){let a=e(o);a||(a=`Unknown Wallet #${i}`,i+=1),n.add(a)}const s=[...n];return s.length?s:s[0]??"Injected"}return e(t)??"Injected"}var ym,$z=class extends vp{constructor({chains:t,options:e}={}){const r={shimDisconnect:!0,getProvider(){if(typeof window>"u")return;const i=window.ethereum;return i!=null&&i.providers?i.providers[0]:i},...e};super({chains:t,options:r}),Ke(this,"id","injected"),Ke(this,"name"),Ke(this,"ready"),Br(this,ym,void 0),Ke(this,"shimDisconnectKey",`${this.id}.shimDisconnect`),Ke(this,"onAccountsChanged",i=>{i.length===0?this.emit("disconnect"):this.emit("change",{account:jn(i[0])})}),Ke(this,"onChainChanged",i=>{const s=Ul(i),o=this.isChainUnsupported(s);this.emit("change",{chain:{id:s,unsupported:o}})}),Ke(this,"onDisconnect",async i=>{var s;i.code===1013&&await this.getProvider()&&await this.getAccount()||(this.emit("disconnect"),this.options.shimDisconnect&&((s=this.storage)==null||s.removeItem(this.shimDisconnectKey)))});const n=r.getProvider();if(typeof r.name=="string")this.name=r.name;else if(n){const i=obe(n);r.name?this.name=r.name(i):typeof i=="string"?this.name=i:this.name=i[0]}else this.name="Injected";this.ready=!!n}async connect({chainId:t}={}){var e;try{const r=await this.getProvider();if(!r)throw new qa;r.on&&(r.on("accountsChanged",this.onAccountsChanged),r.on("chainChanged",this.onChainChanged),r.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const n=await r.request({method:"eth_requestAccounts"}),i=jn(n[0]);let s=await this.getChainId(),o=this.isChainUnsupported(s);return t&&s!==t&&(s=(await this.switchChain(t)).id,o=this.isChainUnsupported(s)),this.options.shimDisconnect&&((e=this.storage)==null||e.setItem(this.shimDisconnectKey,!0)),{account:i,chain:{id:s,unsupported:o}}}catch(r){throw this.isUserRejectedRequestError(r)?new Or(r):r.code===-32002?new Oc(r):r}}async disconnect(){var e;const t=await this.getProvider();t!=null&&t.removeListener&&(t.removeListener("accountsChanged",this.onAccountsChanged),t.removeListener("chainChanged",this.onChainChanged),t.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((e=this.storage)==null||e.removeItem(this.shimDisconnectKey)))}async getAccount(){const t=await this.getProvider();if(!t)throw new qa;const e=await t.request({method:"eth_accounts"});return jn(e[0])}async getChainId(){const t=await this.getProvider();if(!t)throw new qa;return t.request({method:"eth_chainId"}).then(Ul)}async getProvider(){const t=this.options.getProvider();return t&&Es(this,ym,t),He(this,ym)}async getWalletClient({chainId:t}={}){const[e,r]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(i=>i.id===t);if(!e)throw new Error("provider is required.");return Cp({account:r,chain:n,transport:c2(e)})}async isAuthorized(){var t;try{if(this.options.shimDisconnect&&!((t=this.storage)!=null&&t.getItem(this.shimDisconnectKey)))return!1;if(!await this.getProvider())throw new qa;return!!await this.getAccount()}catch{return!1}}async switchChain(t){var n,i,s;const e=await this.getProvider();if(!e)throw new qa;const r=ze(t);try{return await Promise.all([e.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]}),new Promise(o=>this.on("change",({chain:a})=>{(a==null?void 0:a.id)===t&&o()}))]),this.chains.find(o=>o.id===t)??{id:t,name:`Chain ${r}`,network:`${r}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(o){const a=this.chains.find(c=>c.id===t);if(!a)throw new GU({chainId:t,connectorId:this.id});if(o.code===4902||((i=(n=o==null?void 0:o.data)==null?void 0:n.originalError)==null?void 0:i.code)===4902)try{if(await e.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:a.name,nativeCurrency:a.nativeCurrency,rpcUrls:[((s=a.rpcUrls.public)==null?void 0:s.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(a)}]}),await this.getChainId()!==t)throw new Or(new Error("User rejected switch after adding network."));return a}catch(c){throw new Or(c)}throw this.isUserRejectedRequestError(o)?new Or(o):new aa(o)}}async watchAsset({address:t,decimals:e=18,image:r,symbol:n}){const i=await this.getProvider();if(!i)throw new qa;return i.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:t,decimals:e,image:r,symbol:n}}})}isUserRejectedRequestError(t){return t.code===4001}};ym=new WeakMap;var yS=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Sx=(t,e,r)=>(yS(t,e,"read from private field"),r?r.call(t):e.get(t)),kx=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Sv=(t,e,r,n)=>(yS(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),abe=(t,e,r)=>(yS(t,e,"access private method"),r);const cbe=t=>(e,r,n)=>{const i=n.subscribe;return n.subscribe=(o,a,c)=>{let l=o;if(a){const u=(c==null?void 0:c.equalityFn)||Object.is;let f=o(n.getState());l=d=>{const h=o(d);if(!u(f,h)){const p=f;a(f=h,p)}},c!=null&&c.fireImmediately&&a(f,f)}return i(l)},t(e,r,n)},lbe=cbe;function ube(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,e==null?void 0:e.reviver),a=(s=r.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const O1=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return O1(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return O1(n)(r)}}}},fbe=(t,e)=>(r,n,i)=>{let s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:m=>m,version:0,merge:(m,g)=>({...g,...m}),...e},o=!1;const a=new Set,c=new Set;let l;try{l=s.getStorage()}catch{}if(!l)return t((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...m)},n,i);const u=O1(s.serialize),f=()=>{const m=s.partialize({...n()});let g;const y=u({state:m,version:s.version}).then(b=>l.setItem(s.name,b)).catch(b=>{g=b});if(g)throw g;return y},d=i.setState;i.setState=(m,g)=>{d(m,g),f()};const h=t((...m)=>{r(...m),f()},n,i);let p;const v=()=>{var m;if(!l)return;o=!1,a.forEach(y=>y(n()));const g=((m=s.onRehydrateStorage)==null?void 0:m.call(s,n()))||void 0;return O1(l.getItem.bind(l))(s.name).then(y=>{if(y)return s.deserialize(y)}).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==s.version){if(s.migrate)return s.migrate(y.state,y.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return y.state}).then(y=>{var b;return p=s.merge(y,(b=n())!=null?b:h),r(p,!0),f()}).then(()=>{g==null||g(p,void 0),o=!0,c.forEach(y=>y(p))}).catch(y=>{g==null||g(void 0,y)})};return i.persist={setOptions:m=>{s={...s,...m},m.getStorage&&(l=m.getStorage())},clearStorage:()=>{l==null||l.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>v(),hasHydrated:()=>o,onHydrate:m=>(a.add(m),()=>{a.delete(m)}),onFinishHydration:m=>(c.add(m),()=>{c.delete(m)})},v(),p||h},dbe=(t,e)=>(r,n,i)=>{let s={storage:ube(()=>localStorage),partialize:v=>v,version:0,merge:(v,m)=>({...m,...v}),...e},o=!1;const a=new Set,c=new Set;let l=s.storage;if(!l)return t((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...v)},n,i);const u=()=>{const v=s.partialize({...n()});return l.setItem(s.name,{state:v,version:s.version})},f=i.setState;i.setState=(v,m)=>{f(v,m),u()};const d=t((...v)=>{r(...v),u()},n,i);let h;const p=()=>{var v,m;if(!l)return;o=!1,a.forEach(y=>{var b;return y((b=n())!=null?b:d)});const g=((m=s.onRehydrateStorage)==null?void 0:m.call(s,(v=n())!=null?v:d))||void 0;return O1(l.getItem.bind(l))(s.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==s.version){if(s.migrate)return s.migrate(y.state,y.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return y.state}).then(y=>{var b;return h=s.merge(y,(b=n())!=null?b:d),r(h,!0),u()}).then(()=>{g==null||g(h,void 0),h=n(),o=!0,c.forEach(y=>y(h))}).catch(y=>{g==null||g(void 0,y)})};return i.persist={setOptions:v=>{s={...s,...v},v.storage&&(l=v.storage)},clearStorage:()=>{l==null||l.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>p(),hasHydrated:()=>o,onHydrate:v=>(a.add(v),()=>{a.delete(v)}),onFinishHydration:v=>(c.add(v),()=>{c.delete(v)})},s.skipHydration||p(),h||d},hbe=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?fbe(t,e):dbe(t,e),pbe=hbe,kP=t=>{let e;const r=new Set,n=(c,l)=>{const u=typeof c=="function"?c(e):c;if(!Object.is(u,e)){const f=e;e=l??typeof u!="object"?u:Object.assign({},e,u),r.forEach(d=>d(e,f))}},i=()=>e,a={setState:n,getState:i,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{r.clear()}};return e=t(n,i,a),a},vbe=t=>t?kP(t):kP;function gS(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,i]of t)if(!Object.is(i,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let n=0;nv===f.id)||(c=[...c,p.chain]),l[f.id]=[...l[f.id]||[],...p.rpcUrls.http],p.rpcUrls.webSocket&&(u[f.id]=[...u[f.id]||[],...p.rpcUrls.webSocket]))}if(!d)throw new Error([`Could not find valid provider configuration for chain "${f.name}". `,"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.","Read more: https://wagmi.sh/core/providers/jsonRpc"].join(` `))}return{chains:c,publicClient:({chainId:f})=>{const d=c.find(v=>v.id===f)??t[0],h=l[d.id];if(!h||!h[0])throw new Error(`No providers configured for chain "${d.id}"`);const p=SP({batch:r,chain:d,transport:xP(h.map(v=>yz(v,{timeout:a})),{rank:i,retryCount:s,retryDelay:o}),pollingInterval:n});return Object.assign(p,{chains:c})},webSocketPublicClient:({chainId:f})=>{const d=c.find(v=>v.id===f)??t[0],h=u[d.id];if(!h||!h[0])return;const p=SP({batch:r,chain:d,transport:xP(h.map(v=>sbe(v,{timeout:a})),{rank:i,retryCount:s,retryDelay:o}),pollingInterval:n});return Object.assign(p,{chains:c})}}}var ybe=class extends Error{constructor(){super(...arguments),this.name="ConnectorAlreadyConnectedError",this.message="Connector already connected"}},gbe=class extends Error{constructor({connector:t}){super(`"${t.name}" does not support programmatic chain switching.`),this.name="SwitchChainNotSupportedError"}};function F3(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let r,n;if(Array.isArray(t)&&Array.isArray(e)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!F3(t[n],e[n]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const i=Object.keys(t);if(r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(s&&!F3(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}var j3=(t,{find:e,replace:r})=>t&&e(t)?r(t):typeof t!="object"?t:Array.isArray(t)?t.map(n=>j3(n,{find:e,replace:r})):t instanceof Object?Object.entries(t).reduce((n,[i,s])=>({...n,[i]:j3(s,{find:e,replace:r})}),{}):t;function bbe(t){const e=JSON.parse(t);return j3(e,{find:n=>typeof n=="string"&&n.startsWith("#bigint."),replace:n=>BigInt(n.replace("#bigint.",""))})}function AP(t,e){return t.slice(0,e).join(".")||"."}function _P(t,e){const{length:r}=t;for(let n=0;n{const o=typeof s=="bigint"?`#bigint.${s.toString()}`:s;return(e==null?void 0:e(i,o))||o},n),r??void 0)}var Mz={getItem:t=>"",setItem:(t,e)=>null,removeItem:t=>null};function Nz({deserialize:t=bbe,key:e="wagmi",serialize:r=xbe,storage:n}){return{...n,getItem:(i,s=null)=>{const o=n.getItem(`${e}.${i}`);try{return o?t(o):s}catch(a){return console.warn(a),s}},setItem:(i,s)=>{if(s===null)n.removeItem(`${e}.${i}`);else try{n.setItem(`${e}.${i}`,r(s))}catch(o){console.error(o)}},removeItem:i=>n.removeItem(`${e}.${i}`)}}var PP="store",Ju,Uh,U3,Dz,Ebe=class{constructor({autoConnect:e=!1,connectors:r=[new $z],publicClient:n,storage:i=Nz({storage:typeof window<"u"?window.localStorage:Mz}),logger:s={warn:console.warn},webSocketPublicClient:o}){var u,f;kx(this,U3),this.publicClients=new Map,this.webSocketPublicClients=new Map,kx(this,Ju,void 0),kx(this,Uh,void 0),this.args={autoConnect:e,connectors:r,logger:s,publicClient:n,storage:i,webSocketPublicClient:o};let a="disconnected",c;if(e)try{const d=i.getItem(PP),h=(u=d==null?void 0:d.state)==null?void 0:u.data;a=h!=null&&h.account?"reconnecting":"connecting",c=(f=h==null?void 0:h.chain)==null?void 0:f.id}catch{}const l=typeof r=="function"?r():r;l.forEach(d=>d.setStorage(i)),this.store=vbe(lbe(pbe(()=>({connectors:l,publicClient:this.getPublicClient({chainId:c}),status:a,webSocketPublicClient:this.getWebSocketPublicClient({chainId:c})}),{name:PP,storage:i,partialize:d=>{var h,p;return{...e&&{data:{account:(h=d==null?void 0:d.data)==null?void 0:h.account,chain:(p=d==null?void 0:d.data)==null?void 0:p.chain}},chains:d==null?void 0:d.chains}},version:2}))),this.storage=i,Sv(this,Uh,i==null?void 0:i.getItem("wallet")),abe(this,U3,Dz).call(this),e&&typeof window<"u"&&setTimeout(async()=>await this.autoConnect(),0)}get chains(){return this.store.getState().chains}get connectors(){return this.store.getState().connectors}get connector(){return this.store.getState().connector}get data(){return this.store.getState().data}get error(){return this.store.getState().error}get lastUsedChainId(){var e,r;return(r=(e=this.data)==null?void 0:e.chain)==null?void 0:r.id}get publicClient(){return this.store.getState().publicClient}get status(){return this.store.getState().status}get subscribe(){return this.store.subscribe}get webSocketPublicClient(){return this.store.getState().webSocketPublicClient}setState(e){const r=typeof e=="function"?e(this.store.getState()):e;this.store.setState(r,!0)}clearState(){this.setState(e=>({...e,chains:void 0,connector:void 0,data:void 0,error:void 0,status:"disconnected"}))}async destroy(){var e,r;this.connector&&await((r=(e=this.connector).disconnect)==null?void 0:r.call(e)),Sv(this,Ju,!1),this.clearState(),this.store.destroy()}async autoConnect(){if(Sx(this,Ju))return;Sv(this,Ju,!0),this.setState(n=>{var i;return{...n,status:(i=n.data)!=null&&i.account?"reconnecting":"connecting"}});const e=Sx(this,Uh)?[...this.connectors].sort(n=>n.id===Sx(this,Uh)?-1:1):this.connectors;let r=!1;for(const n of e){if(!n.ready||!n.isAuthorized||!await n.isAuthorized())continue;const s=await n.connect();this.setState(o=>({...o,connector:n,chains:n==null?void 0:n.chains,data:s,status:"connected"})),r=!0;break}return r||this.setState(n=>({...n,data:void 0,status:"disconnected"})),Sv(this,Ju,!1),this.data}setConnectors(e){this.args={...this.args,connectors:e};const r=typeof e=="function"?e():e;r.forEach(n=>n.setStorage(this.args.storage)),this.setState(n=>({...n,connectors:r}))}getPublicClient({chainId:e}={}){let r=this.publicClients.get(-1);if(r&&(r==null?void 0:r.chain.id)===e||(r=this.publicClients.get(e??-1),r))return r;const{publicClient:n}=this.args;return r=typeof n=="function"?n({chainId:e}):n,this.publicClients.set(e??-1,r),r}setPublicClient(e){var n,i;const r=(i=(n=this.data)==null?void 0:n.chain)==null?void 0:i.id;this.args={...this.args,publicClient:e},this.publicClients.clear(),this.setState(s=>({...s,publicClient:this.getPublicClient({chainId:r})}))}getWebSocketPublicClient({chainId:e}={}){let r=this.webSocketPublicClients.get(-1);if(r&&(r==null?void 0:r.chain.id)===e||(r=this.webSocketPublicClients.get(e??-1),r))return r;const{webSocketPublicClient:n}=this.args;return r=typeof n=="function"?n({chainId:e}):n,r&&this.webSocketPublicClients.set(e??-1,r),r}setWebSocketPublicClient(e){var n,i;const r=(i=(n=this.data)==null?void 0:n.chain)==null?void 0:i.id;this.args={...this.args,webSocketPublicClient:e},this.webSocketPublicClients.clear(),this.setState(s=>({...s,webSocketPublicClient:this.getWebSocketPublicClient({chainId:r})}))}setLastUsedConnector(e=null){var r;(r=this.storage)==null||r.setItem("wallet",e)}};Ju=new WeakMap;Uh=new WeakMap;U3=new WeakSet;Dz=function(){const t=a=>{this.setState(c=>({...c,data:{...c.data,...a}}))},e=()=>{this.clearState()},r=a=>{this.setState(c=>({...c,error:a}))};this.store.subscribe(({connector:a})=>a,(a,c)=>{var l,u,f,d,h,p;(l=c==null?void 0:c.off)==null||l.call(c,"change",t),(u=c==null?void 0:c.off)==null||u.call(c,"disconnect",e),(f=c==null?void 0:c.off)==null||f.call(c,"error",r),a&&((d=a.on)==null||d.call(a,"change",t),(h=a.on)==null||h.call(a,"disconnect",e),(p=a.on)==null||p.call(a,"error",r))});const{publicClient:n,webSocketPublicClient:i}=this.args;(typeof n=="function"||typeof i=="function")&&this.store.subscribe(({data:a})=>{var c;return(c=a==null?void 0:a.chain)==null?void 0:c.id},a=>{this.setState(c=>({...c,publicClient:this.getPublicClient({chainId:a}),webSocketPublicClient:this.getWebSocketPublicClient({chainId:a})}))})};var z3;function Cbe(t){const e=new Ebe(t);return z3=e,e}function Ji(){if(!z3)throw new Error("No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config");return z3}async function Sbe({chainId:t,connector:e}){const r=Ji(),n=r.connector;if(n&&e.id===n.id)throw new ybe;try{r.setState(s=>({...s,status:"connecting"}));const i=await e.connect({chainId:t});return r.setLastUsedConnector(e.id),r.setState(s=>({...s,connector:e,chains:e==null?void 0:e.chains,data:i,status:"connected"})),r.storage.setItem("connected",!0),{...i,connector:e}}catch(i){throw r.setState(s=>({...s,status:s.connector?"connected":"disconnected"})),i}}async function kbe(){const t=Ji();t.connector&&await t.connector.disconnect(),t.clearState(),t.storage.removeItem("connected")}function W3({chainId:t}={}){const e=Ji();return t&&e.getPublicClient({chainId:t})||e.publicClient}async function Lz({chainId:t}={}){var n,i;return await((i=(n=Ji().connector)==null?void 0:n.getWalletClient)==null?void 0:i.call(n,{chainId:t}))||null}function Abe(t,e){const r=Ji(),n=async()=>e(W3(t));return r.subscribe(({publicClient:s})=>s,n)}function _be({chainId:t},e){const r=Ji(),n=async({chainId:s})=>{if(t&&s&&t!==s)return;const o=await Lz({chainId:t});return Ji().connector?e(o):e(null)};return r.subscribe(({data:s,connector:o})=>{var a;return{account:s==null?void 0:s.account,chainId:(a=s==null?void 0:s.chain)==null?void 0:a.id,connector:o}},n,{equalityFn:gS})}function Bz(){const{data:t,connector:e,status:r}=Ji();switch(r){case"connected":return{address:t==null?void 0:t.account,connector:e,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:r};case"reconnecting":return{address:t==null?void 0:t.account,connector:e,isConnected:!!(t!=null&&t.account),isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:r};case"connecting":return{address:t==null?void 0:t.account,connector:e,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:r};case"disconnected":return{address:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:r}}}function Fz(){var i,s,o,a;const t=Ji(),e=(s=(i=t.data)==null?void 0:i.chain)==null?void 0:s.id,r=t.chains??[],n=[...((o=t.publicClient)==null?void 0:o.chains)||[],...r].find(c=>c.id===e)??{id:e,name:`Chain ${e}`,network:`${e}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}};return{chain:e?{...n,...(a=t.data)==null?void 0:a.chain,id:e}:void 0,chains:r}}async function Pbe({chainId:t}){const{connector:e}=Ji();if(!e)throw new qa;if(!e.switchChain)throw new gbe({connector:e});return e.switchChain(t)}function Tbe(t,{selector:e=r=>r}={}){const r=Ji(),n=()=>t(Bz());return r.subscribe(({data:s,connector:o,status:a})=>e({address:s==null?void 0:s.account,connector:o,status:a}),n,{equalityFn:gS})}function Ibe(t,{selector:e=r=>r}={}){const r=Ji(),n=()=>t(Fz());return r.subscribe(({data:s,chains:o})=>{var a;return e({chainId:(a=s==null?void 0:s.chain)==null?void 0:a.id,chains:o})},n,{equalityFn:gS})}var Obe={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62",blockCreated:16966585},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}},TP={id:137,name:"Polygon",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}},jz={exports:{}},Uz={};/** @@ -184,7 +184,7 @@ ${r.length}`);return ei(oa([n,r]),e)}const Bge="0x608060405234801562000011576000 * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var u2=k,Rbe=j4;function $be(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Mbe=typeof Object.is=="function"?Object.is:$be,Nbe=Rbe.useSyncExternalStore,Dbe=u2.useRef,Lbe=u2.useEffect,Bbe=u2.useMemo,Fbe=u2.useDebugValue;Uz.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var s=Dbe(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Bbe(function(){function c(h){if(!l){if(l=!0,u=h,h=n(h),i!==void 0&&o.hasValue){var p=o.value;if(i(p,h))return f=p}return f=h}if(p=f,Mbe(u,h))return p;var v=n(h);return i!==void 0&&i(p,v)?p:(u=h,f=v)}var l=!1,u,f,d=r===void 0?null:r;return[function(){return c(e())},d===null?void 0:function(){return c(d())}]},[e,r,n,i]);var a=Nbe(t,s[0],s[1]);return Lbe(function(){o.hasValue=!0,o.value=a},[a]),Fbe(a),a};jz.exports=Uz;var zz=jz.exports;function jbe({queryClient:t=new L4({defaultOptions:{queries:{cacheTime:1e3*60*60*24,networkMode:"offlineFirst",refetchOnWindowFocus:!1,retry:0},mutations:{networkMode:"offlineFirst"}}}),storage:e=Nz({storage:typeof window<"u"&&window.localStorage?window.localStorage:Mz}),persister:r=typeof window<"u"?jpe({key:"cache",storage:e,serialize:i=>i,deserialize:i=>i}):void 0,...n}){const i=Cbe({...n,storage:e});return r&&Nve({queryClient:t,persister:r,dehydrateOptions:{shouldDehydrateQuery:s=>s.cacheTime!==0&&s.queryKey[0].persist!==!1}}),Object.assign(i,{queryClient:t})}var Wz=k.createContext(void 0),f2=k.createContext(void 0);function Ube({children:t,config:e}){return k.createElement(Wz.Provider,{children:k.createElement(U4,{children:t,client:e.queryClient,context:f2}),value:e})}function d2(){const t=k.useContext(Wz);if(!t)throw new Error(["`useConfig` must be used within `WagmiConfig`.\n","Read more: https://wagmi.sh/react/WagmiConfig"].join(` -`));return t}var zbe=j4.useSyncExternalStore;function Wbe(t){return Array.isArray(t)}function Hbe(t){if(!IP(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const r=e.prototype;return!(!IP(r)||!r.hasOwnProperty("isPrototypeOf"))}function IP(t){return Object.prototype.toString.call(t)==="[object Object]"}function qbe(t,e,r){return Wbe(t)?typeof e=="function"?{...r,queryKey:t,queryFn:e}:{...e,queryKey:t}:t}function Vbe(t){return JSON.stringify(t,(e,r)=>Hbe(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):typeof r=="bigint"?r.toString():r)}function Gbe(t,e){return typeof t=="function"?t(...e):!!t}function Kbe(t,e){const r={};return Object.keys(t).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(e.trackedProps.add(n),t[n])})}),r}function Qbe(t,e){const r=Gb({context:t.context}),n=TU(),i=IU(),s=r.defaultQueryOptions({...t,queryKeyHashFn:Vbe});s._optimisticResults=n?"isRestoring":"optimistic",s.onError&&(s.onError=wt.batchCalls(s.onError)),s.onSuccess&&(s.onSuccess=wt.batchCalls(s.onSuccess)),s.onSettled&&(s.onSettled=wt.batchCalls(s.onSettled)),s.suspense&&typeof s.staleTime!="number"&&(s.staleTime=1e3),(s.suspense||s.useErrorBoundary)&&(i.isReset()||(s.retryOnMount=!1));const[o]=k.useState(()=>new e(r,s)),a=o.getOptimisticResult(s);if(zbe(k.useCallback(f=>n?()=>{}:o.subscribe(wt.batchCalls(f)),[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),k.useEffect(()=>{i.clearReset()},[i]),k.useEffect(()=>{o.setOptions(s,{listeners:!1})},[s,o]),s.suspense&&a.isLoading&&a.isFetching&&!n)throw o.fetchOptimistic(s).then(({data:f})=>{var d,h;(d=s.onSuccess)==null||d.call(s,f),(h=s.onSettled)==null||h.call(s,f,null)}).catch(f=>{var d,h;i.clearReset(),(d=s.onError)==null||d.call(s,f),(h=s.onSettled)==null||h.call(s,void 0,f)});if(a.isError&&!i.isReset()&&!a.isFetching&&Gbe(s.useErrorBoundary,[a.error,o.getCurrentQuery()]))throw a.error;const c=a.status==="loading"&&a.fetchStatus==="idle"?"idle":a.status,l=c==="idle",u=c==="loading"&&a.fetchStatus==="fetching";return{...a,defaultedOptions:s,isIdle:l,isLoading:u,observer:o,status:c}}function bS(t,e,r){const n=pU(t,e,r);return Tve({context:f2,...n})}function Ybe(t,e,r){const n=qbe(t,e,r),i=Qbe({context:f2,...n},B4),s={data:i.data,error:i.error,fetchStatus:i.fetchStatus,isError:i.isError,isFetched:i.isFetched,isFetchedAfterMount:i.isFetchedAfterMount,isFetching:i.isFetching,isIdle:i.isIdle,isLoading:i.isLoading,isRefetching:i.isRefetching,isSuccess:i.isSuccess,refetch:i.refetch,status:i.status,internal:{dataUpdatedAt:i.dataUpdatedAt,errorUpdatedAt:i.errorUpdatedAt,failureCount:i.failureCount,isFetchedAfterMount:i.isFetchedAfterMount,isLoadingError:i.isLoadingError,isPaused:i.isPaused,isPlaceholderData:i.isPlaceholderData,isPreviousData:i.isPreviousData,isRefetchError:i.isRefetchError,isStale:i.isStale,remove:i.remove}};return i.defaultedOptions.notifyOnChangeProps?s:Kbe(s,i.observer)}var Jbe=()=>Gb({context:f2});function Hz({chainId:t}={}){return zz.useSyncExternalStoreWithSelector(e=>Abe({chainId:t},e),()=>W3({chainId:t}),()=>W3({chainId:t}),e=>e,(e,r)=>e.uid===r.uid)}function Ax({chainId:t}){return[{entity:"walletClient",chainId:t,persist:!1}]}function Xbe({queryKey:[{chainId:t}]}){return Lz({chainId:t})}function wS({chainId:t,suspense:e,onError:r,onSettled:n,onSuccess:i}={}){const{connector:s}=fn(),o=h2({chainId:t}),a=Ybe(Ax({chainId:o}),Xbe,{cacheTime:0,enabled:!!s,staleTime:1/0,suspense:e,onError:r,onSettled:n,onSuccess:i}),c=Jbe();return k.useEffect(()=>_be({chainId:o},u=>{u?c.invalidateQueries(Ax({chainId:o})):c.removeQueries(Ax({chainId:o}))}),[c,o]),a}function h2({chainId:t}={}){return Hz({chainId:t}).chain.id}function Zbe(){const[,t]=k.useReducer(e=>e+1,0);return t}var _x=t=>typeof t=="object"&&!Array.isArray(t);function qz(t,e,r=e,n=F3){const i=k.useRef([]),s=zz.useSyncExternalStoreWithSelector(t,e,r,o=>o,(o,a)=>{if(_x(o)&&_x(a)&&i.current.length){for(const c of i.current)if(!n(o[c],a[c]))return!1;return!0}return n(o,a)});if(_x(s)){const o={...s};return Object.defineProperties(o,Object.entries(o).reduce((a,[c,l])=>({...a,[c]:{configurable:!1,enumerable:!0,get:()=>(i.current.includes(c)||i.current.push(c),l)}}),{})),o}return s}function fn({onConnect:t,onDisconnect:e}={}){const r=d2(),n=k.useCallback(a=>Tbe(a),[r]),i=qz(n,Bz),s=k.useRef(),o=s.current;return k.useEffect(()=>{(o==null?void 0:o.status)!=="connected"&&i.status==="connected"&&(t==null||t({address:i.address,connector:i.connector,isReconnected:(o==null?void 0:o.status)==="reconnecting"||(o==null?void 0:o.status)===void 0})),(o==null?void 0:o.status)==="connected"&&i.status==="disconnected"&&(e==null||e()),s.current=i},[t,e,o,i]),i}var e2e=t=>[{entity:"connect",...t}],t2e=t=>{const{connector:e,chainId:r}=t;if(!e)throw new Error("connector is required");return Sbe({connector:e,chainId:r})};function Vz({chainId:t,connector:e,onError:r,onMutate:n,onSettled:i,onSuccess:s}={}){const o=d2(),{data:a,error:c,isError:l,isIdle:u,isLoading:f,isSuccess:d,mutate:h,mutateAsync:p,reset:v,status:m,variables:g}=bS(e2e({connector:e,chainId:t}),t2e,{onError:r,onMutate:n,onSettled:i,onSuccess:s}),y=k.useCallback(C=>h({chainId:(C==null?void 0:C.chainId)??t,connector:(C==null?void 0:C.connector)??e}),[t,e,h]),b=k.useCallback(C=>p({chainId:(C==null?void 0:C.chainId)??t,connector:(C==null?void 0:C.connector)??e}),[t,e,p]);return{connect:y,connectAsync:b,connectors:o.connectors,data:a,error:c,isError:l,isIdle:u,isLoading:f,isSuccess:d,pendingConnector:g==null?void 0:g.connector,reset:v,status:m,variables:g}}var r2e=[{entity:"disconnect"}],n2e=()=>kbe();function Gz({onError:t,onMutate:e,onSettled:r,onSuccess:n}={}){const{error:i,isError:s,isIdle:o,isLoading:a,isSuccess:c,mutate:l,mutateAsync:u,reset:f,status:d}=bS(r2e,n2e,{...t?{onError(h,p,v){t(h,v)}}:{},onMutate:e,...r?{onSettled(h,p,v,m){r(p,m)}}:{},...n?{onSuccess(h,p,v){n(v)}}:{}});return{disconnect:l,disconnectAsync:u,error:i,isError:s,isIdle:o,isLoading:a,isSuccess:c,reset:f,status:d}}function dn(){const t=d2(),e=k.useCallback(r=>Ibe(r),[t]);return qz(e,Fz)}var i2e=t=>[{entity:"switchNetwork",...t}],s2e=t=>{const{chainId:e}=t;if(!e)throw new Error("chainId is required");return Pbe({chainId:e})};function xS({chainId:t,throwForSwitchChainNotSupported:e,onError:r,onMutate:n,onSettled:i,onSuccess:s}={}){var I;const o=d2(),a=Zbe(),{data:c,error:l,isError:u,isIdle:f,isLoading:d,isSuccess:h,mutate:p,mutateAsync:v,reset:m,status:g,variables:y}=bS(i2e({chainId:t}),s2e,{onError:r,onMutate:n,onSettled:i,onSuccess:s}),b=k.useCallback(B=>p({chainId:B??t}),[t,p]),C=k.useCallback(B=>v({chainId:B??t}),[t,v]);k.useEffect(()=>o.subscribe(({chains:z,connector:H})=>({chains:z,connector:H}),a),[o,a]);let A,O;const w=!!((I=o.connector)!=null&&I.switchChain);return(e||w)&&(A=b,O=C),{chains:o.chains??[],data:c,error:l,isError:u,isIdle:f,isLoading:d,isSuccess:h,pendingChainId:y==null?void 0:y.chainId,reset:m,status:g,switchNetwork:A,switchNetworkAsync:O,variables:y}}var zh,Xu,o2e=class extends vp{constructor({chains:t,options:e}){super({chains:t,options:{reloadOnDisconnect:!1,...e}}),Ke(this,"id","coinbaseWallet"),Ke(this,"name","Coinbase Wallet"),Ke(this,"ready",!0),Br(this,zh,void 0),Br(this,Xu,void 0),Ke(this,"onAccountsChanged",r=>{r.length===0?this.emit("disconnect"):this.emit("change",{account:jn(r[0])})}),Ke(this,"onChainChanged",r=>{const n=Ul(r),i=this.isChainUnsupported(n);this.emit("change",{chain:{id:n,unsupported:i}})}),Ke(this,"onDisconnect",()=>{this.emit("disconnect")})}async connect({chainId:t}={}){try{const e=await this.getProvider();e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const r=await e.enable(),n=jn(r[0]);let i=await this.getChainId(),s=this.isChainUnsupported(i);return t&&i!==t&&(i=(await this.switchChain(t)).id,s=this.isChainUnsupported(i)),{account:n,chain:{id:i,unsupported:s}}}catch(e){throw/(user closed modal|accounts received is empty)/i.test(e.message)?new Or(e):e}}async disconnect(){if(!He(this,Xu))return;const t=await this.getProvider();t.removeListener("accountsChanged",this.onAccountsChanged),t.removeListener("chainChanged",this.onChainChanged),t.removeListener("disconnect",this.onDisconnect),t.disconnect(),t.close()}async getAccount(){const e=await(await this.getProvider()).request({method:"eth_accounts"});return jn(e[0])}async getChainId(){const t=await this.getProvider();return Ul(t.chainId)}async getProvider(){var t;if(!He(this,Xu)){let e=(await cS(()=>import("./index-c40c73d5.js").then(o=>o.i),["./index-c40c73d5.js","./events-16b8e254.js","./index-cc134824.js"],import.meta.url)).default;typeof e!="function"&&typeof e.default=="function"&&(e=e.default),Es(this,zh,new e(this.options));const r=(t=He(this,zh).walletExtension)==null?void 0:t.getChainId(),n=this.chains.find(o=>this.options.chainId?o.id===this.options.chainId:o.id===r)||this.chains[0],i=this.options.chainId||(n==null?void 0:n.id),s=this.options.jsonRpcUrl||(n==null?void 0:n.rpcUrls.default.http[0]);Es(this,Xu,He(this,zh).makeWeb3Provider(s,i))}return He(this,Xu)}async getWalletClient({chainId:t}={}){const[e,r]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(i=>i.id===t);if(!e)throw new Error("provider is required.");return Cp({account:r,chain:n,transport:c2(e)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}async switchChain(t){var n;const e=await this.getProvider(),r=ze(t);try{return await e.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]}),this.chains.find(i=>i.id===t)??{id:t,name:`Chain ${r}`,network:`${r}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(i){const s=this.chains.find(o=>o.id===t);if(!s)throw new GU({chainId:t,connectorId:this.id});if(i.code===4902)try{return await e.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[((n=s.rpcUrls.public)==null?void 0:n.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(s)}]}),s}catch(o){throw new Or(o)}throw new aa(i)}}async watchAsset({address:t,decimals:e=18,image:r,symbol:n}){return(await this.getProvider()).request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:t,decimals:e,image:r,symbol:n}}})}};zh=new WeakMap;Xu=new WeakMap;var gm,a2e=class extends $z{constructor({chains:t,options:e}={}){const r={name:"MetaMask",shimDisconnect:!0,getProvider(){function n(s){if(s!=null&&s.isMetaMask&&!(s.isBraveWallet&&!s._events&&!s._state)&&!s.isApexWallet&&!s.isAvalanche&&!s.isBitKeep&&!s.isBlockWallet&&!s.isMathWallet&&!(s.isOkxWallet||s.isOKExWallet)&&!(s.isOneInchIOSWallet||s.isOneInchAndroidWallet)&&!s.isOpera&&!s.isPortal&&!s.isRabby&&!s.isDefiant&&!s.isTokenPocket&&!s.isTokenary&&!s.isZerion)return s}if(typeof window>"u")return;const i=window.ethereum;return i!=null&&i.providers?i.providers.find(n):n(i)},...e};super({chains:t,options:r}),Ke(this,"id","metaMask"),Ke(this,"shimDisconnectKey",`${this.id}.shimDisconnect`),Br(this,gm,void 0),Es(this,gm,r.UNSTABLE_shimOnConnectSelectAccount)}async connect({chainId:t}={}){var e,r,n,i;try{const s=await this.getProvider();if(!s)throw new qa;s.on&&(s.on("accountsChanged",this.onAccountsChanged),s.on("chainChanged",this.onChainChanged),s.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});let o=null;if(He(this,gm)&&((e=this.options)!=null&&e.shimDisconnect)&&!((r=this.storage)!=null&&r.getItem(this.shimDisconnectKey))&&(o=await this.getAccount().catch(()=>null),!!o))try{await s.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),o=await this.getAccount()}catch(u){if(this.isUserRejectedRequestError(u))throw new Or(u);if(u.code===new Oc(u).code)throw u}if(!o){const l=await s.request({method:"eth_requestAccounts"});o=jn(l[0])}let a=await this.getChainId(),c=this.isChainUnsupported(a);return t&&a!==t&&(a=(await this.switchChain(t)).id,c=this.isChainUnsupported(a)),(n=this.options)!=null&&n.shimDisconnect&&((i=this.storage)==null||i.setItem(this.shimDisconnectKey,!0)),{account:o,chain:{id:a,unsupported:c},provider:s}}catch(s){throw this.isUserRejectedRequestError(s)?new Or(s):s.code===-32002?new Oc(s):s}}};gm=new WeakMap;var yl,Hs,c2e=class{constructor(t){Ke(this,"events",new MU),Ke(this,"chainId"),Br(this,yl,void 0),Br(this,Hs,void 0),this.chainId=t.chainId,Es(this,yl,t)}async enable(){var e;if((e=He(this,yl).flags)!=null&&e.failConnect)throw new Or(new Error("Failed to connect."));He(this,Hs)||Es(this,Hs,He(this,yl).walletClient);const t=He(this,Hs).account.address;return this.events.emit("accountsChanged",[t]),[t]}async disconnect(){this.events.emit("disconnect"),Es(this,Hs,void 0)}async getAccounts(){var e;const t=(e=He(this,Hs))==null?void 0:e.account.address;return t?[jn(t)]:[]}getWalletClient(){const t=He(this,Hs);if(!t)throw new Error("walletClient not found");return t}async switchChain(t){var e;if((e=He(this,yl).flags)!=null&&e.failSwitchChain)throw new Or(new Error("Failed to switch chain."));He(this,yl).chainId=t,this.chainId=t,this.events.emit("chainChanged",t)}async switchWalletClient(t){const e=t.account.address;Es(this,Hs,t),this.events.emit("accountsChanged",[e])}async watchAsset(t){return!0}async request({method:t,params:e}){var r;return(r=He(this,Hs))==null?void 0:r.transport.request({method:t,params:e})}on(t,e){return this.events.on(t,e),this}removeListener(t,e){return this.events.removeListener(t,e),this}toJSON(){return""}};yl=new WeakMap;Hs=new WeakMap;var Wh,H3,Kz,l2e=class extends vp{constructor({chains:t,options:e}){var r;super({chains:t,options:{...e,chainId:e.chainId??((r=t==null?void 0:t[0])==null?void 0:r.id)}}),Br(this,H3),Ke(this,"id","mock"),Ke(this,"name","Mock"),Ke(this,"ready",!0),Br(this,Wh,void 0),Ke(this,"onAccountsChanged",n=>{n.length===0?this.emit("disconnect"):this.emit("change",{account:jn(n[0])})}),Ke(this,"onChainChanged",n=>{const i=Ul(n),s=this.isChainUnsupported(i);this.emit("change",{chain:{id:i,unsupported:s}})}),Ke(this,"onDisconnect",()=>{this.emit("disconnect")})}async connect({chainId:t}={}){var a;const e=await this.getProvider({chainId:t});e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const r=await e.enable(),n=jn(r[0]),i=Ul(e.chainId),s=this.isChainUnsupported(i),o={account:n,chain:{id:i,unsupported:s},provider:e};return(a=this.options.flags)!=null&&a.noSwitchChain||(this.switchChain=Lr(this,H3,Kz)),new Promise(c=>setTimeout(()=>c(o),100))}async disconnect(){const t=await this.getProvider();await t.disconnect(),t.removeListener("accountsChanged",this.onAccountsChanged),t.removeListener("chainChanged",this.onChainChanged),t.removeListener("disconnect",this.onDisconnect)}async getAccount(){const r=(await(await this.getProvider()).getAccounts())[0];if(!r)throw new Error("Failed to get account");return jn(r)}async getChainId(){const t=await this.getProvider();return Ul(t.chainId)}async getProvider({chainId:t}={}){return(!He(this,Wh)||t)&&Es(this,Wh,new c2e({...this.options,chainId:t??this.options.chainId??this.chains[0].id})),He(this,Wh)}async getWalletClient(){return(await this.getProvider()).getWalletClient()}async isAuthorized(){var t;try{const r=await(await this.getProvider()).getAccounts();return((t=this.options.flags)==null?void 0:t.isAuthorized)??!!r}catch{return!1}}async watchAsset(t){return(await this.getProvider()).watchAsset(t)}toJSON(){return""}};Wh=new WeakMap;H3=new WeakSet;Kz=async function(t){return await(await this.getProvider()).switchChain(t),this.chains.find(r=>r.id===t)??{id:t,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}};var ES={},p2={},We={},Qz={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,c){var l=a>>>16&65535,u=a&65535,f=c>>>16&65535,d=c&65535;return u*d+(l*d+u*f<<16>>>0)|0}t.mul=Math.imul||e;function r(a,c){return a+c|0}t.add=r;function n(a,c){return a-c|0}t.sub=n;function i(a,c){return a<>>32-c}t.rotl=i;function s(a,c){return a<<32-c|a>>>c}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Qz);Object.defineProperty(We,"__esModule",{value:!0});var Yz=Qz;function u2e(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}We.readInt16BE=u2e;function f2e(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}We.readUint16BE=f2e;function d2e(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}We.readInt16LE=d2e;function h2e(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}We.readUint16LE=h2e;function Jz(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}We.writeUint16BE=Jz;We.writeInt16BE=Jz;function Xz(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}We.writeUint16LE=Xz;We.writeInt16LE=Xz;function q3(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}We.readInt32BE=q3;function V3(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}We.readUint32BE=V3;function G3(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}We.readInt32LE=G3;function K3(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}We.readUint32LE=K3;function ng(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}We.writeUint32BE=ng;We.writeInt32BE=ng;function ig(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}We.writeUint32LE=ig;We.writeInt32LE=ig;function p2e(t,e){e===void 0&&(e=0);var r=q3(t,e),n=q3(t,e+4);return r*4294967296+n-(n>>31)*4294967296}We.readInt64BE=p2e;function v2e(t,e){e===void 0&&(e=0);var r=V3(t,e),n=V3(t,e+4);return r*4294967296+n}We.readUint64BE=v2e;function m2e(t,e){e===void 0&&(e=0);var r=G3(t,e),n=G3(t,e+4);return n*4294967296+r-(r>>31)*4294967296}We.readInt64LE=m2e;function y2e(t,e){e===void 0&&(e=0);var r=K3(t,e),n=K3(t,e+4);return n*4294967296+r}We.readUint64LE=y2e;function Zz(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ng(t/4294967296>>>0,e,r),ng(t>>>0,e,r+4),e}We.writeUint64BE=Zz;We.writeInt64BE=Zz;function eW(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ig(t>>>0,e,r),ig(t/4294967296>>>0,e,r+4),e}We.writeUint64LE=eW;We.writeInt64LE=eW;function g2e(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}We.readUintBE=g2e;function b2e(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}We.writeUintBE=w2e;function x2e(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Yz.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s>>32-16|P<<16,H=H+P|0,w^=H,w=w>>>32-12|w<<12,C=C+I|0,$^=C,$=$>>>32-16|$<<16,K=K+$|0,I^=K,I=I>>>32-12|I<<12,A=A+B|0,D^=A,D=D>>>32-16|D<<16,F=F+D|0,B^=F,B=B>>>32-12|B<<12,O=O+z|0,_^=O,_=_>>>32-16|_<<16,x=x+_|0,z^=x,z=z>>>32-12|z<<12,A=A+B|0,D^=A,D=D>>>32-8|D<<8,F=F+D|0,B^=F,B=B>>>32-7|B<<7,O=O+z|0,_^=O,_=_>>>32-8|_<<8,x=x+_|0,z^=x,z=z>>>32-7|z<<7,C=C+I|0,$^=C,$=$>>>32-8|$<<8,K=K+$|0,I^=K,I=I>>>32-7|I<<7,b=b+w|0,P^=b,P=P>>>32-8|P<<8,H=H+P|0,w^=H,w=w>>>32-7|w<<7,b=b+I|0,_^=b,_=_>>>32-16|_<<16,F=F+_|0,I^=F,I=I>>>32-12|I<<12,C=C+B|0,P^=C,P=P>>>32-16|P<<16,x=x+P|0,B^=x,B=B>>>32-12|B<<12,A=A+z|0,$^=A,$=$>>>32-16|$<<16,H=H+$|0,z^=H,z=z>>>32-12|z<<12,O=O+w|0,D^=O,D=D>>>32-16|D<<16,K=K+D|0,w^=K,w=w>>>32-12|w<<12,A=A+z|0,$^=A,$=$>>>32-8|$<<8,H=H+$|0,z^=H,z=z>>>32-7|z<<7,O=O+w|0,D^=O,D=D>>>32-8|D<<8,K=K+D|0,w^=K,w=w>>>32-7|w<<7,C=C+B|0,P^=C,P=P>>>32-8|P<<8,x=x+P|0,B^=x,B=B>>>32-7|B<<7,b=b+I|0,_^=b,_=_>>>32-8|_<<8,F=F+_|0,I^=F,I=I>>>32-7|I<<7;yn.writeUint32LE(b+n|0,t,0),yn.writeUint32LE(C+i|0,t,4),yn.writeUint32LE(A+s|0,t,8),yn.writeUint32LE(O+o|0,t,12),yn.writeUint32LE(w+a|0,t,16),yn.writeUint32LE(I+c|0,t,20),yn.writeUint32LE(B+l|0,t,24),yn.writeUint32LE(z+u|0,t,28),yn.writeUint32LE(H+f|0,t,32),yn.writeUint32LE(K+d|0,t,36),yn.writeUint32LE(F+h|0,t,40),yn.writeUint32LE(x+p|0,t,44),yn.writeUint32LE(P+v|0,t,48),yn.writeUint32LE($+m|0,t,52),yn.writeUint32LE(D+g|0,t,56),yn.writeUint32LE(_+y|0,t,60)}function tW(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var rW={},Qc={};Object.defineProperty(Qc,"__esModule",{value:!0});function N2e(t,e,r){return~(t-1)&e|t-1&r}Qc.select=N2e;function D2e(t,e){return(t|0)-(e|0)-1>>>31&1}Qc.lessOrEqual=D2e;function nW(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Qc.compare=nW;function L2e(t,e){return t.length===0||e.length===0?!1:nW(t,e)!==0}Qc.equal=L2e;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Qc,r=Ms;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=a[0]|a[1]<<8;this._r[0]=c&8191;var l=a[2]|a[3]<<8;this._r[1]=(c>>>13|l<<3)&8191;var u=a[4]|a[5]<<8;this._r[2]=(l>>>10|u<<6)&7939;var f=a[6]|a[7]<<8;this._r[3]=(u>>>7|f<<9)&8191;var d=a[8]|a[9]<<8;this._r[4]=(f>>>4|d<<12)&255,this._r[5]=d>>>1&8190;var h=a[10]|a[11]<<8;this._r[6]=(d>>>14|h<<2)&8191;var p=a[12]|a[13]<<8;this._r[7]=(h>>>11|p<<5)&8065;var v=a[14]|a[15]<<8;this._r[8]=(p>>>8|v<<8)&8191,this._r[9]=v>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,c,l){for(var u=this._fin?0:2048,f=this._h[0],d=this._h[1],h=this._h[2],p=this._h[3],v=this._h[4],m=this._h[5],g=this._h[6],y=this._h[7],b=this._h[8],C=this._h[9],A=this._r[0],O=this._r[1],w=this._r[2],I=this._r[3],B=this._r[4],z=this._r[5],H=this._r[6],K=this._r[7],F=this._r[8],x=this._r[9];l>=16;){var P=a[c+0]|a[c+1]<<8;f+=P&8191;var $=a[c+2]|a[c+3]<<8;d+=(P>>>13|$<<3)&8191;var D=a[c+4]|a[c+5]<<8;h+=($>>>10|D<<6)&8191;var _=a[c+6]|a[c+7]<<8;p+=(D>>>7|_<<9)&8191;var N=a[c+8]|a[c+9]<<8;v+=(_>>>4|N<<12)&8191,m+=N>>>1&8191;var L=a[c+10]|a[c+11]<<8;g+=(N>>>14|L<<2)&8191;var R=a[c+12]|a[c+13]<<8;y+=(L>>>11|R<<5)&8191;var E=a[c+14]|a[c+15]<<8;b+=(R>>>8|E<<8)&8191,C+=E>>>5|u;var M=0,j=M;j+=f*A,j+=d*(5*x),j+=h*(5*F),j+=p*(5*K),j+=v*(5*H),M=j>>>13,j&=8191,j+=m*(5*z),j+=g*(5*B),j+=y*(5*I),j+=b*(5*w),j+=C*(5*O),M+=j>>>13,j&=8191;var T=M;T+=f*O,T+=d*A,T+=h*(5*x),T+=p*(5*F),T+=v*(5*K),M=T>>>13,T&=8191,T+=m*(5*H),T+=g*(5*z),T+=y*(5*B),T+=b*(5*I),T+=C*(5*w),M+=T>>>13,T&=8191;var U=M;U+=f*w,U+=d*O,U+=h*A,U+=p*(5*x),U+=v*(5*F),M=U>>>13,U&=8191,U+=m*(5*K),U+=g*(5*H),U+=y*(5*z),U+=b*(5*B),U+=C*(5*I),M+=U>>>13,U&=8191;var W=M;W+=f*I,W+=d*w,W+=h*O,W+=p*A,W+=v*(5*x),M=W>>>13,W&=8191,W+=m*(5*F),W+=g*(5*K),W+=y*(5*H),W+=b*(5*z),W+=C*(5*B),M+=W>>>13,W&=8191;var V=M;V+=f*B,V+=d*I,V+=h*w,V+=p*O,V+=v*A,M=V>>>13,V&=8191,V+=m*(5*x),V+=g*(5*F),V+=y*(5*K),V+=b*(5*H),V+=C*(5*z),M+=V>>>13,V&=8191;var G=M;G+=f*z,G+=d*B,G+=h*I,G+=p*w,G+=v*O,M=G>>>13,G&=8191,G+=m*A,G+=g*(5*x),G+=y*(5*F),G+=b*(5*K),G+=C*(5*H),M+=G>>>13,G&=8191;var J=M;J+=f*H,J+=d*z,J+=h*B,J+=p*I,J+=v*w,M=J>>>13,J&=8191,J+=m*O,J+=g*A,J+=y*(5*x),J+=b*(5*F),J+=C*(5*K),M+=J>>>13,J&=8191;var Y=M;Y+=f*K,Y+=d*H,Y+=h*z,Y+=p*B,Y+=v*I,M=Y>>>13,Y&=8191,Y+=m*w,Y+=g*O,Y+=y*A,Y+=b*(5*x),Y+=C*(5*F),M+=Y>>>13,Y&=8191;var X=M;X+=f*F,X+=d*K,X+=h*H,X+=p*z,X+=v*B,M=X>>>13,X&=8191,X+=m*I,X+=g*w,X+=y*O,X+=b*A,X+=C*(5*x),M+=X>>>13,X&=8191;var ae=M;ae+=f*x,ae+=d*F,ae+=h*K,ae+=p*H,ae+=v*z,M=ae>>>13,ae&=8191,ae+=m*B,ae+=g*I,ae+=y*w,ae+=b*O,ae+=C*A,M+=ae>>>13,ae&=8191,M=(M<<2)+M|0,M=M+j|0,j=M&8191,M=M>>>13,T+=M,f=j,d=T,h=U,p=W,v=V,m=G,g=J,y=Y,b=X,C=ae,c+=16,l-=16}this._h[0]=f,this._h[1]=d,this._h[2]=h,this._h[3]=p,this._h[4]=v,this._h[5]=m,this._h[6]=g,this._h[7]=y,this._h[8]=b,this._h[9]=C},o.prototype.finish=function(a,c){c===void 0&&(c=0);var l=new Uint16Array(10),u,f,d,h;if(this._leftover){for(h=this._leftover,this._buffer[h++]=1;h<16;h++)this._buffer[h]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(u=this._h[1]>>>13,this._h[1]&=8191,h=2;h<10;h++)this._h[h]+=u,u=this._h[h]>>>13,this._h[h]&=8191;for(this._h[0]+=u*5,u=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=u,u=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=u,l[0]=this._h[0]+5,u=l[0]>>>13,l[0]&=8191,h=1;h<10;h++)l[h]=this._h[h]+u,u=l[h]>>>13,l[h]&=8191;for(l[9]-=8192,f=(u^1)-1,h=0;h<10;h++)l[h]&=f;for(f=~f,h=0;h<10;h++)this._h[h]=this._h[h]&f|l[h];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,d=this._h[0]+this._pad[0],this._h[0]=d&65535,h=1;h<8;h++)d=(this._h[h]+this._pad[h]|0)+(d>>>16)|0,this._h[h]=d&65535;return a[c+0]=this._h[0]>>>0,a[c+1]=this._h[0]>>>8,a[c+2]=this._h[1]>>>0,a[c+3]=this._h[1]>>>8,a[c+4]=this._h[2]>>>0,a[c+5]=this._h[2]>>>8,a[c+6]=this._h[3]>>>0,a[c+7]=this._h[3]>>>8,a[c+8]=this._h[4]>>>0,a[c+9]=this._h[4]>>>8,a[c+10]=this._h[5]>>>0,a[c+11]=this._h[5]>>>8,a[c+12]=this._h[6]>>>0,a[c+13]=this._h[6]>>>8,a[c+14]=this._h[7]>>>0,a[c+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var c=0,l=a.length,u;if(this._leftover){u=16-this._leftover,u>l&&(u=l);for(var f=0;f=16&&(u=l-l%16,this._blocks(a,c,u),c+=u,l-=u),l){for(var f=0;f16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var h=new Uint8Array(16);h.set(l,h.length-l.length);var p=new Uint8Array(32);e.stream(this._key,h,p,4);var v=u.length+this.tagLength,m;if(d){if(d.length!==v)throw new Error("ChaCha20Poly1305: incorrect destination length");m=d}else m=new Uint8Array(v);return e.streamXOR(this._key,h,u,m,4),this._authenticate(m.subarray(m.length-this.tagLength,m.length),p,m.subarray(0,m.length-this.tagLength),f),n.wipe(h),m},c.prototype.open=function(l,u,f,d){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(u.length0&&h.update(o.subarray(d.length%16))),h.update(f),f.length%16>0&&h.update(o.subarray(f.length%16));var p=new Uint8Array(8);d&&i.writeUint64LE(d.length,p),h.update(p),i.writeUint64LE(f.length,p),h.update(p);for(var v=h.digest(),m=0;mthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n256)throw new Error("randomString charset is too long");let d="";const h=u.length,p=256-256%h;for(;l>0;){const v=i(Math.ceil(l*256/p),f);for(let m=0;m0;m++){const g=v[m];g0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[u++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(u=s(this._temp,this._state,c,u,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[u++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,u=this._bufferLength,f=l/536870912|0,d=l<<3,h=l%64<56?64:128;this._buffer[u]=128;for(var p=u+1;p0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.state),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,c,l,u,f){for(;f>=64;){for(var d=c[0],h=c[1],p=c[2],v=c[3],m=c[4],g=c[5],y=c[6],b=c[7],C=0;C<16;C++){var A=u+C*4;a[C]=e.readUint32BE(l,A)}for(var C=16;C<64;C++){var O=a[C-2],w=(O>>>17|O<<32-17)^(O>>>19|O<<32-19)^O>>>10;O=a[C-15];var I=(O>>>7|O<<32-7)^(O>>>18|O<<32-18)^O>>>3;a[C]=(w+a[C-7]|0)+(I+a[C-16]|0)}for(var C=0;C<64;C++){var w=(((m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&g^~m&y)|0)+(b+(i[C]+a[C]|0)|0)|0,I=((d>>>2|d<<32-2)^(d>>>13|d<<32-13)^(d>>>22|d<<32-22))+(d&h^d&p^h&p)|0;b=y,y=g,g=m,m=v+w|0,v=p,p=h,h=d,d=w+I|0}c[0]+=d,c[1]+=h,c[2]+=p,c[3]+=v,c[4]+=m,c[5]+=g,c[6]+=y,c[7]+=b,u+=64,f-=64}return u}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(b2);var SS={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=v2,r=Ms;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(C){const A=new Float64Array(16);if(C)for(let O=0;O>16&1),O[z-1]&=65535;O[15]=w[15]-32767-(O[14]>>16&1);const B=O[15]>>16&1;O[14]&=65535,a(w,O,1-B)}for(let I=0;I<16;I++)C[2*I]=w[I]&255,C[2*I+1]=w[I]>>8}function l(C,A){for(let O=0;O<16;O++)C[O]=A[2*O]+(A[2*O+1]<<8);C[15]&=32767}function u(C,A,O){for(let w=0;w<16;w++)C[w]=A[w]+O[w]}function f(C,A,O){for(let w=0;w<16;w++)C[w]=A[w]-O[w]}function d(C,A,O){let w,I,B=0,z=0,H=0,K=0,F=0,x=0,P=0,$=0,D=0,_=0,N=0,L=0,R=0,E=0,M=0,j=0,T=0,U=0,W=0,V=0,G=0,J=0,Y=0,X=0,ae=0,oe=0,ue=0,tt=0,Oe=0,Pe=0,ct=0,Ce=O[0],be=O[1],Qt=O[2],Re=O[3],$e=O[4],Yt=O[5],Me=O[6],Ne=O[7],Jt=O[8],De=O[9],Le=O[10],Xt=O[11],Be=O[12],Fe=O[13],Zt=O[14],je=O[15];w=A[0],B+=w*Ce,z+=w*be,H+=w*Qt,K+=w*Re,F+=w*$e,x+=w*Yt,P+=w*Me,$+=w*Ne,D+=w*Jt,_+=w*De,N+=w*Le,L+=w*Xt,R+=w*Be,E+=w*Fe,M+=w*Zt,j+=w*je,w=A[1],z+=w*Ce,H+=w*be,K+=w*Qt,F+=w*Re,x+=w*$e,P+=w*Yt,$+=w*Me,D+=w*Ne,_+=w*Jt,N+=w*De,L+=w*Le,R+=w*Xt,E+=w*Be,M+=w*Fe,j+=w*Zt,T+=w*je,w=A[2],H+=w*Ce,K+=w*be,F+=w*Qt,x+=w*Re,P+=w*$e,$+=w*Yt,D+=w*Me,_+=w*Ne,N+=w*Jt,L+=w*De,R+=w*Le,E+=w*Xt,M+=w*Be,j+=w*Fe,T+=w*Zt,U+=w*je,w=A[3],K+=w*Ce,F+=w*be,x+=w*Qt,P+=w*Re,$+=w*$e,D+=w*Yt,_+=w*Me,N+=w*Ne,L+=w*Jt,R+=w*De,E+=w*Le,M+=w*Xt,j+=w*Be,T+=w*Fe,U+=w*Zt,W+=w*je,w=A[4],F+=w*Ce,x+=w*be,P+=w*Qt,$+=w*Re,D+=w*$e,_+=w*Yt,N+=w*Me,L+=w*Ne,R+=w*Jt,E+=w*De,M+=w*Le,j+=w*Xt,T+=w*Be,U+=w*Fe,W+=w*Zt,V+=w*je,w=A[5],x+=w*Ce,P+=w*be,$+=w*Qt,D+=w*Re,_+=w*$e,N+=w*Yt,L+=w*Me,R+=w*Ne,E+=w*Jt,M+=w*De,j+=w*Le,T+=w*Xt,U+=w*Be,W+=w*Fe,V+=w*Zt,G+=w*je,w=A[6],P+=w*Ce,$+=w*be,D+=w*Qt,_+=w*Re,N+=w*$e,L+=w*Yt,R+=w*Me,E+=w*Ne,M+=w*Jt,j+=w*De,T+=w*Le,U+=w*Xt,W+=w*Be,V+=w*Fe,G+=w*Zt,J+=w*je,w=A[7],$+=w*Ce,D+=w*be,_+=w*Qt,N+=w*Re,L+=w*$e,R+=w*Yt,E+=w*Me,M+=w*Ne,j+=w*Jt,T+=w*De,U+=w*Le,W+=w*Xt,V+=w*Be,G+=w*Fe,J+=w*Zt,Y+=w*je,w=A[8],D+=w*Ce,_+=w*be,N+=w*Qt,L+=w*Re,R+=w*$e,E+=w*Yt,M+=w*Me,j+=w*Ne,T+=w*Jt,U+=w*De,W+=w*Le,V+=w*Xt,G+=w*Be,J+=w*Fe,Y+=w*Zt,X+=w*je,w=A[9],_+=w*Ce,N+=w*be,L+=w*Qt,R+=w*Re,E+=w*$e,M+=w*Yt,j+=w*Me,T+=w*Ne,U+=w*Jt,W+=w*De,V+=w*Le,G+=w*Xt,J+=w*Be,Y+=w*Fe,X+=w*Zt,ae+=w*je,w=A[10],N+=w*Ce,L+=w*be,R+=w*Qt,E+=w*Re,M+=w*$e,j+=w*Yt,T+=w*Me,U+=w*Ne,W+=w*Jt,V+=w*De,G+=w*Le,J+=w*Xt,Y+=w*Be,X+=w*Fe,ae+=w*Zt,oe+=w*je,w=A[11],L+=w*Ce,R+=w*be,E+=w*Qt,M+=w*Re,j+=w*$e,T+=w*Yt,U+=w*Me,W+=w*Ne,V+=w*Jt,G+=w*De,J+=w*Le,Y+=w*Xt,X+=w*Be,ae+=w*Fe,oe+=w*Zt,ue+=w*je,w=A[12],R+=w*Ce,E+=w*be,M+=w*Qt,j+=w*Re,T+=w*$e,U+=w*Yt,W+=w*Me,V+=w*Ne,G+=w*Jt,J+=w*De,Y+=w*Le,X+=w*Xt,ae+=w*Be,oe+=w*Fe,ue+=w*Zt,tt+=w*je,w=A[13],E+=w*Ce,M+=w*be,j+=w*Qt,T+=w*Re,U+=w*$e,W+=w*Yt,V+=w*Me,G+=w*Ne,J+=w*Jt,Y+=w*De,X+=w*Le,ae+=w*Xt,oe+=w*Be,ue+=w*Fe,tt+=w*Zt,Oe+=w*je,w=A[14],M+=w*Ce,j+=w*be,T+=w*Qt,U+=w*Re,W+=w*$e,V+=w*Yt,G+=w*Me,J+=w*Ne,Y+=w*Jt,X+=w*De,ae+=w*Le,oe+=w*Xt,ue+=w*Be,tt+=w*Fe,Oe+=w*Zt,Pe+=w*je,w=A[15],j+=w*Ce,T+=w*be,U+=w*Qt,W+=w*Re,V+=w*$e,G+=w*Yt,J+=w*Me,Y+=w*Ne,X+=w*Jt,ae+=w*De,oe+=w*Le,ue+=w*Xt,tt+=w*Be,Oe+=w*Fe,Pe+=w*Zt,ct+=w*je,B+=38*T,z+=38*U,H+=38*W,K+=38*V,F+=38*G,x+=38*J,P+=38*Y,$+=38*X,D+=38*ae,_+=38*oe,N+=38*ue,L+=38*tt,R+=38*Oe,E+=38*Pe,M+=38*ct,I=1,w=B+I+65535,I=Math.floor(w/65536),B=w-I*65536,w=z+I+65535,I=Math.floor(w/65536),z=w-I*65536,w=H+I+65535,I=Math.floor(w/65536),H=w-I*65536,w=K+I+65535,I=Math.floor(w/65536),K=w-I*65536,w=F+I+65535,I=Math.floor(w/65536),F=w-I*65536,w=x+I+65535,I=Math.floor(w/65536),x=w-I*65536,w=P+I+65535,I=Math.floor(w/65536),P=w-I*65536,w=$+I+65535,I=Math.floor(w/65536),$=w-I*65536,w=D+I+65535,I=Math.floor(w/65536),D=w-I*65536,w=_+I+65535,I=Math.floor(w/65536),_=w-I*65536,w=N+I+65535,I=Math.floor(w/65536),N=w-I*65536,w=L+I+65535,I=Math.floor(w/65536),L=w-I*65536,w=R+I+65535,I=Math.floor(w/65536),R=w-I*65536,w=E+I+65535,I=Math.floor(w/65536),E=w-I*65536,w=M+I+65535,I=Math.floor(w/65536),M=w-I*65536,w=j+I+65535,I=Math.floor(w/65536),j=w-I*65536,B+=I-1+37*(I-1),I=1,w=B+I+65535,I=Math.floor(w/65536),B=w-I*65536,w=z+I+65535,I=Math.floor(w/65536),z=w-I*65536,w=H+I+65535,I=Math.floor(w/65536),H=w-I*65536,w=K+I+65535,I=Math.floor(w/65536),K=w-I*65536,w=F+I+65535,I=Math.floor(w/65536),F=w-I*65536,w=x+I+65535,I=Math.floor(w/65536),x=w-I*65536,w=P+I+65535,I=Math.floor(w/65536),P=w-I*65536,w=$+I+65535,I=Math.floor(w/65536),$=w-I*65536,w=D+I+65535,I=Math.floor(w/65536),D=w-I*65536,w=_+I+65535,I=Math.floor(w/65536),_=w-I*65536,w=N+I+65535,I=Math.floor(w/65536),N=w-I*65536,w=L+I+65535,I=Math.floor(w/65536),L=w-I*65536,w=R+I+65535,I=Math.floor(w/65536),R=w-I*65536,w=E+I+65535,I=Math.floor(w/65536),E=w-I*65536,w=M+I+65535,I=Math.floor(w/65536),M=w-I*65536,w=j+I+65535,I=Math.floor(w/65536),j=w-I*65536,B+=I-1+37*(I-1),C[0]=B,C[1]=z,C[2]=H,C[3]=K,C[4]=F,C[5]=x,C[6]=P,C[7]=$,C[8]=D,C[9]=_,C[10]=N,C[11]=L,C[12]=R,C[13]=E,C[14]=M,C[15]=j}function h(C,A){d(C,A,A)}function p(C,A){const O=n();for(let w=0;w<16;w++)O[w]=A[w];for(let w=253;w>=0;w--)h(O,O),w!==2&&w!==4&&d(O,O,A);for(let w=0;w<16;w++)C[w]=O[w]}function v(C,A){const O=new Uint8Array(32),w=new Float64Array(80),I=n(),B=n(),z=n(),H=n(),K=n(),F=n();for(let D=0;D<31;D++)O[D]=C[D];O[31]=C[31]&127|64,O[0]&=248,l(w,A);for(let D=0;D<16;D++)B[D]=w[D];I[0]=H[0]=1;for(let D=254;D>=0;--D){const _=O[D>>>3]>>>(D&7)&1;a(I,B,_),a(z,H,_),u(K,I,z),f(I,I,z),u(z,B,H),f(B,B,H),h(H,K),h(F,I),d(I,z,I),d(z,B,K),u(K,I,z),f(I,I,z),h(B,I),f(z,H,F),d(I,z,s),u(I,I,H),d(z,z,I),d(I,H,F),d(H,B,w),h(B,K),a(I,B,_),a(z,H,_)}for(let D=0;D<16;D++)w[D+16]=I[D],w[D+32]=z[D],w[D+48]=B[D],w[D+64]=H[D];const x=w.subarray(32),P=w.subarray(16);p(x,x),d(P,P,x);const $=new Uint8Array(32);return c($,P),$}t.scalarMult=v;function m(C){return v(C,i)}t.scalarMultBase=m;function g(C){if(C.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const A=new Uint8Array(C);return{publicKey:m(A),secretKey:A}}t.generateKeyPairFromSeed=g;function y(C){const A=(0,e.randomBytes)(32,C),O=g(A);return(0,r.wipe)(A),O}t.generateKeyPair=y;function b(C,A,O=!1){if(C.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(A.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const w=v(C,A);if(O){let I=0;for(let B=0;Bi+s.length,0));const r=oW(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return kS(r)}function J2e(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,C=new Uint8Array(b);g!==y;){for(var A=p[g],O=0,w=b-1;(A!==0||O>>0,C[w]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");m=O,g++}for(var I=b-m;I!==b&&C[I]===0;)I++;for(var B=c.repeat(v);I>>0,b=new Uint8Array(y);p[v];){var C=r[p.charCodeAt(v)];if(C===255)return;for(var A=0,O=y-1;(C!==0||A>>0,b[O]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");g=A,v++}if(p[v]!==" "){for(var w=y-g;w!==y&&b[w]===0;)w++;for(var I=new Uint8Array(m+(y-w)),B=m;w!==y;)I[B++]=b[w++];return I}}}function h(p){var v=d(p);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:d,decode:h}}var X2e=J2e,Z2e=X2e;const ewe=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},twe=t=>new TextEncoder().encode(t),rwe=t=>new TextDecoder().decode(t);class nwe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class iwe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return aW(this,e)}}class swe{constructor(e){this.decoders=e}or(e){return aW(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const aW=(t,e)=>new swe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class owe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new nwe(e,r,n),this.decoder=new iwe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const w2=({name:t,prefix:e,encode:r,decode:n})=>new owe(t,e,r,n),kp=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Z2e(r,e);return w2({prefix:t,name:e,encode:n,decode:s=>ewe(i(s))})},awe=(t,e,r,n)=>{const i={};for(let u=0;u=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},cwe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<w2({prefix:e,name:t,encode(i){return cwe(i,n,r)},decode(i){return awe(i,n,r,t)}}),lwe=w2({prefix:"\0",name:"identity",encode:t=>rwe(t),decode:t=>twe(t)}),uwe=Object.freeze(Object.defineProperty({__proto__:null,identity:lwe},Symbol.toStringTag,{value:"Module"})),fwe=hn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),dwe=Object.freeze(Object.defineProperty({__proto__:null,base2:fwe},Symbol.toStringTag,{value:"Module"})),hwe=hn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),pwe=Object.freeze(Object.defineProperty({__proto__:null,base8:hwe},Symbol.toStringTag,{value:"Module"})),vwe=kp({prefix:"9",name:"base10",alphabet:"0123456789"}),mwe=Object.freeze(Object.defineProperty({__proto__:null,base10:vwe},Symbol.toStringTag,{value:"Module"})),ywe=hn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gwe=hn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),bwe=Object.freeze(Object.defineProperty({__proto__:null,base16:ywe,base16upper:gwe},Symbol.toStringTag,{value:"Module"})),wwe=hn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xwe=hn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ewe=hn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cwe=hn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Swe=hn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kwe=hn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Awe=hn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_we=hn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Pwe=hn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Twe=Object.freeze(Object.defineProperty({__proto__:null,base32:wwe,base32hex:Swe,base32hexpad:Awe,base32hexpadupper:_we,base32hexupper:kwe,base32pad:Ewe,base32padupper:Cwe,base32upper:xwe,base32z:Pwe},Symbol.toStringTag,{value:"Module"})),Iwe=kp({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Owe=kp({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Rwe=Object.freeze(Object.defineProperty({__proto__:null,base36:Iwe,base36upper:Owe},Symbol.toStringTag,{value:"Module"})),$we=kp({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Mwe=kp({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Nwe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:$we,base58flickr:Mwe},Symbol.toStringTag,{value:"Module"})),Dwe=hn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Lwe=hn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Bwe=hn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fwe=hn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),jwe=Object.freeze(Object.defineProperty({__proto__:null,base64:Dwe,base64pad:Lwe,base64url:Bwe,base64urlpad:Fwe},Symbol.toStringTag,{value:"Module"})),cW=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Uwe=cW.reduce((t,e,r)=>(t[r]=e,t),[]),zwe=cW.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Wwe(t){return t.reduce((e,r)=>(e+=Uwe[r],e),"")}function Hwe(t){const e=[];for(const r of t){const n=zwe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const qwe=w2({prefix:"🚀",name:"base256emoji",encode:Wwe,decode:Hwe}),Vwe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:qwe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const NP={...uwe,...dwe,...pwe,...mwe,...bwe,...Twe,...Rwe,...Nwe,...jwe,...Vwe};function lW(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const DP=lW("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Px=lW("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=oW(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Jwe:typeof navigator<"u"?jP(navigator.userAgent):ixe()}function rxe(t){return t!==""&&exe.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function jP(t){var e=rxe(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Ywe;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length"u")return!0;const r=e.prototype;return!(!IP(r)||!r.hasOwnProperty("isPrototypeOf"))}function IP(t){return Object.prototype.toString.call(t)==="[object Object]"}function qbe(t,e,r){return Wbe(t)?typeof e=="function"?{...r,queryKey:t,queryFn:e}:{...e,queryKey:t}:t}function Vbe(t){return JSON.stringify(t,(e,r)=>Hbe(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):typeof r=="bigint"?r.toString():r)}function Gbe(t,e){return typeof t=="function"?t(...e):!!t}function Kbe(t,e){const r={};return Object.keys(t).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(e.trackedProps.add(n),t[n])})}),r}function Qbe(t,e){const r=Gb({context:t.context}),n=TU(),i=IU(),s=r.defaultQueryOptions({...t,queryKeyHashFn:Vbe});s._optimisticResults=n?"isRestoring":"optimistic",s.onError&&(s.onError=wt.batchCalls(s.onError)),s.onSuccess&&(s.onSuccess=wt.batchCalls(s.onSuccess)),s.onSettled&&(s.onSettled=wt.batchCalls(s.onSettled)),s.suspense&&typeof s.staleTime!="number"&&(s.staleTime=1e3),(s.suspense||s.useErrorBoundary)&&(i.isReset()||(s.retryOnMount=!1));const[o]=k.useState(()=>new e(r,s)),a=o.getOptimisticResult(s);if(zbe(k.useCallback(f=>n?()=>{}:o.subscribe(wt.batchCalls(f)),[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),k.useEffect(()=>{i.clearReset()},[i]),k.useEffect(()=>{o.setOptions(s,{listeners:!1})},[s,o]),s.suspense&&a.isLoading&&a.isFetching&&!n)throw o.fetchOptimistic(s).then(({data:f})=>{var d,h;(d=s.onSuccess)==null||d.call(s,f),(h=s.onSettled)==null||h.call(s,f,null)}).catch(f=>{var d,h;i.clearReset(),(d=s.onError)==null||d.call(s,f),(h=s.onSettled)==null||h.call(s,void 0,f)});if(a.isError&&!i.isReset()&&!a.isFetching&&Gbe(s.useErrorBoundary,[a.error,o.getCurrentQuery()]))throw a.error;const c=a.status==="loading"&&a.fetchStatus==="idle"?"idle":a.status,l=c==="idle",u=c==="loading"&&a.fetchStatus==="fetching";return{...a,defaultedOptions:s,isIdle:l,isLoading:u,observer:o,status:c}}function bS(t,e,r){const n=pU(t,e,r);return Tve({context:f2,...n})}function Ybe(t,e,r){const n=qbe(t,e,r),i=Qbe({context:f2,...n},B4),s={data:i.data,error:i.error,fetchStatus:i.fetchStatus,isError:i.isError,isFetched:i.isFetched,isFetchedAfterMount:i.isFetchedAfterMount,isFetching:i.isFetching,isIdle:i.isIdle,isLoading:i.isLoading,isRefetching:i.isRefetching,isSuccess:i.isSuccess,refetch:i.refetch,status:i.status,internal:{dataUpdatedAt:i.dataUpdatedAt,errorUpdatedAt:i.errorUpdatedAt,failureCount:i.failureCount,isFetchedAfterMount:i.isFetchedAfterMount,isLoadingError:i.isLoadingError,isPaused:i.isPaused,isPlaceholderData:i.isPlaceholderData,isPreviousData:i.isPreviousData,isRefetchError:i.isRefetchError,isStale:i.isStale,remove:i.remove}};return i.defaultedOptions.notifyOnChangeProps?s:Kbe(s,i.observer)}var Jbe=()=>Gb({context:f2});function Hz({chainId:t}={}){return zz.useSyncExternalStoreWithSelector(e=>Abe({chainId:t},e),()=>W3({chainId:t}),()=>W3({chainId:t}),e=>e,(e,r)=>e.uid===r.uid)}function Ax({chainId:t}){return[{entity:"walletClient",chainId:t,persist:!1}]}function Xbe({queryKey:[{chainId:t}]}){return Lz({chainId:t})}function wS({chainId:t,suspense:e,onError:r,onSettled:n,onSuccess:i}={}){const{connector:s}=fn(),o=h2({chainId:t}),a=Ybe(Ax({chainId:o}),Xbe,{cacheTime:0,enabled:!!s,staleTime:1/0,suspense:e,onError:r,onSettled:n,onSuccess:i}),c=Jbe();return k.useEffect(()=>_be({chainId:o},u=>{u?c.invalidateQueries(Ax({chainId:o})):c.removeQueries(Ax({chainId:o}))}),[c,o]),a}function h2({chainId:t}={}){return Hz({chainId:t}).chain.id}function Zbe(){const[,t]=k.useReducer(e=>e+1,0);return t}var _x=t=>typeof t=="object"&&!Array.isArray(t);function qz(t,e,r=e,n=F3){const i=k.useRef([]),s=zz.useSyncExternalStoreWithSelector(t,e,r,o=>o,(o,a)=>{if(_x(o)&&_x(a)&&i.current.length){for(const c of i.current)if(!n(o[c],a[c]))return!1;return!0}return n(o,a)});if(_x(s)){const o={...s};return Object.defineProperties(o,Object.entries(o).reduce((a,[c,l])=>({...a,[c]:{configurable:!1,enumerable:!0,get:()=>(i.current.includes(c)||i.current.push(c),l)}}),{})),o}return s}function fn({onConnect:t,onDisconnect:e}={}){const r=d2(),n=k.useCallback(a=>Tbe(a),[r]),i=qz(n,Bz),s=k.useRef(),o=s.current;return k.useEffect(()=>{(o==null?void 0:o.status)!=="connected"&&i.status==="connected"&&(t==null||t({address:i.address,connector:i.connector,isReconnected:(o==null?void 0:o.status)==="reconnecting"||(o==null?void 0:o.status)===void 0})),(o==null?void 0:o.status)==="connected"&&i.status==="disconnected"&&(e==null||e()),s.current=i},[t,e,o,i]),i}var e2e=t=>[{entity:"connect",...t}],t2e=t=>{const{connector:e,chainId:r}=t;if(!e)throw new Error("connector is required");return Sbe({connector:e,chainId:r})};function Vz({chainId:t,connector:e,onError:r,onMutate:n,onSettled:i,onSuccess:s}={}){const o=d2(),{data:a,error:c,isError:l,isIdle:u,isLoading:f,isSuccess:d,mutate:h,mutateAsync:p,reset:v,status:m,variables:g}=bS(e2e({connector:e,chainId:t}),t2e,{onError:r,onMutate:n,onSettled:i,onSuccess:s}),y=k.useCallback(C=>h({chainId:(C==null?void 0:C.chainId)??t,connector:(C==null?void 0:C.connector)??e}),[t,e,h]),b=k.useCallback(C=>p({chainId:(C==null?void 0:C.chainId)??t,connector:(C==null?void 0:C.connector)??e}),[t,e,p]);return{connect:y,connectAsync:b,connectors:o.connectors,data:a,error:c,isError:l,isIdle:u,isLoading:f,isSuccess:d,pendingConnector:g==null?void 0:g.connector,reset:v,status:m,variables:g}}var r2e=[{entity:"disconnect"}],n2e=()=>kbe();function Gz({onError:t,onMutate:e,onSettled:r,onSuccess:n}={}){const{error:i,isError:s,isIdle:o,isLoading:a,isSuccess:c,mutate:l,mutateAsync:u,reset:f,status:d}=bS(r2e,n2e,{...t?{onError(h,p,v){t(h,v)}}:{},onMutate:e,...r?{onSettled(h,p,v,m){r(p,m)}}:{},...n?{onSuccess(h,p,v){n(v)}}:{}});return{disconnect:l,disconnectAsync:u,error:i,isError:s,isIdle:o,isLoading:a,isSuccess:c,reset:f,status:d}}function dn(){const t=d2(),e=k.useCallback(r=>Ibe(r),[t]);return qz(e,Fz)}var i2e=t=>[{entity:"switchNetwork",...t}],s2e=t=>{const{chainId:e}=t;if(!e)throw new Error("chainId is required");return Pbe({chainId:e})};function xS({chainId:t,throwForSwitchChainNotSupported:e,onError:r,onMutate:n,onSettled:i,onSuccess:s}={}){var I;const o=d2(),a=Zbe(),{data:c,error:l,isError:u,isIdle:f,isLoading:d,isSuccess:h,mutate:p,mutateAsync:v,reset:m,status:g,variables:y}=bS(i2e({chainId:t}),s2e,{onError:r,onMutate:n,onSettled:i,onSuccess:s}),b=k.useCallback(B=>p({chainId:B??t}),[t,p]),C=k.useCallback(B=>v({chainId:B??t}),[t,v]);k.useEffect(()=>o.subscribe(({chains:z,connector:H})=>({chains:z,connector:H}),a),[o,a]);let A,O;const w=!!((I=o.connector)!=null&&I.switchChain);return(e||w)&&(A=b,O=C),{chains:o.chains??[],data:c,error:l,isError:u,isIdle:f,isLoading:d,isSuccess:h,pendingChainId:y==null?void 0:y.chainId,reset:m,status:g,switchNetwork:A,switchNetworkAsync:O,variables:y}}var zh,Xu,o2e=class extends vp{constructor({chains:t,options:e}){super({chains:t,options:{reloadOnDisconnect:!1,...e}}),Ke(this,"id","coinbaseWallet"),Ke(this,"name","Coinbase Wallet"),Ke(this,"ready",!0),Br(this,zh,void 0),Br(this,Xu,void 0),Ke(this,"onAccountsChanged",r=>{r.length===0?this.emit("disconnect"):this.emit("change",{account:jn(r[0])})}),Ke(this,"onChainChanged",r=>{const n=Ul(r),i=this.isChainUnsupported(n);this.emit("change",{chain:{id:n,unsupported:i}})}),Ke(this,"onDisconnect",()=>{this.emit("disconnect")})}async connect({chainId:t}={}){try{const e=await this.getProvider();e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const r=await e.enable(),n=jn(r[0]);let i=await this.getChainId(),s=this.isChainUnsupported(i);return t&&i!==t&&(i=(await this.switchChain(t)).id,s=this.isChainUnsupported(i)),{account:n,chain:{id:i,unsupported:s}}}catch(e){throw/(user closed modal|accounts received is empty)/i.test(e.message)?new Or(e):e}}async disconnect(){if(!He(this,Xu))return;const t=await this.getProvider();t.removeListener("accountsChanged",this.onAccountsChanged),t.removeListener("chainChanged",this.onChainChanged),t.removeListener("disconnect",this.onDisconnect),t.disconnect(),t.close()}async getAccount(){const e=await(await this.getProvider()).request({method:"eth_accounts"});return jn(e[0])}async getChainId(){const t=await this.getProvider();return Ul(t.chainId)}async getProvider(){var t;if(!He(this,Xu)){let e=(await cS(()=>import("./index-d66c3ebc.js").then(o=>o.i),["./index-d66c3ebc.js","./events-fe40c1a3.js","./index-cc134824.js"],import.meta.url)).default;typeof e!="function"&&typeof e.default=="function"&&(e=e.default),Es(this,zh,new e(this.options));const r=(t=He(this,zh).walletExtension)==null?void 0:t.getChainId(),n=this.chains.find(o=>this.options.chainId?o.id===this.options.chainId:o.id===r)||this.chains[0],i=this.options.chainId||(n==null?void 0:n.id),s=this.options.jsonRpcUrl||(n==null?void 0:n.rpcUrls.default.http[0]);Es(this,Xu,He(this,zh).makeWeb3Provider(s,i))}return He(this,Xu)}async getWalletClient({chainId:t}={}){const[e,r]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(i=>i.id===t);if(!e)throw new Error("provider is required.");return Cp({account:r,chain:n,transport:c2(e)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}async switchChain(t){var n;const e=await this.getProvider(),r=ze(t);try{return await e.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]}),this.chains.find(i=>i.id===t)??{id:t,name:`Chain ${r}`,network:`${r}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(i){const s=this.chains.find(o=>o.id===t);if(!s)throw new GU({chainId:t,connectorId:this.id});if(i.code===4902)try{return await e.request({method:"wallet_addEthereumChain",params:[{chainId:r,chainName:s.name,nativeCurrency:s.nativeCurrency,rpcUrls:[((n=s.rpcUrls.public)==null?void 0:n.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(s)}]}),s}catch(o){throw new Or(o)}throw new aa(i)}}async watchAsset({address:t,decimals:e=18,image:r,symbol:n}){return(await this.getProvider()).request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:t,decimals:e,image:r,symbol:n}}})}};zh=new WeakMap;Xu=new WeakMap;var gm,a2e=class extends $z{constructor({chains:t,options:e}={}){const r={name:"MetaMask",shimDisconnect:!0,getProvider(){function n(s){if(s!=null&&s.isMetaMask&&!(s.isBraveWallet&&!s._events&&!s._state)&&!s.isApexWallet&&!s.isAvalanche&&!s.isBitKeep&&!s.isBlockWallet&&!s.isMathWallet&&!(s.isOkxWallet||s.isOKExWallet)&&!(s.isOneInchIOSWallet||s.isOneInchAndroidWallet)&&!s.isOpera&&!s.isPortal&&!s.isRabby&&!s.isDefiant&&!s.isTokenPocket&&!s.isTokenary&&!s.isZerion)return s}if(typeof window>"u")return;const i=window.ethereum;return i!=null&&i.providers?i.providers.find(n):n(i)},...e};super({chains:t,options:r}),Ke(this,"id","metaMask"),Ke(this,"shimDisconnectKey",`${this.id}.shimDisconnect`),Br(this,gm,void 0),Es(this,gm,r.UNSTABLE_shimOnConnectSelectAccount)}async connect({chainId:t}={}){var e,r,n,i;try{const s=await this.getProvider();if(!s)throw new qa;s.on&&(s.on("accountsChanged",this.onAccountsChanged),s.on("chainChanged",this.onChainChanged),s.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});let o=null;if(He(this,gm)&&((e=this.options)!=null&&e.shimDisconnect)&&!((r=this.storage)!=null&&r.getItem(this.shimDisconnectKey))&&(o=await this.getAccount().catch(()=>null),!!o))try{await s.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),o=await this.getAccount()}catch(u){if(this.isUserRejectedRequestError(u))throw new Or(u);if(u.code===new Oc(u).code)throw u}if(!o){const l=await s.request({method:"eth_requestAccounts"});o=jn(l[0])}let a=await this.getChainId(),c=this.isChainUnsupported(a);return t&&a!==t&&(a=(await this.switchChain(t)).id,c=this.isChainUnsupported(a)),(n=this.options)!=null&&n.shimDisconnect&&((i=this.storage)==null||i.setItem(this.shimDisconnectKey,!0)),{account:o,chain:{id:a,unsupported:c},provider:s}}catch(s){throw this.isUserRejectedRequestError(s)?new Or(s):s.code===-32002?new Oc(s):s}}};gm=new WeakMap;var yl,Hs,c2e=class{constructor(t){Ke(this,"events",new MU),Ke(this,"chainId"),Br(this,yl,void 0),Br(this,Hs,void 0),this.chainId=t.chainId,Es(this,yl,t)}async enable(){var e;if((e=He(this,yl).flags)!=null&&e.failConnect)throw new Or(new Error("Failed to connect."));He(this,Hs)||Es(this,Hs,He(this,yl).walletClient);const t=He(this,Hs).account.address;return this.events.emit("accountsChanged",[t]),[t]}async disconnect(){this.events.emit("disconnect"),Es(this,Hs,void 0)}async getAccounts(){var e;const t=(e=He(this,Hs))==null?void 0:e.account.address;return t?[jn(t)]:[]}getWalletClient(){const t=He(this,Hs);if(!t)throw new Error("walletClient not found");return t}async switchChain(t){var e;if((e=He(this,yl).flags)!=null&&e.failSwitchChain)throw new Or(new Error("Failed to switch chain."));He(this,yl).chainId=t,this.chainId=t,this.events.emit("chainChanged",t)}async switchWalletClient(t){const e=t.account.address;Es(this,Hs,t),this.events.emit("accountsChanged",[e])}async watchAsset(t){return!0}async request({method:t,params:e}){var r;return(r=He(this,Hs))==null?void 0:r.transport.request({method:t,params:e})}on(t,e){return this.events.on(t,e),this}removeListener(t,e){return this.events.removeListener(t,e),this}toJSON(){return""}};yl=new WeakMap;Hs=new WeakMap;var Wh,H3,Kz,l2e=class extends vp{constructor({chains:t,options:e}){var r;super({chains:t,options:{...e,chainId:e.chainId??((r=t==null?void 0:t[0])==null?void 0:r.id)}}),Br(this,H3),Ke(this,"id","mock"),Ke(this,"name","Mock"),Ke(this,"ready",!0),Br(this,Wh,void 0),Ke(this,"onAccountsChanged",n=>{n.length===0?this.emit("disconnect"):this.emit("change",{account:jn(n[0])})}),Ke(this,"onChainChanged",n=>{const i=Ul(n),s=this.isChainUnsupported(i);this.emit("change",{chain:{id:i,unsupported:s}})}),Ke(this,"onDisconnect",()=>{this.emit("disconnect")})}async connect({chainId:t}={}){var a;const e=await this.getProvider({chainId:t});e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const r=await e.enable(),n=jn(r[0]),i=Ul(e.chainId),s=this.isChainUnsupported(i),o={account:n,chain:{id:i,unsupported:s},provider:e};return(a=this.options.flags)!=null&&a.noSwitchChain||(this.switchChain=Lr(this,H3,Kz)),new Promise(c=>setTimeout(()=>c(o),100))}async disconnect(){const t=await this.getProvider();await t.disconnect(),t.removeListener("accountsChanged",this.onAccountsChanged),t.removeListener("chainChanged",this.onChainChanged),t.removeListener("disconnect",this.onDisconnect)}async getAccount(){const r=(await(await this.getProvider()).getAccounts())[0];if(!r)throw new Error("Failed to get account");return jn(r)}async getChainId(){const t=await this.getProvider();return Ul(t.chainId)}async getProvider({chainId:t}={}){return(!He(this,Wh)||t)&&Es(this,Wh,new c2e({...this.options,chainId:t??this.options.chainId??this.chains[0].id})),He(this,Wh)}async getWalletClient(){return(await this.getProvider()).getWalletClient()}async isAuthorized(){var t;try{const r=await(await this.getProvider()).getAccounts();return((t=this.options.flags)==null?void 0:t.isAuthorized)??!!r}catch{return!1}}async watchAsset(t){return(await this.getProvider()).watchAsset(t)}toJSON(){return""}};Wh=new WeakMap;H3=new WeakSet;Kz=async function(t){return await(await this.getProvider()).switchChain(t),this.chains.find(r=>r.id===t)??{id:t,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}};var ES={},p2={},We={},Qz={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,c){var l=a>>>16&65535,u=a&65535,f=c>>>16&65535,d=c&65535;return u*d+(l*d+u*f<<16>>>0)|0}t.mul=Math.imul||e;function r(a,c){return a+c|0}t.add=r;function n(a,c){return a-c|0}t.sub=n;function i(a,c){return a<>>32-c}t.rotl=i;function s(a,c){return a<<32-c|a>>>c}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Qz);Object.defineProperty(We,"__esModule",{value:!0});var Yz=Qz;function u2e(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}We.readInt16BE=u2e;function f2e(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}We.readUint16BE=f2e;function d2e(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}We.readInt16LE=d2e;function h2e(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}We.readUint16LE=h2e;function Jz(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}We.writeUint16BE=Jz;We.writeInt16BE=Jz;function Xz(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}We.writeUint16LE=Xz;We.writeInt16LE=Xz;function q3(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}We.readInt32BE=q3;function V3(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}We.readUint32BE=V3;function G3(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}We.readInt32LE=G3;function K3(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}We.readUint32LE=K3;function ng(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}We.writeUint32BE=ng;We.writeInt32BE=ng;function ig(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}We.writeUint32LE=ig;We.writeInt32LE=ig;function p2e(t,e){e===void 0&&(e=0);var r=q3(t,e),n=q3(t,e+4);return r*4294967296+n-(n>>31)*4294967296}We.readInt64BE=p2e;function v2e(t,e){e===void 0&&(e=0);var r=V3(t,e),n=V3(t,e+4);return r*4294967296+n}We.readUint64BE=v2e;function m2e(t,e){e===void 0&&(e=0);var r=G3(t,e),n=G3(t,e+4);return n*4294967296+r-(r>>31)*4294967296}We.readInt64LE=m2e;function y2e(t,e){e===void 0&&(e=0);var r=K3(t,e),n=K3(t,e+4);return n*4294967296+r}We.readUint64LE=y2e;function Zz(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ng(t/4294967296>>>0,e,r),ng(t>>>0,e,r+4),e}We.writeUint64BE=Zz;We.writeInt64BE=Zz;function eW(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ig(t>>>0,e,r),ig(t/4294967296>>>0,e,r+4),e}We.writeUint64LE=eW;We.writeInt64LE=eW;function g2e(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}We.readUintBE=g2e;function b2e(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}We.writeUintBE=w2e;function x2e(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Yz.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s>>32-16|P<<16,H=H+P|0,w^=H,w=w>>>32-12|w<<12,C=C+I|0,$^=C,$=$>>>32-16|$<<16,K=K+$|0,I^=K,I=I>>>32-12|I<<12,A=A+B|0,D^=A,D=D>>>32-16|D<<16,F=F+D|0,B^=F,B=B>>>32-12|B<<12,O=O+z|0,_^=O,_=_>>>32-16|_<<16,x=x+_|0,z^=x,z=z>>>32-12|z<<12,A=A+B|0,D^=A,D=D>>>32-8|D<<8,F=F+D|0,B^=F,B=B>>>32-7|B<<7,O=O+z|0,_^=O,_=_>>>32-8|_<<8,x=x+_|0,z^=x,z=z>>>32-7|z<<7,C=C+I|0,$^=C,$=$>>>32-8|$<<8,K=K+$|0,I^=K,I=I>>>32-7|I<<7,b=b+w|0,P^=b,P=P>>>32-8|P<<8,H=H+P|0,w^=H,w=w>>>32-7|w<<7,b=b+I|0,_^=b,_=_>>>32-16|_<<16,F=F+_|0,I^=F,I=I>>>32-12|I<<12,C=C+B|0,P^=C,P=P>>>32-16|P<<16,x=x+P|0,B^=x,B=B>>>32-12|B<<12,A=A+z|0,$^=A,$=$>>>32-16|$<<16,H=H+$|0,z^=H,z=z>>>32-12|z<<12,O=O+w|0,D^=O,D=D>>>32-16|D<<16,K=K+D|0,w^=K,w=w>>>32-12|w<<12,A=A+z|0,$^=A,$=$>>>32-8|$<<8,H=H+$|0,z^=H,z=z>>>32-7|z<<7,O=O+w|0,D^=O,D=D>>>32-8|D<<8,K=K+D|0,w^=K,w=w>>>32-7|w<<7,C=C+B|0,P^=C,P=P>>>32-8|P<<8,x=x+P|0,B^=x,B=B>>>32-7|B<<7,b=b+I|0,_^=b,_=_>>>32-8|_<<8,F=F+_|0,I^=F,I=I>>>32-7|I<<7;yn.writeUint32LE(b+n|0,t,0),yn.writeUint32LE(C+i|0,t,4),yn.writeUint32LE(A+s|0,t,8),yn.writeUint32LE(O+o|0,t,12),yn.writeUint32LE(w+a|0,t,16),yn.writeUint32LE(I+c|0,t,20),yn.writeUint32LE(B+l|0,t,24),yn.writeUint32LE(z+u|0,t,28),yn.writeUint32LE(H+f|0,t,32),yn.writeUint32LE(K+d|0,t,36),yn.writeUint32LE(F+h|0,t,40),yn.writeUint32LE(x+p|0,t,44),yn.writeUint32LE(P+v|0,t,48),yn.writeUint32LE($+m|0,t,52),yn.writeUint32LE(D+g|0,t,56),yn.writeUint32LE(_+y|0,t,60)}function tW(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var rW={},Qc={};Object.defineProperty(Qc,"__esModule",{value:!0});function N2e(t,e,r){return~(t-1)&e|t-1&r}Qc.select=N2e;function D2e(t,e){return(t|0)-(e|0)-1>>>31&1}Qc.lessOrEqual=D2e;function nW(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Qc.compare=nW;function L2e(t,e){return t.length===0||e.length===0?!1:nW(t,e)!==0}Qc.equal=L2e;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Qc,r=Ms;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=a[0]|a[1]<<8;this._r[0]=c&8191;var l=a[2]|a[3]<<8;this._r[1]=(c>>>13|l<<3)&8191;var u=a[4]|a[5]<<8;this._r[2]=(l>>>10|u<<6)&7939;var f=a[6]|a[7]<<8;this._r[3]=(u>>>7|f<<9)&8191;var d=a[8]|a[9]<<8;this._r[4]=(f>>>4|d<<12)&255,this._r[5]=d>>>1&8190;var h=a[10]|a[11]<<8;this._r[6]=(d>>>14|h<<2)&8191;var p=a[12]|a[13]<<8;this._r[7]=(h>>>11|p<<5)&8065;var v=a[14]|a[15]<<8;this._r[8]=(p>>>8|v<<8)&8191,this._r[9]=v>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,c,l){for(var u=this._fin?0:2048,f=this._h[0],d=this._h[1],h=this._h[2],p=this._h[3],v=this._h[4],m=this._h[5],g=this._h[6],y=this._h[7],b=this._h[8],C=this._h[9],A=this._r[0],O=this._r[1],w=this._r[2],I=this._r[3],B=this._r[4],z=this._r[5],H=this._r[6],K=this._r[7],F=this._r[8],x=this._r[9];l>=16;){var P=a[c+0]|a[c+1]<<8;f+=P&8191;var $=a[c+2]|a[c+3]<<8;d+=(P>>>13|$<<3)&8191;var D=a[c+4]|a[c+5]<<8;h+=($>>>10|D<<6)&8191;var _=a[c+6]|a[c+7]<<8;p+=(D>>>7|_<<9)&8191;var N=a[c+8]|a[c+9]<<8;v+=(_>>>4|N<<12)&8191,m+=N>>>1&8191;var L=a[c+10]|a[c+11]<<8;g+=(N>>>14|L<<2)&8191;var R=a[c+12]|a[c+13]<<8;y+=(L>>>11|R<<5)&8191;var E=a[c+14]|a[c+15]<<8;b+=(R>>>8|E<<8)&8191,C+=E>>>5|u;var M=0,j=M;j+=f*A,j+=d*(5*x),j+=h*(5*F),j+=p*(5*K),j+=v*(5*H),M=j>>>13,j&=8191,j+=m*(5*z),j+=g*(5*B),j+=y*(5*I),j+=b*(5*w),j+=C*(5*O),M+=j>>>13,j&=8191;var T=M;T+=f*O,T+=d*A,T+=h*(5*x),T+=p*(5*F),T+=v*(5*K),M=T>>>13,T&=8191,T+=m*(5*H),T+=g*(5*z),T+=y*(5*B),T+=b*(5*I),T+=C*(5*w),M+=T>>>13,T&=8191;var U=M;U+=f*w,U+=d*O,U+=h*A,U+=p*(5*x),U+=v*(5*F),M=U>>>13,U&=8191,U+=m*(5*K),U+=g*(5*H),U+=y*(5*z),U+=b*(5*B),U+=C*(5*I),M+=U>>>13,U&=8191;var W=M;W+=f*I,W+=d*w,W+=h*O,W+=p*A,W+=v*(5*x),M=W>>>13,W&=8191,W+=m*(5*F),W+=g*(5*K),W+=y*(5*H),W+=b*(5*z),W+=C*(5*B),M+=W>>>13,W&=8191;var V=M;V+=f*B,V+=d*I,V+=h*w,V+=p*O,V+=v*A,M=V>>>13,V&=8191,V+=m*(5*x),V+=g*(5*F),V+=y*(5*K),V+=b*(5*H),V+=C*(5*z),M+=V>>>13,V&=8191;var G=M;G+=f*z,G+=d*B,G+=h*I,G+=p*w,G+=v*O,M=G>>>13,G&=8191,G+=m*A,G+=g*(5*x),G+=y*(5*F),G+=b*(5*K),G+=C*(5*H),M+=G>>>13,G&=8191;var J=M;J+=f*H,J+=d*z,J+=h*B,J+=p*I,J+=v*w,M=J>>>13,J&=8191,J+=m*O,J+=g*A,J+=y*(5*x),J+=b*(5*F),J+=C*(5*K),M+=J>>>13,J&=8191;var Y=M;Y+=f*K,Y+=d*H,Y+=h*z,Y+=p*B,Y+=v*I,M=Y>>>13,Y&=8191,Y+=m*w,Y+=g*O,Y+=y*A,Y+=b*(5*x),Y+=C*(5*F),M+=Y>>>13,Y&=8191;var X=M;X+=f*F,X+=d*K,X+=h*H,X+=p*z,X+=v*B,M=X>>>13,X&=8191,X+=m*I,X+=g*w,X+=y*O,X+=b*A,X+=C*(5*x),M+=X>>>13,X&=8191;var ae=M;ae+=f*x,ae+=d*F,ae+=h*K,ae+=p*H,ae+=v*z,M=ae>>>13,ae&=8191,ae+=m*B,ae+=g*I,ae+=y*w,ae+=b*O,ae+=C*A,M+=ae>>>13,ae&=8191,M=(M<<2)+M|0,M=M+j|0,j=M&8191,M=M>>>13,T+=M,f=j,d=T,h=U,p=W,v=V,m=G,g=J,y=Y,b=X,C=ae,c+=16,l-=16}this._h[0]=f,this._h[1]=d,this._h[2]=h,this._h[3]=p,this._h[4]=v,this._h[5]=m,this._h[6]=g,this._h[7]=y,this._h[8]=b,this._h[9]=C},o.prototype.finish=function(a,c){c===void 0&&(c=0);var l=new Uint16Array(10),u,f,d,h;if(this._leftover){for(h=this._leftover,this._buffer[h++]=1;h<16;h++)this._buffer[h]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(u=this._h[1]>>>13,this._h[1]&=8191,h=2;h<10;h++)this._h[h]+=u,u=this._h[h]>>>13,this._h[h]&=8191;for(this._h[0]+=u*5,u=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=u,u=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=u,l[0]=this._h[0]+5,u=l[0]>>>13,l[0]&=8191,h=1;h<10;h++)l[h]=this._h[h]+u,u=l[h]>>>13,l[h]&=8191;for(l[9]-=8192,f=(u^1)-1,h=0;h<10;h++)l[h]&=f;for(f=~f,h=0;h<10;h++)this._h[h]=this._h[h]&f|l[h];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,d=this._h[0]+this._pad[0],this._h[0]=d&65535,h=1;h<8;h++)d=(this._h[h]+this._pad[h]|0)+(d>>>16)|0,this._h[h]=d&65535;return a[c+0]=this._h[0]>>>0,a[c+1]=this._h[0]>>>8,a[c+2]=this._h[1]>>>0,a[c+3]=this._h[1]>>>8,a[c+4]=this._h[2]>>>0,a[c+5]=this._h[2]>>>8,a[c+6]=this._h[3]>>>0,a[c+7]=this._h[3]>>>8,a[c+8]=this._h[4]>>>0,a[c+9]=this._h[4]>>>8,a[c+10]=this._h[5]>>>0,a[c+11]=this._h[5]>>>8,a[c+12]=this._h[6]>>>0,a[c+13]=this._h[6]>>>8,a[c+14]=this._h[7]>>>0,a[c+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var c=0,l=a.length,u;if(this._leftover){u=16-this._leftover,u>l&&(u=l);for(var f=0;f=16&&(u=l-l%16,this._blocks(a,c,u),c+=u,l-=u),l){for(var f=0;f16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var h=new Uint8Array(16);h.set(l,h.length-l.length);var p=new Uint8Array(32);e.stream(this._key,h,p,4);var v=u.length+this.tagLength,m;if(d){if(d.length!==v)throw new Error("ChaCha20Poly1305: incorrect destination length");m=d}else m=new Uint8Array(v);return e.streamXOR(this._key,h,u,m,4),this._authenticate(m.subarray(m.length-this.tagLength,m.length),p,m.subarray(0,m.length-this.tagLength),f),n.wipe(h),m},c.prototype.open=function(l,u,f,d){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(u.length0&&h.update(o.subarray(d.length%16))),h.update(f),f.length%16>0&&h.update(o.subarray(f.length%16));var p=new Uint8Array(8);d&&i.writeUint64LE(d.length,p),h.update(p),i.writeUint64LE(f.length,p),h.update(p);for(var v=h.digest(),m=0;mthis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n256)throw new Error("randomString charset is too long");let d="";const h=u.length,p=256-256%h;for(;l>0;){const v=i(Math.ceil(l*256/p),f);for(let m=0;m0;m++){const g=v[m];g0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[u++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(u=s(this._temp,this._state,c,u,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[u++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,u=this._bufferLength,f=l/536870912|0,d=l<<3,h=l%64<56?64:128;this._buffer[u]=128;for(var p=u+1;p0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.state),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,c,l,u,f){for(;f>=64;){for(var d=c[0],h=c[1],p=c[2],v=c[3],m=c[4],g=c[5],y=c[6],b=c[7],C=0;C<16;C++){var A=u+C*4;a[C]=e.readUint32BE(l,A)}for(var C=16;C<64;C++){var O=a[C-2],w=(O>>>17|O<<32-17)^(O>>>19|O<<32-19)^O>>>10;O=a[C-15];var I=(O>>>7|O<<32-7)^(O>>>18|O<<32-18)^O>>>3;a[C]=(w+a[C-7]|0)+(I+a[C-16]|0)}for(var C=0;C<64;C++){var w=(((m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(m&g^~m&y)|0)+(b+(i[C]+a[C]|0)|0)|0,I=((d>>>2|d<<32-2)^(d>>>13|d<<32-13)^(d>>>22|d<<32-22))+(d&h^d&p^h&p)|0;b=y,y=g,g=m,m=v+w|0,v=p,p=h,h=d,d=w+I|0}c[0]+=d,c[1]+=h,c[2]+=p,c[3]+=v,c[4]+=m,c[5]+=g,c[6]+=y,c[7]+=b,u+=64,f-=64}return u}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(b2);var SS={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=v2,r=Ms;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(C){const A=new Float64Array(16);if(C)for(let O=0;O>16&1),O[z-1]&=65535;O[15]=w[15]-32767-(O[14]>>16&1);const B=O[15]>>16&1;O[14]&=65535,a(w,O,1-B)}for(let I=0;I<16;I++)C[2*I]=w[I]&255,C[2*I+1]=w[I]>>8}function l(C,A){for(let O=0;O<16;O++)C[O]=A[2*O]+(A[2*O+1]<<8);C[15]&=32767}function u(C,A,O){for(let w=0;w<16;w++)C[w]=A[w]+O[w]}function f(C,A,O){for(let w=0;w<16;w++)C[w]=A[w]-O[w]}function d(C,A,O){let w,I,B=0,z=0,H=0,K=0,F=0,x=0,P=0,$=0,D=0,_=0,N=0,L=0,R=0,E=0,M=0,j=0,T=0,U=0,W=0,V=0,G=0,J=0,Y=0,X=0,ae=0,oe=0,ue=0,tt=0,Oe=0,Pe=0,ct=0,Ce=O[0],be=O[1],Qt=O[2],Re=O[3],$e=O[4],Yt=O[5],Me=O[6],Ne=O[7],Jt=O[8],De=O[9],Le=O[10],Xt=O[11],Be=O[12],Fe=O[13],Zt=O[14],je=O[15];w=A[0],B+=w*Ce,z+=w*be,H+=w*Qt,K+=w*Re,F+=w*$e,x+=w*Yt,P+=w*Me,$+=w*Ne,D+=w*Jt,_+=w*De,N+=w*Le,L+=w*Xt,R+=w*Be,E+=w*Fe,M+=w*Zt,j+=w*je,w=A[1],z+=w*Ce,H+=w*be,K+=w*Qt,F+=w*Re,x+=w*$e,P+=w*Yt,$+=w*Me,D+=w*Ne,_+=w*Jt,N+=w*De,L+=w*Le,R+=w*Xt,E+=w*Be,M+=w*Fe,j+=w*Zt,T+=w*je,w=A[2],H+=w*Ce,K+=w*be,F+=w*Qt,x+=w*Re,P+=w*$e,$+=w*Yt,D+=w*Me,_+=w*Ne,N+=w*Jt,L+=w*De,R+=w*Le,E+=w*Xt,M+=w*Be,j+=w*Fe,T+=w*Zt,U+=w*je,w=A[3],K+=w*Ce,F+=w*be,x+=w*Qt,P+=w*Re,$+=w*$e,D+=w*Yt,_+=w*Me,N+=w*Ne,L+=w*Jt,R+=w*De,E+=w*Le,M+=w*Xt,j+=w*Be,T+=w*Fe,U+=w*Zt,W+=w*je,w=A[4],F+=w*Ce,x+=w*be,P+=w*Qt,$+=w*Re,D+=w*$e,_+=w*Yt,N+=w*Me,L+=w*Ne,R+=w*Jt,E+=w*De,M+=w*Le,j+=w*Xt,T+=w*Be,U+=w*Fe,W+=w*Zt,V+=w*je,w=A[5],x+=w*Ce,P+=w*be,$+=w*Qt,D+=w*Re,_+=w*$e,N+=w*Yt,L+=w*Me,R+=w*Ne,E+=w*Jt,M+=w*De,j+=w*Le,T+=w*Xt,U+=w*Be,W+=w*Fe,V+=w*Zt,G+=w*je,w=A[6],P+=w*Ce,$+=w*be,D+=w*Qt,_+=w*Re,N+=w*$e,L+=w*Yt,R+=w*Me,E+=w*Ne,M+=w*Jt,j+=w*De,T+=w*Le,U+=w*Xt,W+=w*Be,V+=w*Fe,G+=w*Zt,J+=w*je,w=A[7],$+=w*Ce,D+=w*be,_+=w*Qt,N+=w*Re,L+=w*$e,R+=w*Yt,E+=w*Me,M+=w*Ne,j+=w*Jt,T+=w*De,U+=w*Le,W+=w*Xt,V+=w*Be,G+=w*Fe,J+=w*Zt,Y+=w*je,w=A[8],D+=w*Ce,_+=w*be,N+=w*Qt,L+=w*Re,R+=w*$e,E+=w*Yt,M+=w*Me,j+=w*Ne,T+=w*Jt,U+=w*De,W+=w*Le,V+=w*Xt,G+=w*Be,J+=w*Fe,Y+=w*Zt,X+=w*je,w=A[9],_+=w*Ce,N+=w*be,L+=w*Qt,R+=w*Re,E+=w*$e,M+=w*Yt,j+=w*Me,T+=w*Ne,U+=w*Jt,W+=w*De,V+=w*Le,G+=w*Xt,J+=w*Be,Y+=w*Fe,X+=w*Zt,ae+=w*je,w=A[10],N+=w*Ce,L+=w*be,R+=w*Qt,E+=w*Re,M+=w*$e,j+=w*Yt,T+=w*Me,U+=w*Ne,W+=w*Jt,V+=w*De,G+=w*Le,J+=w*Xt,Y+=w*Be,X+=w*Fe,ae+=w*Zt,oe+=w*je,w=A[11],L+=w*Ce,R+=w*be,E+=w*Qt,M+=w*Re,j+=w*$e,T+=w*Yt,U+=w*Me,W+=w*Ne,V+=w*Jt,G+=w*De,J+=w*Le,Y+=w*Xt,X+=w*Be,ae+=w*Fe,oe+=w*Zt,ue+=w*je,w=A[12],R+=w*Ce,E+=w*be,M+=w*Qt,j+=w*Re,T+=w*$e,U+=w*Yt,W+=w*Me,V+=w*Ne,G+=w*Jt,J+=w*De,Y+=w*Le,X+=w*Xt,ae+=w*Be,oe+=w*Fe,ue+=w*Zt,tt+=w*je,w=A[13],E+=w*Ce,M+=w*be,j+=w*Qt,T+=w*Re,U+=w*$e,W+=w*Yt,V+=w*Me,G+=w*Ne,J+=w*Jt,Y+=w*De,X+=w*Le,ae+=w*Xt,oe+=w*Be,ue+=w*Fe,tt+=w*Zt,Oe+=w*je,w=A[14],M+=w*Ce,j+=w*be,T+=w*Qt,U+=w*Re,W+=w*$e,V+=w*Yt,G+=w*Me,J+=w*Ne,Y+=w*Jt,X+=w*De,ae+=w*Le,oe+=w*Xt,ue+=w*Be,tt+=w*Fe,Oe+=w*Zt,Pe+=w*je,w=A[15],j+=w*Ce,T+=w*be,U+=w*Qt,W+=w*Re,V+=w*$e,G+=w*Yt,J+=w*Me,Y+=w*Ne,X+=w*Jt,ae+=w*De,oe+=w*Le,ue+=w*Xt,tt+=w*Be,Oe+=w*Fe,Pe+=w*Zt,ct+=w*je,B+=38*T,z+=38*U,H+=38*W,K+=38*V,F+=38*G,x+=38*J,P+=38*Y,$+=38*X,D+=38*ae,_+=38*oe,N+=38*ue,L+=38*tt,R+=38*Oe,E+=38*Pe,M+=38*ct,I=1,w=B+I+65535,I=Math.floor(w/65536),B=w-I*65536,w=z+I+65535,I=Math.floor(w/65536),z=w-I*65536,w=H+I+65535,I=Math.floor(w/65536),H=w-I*65536,w=K+I+65535,I=Math.floor(w/65536),K=w-I*65536,w=F+I+65535,I=Math.floor(w/65536),F=w-I*65536,w=x+I+65535,I=Math.floor(w/65536),x=w-I*65536,w=P+I+65535,I=Math.floor(w/65536),P=w-I*65536,w=$+I+65535,I=Math.floor(w/65536),$=w-I*65536,w=D+I+65535,I=Math.floor(w/65536),D=w-I*65536,w=_+I+65535,I=Math.floor(w/65536),_=w-I*65536,w=N+I+65535,I=Math.floor(w/65536),N=w-I*65536,w=L+I+65535,I=Math.floor(w/65536),L=w-I*65536,w=R+I+65535,I=Math.floor(w/65536),R=w-I*65536,w=E+I+65535,I=Math.floor(w/65536),E=w-I*65536,w=M+I+65535,I=Math.floor(w/65536),M=w-I*65536,w=j+I+65535,I=Math.floor(w/65536),j=w-I*65536,B+=I-1+37*(I-1),I=1,w=B+I+65535,I=Math.floor(w/65536),B=w-I*65536,w=z+I+65535,I=Math.floor(w/65536),z=w-I*65536,w=H+I+65535,I=Math.floor(w/65536),H=w-I*65536,w=K+I+65535,I=Math.floor(w/65536),K=w-I*65536,w=F+I+65535,I=Math.floor(w/65536),F=w-I*65536,w=x+I+65535,I=Math.floor(w/65536),x=w-I*65536,w=P+I+65535,I=Math.floor(w/65536),P=w-I*65536,w=$+I+65535,I=Math.floor(w/65536),$=w-I*65536,w=D+I+65535,I=Math.floor(w/65536),D=w-I*65536,w=_+I+65535,I=Math.floor(w/65536),_=w-I*65536,w=N+I+65535,I=Math.floor(w/65536),N=w-I*65536,w=L+I+65535,I=Math.floor(w/65536),L=w-I*65536,w=R+I+65535,I=Math.floor(w/65536),R=w-I*65536,w=E+I+65535,I=Math.floor(w/65536),E=w-I*65536,w=M+I+65535,I=Math.floor(w/65536),M=w-I*65536,w=j+I+65535,I=Math.floor(w/65536),j=w-I*65536,B+=I-1+37*(I-1),C[0]=B,C[1]=z,C[2]=H,C[3]=K,C[4]=F,C[5]=x,C[6]=P,C[7]=$,C[8]=D,C[9]=_,C[10]=N,C[11]=L,C[12]=R,C[13]=E,C[14]=M,C[15]=j}function h(C,A){d(C,A,A)}function p(C,A){const O=n();for(let w=0;w<16;w++)O[w]=A[w];for(let w=253;w>=0;w--)h(O,O),w!==2&&w!==4&&d(O,O,A);for(let w=0;w<16;w++)C[w]=O[w]}function v(C,A){const O=new Uint8Array(32),w=new Float64Array(80),I=n(),B=n(),z=n(),H=n(),K=n(),F=n();for(let D=0;D<31;D++)O[D]=C[D];O[31]=C[31]&127|64,O[0]&=248,l(w,A);for(let D=0;D<16;D++)B[D]=w[D];I[0]=H[0]=1;for(let D=254;D>=0;--D){const _=O[D>>>3]>>>(D&7)&1;a(I,B,_),a(z,H,_),u(K,I,z),f(I,I,z),u(z,B,H),f(B,B,H),h(H,K),h(F,I),d(I,z,I),d(z,B,K),u(K,I,z),f(I,I,z),h(B,I),f(z,H,F),d(I,z,s),u(I,I,H),d(z,z,I),d(I,H,F),d(H,B,w),h(B,K),a(I,B,_),a(z,H,_)}for(let D=0;D<16;D++)w[D+16]=I[D],w[D+32]=z[D],w[D+48]=B[D],w[D+64]=H[D];const x=w.subarray(32),P=w.subarray(16);p(x,x),d(P,P,x);const $=new Uint8Array(32);return c($,P),$}t.scalarMult=v;function m(C){return v(C,i)}t.scalarMultBase=m;function g(C){if(C.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const A=new Uint8Array(C);return{publicKey:m(A),secretKey:A}}t.generateKeyPairFromSeed=g;function y(C){const A=(0,e.randomBytes)(32,C),O=g(A);return(0,r.wipe)(A),O}t.generateKeyPair=y;function b(C,A,O=!1){if(C.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(A.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const w=v(C,A);if(O){let I=0;for(let B=0;Bi+s.length,0));const r=oW(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return kS(r)}function J2e(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,C=new Uint8Array(b);g!==y;){for(var A=p[g],O=0,w=b-1;(A!==0||O>>0,C[w]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");m=O,g++}for(var I=b-m;I!==b&&C[I]===0;)I++;for(var B=c.repeat(v);I>>0,b=new Uint8Array(y);p[v];){var C=r[p.charCodeAt(v)];if(C===255)return;for(var A=0,O=y-1;(C!==0||A>>0,b[O]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");g=A,v++}if(p[v]!==" "){for(var w=y-g;w!==y&&b[w]===0;)w++;for(var I=new Uint8Array(m+(y-w)),B=m;w!==y;)I[B++]=b[w++];return I}}}function h(p){var v=d(p);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:d,decode:h}}var X2e=J2e,Z2e=X2e;const ewe=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},twe=t=>new TextEncoder().encode(t),rwe=t=>new TextDecoder().decode(t);class nwe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class iwe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return aW(this,e)}}class swe{constructor(e){this.decoders=e}or(e){return aW(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const aW=(t,e)=>new swe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class owe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new nwe(e,r,n),this.decoder=new iwe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const w2=({name:t,prefix:e,encode:r,decode:n})=>new owe(t,e,r,n),kp=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Z2e(r,e);return w2({prefix:t,name:e,encode:n,decode:s=>ewe(i(s))})},awe=(t,e,r,n)=>{const i={};for(let u=0;u=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},cwe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<w2({prefix:e,name:t,encode(i){return cwe(i,n,r)},decode(i){return awe(i,n,r,t)}}),lwe=w2({prefix:"\0",name:"identity",encode:t=>rwe(t),decode:t=>twe(t)}),uwe=Object.freeze(Object.defineProperty({__proto__:null,identity:lwe},Symbol.toStringTag,{value:"Module"})),fwe=hn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),dwe=Object.freeze(Object.defineProperty({__proto__:null,base2:fwe},Symbol.toStringTag,{value:"Module"})),hwe=hn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),pwe=Object.freeze(Object.defineProperty({__proto__:null,base8:hwe},Symbol.toStringTag,{value:"Module"})),vwe=kp({prefix:"9",name:"base10",alphabet:"0123456789"}),mwe=Object.freeze(Object.defineProperty({__proto__:null,base10:vwe},Symbol.toStringTag,{value:"Module"})),ywe=hn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gwe=hn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),bwe=Object.freeze(Object.defineProperty({__proto__:null,base16:ywe,base16upper:gwe},Symbol.toStringTag,{value:"Module"})),wwe=hn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xwe=hn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ewe=hn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cwe=hn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Swe=hn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kwe=hn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Awe=hn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_we=hn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Pwe=hn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Twe=Object.freeze(Object.defineProperty({__proto__:null,base32:wwe,base32hex:Swe,base32hexpad:Awe,base32hexpadupper:_we,base32hexupper:kwe,base32pad:Ewe,base32padupper:Cwe,base32upper:xwe,base32z:Pwe},Symbol.toStringTag,{value:"Module"})),Iwe=kp({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Owe=kp({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Rwe=Object.freeze(Object.defineProperty({__proto__:null,base36:Iwe,base36upper:Owe},Symbol.toStringTag,{value:"Module"})),$we=kp({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Mwe=kp({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Nwe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:$we,base58flickr:Mwe},Symbol.toStringTag,{value:"Module"})),Dwe=hn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Lwe=hn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Bwe=hn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fwe=hn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),jwe=Object.freeze(Object.defineProperty({__proto__:null,base64:Dwe,base64pad:Lwe,base64url:Bwe,base64urlpad:Fwe},Symbol.toStringTag,{value:"Module"})),cW=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Uwe=cW.reduce((t,e,r)=>(t[r]=e,t),[]),zwe=cW.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Wwe(t){return t.reduce((e,r)=>(e+=Uwe[r],e),"")}function Hwe(t){const e=[];for(const r of t){const n=zwe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const qwe=w2({prefix:"🚀",name:"base256emoji",encode:Wwe,decode:Hwe}),Vwe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:qwe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const NP={...uwe,...dwe,...pwe,...mwe,...bwe,...Twe,...Rwe,...Nwe,...jwe,...Vwe};function lW(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const DP=lW("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Px=lW("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=oW(t.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Jwe:typeof navigator<"u"?jP(navigator.userAgent):ixe()}function rxe(t){return t!==""&&exe.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function jP(t){var e=rxe(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Ywe;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{if(!f.includes(":")||n)return;const d=Yd(e[f].accounts);d.includes(f)||(n=Ka("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${f} Required: ${f} - Approved: ${d.toString()}`))}),o.forEach(f=>{n||(Ol(i[f].methods,s[f].methods)?Ol(i[f].events,s[f].events)||(n=Ka("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${f}`)):n=Ka("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${f}`))}),n}function z5e(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function cT(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function W5e(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Yd(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function gIe(t,e){return RS(t,!1)&&t<=e.max&&t>=e.min}var AW="eip155",H5e="store",_W="requestedChains",r8="wallet_addEthereumChain",ar,S0,bm,n8,$S,PW,wm,i8,s8,TW,og,MS,Zu,Hh,ag,NS,cg,DS,lg,LS,q5e=class extends vp{constructor(t){super({...t,options:{isNewChainsStale:!0,...t.options}}),Br(this,bm),Br(this,$S),Br(this,wm),Br(this,s8),Br(this,og),Br(this,Zu),Br(this,ag),Br(this,cg),Br(this,lg),Ke(this,"id","walletConnect"),Ke(this,"name","WalletConnect"),Ke(this,"ready",!0),Br(this,ar,void 0),Br(this,S0,void 0),Ke(this,"onAccountsChanged",e=>{e.length===0?this.emit("disconnect"):this.emit("change",{account:jn(e[0])})}),Ke(this,"onChainChanged",e=>{const r=Number(e),n=this.isChainUnsupported(r);this.emit("change",{chain:{id:r,unsupported:n}})}),Ke(this,"onDisconnect",()=>{Lr(this,Zu,Hh).call(this,[]),this.emit("disconnect")}),Ke(this,"onDisplayUri",e=>{this.emit("message",{type:"display_uri",data:e})}),Ke(this,"onConnect",()=>{this.emit("connect",{})}),Lr(this,bm,n8).call(this)}async connect({chainId:t,pairingTopic:e}={}){var r,n,i,s,o;try{let a=t;if(!a){const p=(r=this.storage)==null?void 0:r.getItem(H5e),v=(s=(i=(n=p==null?void 0:p.state)==null?void 0:n.data)==null?void 0:i.chain)==null?void 0:s.id;v&&!this.isChainUnsupported(v)?a=v:a=(o=this.chains[0])==null?void 0:o.id}if(!a)throw new Error("No chains found on connector.");const c=await this.getProvider();Lr(this,s8,TW).call(this);const l=Lr(this,wm,i8).call(this);if(c.session&&l&&await c.disconnect(),!c.session||l){const p=this.chains.filter(v=>v.id!==a).map(v=>v.id);this.emit("message",{type:"connecting"}),await c.connect({pairingTopic:e,chains:[a],optionalChains:p.length?p:void 0}),Lr(this,Zu,Hh).call(this,this.chains.map(({id:v})=>v))}const u=await c.enable(),f=jn(u[0]),d=await this.getChainId(),h=this.isChainUnsupported(d);return{account:f,chain:{id:d,unsupported:h}}}catch(a){throw/user rejected/i.test(a==null?void 0:a.message)?new Or(a):a}}async disconnect(){const t=await this.getProvider();try{await t.disconnect()}catch(e){if(!/No matching key/i.test(e.message))throw e}finally{Lr(this,og,MS).call(this),Lr(this,Zu,Hh).call(this,[])}}async getAccount(){const{accounts:t}=await this.getProvider();return jn(t[0])}async getChainId(){const{chainId:t}=await this.getProvider();return t}async getProvider({chainId:t}={}){return He(this,ar)||await Lr(this,bm,n8).call(this),t&&await this.switchChain(t),He(this,ar)}async getWalletClient({chainId:t}={}){const[e,r]=await Promise.all([this.getProvider({chainId:t}),this.getAccount()]),n=this.chains.find(i=>i.id===t);if(!e)throw new Error("provider is required.");return Cp({account:r,chain:n,transport:c2(e)})}async isAuthorized(){try{const[t,e]=await Promise.all([this.getAccount(),this.getProvider()]),r=Lr(this,wm,i8).call(this);if(!t)return!1;if(r&&e.session){try{await e.disconnect()}catch{}return!1}return!0}catch{return!1}}async switchChain(t){var r,n;const e=this.chains.find(i=>i.id===t);if(!e)throw new aa(new Error("chain not found on connector."));try{const i=await this.getProvider(),s=Lr(this,cg,DS).call(this),o=Lr(this,lg,LS).call(this);if(!s.includes(t)&&o.includes(r8)){await i.request({method:r8,params:[{chainId:ze(e.id),blockExplorerUrls:[(n=(r=e.blockExplorers)==null?void 0:r.default)==null?void 0:n.url],chainName:e.name,nativeCurrency:e.nativeCurrency,rpcUrls:[...e.rpcUrls.default.http]}]});const c=Lr(this,ag,NS).call(this);c.push(t),Lr(this,Zu,Hh).call(this,c)}return await i.request({method:"wallet_switchEthereumChain",params:[{chainId:ze(t)}]}),e}catch(i){const s=typeof i=="string"?i:i==null?void 0:i.message;throw/user rejected request/i.test(s)?new Or(i):new aa(i)}}};ar=new WeakMap;S0=new WeakMap;bm=new WeakSet;n8=async function(){return!He(this,S0)&&typeof window<"u"&&Es(this,S0,Lr(this,$S,PW).call(this)),He(this,S0)};$S=new WeakSet;PW=async function(){const{EthereumProvider:t,OPTIONAL_EVENTS:e,OPTIONAL_METHODS:r}=await cS(()=>import("./index.es-97978cd1.js"),["./index.es-97978cd1.js","./events-16b8e254.js"],import.meta.url),[n,...i]=this.chains.map(({id:s})=>s);if(n){const{projectId:s,showQrModal:o=!0,qrModalOptions:a,metadata:c,relayUrl:l}=this.options;Es(this,ar,await t.init({showQrModal:o,qrModalOptions:a,projectId:s,optionalMethods:r,optionalEvents:e,chains:[n],optionalChains:i.length?i:void 0,rpcMap:Object.fromEntries(this.chains.map(u=>[u.id,u.rpcUrls.default.http[0]])),metadata:c,relayUrl:l}))}};wm=new WeakSet;i8=function(){if(Lr(this,lg,LS).call(this).includes(r8)||!this.options.isNewChainsStale)return!1;const e=Lr(this,ag,NS).call(this),r=this.chains.map(({id:i})=>i),n=Lr(this,cg,DS).call(this);return n.length&&!n.some(i=>r.includes(i))?!1:!r.every(i=>e.includes(i))};s8=new WeakSet;TW=function(){He(this,ar)&&(Lr(this,og,MS).call(this),He(this,ar).on("accountsChanged",this.onAccountsChanged),He(this,ar).on("chainChanged",this.onChainChanged),He(this,ar).on("disconnect",this.onDisconnect),He(this,ar).on("session_delete",this.onDisconnect),He(this,ar).on("display_uri",this.onDisplayUri),He(this,ar).on("connect",this.onConnect))};og=new WeakSet;MS=function(){He(this,ar)&&(He(this,ar).removeListener("accountsChanged",this.onAccountsChanged),He(this,ar).removeListener("chainChanged",this.onChainChanged),He(this,ar).removeListener("disconnect",this.onDisconnect),He(this,ar).removeListener("session_delete",this.onDisconnect),He(this,ar).removeListener("display_uri",this.onDisplayUri),He(this,ar).removeListener("connect",this.onConnect))};Zu=new WeakSet;Hh=function(t){var e;(e=this.storage)==null||e.setItem(_W,t)};ag=new WeakSet;NS=function(){var t;return((t=this.storage)==null?void 0:t.getItem(_W))??[]};cg=new WeakSet;DS=function(){var n,i,s;if(!He(this,ar))return[];const t=(n=He(this,ar).session)==null?void 0:n.namespaces;return t?((s=(i=SW(t)[AW])==null?void 0:i.chains)==null?void 0:s.map(o=>parseInt(o.split(":")[1]||"")))??[]:[]};lg=new WeakSet;LS=function(){var n,i;if(!He(this,ar))return[];const t=(n=He(this,ar).session)==null?void 0:n.namespaces;return t?((i=SW(t)[AW])==null?void 0:i.methods)??[]:[]};function Ae(){return Ae=Object.assign?Object.assign.bind():function(t){for(var e=1;e({account:l[0]}),this.onDisconnect=()=>{this==null||this.emit("disconnect")};const o=(r==null||(n=r.connect)==null||(n=n.settings)==null?void 0:n.signInOptions)||[],a=r==null||(i=r.connect)==null||(i=i.settings)==null?void 0:i.signInWith;if(r==null||(s=r.connect)==null||(s=s.settings)==null?void 0:s.signInWithEmail)this.id="email",this.name="Email";else if(a)this.id=a,this.name=`${a[0].toUpperCase()}${a.slice(1)}`;else if(o.length>0){const l=o[0],u=`${l[0].toUpperCase()}${l.slice(1)}`;this.id=l,this.name=u}this.provider=M4.initWallet(r.projectAccessKey,{defaultNetwork:r==null?void 0:r.defaultNetwork,transports:{walletAppURL:"https://sequence.app"},defaultEIP6492:!0,analytics:!1}),this.provider.on("chainChanged",l=>{this==null||this.emit("change",{chain:{id:o8(l),unsupported:!1}})}),this.provider.on("accountsChanged",l=>{this==null||this.emit("accountsChanged",this.onAccountsChanged(l))}),this.provider.on("disconnect",()=>{this.onDisconnect()})}async connect(){if(!this.provider.isConnected()){var e,r,n;this==null||this.emit("message",{type:"connecting"});const s=(e=this.options)==null?void 0:e.connect,o=localStorage.getItem(Dn.Theme),a=localStorage.getItem(Dn.EthAuthSettings),c=a?JSON.parse(a):{},l=Ae({authorize:!0},c,s,{settings:Ae({theme:o||"dark"},s==null?void 0:s.settings)}),u=await this.provider.connect(l);if(u.error)throw new Or(new Error(u.error));if(!u.connected)throw new Or(new Error("Wallet connection rejected"));const f=(r=u.proof)==null?void 0:r.proofString,d=(n=u.proof)==null?void 0:n.typedData;if(f){const h=JSON.stringify({proofString:f,typedData:d});localStorage.setItem(Dn.EthAuthProof,h)}}return{account:await this.getAccount(),chain:{id:this.provider.getChainId(),unsupported:this.isChainUnsupported(this.provider.getChainId())}}}async getWalletClient({chainId:e}={}){const r=this.chains.find(n=>n.id===e);return Cp({chain:r,account:await this.getAccount(),transport:c2(this.provider)})}onChainChanged(e){this.provider.setDefaultChainId(o8(e))}async switchChain(e){if(this.isChainUnsupported(e))throw new Error("Unsupported chain");return this.provider.setDefaultChainId(e),this.chains.find(r=>r.id===e)}async disconnect(){localStorage.removeItem(Dn.EthAuthProof),this.provider.disconnect()}getAccount(){return this.provider.getSigner().getAddress()}async getChainId(){return this.provider.getChainId()}async getProvider(){return this.provider}async getSigner(){return this.provider.getSigner()}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}isChainUnsupported(e){return this.provider.networks.findIndex(r=>r.chainId===e)===-1}}const o8=t=>typeof t=="object"?o8(t.chainId):typeof t=="string"?Number.parseInt(t,t.trim().substring(0,2)==="0x"?16:10):typeof t=="bigint"?Number(t):t;function ns(t){if(t==null)throw new TypeError("Cannot destructure "+t)}const lT=({isDarkMode:t})=>{const e=t?"white":"black";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 29 34",fill:"none"},i),S.createElement("path",{d:"M27.702 11.5918C27.5049 11.7448 24.0243 13.7068 24.0243 18.0694C24.0243 23.1155 28.4532 24.9007 28.5858 24.9449C28.5654 25.0537 27.8822 27.3897 26.2506 29.77C24.7958 31.8646 23.2765 33.9558 20.9651 33.9558C18.6538 33.9558 18.0589 32.6127 15.3907 32.6127C12.7904 32.6127 11.8659 34 9.75169 34C7.63748 34 6.1623 32.0618 4.46618 29.6816C2.50154 26.8865 0.914185 22.5443 0.914185 18.423C0.914185 11.8128 5.21057 8.30703 9.43897 8.30703C11.6857 8.30703 13.5586 9.78278 14.9692 9.78278C16.3118 9.78278 18.4056 8.21862 20.9617 8.21862C21.9304 8.21862 25.4111 8.30703 27.702 11.5918ZM19.7483 5.42014C20.8054 4.16542 21.5532 2.42444 21.5532 0.683468C21.5532 0.442044 21.5328 0.19722 21.4886 0C19.7687 0.0646065 17.7224 1.14591 16.4886 2.57746C15.5199 3.67917 14.6157 5.42014 14.6157 7.18492C14.6157 7.45014 14.6599 7.71537 14.6803 7.80038C14.7891 7.82078 14.9658 7.84458 15.1426 7.84458C16.6857 7.84458 18.6266 6.81088 19.7483 5.42014Z",fill:e})))}},uT=({isDarkMode:t})=>{const e=t?"#FFFFFF":"#000000";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},i),S.createElement("path",{d:"M27.166 20.8774C27.1338 17.335 30.0617 15.633 30.1936 15.5493C28.5463 13.1395 25.9852 12.8113 25.0714 12.7727C22.8932 12.5507 20.8179 14.0565 19.7111 14.0565C18.6043 14.0565 16.8991 12.8049 15.0909 12.8403C12.7131 12.8757 10.5221 14.2205 9.2962 16.3505C6.8284 20.6297 8.66557 26.9777 11.0722 30.4557C12.2498 32.1545 13.6494 34.0689 15.493 33.9981C17.2691 33.9273 17.9383 32.8495 20.0811 32.8495C22.224 32.8495 22.8289 33.9981 24.7014 33.9627C26.6094 33.9241 27.8191 32.2253 28.9871 30.5201C30.3352 28.5478 30.8918 26.6366 30.924 26.5369C30.8822 26.5208 27.2046 25.1116 27.166 20.8774Z",fill:e}),S.createElement("path",{d:"M23.6429 10.4722C24.621 9.28822 25.2806 7.64089 25.1004 6C23.6911 6.05791 21.9859 6.93949 20.9756 8.12351C20.0715 9.16917 19.2768 10.8455 19.4923 12.4542C21.0592 12.5764 22.6648 11.653 23.6429 10.4722Z",fill:e})))}},V5e=({chains:t,options:e})=>({id:"apple",isSequenceBased:!0,logoDark:lT({isDarkMode:!0}),logoLight:lT({isDarkMode:!1}),monochromeLogoDark:uT({isDarkMode:!0}),monochromeLogoLight:uT({isDarkMode:!1}),name:"Apple",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"apple"})})})})}}),fT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("rect",{width:"28",height:"28",fill:"#2C5FF6"}),S.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14 23.8C19.4124 23.8 23.8 19.4124 23.8 14C23.8 8.58761 19.4124 4.2 14 4.2C8.58761 4.2 4.2 8.58761 4.2 14C4.2 19.4124 8.58761 23.8 14 23.8ZM11.55 10.8C11.1358 10.8 10.8 11.1358 10.8 11.55V16.45C10.8 16.8642 11.1358 17.2 11.55 17.2H16.45C16.8642 17.2 17.2 16.8642 17.2 16.45V11.55C17.2 11.1358 16.8642 10.8 16.45 10.8H11.55Z",fill:"white"})))},G5e=t=>({id:"coinbase-wallet",logoDark:fT,logoLight:fT,name:"Coinbase Wallet",createConnector:()=>new o2e(Ae({},t))}),dT=({isDarkMode:t})=>{const e=t?"white":"black";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 35 34",fill:"none"},i),S.createElement("path",{d:"M17.0826 16.3805C17.1802 16.4598 17.32 16.4598 17.4176 16.3805L30.1401 6.04341C30.5283 5.72801 30.3053 5.09985 29.8051 5.09985H4.69499C4.19482 5.09985 3.9718 5.72801 4.35998 6.04341L17.0826 16.3805Z",fill:e}),S.createElement("path",{d:"M19.7626 19.2667L33.3838 8.19943C33.731 7.91735 34.2501 8.16441 34.2501 8.61174V24.2249C34.2501 26.5721 32.3473 28.4749 30.0001 28.4749H4.50006C2.15285 28.4749 0.250061 26.5721 0.250061 24.2249V8.61174C0.250061 8.16441 0.769134 7.91735 1.11631 8.19943L14.7375 19.2667C16.2014 20.4561 18.2987 20.4561 19.7626 19.2667Z",fill:e})))}},a8="@sequence.kit.connector.email",K5e=({chains:t,options:e})=>({id:"email",isSequenceBased:!0,logoDark:dT({isDarkMode:!0}),logoLight:dT({isDarkMode:!1}),name:"Email",createConnector:()=>{var r;const n=localStorage.getItem(a8);return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInOptions:["email"],signInWithEmail:n||""})})})})}}),hT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},e),S.createElement("path",{d:"M17.4214 36.9716C9.27855 35.5145 3.10712 28.4859 3.10712 20.0001C3.10712 10.5715 10.8214 2.85718 20.25 2.85718C29.6785 2.85718 37.3928 10.5715 37.3928 20.0001C37.3928 28.4859 31.2214 35.5145 23.0785 36.9716L22.1357 36.2002H18.3643L17.4214 36.9716Z",fill:"url(#paint0_linear_193_14528)"}),S.createElement("path",{d:"M26.9357 24.7999L27.7072 19.9999H23.1643V16.657C23.1643 15.2856 23.6786 14.257 25.7357 14.257H27.9643V9.88558C26.7643 9.71415 25.3929 9.54272 24.1929 9.54272C20.25 9.54272 17.5071 11.9427 17.5071 16.2285V19.9999H13.2214V24.7999H17.5071V36.8857C18.45 37.0571 19.3929 37.1429 20.3357 37.1429C21.2786 37.1429 22.2214 37.0571 23.1643 36.8857V24.7999H26.9357Z",fill:"white"}),S.createElement("defs",null,S.createElement("linearGradient",{id:"paint0_linear_193_14528",x1:"20.2508",y1:"35.9507",x2:"20.2508",y2:"2.85086",gradientUnits:"userSpaceOnUse"},S.createElement("stop",{"stop-color":"#0062E0"}),S.createElement("stop",{offset:"1","stop-color":"#19AFFF"})))))},pT=({isDarkMode:t})=>{const e=t?"#FFFFFF":"#000000";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},i),S.createElement("path",{d:"M25.8582 10.4398C24.1222 10.4398 23.6288 11.2098 23.6288 12.9073V15.709H28.246L27.791 20.2476H23.6279V34H18.1024V20.2468H14.375V15.7081H18.1042V12.9851C18.1042 8.40625 19.9399 6 25.0891 6C26.1942 6 27.5163 6.0875 28.3055 6.19775V10.459",fill:e})))}},Q5e=({chains:t,options:e})=>({id:"facebook",isSequenceBased:!0,logoDark:hT,logoLight:hT,monochromeLogoDark:pT({isDarkMode:!0}),monochromeLogoLight:pT({isDarkMode:!1}),name:"Facebook",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"facebook"})})})})}}),vT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({viewBox:"0 0 41 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("g",{id:"Frame 2114"},S.createElement("g",{id:"Group"},S.createElement("path",{id:"Vector",d:"M20.7497 16.8828V23.5218H29.9756C29.5705 25.6568 28.3548 27.4647 26.5314 28.6803L32.095 32.9972C35.3366 30.0051 37.2068 25.6102 37.2068 20.3895C37.2068 19.1739 37.0977 18.005 36.895 16.883L20.7497 16.8828Z",fill:"#4285F4"}),S.createElement("path",{id:"Vector_2",d:"M11.1424 23.2627L9.88756 24.2232L5.44592 27.6829C8.2667 33.2777 14.0481 37.1427 20.7493 37.1427C25.3778 37.1427 29.2583 35.6154 32.0947 32.9973L26.5311 28.6803C25.0038 29.7089 23.0557 30.3324 20.7493 30.3324C16.2922 30.3324 12.5053 27.3246 11.1494 23.2726L11.1424 23.2627Z",fill:"#34A853"}),S.createElement("path",{id:"Vector_3",d:"M5.44594 12.3169C4.27718 14.6233 3.60712 17.2259 3.60712 19.9999C3.60712 22.7739 4.27718 25.3765 5.44594 27.6829C5.44594 27.6984 11.1499 23.2569 11.1499 23.2569C10.8071 22.2284 10.6044 21.1375 10.6044 19.9997C10.6044 18.8619 10.8071 17.7711 11.1499 16.7425L5.44594 12.3169Z",fill:"#FBBC05"}),S.createElement("path",{id:"Vector_4",d:"M20.7497 9.6829C23.2744 9.6829 25.5185 10.5556 27.3107 12.2387L32.2198 7.32972C29.2431 4.55574 25.3783 2.85693 20.7497 2.85693C14.0484 2.85693 8.2667 6.70628 5.44592 12.3167L11.1497 16.7427C12.5055 12.6907 16.2926 9.6829 20.7497 9.6829Z",fill:"#EA4335"})))))},mT=({isDarkMode:t})=>{const e=t?"white":"black";return n=>{let i=Ae({},(ns(n),n));return S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},i),S.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.8355 14.7613C24.5584 13.5329 22.9441 12.9032 21.1356 12.9032C17.9377 12.9032 15.2302 15.0813 14.2595 18.0232L14.2593 18.023C14.0142 18.7662 13.8712 19.5609 13.8712 20.3866C13.8712 21.2124 14.004 22.0072 14.2594 22.7504L14.2587 22.751H14.2595C15.2302 25.6929 17.9377 27.871 21.1356 27.871C22.7907 27.871 24.1904 27.4168 25.2939 26.6736V26.6732C26.5812 25.7958 27.4497 24.5055 27.746 22.9777H21.1355V18.3223H32.6808C32.8034 19.0758 32.875 19.85 32.875 20.6655C32.875 24.4332 31.5467 27.6126 29.2377 29.77L29.2378 29.7703C27.2148 31.6594 24.446 32.7742 21.1356 32.7742C16.3438 32.7742 12.2059 29.9871 10.1931 25.9407V25.94L10.193 25.9401C9.35521 24.2678 8.875 22.3891 8.875 20.3866C8.875 18.384 9.35521 16.5053 10.193 14.833H10.1934C12.2063 10.7869 16.344 8 21.1356 8C24.446 8 27.2148 9.22839 29.3298 11.231L25.8355 14.7613Z",fill:e}))}},Y5e=({chains:t,options:e})=>({id:"google",isSequenceBased:!0,logoDark:vT,logoLight:vT,monochromeLogoDark:mT({isDarkMode:!0}),monochromeLogoLight:mT({isDarkMode:!1}),name:"Google",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"google"})})})})}}),yT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("rect",{width:"28",height:"28"}),S.createElement("path",{d:"M24.0891 3.1199L15.3446 9.61456L16.9617 5.7828L24.0891 3.1199Z",fill:"#E2761B",stroke:"#E2761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M3.90207 3.1199L12.5763 9.67608L11.0383 5.7828L3.90207 3.1199Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M20.9429 18.1745L18.6139 21.7426L23.597 23.1136L25.0295 18.2536L20.9429 18.1745Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M2.97929 18.2536L4.40301 23.1136L9.38607 21.7426L7.05713 18.1745L2.97929 18.2536Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.10483 12.1456L7.71626 14.2461L12.6642 14.4658L12.4884 9.14877L9.10483 12.1456Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.8864 12.1456L15.4589 9.08725L15.3446 14.4658L20.2837 14.2461L18.8864 12.1456Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.38606 21.7426L12.3566 20.2925L9.79033 18.2888L9.38606 21.7426Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.6347 20.2925L18.6139 21.7426L18.2009 18.2888L15.6347 20.2925Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.6139 21.7426L15.6347 20.2925L15.8719 22.2348L15.8456 23.0521L18.6139 21.7426Z",fill:"#D7C1B3",stroke:"#D7C1B3",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.38606 21.7426L12.1544 23.0521L12.1368 22.2348L12.3566 20.2925L9.38606 21.7426Z",fill:"#D7C1B3",stroke:"#D7C1B3",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M12.1984 17.0056L9.72002 16.2762L11.4689 15.4765L12.1984 17.0056Z",fill:"#233447",stroke:"#233447",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.7928 17.0056L16.5223 15.4765L18.28 16.2762L15.7928 17.0056Z",fill:"#233447",stroke:"#233447",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.38606 21.7426L9.80791 18.1745L7.05712 18.2536L9.38606 21.7426Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.1921 18.1745L18.6139 21.7426L20.9429 18.2536L18.1921 18.1745Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M20.2837 14.2461L15.3446 14.4658L15.8016 17.0057L16.5311 15.4765L18.2888 16.2762L20.2837 14.2461Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.72002 16.2762L11.4777 15.4765L12.1984 17.0057L12.6642 14.4658L7.71626 14.2461L9.72002 16.2762Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M7.71626 14.2461L9.79033 18.2888L9.72002 16.2762L7.71626 14.2461Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.2888 16.2762L18.2009 18.2888L20.2837 14.2461L18.2888 16.2762Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M12.6642 14.4658L12.1984 17.0057L12.7784 20.0025L12.9102 16.0565L12.6642 14.4658Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.3446 14.4658L15.1073 16.0477L15.2128 20.0025L15.8016 17.0057L15.3446 14.4658Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.8016 17.0056L15.2128 20.0025L15.6347 20.2925L18.2009 18.2888L18.2888 16.2762L15.8016 17.0056Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.72002 16.2762L9.79033 18.2888L12.3566 20.2925L12.7784 20.0025L12.1984 17.0056L9.72002 16.2762Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.8456 23.0521L15.8719 22.2348L15.6522 22.0414H12.339L12.1368 22.2348L12.1544 23.0521L9.38606 21.7426L10.3528 22.5336L12.3126 23.8958H15.6786L17.6472 22.5336L18.6139 21.7426L15.8456 23.0521Z",fill:"#C0AD9E",stroke:"#C0AD9E",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.6347 20.2925L15.2128 20.0025H12.7784L12.3566 20.2925L12.1368 22.2348L12.339 22.0414H15.6522L15.8719 22.2348L15.6347 20.2925Z",fill:"#161616",stroke:"#161616",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M24.4583 10.0364L25.2053 6.45072L24.0891 3.1199L15.6347 9.39485L18.8864 12.1456L23.4827 13.4903L24.5022 12.3038L24.0628 11.9874L24.7658 11.3459L24.221 10.924L24.924 10.3879L24.4583 10.0364Z",fill:"#763D16",stroke:"#763D16",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M2.79472 6.45072L3.54174 10.0364L3.06717 10.3879L3.77024 10.924L3.23415 11.3459L3.93722 11.9874L3.4978 12.3038L4.50847 13.4903L9.10483 12.1456L12.3566 9.39485L3.90207 3.1199L2.79472 6.45072Z",fill:"#763D16",stroke:"#763D16",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M23.4827 13.4903L18.8864 12.1456L20.2837 14.2461L18.2009 18.2888L20.9429 18.2536H25.0295L23.4827 13.4903Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.10484 12.1456L4.50848 13.4903L2.97929 18.2536H7.05713L9.79033 18.2888L7.71626 14.2461L9.10484 12.1456Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.3446 14.4658L15.6347 9.39485L16.9705 5.7828H11.0383L12.3566 9.39485L12.6642 14.4658L12.7696 16.0653L12.7784 20.0025H15.2128L15.2304 16.0653L15.3446 14.4658Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"})))},ug=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",style:{fill:"none"},id:"svg1316",version:"1.1",viewBox:"0 0 396 396"},e),S.createElement("g",{transform:"translate(0,38)",id:"g1256",clipPath:"url(#clip0_5_131)"},S.createElement("g",{id:"g1254",clipPath:"url(#clip1_5_131)"},S.createElement("path",{style:{fill:"#111111"},id:"path1232",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint0_linear_5_13"},id:"path1234",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint1_linear_5_131"},id:"path1236",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint2_linear_5_131)"},id:"path1238",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint3_linear_5_131)"},id:"path1240",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint4_linear_5_131)"},id:"path1242",d:"m 98.9999,238.126 c 0,-10.965 -8.8648,-19.854 -19.8,-19.854 -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.966 8.8648,19.855 19.8,19.855 10.9352,0 19.8,-8.889 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint5_linear_5_131)"},id:"path1244",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint6_linear_5_131)"},id:"path1246",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint7_linear_5_131)"},id:"path1248",d:"M 316.8,59.5632 H 158.4 c -10.935,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.865,19.8544 19.8,19.8544 h 158.4 c 10.935,0 19.8,-8.8892 19.8,-19.8544 0,-10.9653 -8.865,-19.8544 -19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint8_linear_5_131)"},id:"path1250",d:"M 316.8,218.272 H 158.4 c -10.935,0 -19.8,8.889 -19.8,19.854 0,10.966 8.865,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.889 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}),S.createElement("path",{style:{fill:"url(#paint9_linear_5_131)"},id:"path1252",d:"M 237.6,138.981 H 79.2 c -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.965 8.8648,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.89 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}))),S.createElement("defs",{id:"defs1314"},S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"318",x2:"198",y1:"4.0585401e-05",x1:"198",id:"paint0_linear_5_131"},S.createElement("stop",{id:"stop1258",stopColor:"#1D273D"}),S.createElement("stop",{id:"stop1260",stopColor:"#0D0F13",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"63",x2:"92.5",y1:"99",x1:"65.5",id:"paint1_linear_5_131"},S.createElement("stop",{id:"stop1263",stopColor:"#4462FE"}),S.createElement("stop",{id:"stop1265",stopColor:"#7D69FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint2_linear_5_131"},S.createElement("stop",{id:"stop1268",stopColor:"#3757FD"}),S.createElement("stop",{id:"stop1270",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint3_linear_5_131"},S.createElement("stop",{id:"stop1273",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1275",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"223.5",x2:"91.5",y1:"251.5",x1:"65",id:"paint4_linear_5_131"},S.createElement("stop",{id:"stop1278",stopColor:"#BC3EE6"}),S.createElement("stop",{id:"stop1280",stopColor:"#D972F1",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"146",x2:"329.5",y1:"172",x1:"305",id:"paint5_linear_5_131"},S.createElement("stop",{id:"stop1283",stopColor:"#29BDFF"}),S.createElement("stop",{id:"stop1285",stopColor:"#96E7FB",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"176.772",x2:"334.56699",y1:"178.418",x1:"300.17999",id:"paint6_linear_5_131"},S.createElement("stop",{id:"stop1288",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1290",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"60",x2:"317.5",y1:"99",x1:"154.5",id:"paint7_linear_5_131"},S.createElement("stop",{id:"stop1293",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1295",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"218",x2:"312.5",y1:"258",x1:"156",id:"paint8_linear_5_131"},S.createElement("stop",{id:"stop1298",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1300",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"139",x2:"235.5",y1:"179",x1:"86.000099",id:"paint9_linear_5_131"},S.createElement("stop",{id:"stop1303",stopColor:"#6634FF"}),S.createElement("stop",{id:"stop1305",stopColor:"#9C6DFF",offset:"1"})),S.createElement("clipPath",{id:"clip0_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1308",height:"317.67001",width:"396"})),S.createElement("clipPath",{id:"clip1_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1311",height:"317.67001",width:"396"})))))};window.ethereum=window.ethereum||{};const J5e=({chains:t})=>({id:"metamask",logoDark:yT,logoLight:yT,name:"Metamask",createConnector:()=>new a2e({chains:t,options:{shimDisconnect:!0}})}),X5e=({chains:t,options:e})=>({id:"mock",isSequenceBased:!0,logoDark:ug,logoLight:ug,name:"Mock",createConnector:()=>{var r;return new l2e({chains:t,options:Ae({chainId:(e==null||(r=e.chain)==null?void 0:r.id)||137,walletClient:Cp({account:e.account,chain:(e==null?void 0:e.chain)||hme,transport:e.transport})},e)})}}),Z5e=({chains:t,options:e})=>({id:"sequence",isSequenceBased:!0,logoDark:ug,logoLight:ug,name:"Sequence",createConnector:()=>new Jd({chains:t,options:e})}),kv=({isDarkMode:t})=>{let e;return t===void 0?e="#9146FF":e=t?"white":"black",n=>(Ae({},(ns(n),n)),S.createElement(S.Fragment,null,S.createElement("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 2400 2800",transform:"scale(0.80)"},S.createElement("g",null,S.createElement("g",{id:"Layer_1-2"},S.createElement("path",{fill:e,d:"M500,0L0,500v1800h600v500l500-500h400l900-900V0H500z M2200,1300l-400,400h-400l-350,350v-350H600V200h1600 V1300z"}),S.createElement("rect",{x:"1700",y:"550",fill:e,width:"200",height:"600"}),S.createElement("rect",{x:"1150",y:"550",fill:e,width:"200",height:"600"}))))))},e6e=({chains:t,options:e})=>({id:"twitch",isSequenceBased:!0,logoDark:kv({}),logoLight:kv({}),monochromeLogoDark:kv({isDarkMode:!0}),monochromeLogoLight:kv({isDarkMode:!1}),name:"Twitch",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"twitch"})})})})}}),gT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({fill:"none",viewBox:"0 0 480 332",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("path",{d:"m126.613 93.9842c62.622-61.3123 164.152-61.3123 226.775 0l7.536 7.3788c3.131 3.066 3.131 8.036 0 11.102l-25.781 25.242c-1.566 1.533-4.104 1.533-5.67 0l-10.371-10.154c-43.687-42.7734-114.517-42.7734-158.204 0l-11.107 10.874c-1.565 1.533-4.103 1.533-5.669 0l-25.781-25.242c-3.132-3.066-3.132-8.036 0-11.102zm280.093 52.2038 22.946 22.465c3.131 3.066 3.131 8.036 0 11.102l-103.463 101.301c-3.131 3.065-8.208 3.065-11.339 0l-73.432-71.896c-.783-.767-2.052-.767-2.835 0l-73.43 71.896c-3.131 3.065-8.208 3.065-11.339 0l-103.4657-101.302c-3.1311-3.066-3.1311-8.036 0-11.102l22.9456-22.466c3.1311-3.065 8.2077-3.065 11.3388 0l73.4333 71.897c.782.767 2.051.767 2.834 0l73.429-71.897c3.131-3.065 8.208-3.065 11.339 0l73.433 71.897c.783.767 2.052.767 2.835 0l73.431-71.895c3.132-3.066 8.208-3.066 11.339 0z",fill:"#3396ff"})))},t6e=({chains:t,options:e})=>({id:"wallet-connect",logoDark:gT,logoLight:gT,name:"Walletconnect",createConnector:()=>new q5e({chains:t,options:e})}),r6e=({chains:t,walletConnectProjectId:e,defaultChainId:r,projectAccessKey:n,appName:i})=>{let s=t[0].id;if(r){const a=t.find(c=>c.id===r);a&&(s=a.id)}return KW([G5e({chains:t,options:{appName:i}}),K5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),Y5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),Q5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),e6e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),V5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),J5e({chains:t}),t6e({chains:t,options:{projectId:e}}),Z5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}})])};function BS(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function Av(){}function bT(){return typeof WeakMap<"u"?new WeakMap:n6e()}function n6e(){return{add:Av,delete:Av,get:Av,set:Av,has:function(t){return!1}}}var i6e=Object.prototype.hasOwnProperty,c8=function(t,e){return i6e.call(t,e)};function Mx(t,e){for(var r in e)c8(e,r)&&(t[r]=e[r]);return t}var s6e=/^[ \t]*(?:\r\n|\r|\n)/,o6e=/(?:\r\n|\r|\n)[ \t]*$/,a6e=/^(?:[\r\n]|$)/,c6e=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,l6e=/^[ \t]*[\r\n][ \t\r\n]*$/;function wT(t,e,r){var n=0,i=t[0].match(c6e);i&&(n=i[1].length);var s="(\\r\\n|\\r|\\n).{0,"+n+"}",o=new RegExp(s,"g");e&&(t=t.slice(1));var a=r.newline,c=r.trimLeadingNewline,l=r.trimTrailingNewline,u=typeof a=="string",f=t.length,d=t.map(function(h,p){return h=h.replace(o,"$1"),p===0&&c&&(h=h.replace(s6e,"")),p===f-1&&l&&(h=h.replace(o6e,"")),u&&(h=h.replace(/\r\n|\n|\r/g,function(v){return a})),h});return d}function u6e(t,e){for(var r="",n=0,i=t.length;n{},registerClassName:()=>{},onEndFileScope:()=>{},registerComposition:()=>{},markCompositionUsed:()=>{},getIdentOption:()=>"short"},xm=[d6e],Cu=()=>{if(xm.length<1)throw new Error("No adapter configured");return xm[xm.length-1]},OW=!1,h6e=t=>{OW||p6e(t)},p6e=t=>{if(!t)throw new Error('No adapter provided when calling "setAdapter"');OW=!0,xm.push(t)},S2=function(){return Cu().appendCss(...arguments)},RW=function(){return Cu().registerClassName(...arguments)},v6e=function(){return Cu().registerComposition(...arguments)},$W=function(){return Cu().markCompositionUsed(...arguments)},m6e=function(){for(var e,r,n=arguments.length,i=new Array(n),s=0;s{n||(Ol(i[f].methods,s[f].methods)?Ol(i[f].events,s[f].events)||(n=Ka("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${f}`)):n=Ka("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${f}`))}),n}function z5e(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function cT(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function W5e(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Yd(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function gIe(t,e){return RS(t,!1)&&t<=e.max&&t>=e.min}var AW="eip155",H5e="store",_W="requestedChains",r8="wallet_addEthereumChain",ar,S0,bm,n8,$S,PW,wm,i8,s8,TW,og,MS,Zu,Hh,ag,NS,cg,DS,lg,LS,q5e=class extends vp{constructor(t){super({...t,options:{isNewChainsStale:!0,...t.options}}),Br(this,bm),Br(this,$S),Br(this,wm),Br(this,s8),Br(this,og),Br(this,Zu),Br(this,ag),Br(this,cg),Br(this,lg),Ke(this,"id","walletConnect"),Ke(this,"name","WalletConnect"),Ke(this,"ready",!0),Br(this,ar,void 0),Br(this,S0,void 0),Ke(this,"onAccountsChanged",e=>{e.length===0?this.emit("disconnect"):this.emit("change",{account:jn(e[0])})}),Ke(this,"onChainChanged",e=>{const r=Number(e),n=this.isChainUnsupported(r);this.emit("change",{chain:{id:r,unsupported:n}})}),Ke(this,"onDisconnect",()=>{Lr(this,Zu,Hh).call(this,[]),this.emit("disconnect")}),Ke(this,"onDisplayUri",e=>{this.emit("message",{type:"display_uri",data:e})}),Ke(this,"onConnect",()=>{this.emit("connect",{})}),Lr(this,bm,n8).call(this)}async connect({chainId:t,pairingTopic:e}={}){var r,n,i,s,o;try{let a=t;if(!a){const p=(r=this.storage)==null?void 0:r.getItem(H5e),v=(s=(i=(n=p==null?void 0:p.state)==null?void 0:n.data)==null?void 0:i.chain)==null?void 0:s.id;v&&!this.isChainUnsupported(v)?a=v:a=(o=this.chains[0])==null?void 0:o.id}if(!a)throw new Error("No chains found on connector.");const c=await this.getProvider();Lr(this,s8,TW).call(this);const l=Lr(this,wm,i8).call(this);if(c.session&&l&&await c.disconnect(),!c.session||l){const p=this.chains.filter(v=>v.id!==a).map(v=>v.id);this.emit("message",{type:"connecting"}),await c.connect({pairingTopic:e,chains:[a],optionalChains:p.length?p:void 0}),Lr(this,Zu,Hh).call(this,this.chains.map(({id:v})=>v))}const u=await c.enable(),f=jn(u[0]),d=await this.getChainId(),h=this.isChainUnsupported(d);return{account:f,chain:{id:d,unsupported:h}}}catch(a){throw/user rejected/i.test(a==null?void 0:a.message)?new Or(a):a}}async disconnect(){const t=await this.getProvider();try{await t.disconnect()}catch(e){if(!/No matching key/i.test(e.message))throw e}finally{Lr(this,og,MS).call(this),Lr(this,Zu,Hh).call(this,[])}}async getAccount(){const{accounts:t}=await this.getProvider();return jn(t[0])}async getChainId(){const{chainId:t}=await this.getProvider();return t}async getProvider({chainId:t}={}){return He(this,ar)||await Lr(this,bm,n8).call(this),t&&await this.switchChain(t),He(this,ar)}async getWalletClient({chainId:t}={}){const[e,r]=await Promise.all([this.getProvider({chainId:t}),this.getAccount()]),n=this.chains.find(i=>i.id===t);if(!e)throw new Error("provider is required.");return Cp({account:r,chain:n,transport:c2(e)})}async isAuthorized(){try{const[t,e]=await Promise.all([this.getAccount(),this.getProvider()]),r=Lr(this,wm,i8).call(this);if(!t)return!1;if(r&&e.session){try{await e.disconnect()}catch{}return!1}return!0}catch{return!1}}async switchChain(t){var r,n;const e=this.chains.find(i=>i.id===t);if(!e)throw new aa(new Error("chain not found on connector."));try{const i=await this.getProvider(),s=Lr(this,cg,DS).call(this),o=Lr(this,lg,LS).call(this);if(!s.includes(t)&&o.includes(r8)){await i.request({method:r8,params:[{chainId:ze(e.id),blockExplorerUrls:[(n=(r=e.blockExplorers)==null?void 0:r.default)==null?void 0:n.url],chainName:e.name,nativeCurrency:e.nativeCurrency,rpcUrls:[...e.rpcUrls.default.http]}]});const c=Lr(this,ag,NS).call(this);c.push(t),Lr(this,Zu,Hh).call(this,c)}return await i.request({method:"wallet_switchEthereumChain",params:[{chainId:ze(t)}]}),e}catch(i){const s=typeof i=="string"?i:i==null?void 0:i.message;throw/user rejected request/i.test(s)?new Or(i):new aa(i)}}};ar=new WeakMap;S0=new WeakMap;bm=new WeakSet;n8=async function(){return!He(this,S0)&&typeof window<"u"&&Es(this,S0,Lr(this,$S,PW).call(this)),He(this,S0)};$S=new WeakSet;PW=async function(){const{EthereumProvider:t,OPTIONAL_EVENTS:e,OPTIONAL_METHODS:r}=await cS(()=>import("./index.es-044e61fa.js"),["./index.es-044e61fa.js","./events-fe40c1a3.js"],import.meta.url),[n,...i]=this.chains.map(({id:s})=>s);if(n){const{projectId:s,showQrModal:o=!0,qrModalOptions:a,metadata:c,relayUrl:l}=this.options;Es(this,ar,await t.init({showQrModal:o,qrModalOptions:a,projectId:s,optionalMethods:r,optionalEvents:e,chains:[n],optionalChains:i.length?i:void 0,rpcMap:Object.fromEntries(this.chains.map(u=>[u.id,u.rpcUrls.default.http[0]])),metadata:c,relayUrl:l}))}};wm=new WeakSet;i8=function(){if(Lr(this,lg,LS).call(this).includes(r8)||!this.options.isNewChainsStale)return!1;const e=Lr(this,ag,NS).call(this),r=this.chains.map(({id:i})=>i),n=Lr(this,cg,DS).call(this);return n.length&&!n.some(i=>r.includes(i))?!1:!r.every(i=>e.includes(i))};s8=new WeakSet;TW=function(){He(this,ar)&&(Lr(this,og,MS).call(this),He(this,ar).on("accountsChanged",this.onAccountsChanged),He(this,ar).on("chainChanged",this.onChainChanged),He(this,ar).on("disconnect",this.onDisconnect),He(this,ar).on("session_delete",this.onDisconnect),He(this,ar).on("display_uri",this.onDisplayUri),He(this,ar).on("connect",this.onConnect))};og=new WeakSet;MS=function(){He(this,ar)&&(He(this,ar).removeListener("accountsChanged",this.onAccountsChanged),He(this,ar).removeListener("chainChanged",this.onChainChanged),He(this,ar).removeListener("disconnect",this.onDisconnect),He(this,ar).removeListener("session_delete",this.onDisconnect),He(this,ar).removeListener("display_uri",this.onDisplayUri),He(this,ar).removeListener("connect",this.onConnect))};Zu=new WeakSet;Hh=function(t){var e;(e=this.storage)==null||e.setItem(_W,t)};ag=new WeakSet;NS=function(){var t;return((t=this.storage)==null?void 0:t.getItem(_W))??[]};cg=new WeakSet;DS=function(){var n,i,s;if(!He(this,ar))return[];const t=(n=He(this,ar).session)==null?void 0:n.namespaces;return t?((s=(i=SW(t)[AW])==null?void 0:i.chains)==null?void 0:s.map(o=>parseInt(o.split(":")[1]||"")))??[]:[]};lg=new WeakSet;LS=function(){var n,i;if(!He(this,ar))return[];const t=(n=He(this,ar).session)==null?void 0:n.namespaces;return t?((i=SW(t)[AW])==null?void 0:i.methods)??[]:[]};function Ae(){return Ae=Object.assign?Object.assign.bind():function(t){for(var e=1;e({account:l[0]}),this.onDisconnect=()=>{this==null||this.emit("disconnect")};const o=(r==null||(n=r.connect)==null||(n=n.settings)==null?void 0:n.signInOptions)||[],a=r==null||(i=r.connect)==null||(i=i.settings)==null?void 0:i.signInWith;if(r==null||(s=r.connect)==null||(s=s.settings)==null?void 0:s.signInWithEmail)this.id="email",this.name="Email";else if(a)this.id=a,this.name=`${a[0].toUpperCase()}${a.slice(1)}`;else if(o.length>0){const l=o[0],u=`${l[0].toUpperCase()}${l.slice(1)}`;this.id=l,this.name=u}this.provider=M4.initWallet(r.projectAccessKey,{defaultNetwork:r==null?void 0:r.defaultNetwork,transports:{walletAppURL:"https://sequence.app"},defaultEIP6492:!0,analytics:!1}),this.provider.on("chainChanged",l=>{this==null||this.emit("change",{chain:{id:o8(l),unsupported:!1}})}),this.provider.on("accountsChanged",l=>{this==null||this.emit("accountsChanged",this.onAccountsChanged(l))}),this.provider.on("disconnect",()=>{this.onDisconnect()})}async connect(){if(!this.provider.isConnected()){var e,r,n;this==null||this.emit("message",{type:"connecting"});const s=(e=this.options)==null?void 0:e.connect,o=localStorage.getItem(Dn.Theme),a=localStorage.getItem(Dn.EthAuthSettings),c=a?JSON.parse(a):{},l=Ae({authorize:!0},c,s,{settings:Ae({theme:o||"dark"},s==null?void 0:s.settings)}),u=await this.provider.connect(l);if(u.error)throw new Or(new Error(u.error));if(!u.connected)throw new Or(new Error("Wallet connection rejected"));const f=(r=u.proof)==null?void 0:r.proofString,d=(n=u.proof)==null?void 0:n.typedData;if(f){const h=JSON.stringify({proofString:f,typedData:d});localStorage.setItem(Dn.EthAuthProof,h)}}return{account:await this.getAccount(),chain:{id:this.provider.getChainId(),unsupported:this.isChainUnsupported(this.provider.getChainId())}}}async getWalletClient({chainId:e}={}){const r=this.chains.find(n=>n.id===e);return Cp({chain:r,account:await this.getAccount(),transport:c2(this.provider)})}onChainChanged(e){this.provider.setDefaultChainId(o8(e))}async switchChain(e){if(this.isChainUnsupported(e))throw new Error("Unsupported chain");return this.provider.setDefaultChainId(e),this.chains.find(r=>r.id===e)}async disconnect(){localStorage.removeItem(Dn.EthAuthProof),this.provider.disconnect()}getAccount(){return this.provider.getSigner().getAddress()}async getChainId(){return this.provider.getChainId()}async getProvider(){return this.provider}async getSigner(){return this.provider.getSigner()}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}isChainUnsupported(e){return this.provider.networks.findIndex(r=>r.chainId===e)===-1}}const o8=t=>typeof t=="object"?o8(t.chainId):typeof t=="string"?Number.parseInt(t,t.trim().substring(0,2)==="0x"?16:10):typeof t=="bigint"?Number(t):t;function ns(t){if(t==null)throw new TypeError("Cannot destructure "+t)}const lT=({isDarkMode:t})=>{const e=t?"white":"black";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 29 34",fill:"none"},i),S.createElement("path",{d:"M27.702 11.5918C27.5049 11.7448 24.0243 13.7068 24.0243 18.0694C24.0243 23.1155 28.4532 24.9007 28.5858 24.9449C28.5654 25.0537 27.8822 27.3897 26.2506 29.77C24.7958 31.8646 23.2765 33.9558 20.9651 33.9558C18.6538 33.9558 18.0589 32.6127 15.3907 32.6127C12.7904 32.6127 11.8659 34 9.75169 34C7.63748 34 6.1623 32.0618 4.46618 29.6816C2.50154 26.8865 0.914185 22.5443 0.914185 18.423C0.914185 11.8128 5.21057 8.30703 9.43897 8.30703C11.6857 8.30703 13.5586 9.78278 14.9692 9.78278C16.3118 9.78278 18.4056 8.21862 20.9617 8.21862C21.9304 8.21862 25.4111 8.30703 27.702 11.5918ZM19.7483 5.42014C20.8054 4.16542 21.5532 2.42444 21.5532 0.683468C21.5532 0.442044 21.5328 0.19722 21.4886 0C19.7687 0.0646065 17.7224 1.14591 16.4886 2.57746C15.5199 3.67917 14.6157 5.42014 14.6157 7.18492C14.6157 7.45014 14.6599 7.71537 14.6803 7.80038C14.7891 7.82078 14.9658 7.84458 15.1426 7.84458C16.6857 7.84458 18.6266 6.81088 19.7483 5.42014Z",fill:e})))}},uT=({isDarkMode:t})=>{const e=t?"#FFFFFF":"#000000";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},i),S.createElement("path",{d:"M27.166 20.8774C27.1338 17.335 30.0617 15.633 30.1936 15.5493C28.5463 13.1395 25.9852 12.8113 25.0714 12.7727C22.8932 12.5507 20.8179 14.0565 19.7111 14.0565C18.6043 14.0565 16.8991 12.8049 15.0909 12.8403C12.7131 12.8757 10.5221 14.2205 9.2962 16.3505C6.8284 20.6297 8.66557 26.9777 11.0722 30.4557C12.2498 32.1545 13.6494 34.0689 15.493 33.9981C17.2691 33.9273 17.9383 32.8495 20.0811 32.8495C22.224 32.8495 22.8289 33.9981 24.7014 33.9627C26.6094 33.9241 27.8191 32.2253 28.9871 30.5201C30.3352 28.5478 30.8918 26.6366 30.924 26.5369C30.8822 26.5208 27.2046 25.1116 27.166 20.8774Z",fill:e}),S.createElement("path",{d:"M23.6429 10.4722C24.621 9.28822 25.2806 7.64089 25.1004 6C23.6911 6.05791 21.9859 6.93949 20.9756 8.12351C20.0715 9.16917 19.2768 10.8455 19.4923 12.4542C21.0592 12.5764 22.6648 11.653 23.6429 10.4722Z",fill:e})))}},V5e=({chains:t,options:e})=>({id:"apple",isSequenceBased:!0,logoDark:lT({isDarkMode:!0}),logoLight:lT({isDarkMode:!1}),monochromeLogoDark:uT({isDarkMode:!0}),monochromeLogoLight:uT({isDarkMode:!1}),name:"Apple",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"apple"})})})})}}),fT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("rect",{width:"28",height:"28",fill:"#2C5FF6"}),S.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14 23.8C19.4124 23.8 23.8 19.4124 23.8 14C23.8 8.58761 19.4124 4.2 14 4.2C8.58761 4.2 4.2 8.58761 4.2 14C4.2 19.4124 8.58761 23.8 14 23.8ZM11.55 10.8C11.1358 10.8 10.8 11.1358 10.8 11.55V16.45C10.8 16.8642 11.1358 17.2 11.55 17.2H16.45C16.8642 17.2 17.2 16.8642 17.2 16.45V11.55C17.2 11.1358 16.8642 10.8 16.45 10.8H11.55Z",fill:"white"})))},G5e=t=>({id:"coinbase-wallet",logoDark:fT,logoLight:fT,name:"Coinbase Wallet",createConnector:()=>new o2e(Ae({},t))}),dT=({isDarkMode:t})=>{const e=t?"white":"black";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 35 34",fill:"none"},i),S.createElement("path",{d:"M17.0826 16.3805C17.1802 16.4598 17.32 16.4598 17.4176 16.3805L30.1401 6.04341C30.5283 5.72801 30.3053 5.09985 29.8051 5.09985H4.69499C4.19482 5.09985 3.9718 5.72801 4.35998 6.04341L17.0826 16.3805Z",fill:e}),S.createElement("path",{d:"M19.7626 19.2667L33.3838 8.19943C33.731 7.91735 34.2501 8.16441 34.2501 8.61174V24.2249C34.2501 26.5721 32.3473 28.4749 30.0001 28.4749H4.50006C2.15285 28.4749 0.250061 26.5721 0.250061 24.2249V8.61174C0.250061 8.16441 0.769134 7.91735 1.11631 8.19943L14.7375 19.2667C16.2014 20.4561 18.2987 20.4561 19.7626 19.2667Z",fill:e})))}},a8="@sequence.kit.connector.email",K5e=({chains:t,options:e})=>({id:"email",isSequenceBased:!0,logoDark:dT({isDarkMode:!0}),logoLight:dT({isDarkMode:!1}),name:"Email",createConnector:()=>{var r;const n=localStorage.getItem(a8);return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInOptions:["email"],signInWithEmail:n||""})})})})}}),hT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},e),S.createElement("path",{d:"M17.4214 36.9716C9.27855 35.5145 3.10712 28.4859 3.10712 20.0001C3.10712 10.5715 10.8214 2.85718 20.25 2.85718C29.6785 2.85718 37.3928 10.5715 37.3928 20.0001C37.3928 28.4859 31.2214 35.5145 23.0785 36.9716L22.1357 36.2002H18.3643L17.4214 36.9716Z",fill:"url(#paint0_linear_193_14528)"}),S.createElement("path",{d:"M26.9357 24.7999L27.7072 19.9999H23.1643V16.657C23.1643 15.2856 23.6786 14.257 25.7357 14.257H27.9643V9.88558C26.7643 9.71415 25.3929 9.54272 24.1929 9.54272C20.25 9.54272 17.5071 11.9427 17.5071 16.2285V19.9999H13.2214V24.7999H17.5071V36.8857C18.45 37.0571 19.3929 37.1429 20.3357 37.1429C21.2786 37.1429 22.2214 37.0571 23.1643 36.8857V24.7999H26.9357Z",fill:"white"}),S.createElement("defs",null,S.createElement("linearGradient",{id:"paint0_linear_193_14528",x1:"20.2508",y1:"35.9507",x2:"20.2508",y2:"2.85086",gradientUnits:"userSpaceOnUse"},S.createElement("stop",{"stop-color":"#0062E0"}),S.createElement("stop",{offset:"1","stop-color":"#19AFFF"})))))},pT=({isDarkMode:t})=>{const e=t?"#FFFFFF":"#000000";return n=>{let i=Ae({},(ns(n),n));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},i),S.createElement("path",{d:"M25.8582 10.4398C24.1222 10.4398 23.6288 11.2098 23.6288 12.9073V15.709H28.246L27.791 20.2476H23.6279V34H18.1024V20.2468H14.375V15.7081H18.1042V12.9851C18.1042 8.40625 19.9399 6 25.0891 6C26.1942 6 27.5163 6.0875 28.3055 6.19775V10.459",fill:e})))}},Q5e=({chains:t,options:e})=>({id:"facebook",isSequenceBased:!0,logoDark:hT,logoLight:hT,monochromeLogoDark:pT({isDarkMode:!0}),monochromeLogoLight:pT({isDarkMode:!1}),name:"Facebook",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"facebook"})})})})}}),vT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({viewBox:"0 0 41 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("g",{id:"Frame 2114"},S.createElement("g",{id:"Group"},S.createElement("path",{id:"Vector",d:"M20.7497 16.8828V23.5218H29.9756C29.5705 25.6568 28.3548 27.4647 26.5314 28.6803L32.095 32.9972C35.3366 30.0051 37.2068 25.6102 37.2068 20.3895C37.2068 19.1739 37.0977 18.005 36.895 16.883L20.7497 16.8828Z",fill:"#4285F4"}),S.createElement("path",{id:"Vector_2",d:"M11.1424 23.2627L9.88756 24.2232L5.44592 27.6829C8.2667 33.2777 14.0481 37.1427 20.7493 37.1427C25.3778 37.1427 29.2583 35.6154 32.0947 32.9973L26.5311 28.6803C25.0038 29.7089 23.0557 30.3324 20.7493 30.3324C16.2922 30.3324 12.5053 27.3246 11.1494 23.2726L11.1424 23.2627Z",fill:"#34A853"}),S.createElement("path",{id:"Vector_3",d:"M5.44594 12.3169C4.27718 14.6233 3.60712 17.2259 3.60712 19.9999C3.60712 22.7739 4.27718 25.3765 5.44594 27.6829C5.44594 27.6984 11.1499 23.2569 11.1499 23.2569C10.8071 22.2284 10.6044 21.1375 10.6044 19.9997C10.6044 18.8619 10.8071 17.7711 11.1499 16.7425L5.44594 12.3169Z",fill:"#FBBC05"}),S.createElement("path",{id:"Vector_4",d:"M20.7497 9.6829C23.2744 9.6829 25.5185 10.5556 27.3107 12.2387L32.2198 7.32972C29.2431 4.55574 25.3783 2.85693 20.7497 2.85693C14.0484 2.85693 8.2667 6.70628 5.44592 12.3167L11.1497 16.7427C12.5055 12.6907 16.2926 9.6829 20.7497 9.6829Z",fill:"#EA4335"})))))},mT=({isDarkMode:t})=>{const e=t?"white":"black";return n=>{let i=Ae({},(ns(n),n));return S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 41 40",fill:"none"},i),S.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25.8355 14.7613C24.5584 13.5329 22.9441 12.9032 21.1356 12.9032C17.9377 12.9032 15.2302 15.0813 14.2595 18.0232L14.2593 18.023C14.0142 18.7662 13.8712 19.5609 13.8712 20.3866C13.8712 21.2124 14.004 22.0072 14.2594 22.7504L14.2587 22.751H14.2595C15.2302 25.6929 17.9377 27.871 21.1356 27.871C22.7907 27.871 24.1904 27.4168 25.2939 26.6736V26.6732C26.5812 25.7958 27.4497 24.5055 27.746 22.9777H21.1355V18.3223H32.6808C32.8034 19.0758 32.875 19.85 32.875 20.6655C32.875 24.4332 31.5467 27.6126 29.2377 29.77L29.2378 29.7703C27.2148 31.6594 24.446 32.7742 21.1356 32.7742C16.3438 32.7742 12.2059 29.9871 10.1931 25.9407V25.94L10.193 25.9401C9.35521 24.2678 8.875 22.3891 8.875 20.3866C8.875 18.384 9.35521 16.5053 10.193 14.833H10.1934C12.2063 10.7869 16.344 8 21.1356 8C24.446 8 27.2148 9.22839 29.3298 11.231L25.8355 14.7613Z",fill:e}))}},Y5e=({chains:t,options:e})=>({id:"google",isSequenceBased:!0,logoDark:vT,logoLight:vT,monochromeLogoDark:mT({isDarkMode:!0}),monochromeLogoLight:mT({isDarkMode:!1}),name:"Google",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"google"})})})})}}),yT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("rect",{width:"28",height:"28"}),S.createElement("path",{d:"M24.0891 3.1199L15.3446 9.61456L16.9617 5.7828L24.0891 3.1199Z",fill:"#E2761B",stroke:"#E2761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M3.90207 3.1199L12.5763 9.67608L11.0383 5.7828L3.90207 3.1199Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M20.9429 18.1745L18.6139 21.7426L23.597 23.1136L25.0295 18.2536L20.9429 18.1745Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M2.97929 18.2536L4.40301 23.1136L9.38607 21.7426L7.05713 18.1745L2.97929 18.2536Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.10483 12.1456L7.71626 14.2461L12.6642 14.4658L12.4884 9.14877L9.10483 12.1456Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.8864 12.1456L15.4589 9.08725L15.3446 14.4658L20.2837 14.2461L18.8864 12.1456Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.38606 21.7426L12.3566 20.2925L9.79033 18.2888L9.38606 21.7426Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.6347 20.2925L18.6139 21.7426L18.2009 18.2888L15.6347 20.2925Z",fill:"#E4761B",stroke:"#E4761B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.6139 21.7426L15.6347 20.2925L15.8719 22.2348L15.8456 23.0521L18.6139 21.7426Z",fill:"#D7C1B3",stroke:"#D7C1B3",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.38606 21.7426L12.1544 23.0521L12.1368 22.2348L12.3566 20.2925L9.38606 21.7426Z",fill:"#D7C1B3",stroke:"#D7C1B3",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M12.1984 17.0056L9.72002 16.2762L11.4689 15.4765L12.1984 17.0056Z",fill:"#233447",stroke:"#233447",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.7928 17.0056L16.5223 15.4765L18.28 16.2762L15.7928 17.0056Z",fill:"#233447",stroke:"#233447",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.38606 21.7426L9.80791 18.1745L7.05712 18.2536L9.38606 21.7426Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.1921 18.1745L18.6139 21.7426L20.9429 18.2536L18.1921 18.1745Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M20.2837 14.2461L15.3446 14.4658L15.8016 17.0057L16.5311 15.4765L18.2888 16.2762L20.2837 14.2461Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.72002 16.2762L11.4777 15.4765L12.1984 17.0057L12.6642 14.4658L7.71626 14.2461L9.72002 16.2762Z",fill:"#CD6116",stroke:"#CD6116",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M7.71626 14.2461L9.79033 18.2888L9.72002 16.2762L7.71626 14.2461Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M18.2888 16.2762L18.2009 18.2888L20.2837 14.2461L18.2888 16.2762Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M12.6642 14.4658L12.1984 17.0057L12.7784 20.0025L12.9102 16.0565L12.6642 14.4658Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.3446 14.4658L15.1073 16.0477L15.2128 20.0025L15.8016 17.0057L15.3446 14.4658Z",fill:"#E4751F",stroke:"#E4751F",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.8016 17.0056L15.2128 20.0025L15.6347 20.2925L18.2009 18.2888L18.2888 16.2762L15.8016 17.0056Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.72002 16.2762L9.79033 18.2888L12.3566 20.2925L12.7784 20.0025L12.1984 17.0056L9.72002 16.2762Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.8456 23.0521L15.8719 22.2348L15.6522 22.0414H12.339L12.1368 22.2348L12.1544 23.0521L9.38606 21.7426L10.3528 22.5336L12.3126 23.8958H15.6786L17.6472 22.5336L18.6139 21.7426L15.8456 23.0521Z",fill:"#C0AD9E",stroke:"#C0AD9E",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.6347 20.2925L15.2128 20.0025H12.7784L12.3566 20.2925L12.1368 22.2348L12.339 22.0414H15.6522L15.8719 22.2348L15.6347 20.2925Z",fill:"#161616",stroke:"#161616",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M24.4583 10.0364L25.2053 6.45072L24.0891 3.1199L15.6347 9.39485L18.8864 12.1456L23.4827 13.4903L24.5022 12.3038L24.0628 11.9874L24.7658 11.3459L24.221 10.924L24.924 10.3879L24.4583 10.0364Z",fill:"#763D16",stroke:"#763D16",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M2.79472 6.45072L3.54174 10.0364L3.06717 10.3879L3.77024 10.924L3.23415 11.3459L3.93722 11.9874L3.4978 12.3038L4.50847 13.4903L9.10483 12.1456L12.3566 9.39485L3.90207 3.1199L2.79472 6.45072Z",fill:"#763D16",stroke:"#763D16",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M23.4827 13.4903L18.8864 12.1456L20.2837 14.2461L18.2009 18.2888L20.9429 18.2536H25.0295L23.4827 13.4903Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M9.10484 12.1456L4.50848 13.4903L2.97929 18.2536H7.05713L9.79033 18.2888L7.71626 14.2461L9.10484 12.1456Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"}),S.createElement("path",{d:"M15.3446 14.4658L15.6347 9.39485L16.9705 5.7828H11.0383L12.3566 9.39485L12.6642 14.4658L12.7696 16.0653L12.7784 20.0025H15.2128L15.2304 16.0653L15.3446 14.4658Z",fill:"#F6851B",stroke:"#F6851B",strokeWidth:"0.0878845",strokeLinecap:"round",strokeLinejoin:"round"})))},ug=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({xmlns:"http://www.w3.org/2000/svg",style:{fill:"none"},id:"svg1316",version:"1.1",viewBox:"0 0 396 396"},e),S.createElement("g",{transform:"translate(0,38)",id:"g1256",clipPath:"url(#clip0_5_131)"},S.createElement("g",{id:"g1254",clipPath:"url(#clip1_5_131)"},S.createElement("path",{style:{fill:"#111111"},id:"path1232",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint0_linear_5_13"},id:"path1234",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint1_linear_5_131"},id:"path1236",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint2_linear_5_131)"},id:"path1238",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint3_linear_5_131)"},id:"path1240",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint4_linear_5_131)"},id:"path1242",d:"m 98.9999,238.126 c 0,-10.965 -8.8648,-19.854 -19.8,-19.854 -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.966 8.8648,19.855 19.8,19.855 10.9352,0 19.8,-8.889 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint5_linear_5_131)"},id:"path1244",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint6_linear_5_131)"},id:"path1246",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint7_linear_5_131)"},id:"path1248",d:"M 316.8,59.5632 H 158.4 c -10.935,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.865,19.8544 19.8,19.8544 h 158.4 c 10.935,0 19.8,-8.8892 19.8,-19.8544 0,-10.9653 -8.865,-19.8544 -19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint8_linear_5_131)"},id:"path1250",d:"M 316.8,218.272 H 158.4 c -10.935,0 -19.8,8.889 -19.8,19.854 0,10.966 8.865,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.889 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}),S.createElement("path",{style:{fill:"url(#paint9_linear_5_131)"},id:"path1252",d:"M 237.6,138.981 H 79.2 c -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.965 8.8648,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.89 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}))),S.createElement("defs",{id:"defs1314"},S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"318",x2:"198",y1:"4.0585401e-05",x1:"198",id:"paint0_linear_5_131"},S.createElement("stop",{id:"stop1258",stopColor:"#1D273D"}),S.createElement("stop",{id:"stop1260",stopColor:"#0D0F13",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"63",x2:"92.5",y1:"99",x1:"65.5",id:"paint1_linear_5_131"},S.createElement("stop",{id:"stop1263",stopColor:"#4462FE"}),S.createElement("stop",{id:"stop1265",stopColor:"#7D69FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint2_linear_5_131"},S.createElement("stop",{id:"stop1268",stopColor:"#3757FD"}),S.createElement("stop",{id:"stop1270",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint3_linear_5_131"},S.createElement("stop",{id:"stop1273",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1275",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"223.5",x2:"91.5",y1:"251.5",x1:"65",id:"paint4_linear_5_131"},S.createElement("stop",{id:"stop1278",stopColor:"#BC3EE6"}),S.createElement("stop",{id:"stop1280",stopColor:"#D972F1",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"146",x2:"329.5",y1:"172",x1:"305",id:"paint5_linear_5_131"},S.createElement("stop",{id:"stop1283",stopColor:"#29BDFF"}),S.createElement("stop",{id:"stop1285",stopColor:"#96E7FB",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"176.772",x2:"334.56699",y1:"178.418",x1:"300.17999",id:"paint6_linear_5_131"},S.createElement("stop",{id:"stop1288",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1290",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"60",x2:"317.5",y1:"99",x1:"154.5",id:"paint7_linear_5_131"},S.createElement("stop",{id:"stop1293",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1295",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"218",x2:"312.5",y1:"258",x1:"156",id:"paint8_linear_5_131"},S.createElement("stop",{id:"stop1298",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1300",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"139",x2:"235.5",y1:"179",x1:"86.000099",id:"paint9_linear_5_131"},S.createElement("stop",{id:"stop1303",stopColor:"#6634FF"}),S.createElement("stop",{id:"stop1305",stopColor:"#9C6DFF",offset:"1"})),S.createElement("clipPath",{id:"clip0_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1308",height:"317.67001",width:"396"})),S.createElement("clipPath",{id:"clip1_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1311",height:"317.67001",width:"396"})))))};window.ethereum=window.ethereum||{};const J5e=({chains:t})=>({id:"metamask",logoDark:yT,logoLight:yT,name:"Metamask",createConnector:()=>new a2e({chains:t,options:{shimDisconnect:!0}})}),X5e=({chains:t,options:e})=>({id:"mock",isSequenceBased:!0,logoDark:ug,logoLight:ug,name:"Mock",createConnector:()=>{var r;return new l2e({chains:t,options:Ae({chainId:(e==null||(r=e.chain)==null?void 0:r.id)||137,walletClient:Cp({account:e.account,chain:(e==null?void 0:e.chain)||hme,transport:e.transport})},e)})}}),Z5e=({chains:t,options:e})=>({id:"sequence",isSequenceBased:!0,logoDark:ug,logoLight:ug,name:"Sequence",createConnector:()=>new Jd({chains:t,options:e})}),kv=({isDarkMode:t})=>{let e;return t===void 0?e="#9146FF":e=t?"white":"black",n=>(Ae({},(ns(n),n)),S.createElement(S.Fragment,null,S.createElement("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 2400 2800",transform:"scale(0.80)"},S.createElement("g",null,S.createElement("g",{id:"Layer_1-2"},S.createElement("path",{fill:e,d:"M500,0L0,500v1800h600v500l500-500h400l900-900V0H500z M2200,1300l-400,400h-400l-350,350v-350H600V200h1600 V1300z"}),S.createElement("rect",{x:"1700",y:"550",fill:e,width:"200",height:"600"}),S.createElement("rect",{x:"1150",y:"550",fill:e,width:"200",height:"600"}))))))},e6e=({chains:t,options:e})=>({id:"twitch",isSequenceBased:!0,logoDark:kv({}),logoLight:kv({}),monochromeLogoDark:kv({isDarkMode:!0}),monochromeLogoLight:kv({isDarkMode:!1}),name:"Twitch",createConnector:()=>{var r;return new Jd({chains:t,options:Ae({},e,{connect:Ae({},e==null?void 0:e.connect,{settings:Ae({},e==null||(r=e.connect)==null?void 0:r.settings,{signInWith:"twitch"})})})})}}),gT=t=>{let e=Ae({},(ns(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Ae({fill:"none",viewBox:"0 0 480 332",xmlns:"http://www.w3.org/2000/svg"},e),S.createElement("path",{d:"m126.613 93.9842c62.622-61.3123 164.152-61.3123 226.775 0l7.536 7.3788c3.131 3.066 3.131 8.036 0 11.102l-25.781 25.242c-1.566 1.533-4.104 1.533-5.67 0l-10.371-10.154c-43.687-42.7734-114.517-42.7734-158.204 0l-11.107 10.874c-1.565 1.533-4.103 1.533-5.669 0l-25.781-25.242c-3.132-3.066-3.132-8.036 0-11.102zm280.093 52.2038 22.946 22.465c3.131 3.066 3.131 8.036 0 11.102l-103.463 101.301c-3.131 3.065-8.208 3.065-11.339 0l-73.432-71.896c-.783-.767-2.052-.767-2.835 0l-73.43 71.896c-3.131 3.065-8.208 3.065-11.339 0l-103.4657-101.302c-3.1311-3.066-3.1311-8.036 0-11.102l22.9456-22.466c3.1311-3.065 8.2077-3.065 11.3388 0l73.4333 71.897c.782.767 2.051.767 2.834 0l73.429-71.897c3.131-3.065 8.208-3.065 11.339 0l73.433 71.897c.783.767 2.052.767 2.835 0l73.431-71.895c3.132-3.066 8.208-3.066 11.339 0z",fill:"#3396ff"})))},t6e=({chains:t,options:e})=>({id:"wallet-connect",logoDark:gT,logoLight:gT,name:"Walletconnect",createConnector:()=>new q5e({chains:t,options:e})}),r6e=({chains:t,walletConnectProjectId:e,defaultChainId:r,projectAccessKey:n,appName:i})=>{let s=t[0].id;if(r){const a=t.find(c=>c.id===r);a&&(s=a.id)}return KW([G5e({chains:t,options:{appName:i}}),K5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),Y5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),Q5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),e6e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),V5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}}),J5e({chains:t}),t6e({chains:t,options:{projectId:e}}),Z5e({chains:t,options:{defaultNetwork:s,projectAccessKey:n,connect:{app:i,projectAccessKey:n}}})])};function BS(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function Av(){}function bT(){return typeof WeakMap<"u"?new WeakMap:n6e()}function n6e(){return{add:Av,delete:Av,get:Av,set:Av,has:function(t){return!1}}}var i6e=Object.prototype.hasOwnProperty,c8=function(t,e){return i6e.call(t,e)};function Mx(t,e){for(var r in e)c8(e,r)&&(t[r]=e[r]);return t}var s6e=/^[ \t]*(?:\r\n|\r|\n)/,o6e=/(?:\r\n|\r|\n)[ \t]*$/,a6e=/^(?:[\r\n]|$)/,c6e=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,l6e=/^[ \t]*[\r\n][ \t\r\n]*$/;function wT(t,e,r){var n=0,i=t[0].match(c6e);i&&(n=i[1].length);var s="(\\r\\n|\\r|\\n).{0,"+n+"}",o=new RegExp(s,"g");e&&(t=t.slice(1));var a=r.newline,c=r.trimLeadingNewline,l=r.trimTrailingNewline,u=typeof a=="string",f=t.length,d=t.map(function(h,p){return h=h.replace(o,"$1"),p===0&&c&&(h=h.replace(s6e,"")),p===f-1&&l&&(h=h.replace(o6e,"")),u&&(h=h.replace(/\r\n|\n|\r/g,function(v){return a})),h});return d}function u6e(t,e){for(var r="",n=0,i=t.length;n{},registerClassName:()=>{},onEndFileScope:()=>{},registerComposition:()=>{},markCompositionUsed:()=>{},getIdentOption:()=>"short"},xm=[d6e],Cu=()=>{if(xm.length<1)throw new Error("No adapter configured");return xm[xm.length-1]},OW=!1,h6e=t=>{OW||p6e(t)},p6e=t=>{if(!t)throw new Error('No adapter provided when calling "setAdapter"');OW=!0,xm.push(t)},S2=function(){return Cu().appendCss(...arguments)},RW=function(){return Cu().registerClassName(...arguments)},v6e=function(){return Cu().registerComposition(...arguments)},$W=function(){return Cu().markCompositionUsed(...arguments)},m6e=function(){for(var e,r,n=arguments.length,i=new Array(n),s=0;sg?s(g):y));else throw new Error(`Invalid Chalk template style argument: ${p} (in style '${l}')`)}return f}function a(l){e.lastIndex=0;const u=[];let f;for(;(f=e.exec(l))!==null;){const d=f[1];if(f[2]){const h=o(d,f[2]);u.push([d].concat(h))}else u.push([d])}return u}function c(l,u){const f={};for(const h of u)for(const p of h.styles)f[p[0]]=h.inverse?null:p.slice(1);let d=l;for(const[h,p]of Object.entries(f))if(Array.isArray(p)){if(!(h in d))throw new Error(`Unknown Chalk style: ${h}`);d=p.length>0?d[h](...p):d[h]}return d}return Ux=(l,u)=>{const f=[],d=[];let h=[];if(u.replace(t,(p,v,m,g,y,b)=>{if(v)h.push(s(v));else if(g){const C=h.join("");h=[],d.push(f.length===0?C:c(l,f)(C)),f.push({inverse:m,styles:a(g)})}else if(y){if(f.length===0)throw new Error("Found extraneous } in Chalk template literal");d.push(c(l,f)(h.join(""))),h=[],f.pop()}else h.push(b)}),d.push(h.join("")),f.length>0){const p=`Chalk template literal is missing ${f.length} closing bracket${f.length===1?"":"s"} (\`}\`)`;throw new Error(p)}return d.join("")},Ux}const M1=C3e,{stdout:f8,stderr:d8}=S3e,{stringReplaceAll:T3e,stringEncaseCRLFWithFirstIndex:I3e}=_3e,{isArray:pg}=Array,jW=["ansi","ansi","ansi256","ansi16m"],Xd=Object.create(null),O3e=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=f8?f8.level:0;t.level=e.level===void 0?r:e.level};class R3e{constructor(e){return UW(e)}}const UW=t=>{const e={};return O3e(e,t),e.template=(...r)=>WW(e.template,...r),Object.setPrototypeOf(e,k2.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=R3e,e.template};function k2(t){return UW(t)}for(const[t,e]of Object.entries(M1))Xd[t]={get(){const r=A2(this,HS(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};Xd.visible={get(){const t=A2(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};const zW=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const t of zW)Xd[t]={get(){const{level:e}=this;return function(...r){const n=HS(M1.color[jW[e]][t](...r),M1.color.close,this._styler);return A2(this,n,this._isEmpty)}}};for(const t of zW){const e="bg"+t[0].toUpperCase()+t.slice(1);Xd[e]={get(){const{level:r}=this;return function(...n){const i=HS(M1.bgColor[jW[r]][t](...n),M1.bgColor.close,this._styler);return A2(this,i,this._isEmpty)}}}}const $3e=Object.defineProperties(()=>{},{...Xd,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),HS=(t,e,r)=>{let n,i;return r===void 0?(n=t,i=e):(n=r.openAll+t,i=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:i,parent:r}},A2=(t,e,r)=>{const n=(...i)=>pg(i[0])&&pg(i[0].raw)?LT(n,WW(n,...i)):LT(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,$3e),n._generator=t,n._styler=e,n._isEmpty=r,n},LT=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;const{openAll:n,closeAll:i}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=T3e(e,r.close,r.open),r=r.parent;const s=e.indexOf(` `);return s!==-1&&(e=I3e(e,i,n,s)),n+e+i};let zx;const WW=(t,...e)=>{const[r]=e;if(!pg(r)||!pg(r.raw))return e.join(" ");const n=e.slice(1),i=[r.raw[0]];for(let s=1;s{Wx.push(t)},registerClassName:t=>{FT.add(t)},registerComposition:t=>{jT.push(t)},markCompositionUsed:()=>{},onEndFileScope:t=>{var e=b3e({localClassNames:Array.from(FT),composedClassLists:jT,cssObjs:Wx}).join(` -`);w6e({fileScope:t,css:e}),Wx=[]},getIdentOption:()=>"short"};h6e(Q3e);function vg(t,e){return vg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},vg(t,e)}function Y3e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vg(t,e)}function h8(){h8=function(i,s){return new r(i,void 0,s)};var t=RegExp.prototype,e=new WeakMap;function r(i,s,o){var a=new RegExp(i,s);return e.set(a,o||e.get(i)),vg(a,r.prototype)}function n(i,s){var o=e.get(s);return Object.keys(o).reduce(function(a,c){var l=o[c];if(typeof l=="number")a[c]=i[l];else{for(var u=0;i[l[u]]===void 0&&u+1]+)>/g,function(c,l){var u=o[l];return"$"+(Array.isArray(u)?u.join("$"):u)}))}if(typeof s=="function"){var a=this;return t[Symbol.replace].call(this,i,function(){var c=arguments;return typeof c[c.length-1]!="object"&&(c=[].slice.call(c)).push(n(c,a)),s.apply(this,c)})}return t[Symbol.replace].call(this,i,s)},h8.apply(this,arguments)}function J3e(t){var{debugId:e,debugFileName:r}=t,n=e?[e.replace(/\s/g,"_")]:[];if(r){var{filePath:i}=po(),s=i.match(h8(/([^\/\\]*)?[\/\\]?([^\/\\]*)\.css\.(ts|js|tsx|jsx|cjs|mjs)$/,{dir:1,file:2}));if(s&&s.groups){var{dir:o,file:a}=s.groups;n.unshift(a&&a!=="index"?a:o)}}return n.join("_")}function UT(t){return t.match(/^[0-9]/)?"_".concat(t):t}function VS(t){var e=g6e(),{debugId:r,debugFileName:n=!0}=k0(k0({},typeof t=="string"?{debugId:t}:null),typeof t=="object"?t:null),i=b6e().toString(36),{filePath:s,packageName:o}=po(),a=BW(o?"".concat(o).concat(s):s),c="".concat(a).concat(i);if(e==="debug"){var l=J3e({debugId:r,debugFileName:n});return l&&(c="".concat(l,"__").concat(c)),UT(c)}if(typeof e=="function"){if(c=e({hash:c,debugId:r,filePath:s,packageName:o}),!c.match(/^[A-Z_][0-9A-Z_]+$/i))throw new Error('Identifier function returned invalid indentifier: "'.concat(c,'"'));return c}return UT(c)}function X3e(t,e){var r=VS(e);RW(r,po());var n=[],i=[];for(var s of t)typeof s=="string"?n.push(s):i.push(s);var o=r;if(n.length>0&&(o="".concat(r," ").concat(o3e(n)),v6e({identifier:r,classList:o},po()),i.length>0&&$W(r)),i.length>0){var a=K3e.all(i,{arrayMerge:(c,l)=>l});S2({type:"local",selector:r,rule:a},po())}return o}function Ii(t,e){if(Array.isArray(t))return X3e(t,e);var r=VS(e);return RW(r,po()),S2({type:"local",selector:r,rule:t},po()),r}function Ns(t,e){S2({type:"global",selector:t,rule:e},po())}function qW(t,e){var r=US(VS(e),{isIdentifier:!0});return S2({type:"keyframes",name:r,rule:t},po()),r}function Mc(){return Mc=Object.assign?Object.assign.bind():function(t){for(var e=1;e svg`,{width:"20px",height:"20px"});ku();const e8e=({onConnect:t,connectors:e})=>{const{theme:r}=ip(),{isLoading:n}=Vz();return S.createElement(q,{flexDirection:"column",gap:"2",marginTop:"5"},e.map(i=>{const s=r==="dark"?i._wallet.logoDark:i._wallet.logoLight,o=i._wallet.name;return S.createElement(q,{key:i.id,as:"button",flexDirection:"row",alignItems:"center",justifyContent:"space-between",background:"backgroundSecondary",color:"text100",borderRadius:"md",padding:"4",style:{height:"60px"},className:Z3e,onClick:()=>t(i)},S.createElement(ie,{variant:"medium",color:"text100"},o,n),S.createElement(q,{justifyContent:"center",alignItems:"center",style:{backgroundColor:i._wallet.iconBackground},borderRadius:"md",className:VW},S.createElement(s,null)))}))},t8e=({config:t={}})=>{const{signIn:e={}}=t,{logoUrl:r}=e;return S.createElement(S.Fragment,null,r&&S.createElement(q,{marginTop:"5",justifyContent:"center",alignItems:"center"},S.createElement(gr,{src:r,style:{height:"110px"}})))};let Dn=function(t){return t.Settings="@kit.settings",t.Theme="@kit.theme",t.EthAuthProof="@kit.ethAuthProof",t.EthAuthSettings="@kit.ethAuthSettings",t.ProjectAccessKey="@kit.projectAccessKey",t}({});const Hx={showEmailInput:!0,walletAuthOptions:["sequence","metamask","wallet-connect","coinbase-wallet"],socialAuthOptions:["google","facebook","twitch","apple"]},GW=60*60*24*7;function r8e(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}const n8e=["createConnector"],KW=t=>{const e=[],r=t.find(i=>i.id==="injected");return t.filter(i=>!r||!r.hideConnectorId?!0:i.id!==r.hideConnectorId).forEach(i=>{const s=r8e(i,n8e),o=i.createConnector(),a=Mc({},s),l=((u,f)=>{const d=u;return d._wallet=Mc({},f),d})(o,a);e.push(l)}),e},i8e=t=>/^\S+@\S+\.\S{2,}$/.test(t),v8={1:{name:"Ethereum",symbol:"ETH",logoURI:"https://assets.coingecko.com/coins/images/279/thumb/ethereum.png",decimals:18,blockExplorerName:"Etherscan",blockExplorerUrl:"https://etherscan.io"},5:{name:"Goerli",symbol:"ETH",decimals:18,logoURI:"https://assets.coingecko.com/coins/images/279/thumb/ethereum.png",blockExplorerName:"Etherscan (Goerli)",blockExplorerUrl:"https://goerli.etherscan.io"},10:{name:"Optimism",symbol:"OP",logoURI:"https://assets.coingecko.com/coins/images/25244/small/Optimism.png",decimals:18,blockExplorerName:"Etherscan (Optimism)",blockExplorerUrl:"https://optimistic.etherscan.io"},56:{name:"BNB",symbol:"BNB",logoURI:"https://assets.coingecko.com/coins/images/825/thumb/bnb-icon2_2x.png",decimals:18,blockExplorerName:"BscScan",blockExplorerUrl:"https://bscscan.com"},100:{name:"Gnosis",symbol:"GNO",logoURI:"https://assets.coingecko.com/coins/images/662/small/logo_square_simple_300px.png",decimals:18,blockExplorerUrl:"https://gnosisscan.io",blockExplorerName:"Gnosis Scan"},137:{name:"Polygon",symbol:"MATIC",logoURI:"https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png",decimals:18,blockExplorerName:"Polyscan",blockExplorerUrl:"https://polygonscan.com"},1101:{name:"Polygon zkEVM",symbol:"ETH",logoURI:"https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png",decimals:18,blockExplorerName:"PolygonScan",blockExplorerUrl:"https://zkevm.polygonscan.com"},42161:{name:"Arbitrum",symbol:"ARB",logoURI:"https://assets.coingecko.com/asset_platforms/images/33/small/arbitrum-one.png",decimals:18,blockExplorerName:"Arbiscan",blockExplorerUrl:"https://arbiscan.io"},43114:{name:"Avalanche",symbol:"AVAX",logoURI:"https://assets.coingecko.com/coins/images/12559/small/Avalanche_Circle_RedWhite_Trans.png",decimals:18,blockExplorerName:"Snowtrace",blockExplorerUrl:"https://snowtrace.io"},80001:{name:"Mumbai",symbol:"MATIC",logoURI:"https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png",decimals:18,blockExplorerName:"Polyscan (Mumbai)",blockExplorerUrl:"https://mumbai.polygonscan.com"}},s8e=(t,e)=>{const r=e.find(s=>s.id===t);if(r){var n,i;return{name:r.name,symbol:r.nativeCurrency.symbol,decimals:r.nativeCurrency.decimals,logoURI:v8[1].logoURI,blockExplorerName:(n=r.blockExplorers)==null?void 0:n.default.name,blockExplorerUrl:(i=r.blockExplorers)==null?void 0:i.default.url}}},Rr=(t,e)=>v8[t]||s8e(t,e)||v8[1],Yc=()=>{const t=S.createContext(void 0);return[()=>{const r=S.useContext(t);if(!r)throw new Error("useGenericContext must be used within a Provider");return r},t.Provider]},KS=t=>{switch(t){case"top-right":return{top:"0px",right:"0px"};case"top-left":return{top:"0px",left:"0px"};case"top-center":return{top:"0px"};case"bottom-right":return{bottom:"0px",right:"0px"};case"bottom-left":return{bottom:"0px",left:"0px"};case"bottom-center":return{bottom:"0px"};case"middle-right":return{right:"0px"};case"middle-left":return{left:"0px"};case"center":default:return{}}},o8e=(t,e="light")=>{switch(t){case 1:return"#abf";case 137:return"#c7a6ff";case 42161:return"#52A7E6";case 10:return"#DB3132";case 56:return e==="light"?"#CB9C1D":"#EEB445";case 43114:return"#E84142";case 100:return e==="light"?"#00193C":"#D8E8FF";case 5:return e==="light"?"#A77A00":"#FFA700";case 80001:return e==="light"?"#D68828":"#FFA700";default:return"#abf"}},a8e=(t,e="light")=>{switch(t){case 1:return"#132362";case 137:return"#350881";case 42161:return e==="light"?"#EDF7FF":"#0C3754";case 10:return e==="light"?"#FFEAE9":"#390B0C";case 56:return e==="light"?"#FFE8AB":"#554018";case 43114:return e==="light"?"#FBDFDF":"#390B0C";case 100:return e==="light"?"#D8E8FF":"#00193C";case 5:return e==="light"?"#FFD871":"#554018";case 80001:return e==="light"?"#FFE8CD":"#554018";default:return"#132362"}};function c8e(t){var e;const{account:r,chain:n,transport:i}=t,s={chainId:n.id,name:n.name,ensAddress:(e=n.contracts)==null||(e=e.ensRegistry)==null?void 0:e.address};return new VM(i,s).getSigner(r.address)}function l8e(t){var e;const{chain:r,transport:n}=t,i={chainId:r.id,name:r.name,ensAddress:(e=r.contracts)==null||(e=e.ensRegistry)==null?void 0:e.address};return n.type==="fallback"?new _Z(n.transports.map(({value:s})=>new ta(s==null?void 0:s.url,i))):new ta(n.url,i)}const u8e=async t=>{const e=localStorage.getItem(Dn.EthAuthProof);if(e)return JSON.parse(e);const r=localStorage.getItem(Dn.EthAuthSettings);if(!r)throw new Error("No ETHAuth settings found");const n=JSON.parse(r),i=t.account.address,s=new Mb;s.address=i,s.claims.app=n.app||"app",s.claims.ogn=n.origin,s.claims.n=n.nonce,s.setExpiryIn(n.expiry?Math.max(n.expiry,200):GW);const o=s.messageTypedData();o.domain.verifyingContract;const c=await c8e(t)._signTypedData(o.domain,o.types,o.message);s.signature=c;const u=await new c1().encodeProof(s,!0);return{typedData:o,proofString:u}},f8e=async(t,e,r)=>{const n=t.account.address,s=await new c1().decodeProof(r.proofString,!0),o=l8e(e);return await M4.utils.isValidTypedDataSignature(n,r.typedData,s.signature,o)},pn=t=>{const e=Wt[t];if(!e)throw"invalid network";const r=localStorage.getItem(Dn.ProjectAccessKey)||void 0,n=new S4("https://metadata.sequence.app",r),i=new C4(r4(e.name),r),s=new d0("https://api.sequence.app",r);return{network:e,metadataClient:n,indexerClient:i,apiClient:s}},d8e=t=>{const{isConnected:e}=fn(),{theme:r}=ip(),{config:n={}}=t,{signIn:i={}}=n,{showEmailInput:s=Hx.showEmailInput,socialAuthOptions:o=Hx.socialAuthOptions,walletAuthOptions:a=Hx.walletAuthOptions}=i,{openConnectModal:c,setOpenConnectModal:l}=t,[u,f]=k.useState(""),{connectors:d,connect:h,isLoading:p}=Vz(),v=d,[m,g]=k.useState(!1),y=v.find(B=>B.id==="mock"),b=v.find(B=>B._wallet.id==="email"),C=v.filter(B=>!!a.find(H=>H===B._wallet.id)).sort((B,z)=>a.indexOf(B._wallet.id)-a.indexOf(z._wallet.id)),A=v.filter(B=>!!o.find(H=>H===B._wallet.id)).sort((B,z)=>o.indexOf(B._wallet.id)-o.indexOf(z._wallet.id));C.length>4;const O=B=>{f(B.target.value)};k.useEffect(()=>{e&&c&&l(!1)},[e,c]);const w=B=>{if(i.useMock&&y){h({connector:y});return}if(B._wallet.id==="email"){const z=prompt("Auto-email login, please specify the email address:");localStorage.setItem(a8,z||"")}h({connector:B})},I=B=>{if(i.useMock&&y){h({connector:y});return}B.preventDefault(),localStorage.setItem(a8,u),h({connector:b})};return m?S.createElement(S.Fragment,null,S.createElement(q,{as:"button",position:"absolute",style:{top:"20px"},onClick:()=>g(!1),className:Em},S.createElement(yb,null)),S.createElement(e8e,{connectors:C,onConnect:w})):S.createElement(S.Fragment,null,S.createElement(t8e,{config:n}),S.createElement(q,{marginTop:"5"},b&&s&&S.createElement(S.Fragment,null,S.createElement("form",{onSubmit:I},S.createElement(qc,{onChange:O,value:u,name:"email",placeholder:"Enter email","data-1p-ignore":!0}),S.createElement(nt,{type:"submit",disabled:!i8e(u),marginTop:"4",width:"full",label:"Continue",rightIcon:qo}))),A.length>0&&S.createElement(S.Fragment,null,b&&s&&S.createElement(S.Fragment,null,S.createElement(q,{style:{marginBottom:"-4px"}},S.createElement(i1,{color:"backgroundSecondary"})),S.createElement(q,{justifyContent:"center",alignItems:"center"},S.createElement(ie,{variant:"small",color:"text50"},"or sign in via"))),S.createElement(q,{marginTop:"3",gap:"2",flexDirection:"row",justifyContent:"center",alignItems:"center",flexWrap:"wrap"},A.map(B=>{const z=r==="dark"?B._wallet.monochromeLogoDark:B._wallet.monochromeLogoLight;return S.createElement(Eo,{key:B._wallet.id,className:Em,justifyContent:"center",alignItems:"center",onClick:()=>w(B),aspectRatio:"1/1",style:{width:`calc(25% - ${ve.space[2]})`}},S.createElement(q,{className:p8,flexDirection:"column",alignItems:"center",justifyContent:"center"},S.createElement(z,null)))}))),C.length>0&&S.createElement(S.Fragment,null,(b&&s||A.length>0)&&S.createElement(S.Fragment,null,S.createElement(q,{style:{marginBottom:"-4px"}},S.createElement(i1,{color:"backgroundSecondary"})),S.createElement(q,{justifyContent:"center",alignItems:"center"},S.createElement(ie,{variant:"small",color:"text50"},"or select a wallet"))),S.createElement(q,{marginTop:"3",gap:"2",flexDirection:"row",justifyContent:"center",alignItems:"center"},C.map(B=>{const z=r==="dark"?B._wallet.logoDark||B._wallet.logoDark:B._wallet.logoLight||B._wallet.logoLight;return S.createElement(Eo,{key:B._wallet.id,className:Em,justifyContent:"center",alignItems:"center",onClick:()=>w(B),aspectRatio:"1/1",style:{width:`calc(25% - ${ve.space[2]})`}},S.createElement(q,{className:p8,flexDirection:"column",alignItems:"center",justifyContent:"center"},S.createElement(z,null)))})))))};function h8e(t){if(t==null)throw new TypeError("Cannot destructure "+t)}const p8e=t=>{let e=Mc({},(h8e(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Mc({xmlns:"http://www.w3.org/2000/svg",style:{fill:"none"},id:"svg1316",version:"1.1",viewBox:"0 0 396 396"},e),S.createElement("g",{transform:"translate(0,38)",id:"g1256",clipPath:"url(#clip0_5_131)"},S.createElement("g",{id:"g1254",clipPath:"url(#clip1_5_131)"},S.createElement("path",{style:{fill:"#111111"},id:"path1232",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint0_linear_5_13"},id:"path1234",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint1_linear_5_131"},id:"path1236",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint2_linear_5_131)"},id:"path1238",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint3_linear_5_131)"},id:"path1240",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint4_linear_5_131)"},id:"path1242",d:"m 98.9999,238.126 c 0,-10.965 -8.8648,-19.854 -19.8,-19.854 -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.966 8.8648,19.855 19.8,19.855 10.9352,0 19.8,-8.889 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint5_linear_5_131)"},id:"path1244",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint6_linear_5_131)"},id:"path1246",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint7_linear_5_131)"},id:"path1248",d:"M 316.8,59.5632 H 158.4 c -10.935,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.865,19.8544 19.8,19.8544 h 158.4 c 10.935,0 19.8,-8.8892 19.8,-19.8544 0,-10.9653 -8.865,-19.8544 -19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint8_linear_5_131)"},id:"path1250",d:"M 316.8,218.272 H 158.4 c -10.935,0 -19.8,8.889 -19.8,19.854 0,10.966 8.865,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.889 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}),S.createElement("path",{style:{fill:"url(#paint9_linear_5_131)"},id:"path1252",d:"M 237.6,138.981 H 79.2 c -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.965 8.8648,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.89 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}))),S.createElement("defs",{id:"defs1314"},S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"318",x2:"198",y1:"4.0585401e-05",x1:"198",id:"paint0_linear_5_131"},S.createElement("stop",{id:"stop1258",stopColor:"#1D273D"}),S.createElement("stop",{id:"stop1260",stopColor:"#0D0F13",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"63",x2:"92.5",y1:"99",x1:"65.5",id:"paint1_linear_5_131"},S.createElement("stop",{id:"stop1263",stopColor:"#4462FE"}),S.createElement("stop",{id:"stop1265",stopColor:"#7D69FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint2_linear_5_131"},S.createElement("stop",{id:"stop1268",stopColor:"#3757FD"}),S.createElement("stop",{id:"stop1270",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint3_linear_5_131"},S.createElement("stop",{id:"stop1273",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1275",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"223.5",x2:"91.5",y1:"251.5",x1:"65",id:"paint4_linear_5_131"},S.createElement("stop",{id:"stop1278",stopColor:"#BC3EE6"}),S.createElement("stop",{id:"stop1280",stopColor:"#D972F1",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"146",x2:"329.5",y1:"172",x1:"305",id:"paint5_linear_5_131"},S.createElement("stop",{id:"stop1283",stopColor:"#29BDFF"}),S.createElement("stop",{id:"stop1285",stopColor:"#96E7FB",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"176.772",x2:"334.56699",y1:"178.418",x1:"300.17999",id:"paint6_linear_5_131"},S.createElement("stop",{id:"stop1288",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1290",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"60",x2:"317.5",y1:"99",x1:"154.5",id:"paint7_linear_5_131"},S.createElement("stop",{id:"stop1293",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1295",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"218",x2:"312.5",y1:"258",x1:"156",id:"paint8_linear_5_131"},S.createElement("stop",{id:"stop1298",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1300",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"139",x2:"235.5",y1:"179",x1:"86.000099",id:"paint9_linear_5_131"},S.createElement("stop",{id:"stop1303",stopColor:"#6634FF"}),S.createElement("stop",{id:"stop1305",stopColor:"#9C6DFF",offset:"1"})),S.createElement("clipPath",{id:"clip0_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1308",height:"317.67001",width:"396"})),S.createElement("clipPath",{id:"clip1_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1311",height:"317.67001",width:"396"})))))},[QW,v8e]=Yc(),[m8e,y8e]=Yc(),[g8e,b8e]=Yc(),[w8e,x8e]=Yc(),E8e={dark:"dark",light:"light"},C8e=t=>{const{config:e,children:r}=t,{projectAccessKey:n,defaultTheme:i="dark",signIn:s={},position:o="center",displayedAssets:a=[],ethAuth:c={},analytics:l}=e,u=s.projectName||"app",{expiry:f=GW,app:d=u,origin:h=location.origin,nonce:p}=c,{projectName:v}=s,[m,g]=k.useState(!1),[y,b]=k.useState(i||E8e.dark),[C,A]=k.useState(o),[O,w]=k.useState(a),[I,B]=k.useState(),{address:z,isConnected:H}=fn(),K=(x,P)=>{if(P){B(P);return}const D=M4.initWallet(x).client.analytics;B(D)};k.useEffect(()=>{if(!H){I==null||I.reset();return}z&&(I==null||I.identify(z.toLowerCase()))},[I,z,H]);const F=()=>{window.open("https://sequence.xyz")};return k.useEffect(()=>{K(n,l),localStorage.setItem(Dn.ProjectAccessKey,n)},[n,l]),k.useEffect(()=>{y!==i&&b(i)},[i]),k.useEffect(()=>{C!==o&&A(o)},[o]),k.useEffect(()=>{typeof y=="object"||localStorage.setItem(Dn.Theme,y),localStorage.setItem(Dn.EthAuthSettings,JSON.stringify({expiry:f,app:d,origin:h,nonce:p}))},[y,c]),k.useEffect(()=>{w(O)},[a]),S.createElement(b8e,{value:{theme:y,setTheme:b,position:C,setPosition:A}},S.createElement(y8e,{value:{setOpenConnectModal:g,openConnectModalState:m}},S.createElement(x8e,{value:{setDisplayedAssets:w,displayedAssets:O}},S.createElement(v8e,{value:{setAnalytics:B,analytics:I}},S.createElement("div",{id:"kit-provider"},S.createElement(_b,{root:"#kit-provider",scope:"kit",theme:y},S.createElement(db,null,m&&S.createElement(HC,{scroll:!1,backdropColor:"backgroundBackdrop",size:"sm",contentProps:{style:Mc({maxWidth:"364px"},KS(o))},onClose:()=>g(!1)},S.createElement(q,{padding:"4",className:GS},S.createElement(q,{justifyContent:"center",color:"text100",alignItems:"center",fontWeight:"medium",style:{marginTop:"4px"}},S.createElement(ie,null,"Sign in ",v?`to ${v}`:"")),S.createElement(d8e,Mc({openConnectModal:m,setOpenConnectModal:g},t)),S.createElement(q,{onClick:F,className:Em,gap:"1",marginTop:"2",flexDirection:"row",alignItems:"center",justifyContent:"center"},S.createElement(ie,{fontSize:"small",color:"text100"},"Powered by Sequence"),S.createElement(q,{height:"5",width:"5"},S.createElement(p8e,null)))))))),r))))},S8e=()=>{const{setOpenConnectModal:t,openConnectModalState:e}=m8e();return{setOpenConnectModal:t,openConnectModalState:e}},Pp=()=>{const{setTheme:t,theme:e,position:r,setPosition:n}=g8e();return{setTheme:t,theme:e,position:r,setPosition:n}},k8e=()=>{const{setDisplayedAssets:t,displayedAssets:e}=w8e();return{displayedAssets:e,setDisplayedAssets:t}};function A8e(t,e,r){return t===t&&(r!==void 0&&(t=t<=r?t:r),e!==void 0&&(t=t>=e?t:e)),t}var YW=A8e;function _8e(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r-1&&t%1==0&&t-1&&t%1==0&&t<=IEe}var sH=OEe,REe=_2,$Ee=sH,MEe=P2,NEe="[object Arguments]",DEe="[object Array]",LEe="[object Boolean]",BEe="[object Date]",FEe="[object Error]",jEe="[object Function]",UEe="[object Map]",zEe="[object Number]",WEe="[object Object]",HEe="[object RegExp]",qEe="[object Set]",VEe="[object String]",GEe="[object WeakMap]",KEe="[object ArrayBuffer]",QEe="[object DataView]",YEe="[object Float32Array]",JEe="[object Float64Array]",XEe="[object Int8Array]",ZEe="[object Int16Array]",eCe="[object Int32Array]",tCe="[object Uint8Array]",rCe="[object Uint8ClampedArray]",nCe="[object Uint16Array]",iCe="[object Uint32Array]",Ht={};Ht[YEe]=Ht[JEe]=Ht[XEe]=Ht[ZEe]=Ht[eCe]=Ht[tCe]=Ht[rCe]=Ht[nCe]=Ht[iCe]=!0;Ht[NEe]=Ht[DEe]=Ht[KEe]=Ht[LEe]=Ht[QEe]=Ht[BEe]=Ht[FEe]=Ht[jEe]=Ht[UEe]=Ht[zEe]=Ht[WEe]=Ht[HEe]=Ht[qEe]=Ht[VEe]=Ht[GEe]=!1;function sCe(t){return MEe(t)&&$Ee(t.length)&&!!Ht[REe(t)]}var oCe=sCe;function aCe(t){return function(e){return t(e)}}var cCe=aCe,yg={exports:{}};yg.exports;(function(t,e){var r=XW,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===n,o=s&&r.process,a=function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();t.exports=a})(yg,yg.exports);var lCe=yg.exports,uCe=oCe,fCe=cCe,VT=lCe,GT=VT&&VT.isTypedArray,dCe=GT?fCe(GT):uCe,hCe=dCe,pCe=V8e,vCe=EEe,mCe=nH,yCe=AEe,gCe=iH,bCe=hCe,wCe=Object.prototype,xCe=wCe.hasOwnProperty;function ECe(t,e){var r=mCe(t),n=!r&&vCe(t),i=!r&&!n&&yCe(t),s=!r&&!n&&!i&&bCe(t),o=r||n||i||s,a=o?pCe(t.length,String):[],c=a.length;for(var l in t)(e||xCe.call(t,l))&&!(o&&(l=="length"||i&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||gCe(l,c)))&&a.push(l);return a}var CCe=ECe,SCe=Object.prototype;function kCe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||SCe;return t===r}var ACe=kCe;function _Ce(t,e){return function(r){return t(e(r))}}var PCe=_Ce,TCe=PCe,ICe=TCe(Object.keys,Object),OCe=ICe,RCe=ACe,$Ce=OCe,MCe=Object.prototype,NCe=MCe.hasOwnProperty;function DCe(t){if(!RCe(t))return $Ce(t);var e=[];for(var r in Object(t))NCe.call(t,r)&&r!="constructor"&&e.push(r);return e}var LCe=DCe;function BCe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var QS=BCe,FCe=_2,jCe=QS,UCe="[object AsyncFunction]",zCe="[object Function]",WCe="[object GeneratorFunction]",HCe="[object Proxy]";function qCe(t){if(!jCe(t))return!1;var e=FCe(t);return e==zCe||e==WCe||e==UCe||e==HCe}var VCe=qCe,GCe=VCe,KCe=sH;function QCe(t){return t!=null&&KCe(t.length)&&!GCe(t)}var oH=QCe,YCe=CCe,JCe=LCe,XCe=oH;function ZCe(t){return XCe(t)?YCe(t):JCe(t)}var e4e=ZCe,t4e=H8e,r4e=e4e;function n4e(t){return t==null?[]:t4e(t,r4e(t))}var i4e=n4e,s4e=YW,o4e=JW,a4e=i4e;function c4e(t,e){var r=a4e(t);return o4e(r,s4e(e,0,r.length))}var l4e=c4e;function u4e(t,e){return t===e||t!==t&&e!==e}var f4e=u4e,d4e=f4e,h4e=oH,p4e=iH,v4e=QS;function m4e(t,e,r){if(!v4e(r))return!1;var n=typeof e;return(n=="number"?h4e(r)&&p4e(e,r.length):n=="string"&&e in r)?d4e(r[e],t):!1}var y4e=m4e,g4e=/\s/;function b4e(t){for(var e=t.length;e--&&g4e.test(t.charAt(e)););return e}var w4e=b4e,x4e=w4e,E4e=/^\s+/;function C4e(t){return t&&t.slice(0,x4e(t)+1).replace(E4e,"")}var S4e=C4e,k4e=_2,A4e=P2,_4e="[object Symbol]";function P4e(t){return typeof t=="symbol"||A4e(t)&&k4e(t)==_4e}var T4e=P4e,I4e=S4e,KT=QS,O4e=T4e,QT=0/0,R4e=/^[-+]0x[0-9a-f]+$/i,$4e=/^0b[01]+$/i,M4e=/^0o[0-7]+$/i,N4e=parseInt;function D4e(t){if(typeof t=="number")return t;if(O4e(t))return QT;if(KT(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=KT(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=I4e(t);var r=$4e.test(t);return r||M4e.test(t)?N4e(t.slice(2),r?2:8):R4e.test(t)?QT:+t}var L4e=D4e,B4e=L4e,YT=1/0,F4e=17976931348623157e292;function j4e(t){if(!t)return t===0?t:0;if(t=B4e(t),t===YT||t===-YT){var e=t<0?-1:1;return e*F4e}return t===t?t:0}var U4e=j4e,z4e=U4e;function W4e(t){var e=z4e(t),r=e%1;return e===e?r?e-r:e:0}var H4e=W4e,q4e=F8e,V4e=l4e,G4e=nH,K4e=y4e,Q4e=H4e;function Y4e(t,e,r){(r?K4e(t,e,r):e===void 0)?e=1:e=Q4e(e);var n=G4e(t)?q4e:V4e;return n(t,e)}var J4e=Y4e;const X4e=ki(J4e);var T2={},Z4e=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],n=0;n"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=JT[e.format]||JT.default;window.clipboardData.setData(f,t)}else u.clipboardData.clearData(),u.clipboardData.setData(e.format,t);e.onCopy&&(u.preventDefault(),e.onCopy(u.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=rSe("message"in e?e.message:tSe),window.prompt(n,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var iSe=nSe;function m8(t){"@babel/helpers - typeof";return m8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m8(t)}Object.defineProperty(T2,"__esModule",{value:!0});T2.CopyToClipboard=void 0;var Pv=aH(k),sSe=aH(iSe),oSe=["text","onCopy","options","children"];function aH(t){return t&&t.__esModule?t:{default:t}}function XT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ZT(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function cSe(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}function lSe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function eI(t,e){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gg(t){return gg=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},gg(t)}function YS(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var lH=function(t){fSe(r,t);var e=dSe(r);function r(){var n;lSe(this,r);for(var i=arguments.length,s=new Array(i),o=0;oe in t?mSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D1=(t,e)=>{for(var r in e||(e={}))fH.call(e,r)&&tI(t,r,e[r]);if(bg)for(var r of bg(e))dH.call(e,r)&&tI(t,r,e[r]);return t},JS=(t,e)=>{var r={};for(var n in t)fH.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&bg)for(var n of bg(t))e.indexOf(n)<0&&dH.call(t,n)&&(r[n]=t[n]);return r};/** +`);w6e({fileScope:t,css:e}),Wx=[]},getIdentOption:()=>"short"};h6e(Q3e);function vg(t,e){return vg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},vg(t,e)}function Y3e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vg(t,e)}function h8(){h8=function(i,s){return new r(i,void 0,s)};var t=RegExp.prototype,e=new WeakMap;function r(i,s,o){var a=new RegExp(i,s);return e.set(a,o||e.get(i)),vg(a,r.prototype)}function n(i,s){var o=e.get(s);return Object.keys(o).reduce(function(a,c){var l=o[c];if(typeof l=="number")a[c]=i[l];else{for(var u=0;i[l[u]]===void 0&&u+1]+)>/g,function(c,l){var u=o[l];return"$"+(Array.isArray(u)?u.join("$"):u)}))}if(typeof s=="function"){var a=this;return t[Symbol.replace].call(this,i,function(){var c=arguments;return typeof c[c.length-1]!="object"&&(c=[].slice.call(c)).push(n(c,a)),s.apply(this,c)})}return t[Symbol.replace].call(this,i,s)},h8.apply(this,arguments)}function J3e(t){var{debugId:e,debugFileName:r}=t,n=e?[e.replace(/\s/g,"_")]:[];if(r){var{filePath:i}=po(),s=i.match(h8(/([^\/\\]*)?[\/\\]?([^\/\\]*)\.css\.(ts|js|tsx|jsx|cjs|mjs)$/,{dir:1,file:2}));if(s&&s.groups){var{dir:o,file:a}=s.groups;n.unshift(a&&a!=="index"?a:o)}}return n.join("_")}function UT(t){return t.match(/^[0-9]/)?"_".concat(t):t}function VS(t){var e=g6e(),{debugId:r,debugFileName:n=!0}=k0(k0({},typeof t=="string"?{debugId:t}:null),typeof t=="object"?t:null),i=b6e().toString(36),{filePath:s,packageName:o}=po(),a=BW(o?"".concat(o).concat(s):s),c="".concat(a).concat(i);if(e==="debug"){var l=J3e({debugId:r,debugFileName:n});return l&&(c="".concat(l,"__").concat(c)),UT(c)}if(typeof e=="function"){if(c=e({hash:c,debugId:r,filePath:s,packageName:o}),!c.match(/^[A-Z_][0-9A-Z_]+$/i))throw new Error('Identifier function returned invalid indentifier: "'.concat(c,'"'));return c}return UT(c)}function X3e(t,e){var r=VS(e);RW(r,po());var n=[],i=[];for(var s of t)typeof s=="string"?n.push(s):i.push(s);var o=r;if(n.length>0&&(o="".concat(r," ").concat(o3e(n)),v6e({identifier:r,classList:o},po()),i.length>0&&$W(r)),i.length>0){var a=K3e.all(i,{arrayMerge:(c,l)=>l});S2({type:"local",selector:r,rule:a},po())}return o}function Ii(t,e){if(Array.isArray(t))return X3e(t,e);var r=VS(e);return RW(r,po()),S2({type:"local",selector:r,rule:t},po()),r}function Ns(t,e){S2({type:"global",selector:t,rule:e},po())}function qW(t,e){var r=US(VS(e),{isIdentifier:!0});return S2({type:"keyframes",name:r,rule:t},po()),r}function Mc(){return Mc=Object.assign?Object.assign.bind():function(t){for(var e=1;e svg`,{width:"20px",height:"20px"});ku();const e8e=({onConnect:t,connectors:e})=>{const{theme:r}=ip(),{isLoading:n}=Vz();return S.createElement(q,{flexDirection:"column",gap:"2",marginTop:"5"},e.map(i=>{const s=r==="dark"?i._wallet.logoDark:i._wallet.logoLight,o=i._wallet.name;return S.createElement(q,{key:i.id,as:"button",flexDirection:"row",alignItems:"center",justifyContent:"space-between",background:"backgroundSecondary",color:"text100",borderRadius:"md",padding:"4",style:{height:"60px"},className:Z3e,onClick:()=>t(i)},S.createElement(ie,{variant:"medium",color:"text100"},o,n),S.createElement(q,{justifyContent:"center",alignItems:"center",style:{backgroundColor:i._wallet.iconBackground},borderRadius:"md",className:VW},S.createElement(s,null)))}))},t8e=({config:t={}})=>{const{signIn:e={}}=t,{logoUrl:r}=e;return S.createElement(S.Fragment,null,r&&S.createElement(q,{marginTop:"5",justifyContent:"center",alignItems:"center"},S.createElement(gr,{src:r,style:{height:"110px"}})))};let Dn=function(t){return t.Settings="@kit.settings",t.Theme="@kit.theme",t.EthAuthProof="@kit.ethAuthProof",t.EthAuthSettings="@kit.ethAuthSettings",t.ProjectAccessKey="@kit.projectAccessKey",t}({});const Hx={showEmailInput:!0,walletAuthOptions:["sequence","metamask","wallet-connect","coinbase-wallet"],socialAuthOptions:["google","facebook","twitch","apple"]},GW=60*60*24*7;function r8e(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}const n8e=["createConnector"],KW=t=>{const e=[],r=t.find(i=>i.id==="injected");return t.filter(i=>!r||!r.hideConnectorId?!0:i.id!==r.hideConnectorId).forEach(i=>{const s=r8e(i,n8e),o=i.createConnector(),a=Mc({},s),l=((u,f)=>{const d=u;return d._wallet=Mc({},f),d})(o,a);e.push(l)}),e},i8e=t=>/^\S+@\S+\.\S{2,}$/.test(t),v8={1:{name:"Ethereum",symbol:"ETH",logoURI:"https://assets.coingecko.com/coins/images/279/thumb/ethereum.png",decimals:18,blockExplorerName:"Etherscan",blockExplorerUrl:"https://etherscan.io"},5:{name:"Goerli",symbol:"ETH",decimals:18,logoURI:"https://assets.coingecko.com/coins/images/279/thumb/ethereum.png",blockExplorerName:"Etherscan (Goerli)",blockExplorerUrl:"https://goerli.etherscan.io"},10:{name:"Optimism",symbol:"OP",logoURI:"https://assets.coingecko.com/coins/images/25244/small/Optimism.png",decimals:18,blockExplorerName:"Etherscan (Optimism)",blockExplorerUrl:"https://optimistic.etherscan.io"},56:{name:"BNB",symbol:"BNB",logoURI:"https://assets.coingecko.com/coins/images/825/thumb/bnb-icon2_2x.png",decimals:18,blockExplorerName:"BscScan",blockExplorerUrl:"https://bscscan.com"},100:{name:"Gnosis",symbol:"GNO",logoURI:"https://assets.coingecko.com/coins/images/662/small/logo_square_simple_300px.png",decimals:18,blockExplorerUrl:"https://gnosisscan.io",blockExplorerName:"Gnosis Scan"},137:{name:"Polygon",symbol:"MATIC",logoURI:"https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png",decimals:18,blockExplorerName:"Polyscan",blockExplorerUrl:"https://polygonscan.com"},1101:{name:"Polygon zkEVM",symbol:"ETH",logoURI:"https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png",decimals:18,blockExplorerName:"PolygonScan",blockExplorerUrl:"https://zkevm.polygonscan.com"},42161:{name:"Arbitrum",symbol:"ARB",logoURI:"https://assets.coingecko.com/asset_platforms/images/33/small/arbitrum-one.png",decimals:18,blockExplorerName:"Arbiscan",blockExplorerUrl:"https://arbiscan.io"},43114:{name:"Avalanche",symbol:"AVAX",logoURI:"https://assets.coingecko.com/coins/images/12559/small/Avalanche_Circle_RedWhite_Trans.png",decimals:18,blockExplorerName:"Snowtrace",blockExplorerUrl:"https://snowtrace.io"},80001:{name:"Mumbai",symbol:"MATIC",logoURI:"https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png",decimals:18,blockExplorerName:"Polyscan (Mumbai)",blockExplorerUrl:"https://mumbai.polygonscan.com"}},s8e=(t,e)=>{const r=e.find(s=>s.id===t);if(r){var n,i;return{name:r.name,symbol:r.nativeCurrency.symbol,decimals:r.nativeCurrency.decimals,logoURI:v8[1].logoURI,blockExplorerName:(n=r.blockExplorers)==null?void 0:n.default.name,blockExplorerUrl:(i=r.blockExplorers)==null?void 0:i.default.url}}},Rr=(t,e)=>v8[t]||s8e(t,e)||v8[1],Yc=()=>{const t=S.createContext(void 0);return[()=>{const r=S.useContext(t);if(!r)throw new Error("useGenericContext must be used within a Provider");return r},t.Provider]},KS=t=>{switch(t){case"top-right":return{top:"0px",right:"0px"};case"top-left":return{top:"0px",left:"0px"};case"top-center":return{top:"0px"};case"bottom-right":return{bottom:"0px",right:"0px"};case"bottom-left":return{bottom:"0px",left:"0px"};case"bottom-center":return{bottom:"0px"};case"middle-right":return{right:"0px"};case"middle-left":return{left:"0px"};case"center":default:return{}}},o8e=(t,e="light")=>{switch(t){case 1:return"#abf";case 137:return"#c7a6ff";case 42161:return"#52A7E6";case 10:return"#DB3132";case 56:return e==="light"?"#CB9C1D":"#EEB445";case 43114:return"#E84142";case 100:return e==="light"?"#00193C":"#D8E8FF";case 5:return e==="light"?"#A77A00":"#FFA700";case 80001:return e==="light"?"#D68828":"#FFA700";default:return"#abf"}},a8e=(t,e="light")=>{switch(t){case 1:return"#132362";case 137:return"#350881";case 42161:return e==="light"?"#EDF7FF":"#0C3754";case 10:return e==="light"?"#FFEAE9":"#390B0C";case 56:return e==="light"?"#FFE8AB":"#554018";case 43114:return e==="light"?"#FBDFDF":"#390B0C";case 100:return e==="light"?"#D8E8FF":"#00193C";case 5:return e==="light"?"#FFD871":"#554018";case 80001:return e==="light"?"#FFE8CD":"#554018";default:return"#132362"}};function c8e(t){var e;const{account:r,chain:n,transport:i}=t,s={chainId:n.id,name:n.name,ensAddress:(e=n.contracts)==null||(e=e.ensRegistry)==null?void 0:e.address};return new VM(i,s).getSigner(r.address)}function l8e(t){var e;const{chain:r,transport:n}=t,i={chainId:r.id,name:r.name,ensAddress:(e=r.contracts)==null||(e=e.ensRegistry)==null?void 0:e.address};return n.type==="fallback"?new _Z(n.transports.map(({value:s})=>new ta(s==null?void 0:s.url,i))):new ta(n.url,i)}const u8e=async t=>{const e=localStorage.getItem(Dn.EthAuthProof);if(e)return JSON.parse(e);const r=localStorage.getItem(Dn.EthAuthSettings);if(!r)throw new Error("No ETHAuth settings found");const n=JSON.parse(r),i=t.account.address,s=new Mb;s.address=i,s.claims.app=n.app||"app",s.claims.ogn=n.origin,s.claims.n=n.nonce,s.setExpiryIn(n.expiry?Math.max(n.expiry,200):GW);const o=s.messageTypedData();o.domain.verifyingContract;const c=await c8e(t)._signTypedData(o.domain,o.types,o.message);s.signature=c;const u=await new c1().encodeProof(s,!0);return{typedData:o,proofString:u}},f8e=async(t,e,r)=>{const n=t.account.address,s=await new c1().decodeProof(r.proofString,!0),o=l8e(e);return await M4.utils.isValidTypedDataSignature(n,r.typedData,s.signature,o)},pn=t=>{const e=Wt[t];if(!e)throw"invalid network";const r=localStorage.getItem(Dn.ProjectAccessKey)||void 0,n=new S4("https://metadata.sequence.app",r),i=new C4(r4(e.name),r),s=new d0("https://api.sequence.app",r);return{network:e,metadataClient:n,indexerClient:i,apiClient:s}},d8e=t=>{const{isConnected:e}=fn(),{theme:r}=ip(),{config:n={}}=t,{signIn:i={}}=n,{showEmailInput:s=Hx.showEmailInput,socialAuthOptions:o=Hx.socialAuthOptions,walletAuthOptions:a=Hx.walletAuthOptions}=i,{openConnectModal:c,setOpenConnectModal:l}=t,[u,f]=k.useState(""),{connectors:d,connect:h,isLoading:p}=Vz(),v=d,[m,g]=k.useState(!1),y=v.find(B=>B.id==="mock"),b=v.find(B=>B._wallet.id==="email"),C=v.filter(B=>!!a.find(H=>H===B._wallet.id)).sort((B,z)=>a.indexOf(B._wallet.id)-a.indexOf(z._wallet.id)),A=v.filter(B=>!!o.find(H=>H===B._wallet.id)).sort((B,z)=>o.indexOf(B._wallet.id)-o.indexOf(z._wallet.id));C.length>4;const O=B=>{f(B.target.value)};k.useEffect(()=>{e&&c&&l(!1)},[e,c]);const w=B=>{if(i.useMock&&y){h({connector:y});return}if(B._wallet.id==="email"){const z=prompt("Auto-email login, please specify the email address:");localStorage.setItem(a8,z||"")}h({connector:B})},I=B=>{if(i.useMock&&y){h({connector:y});return}B.preventDefault(),localStorage.setItem(a8,u),h({connector:b})};return m?S.createElement(S.Fragment,null,S.createElement(q,{as:"button",position:"absolute",style:{top:"20px"},onClick:()=>g(!1),className:Em},S.createElement(yb,null)),S.createElement(e8e,{connectors:C,onConnect:w})):S.createElement(S.Fragment,null,S.createElement(t8e,{config:n}),S.createElement(q,{marginTop:"5"},b&&s&&S.createElement(S.Fragment,null,S.createElement("form",{onSubmit:I},S.createElement(qc,{onChange:O,value:u,name:"email",placeholder:"Enter email","data-1p-ignore":!0}),S.createElement(nt,{type:"submit",disabled:!i8e(u),marginTop:"4",width:"full",label:"Continue",rightIcon:qo}))),A.length>0&&S.createElement(S.Fragment,null,b&&s&&S.createElement(S.Fragment,null,S.createElement(q,{style:{marginBottom:"-4px"}},S.createElement(i1,{color:"backgroundSecondary"})),S.createElement(q,{justifyContent:"center",alignItems:"center"},S.createElement(ie,{variant:"small",color:"text50"},"or sign in via"))),S.createElement(q,{marginTop:"3",gap:"2",flexDirection:"row",justifyContent:"center",alignItems:"center",flexWrap:"wrap"},A.map(B=>{const z=r==="dark"?B._wallet.monochromeLogoDark:B._wallet.monochromeLogoLight;return S.createElement(Eo,{key:B._wallet.id,className:Em,justifyContent:"center",alignItems:"center",onClick:()=>w(B),aspectRatio:"1/1",style:{width:`calc(25% - ${ve.space[2]})`}},S.createElement(q,{className:p8,flexDirection:"column",alignItems:"center",justifyContent:"center"},S.createElement(z,null)))}))),C.length>0&&S.createElement(S.Fragment,null,(b&&s||A.length>0)&&S.createElement(S.Fragment,null,S.createElement(q,{style:{marginBottom:"-4px"}},S.createElement(i1,{color:"backgroundSecondary"})),S.createElement(q,{justifyContent:"center",alignItems:"center"},S.createElement(ie,{variant:"small",color:"text50"},"or select a wallet"))),S.createElement(q,{marginTop:"3",gap:"2",flexDirection:"row",justifyContent:"center",alignItems:"center"},C.map(B=>{const z=r==="dark"?B._wallet.logoDark||B._wallet.logoDark:B._wallet.logoLight||B._wallet.logoLight;return S.createElement(Eo,{key:B._wallet.id,className:Em,justifyContent:"center",alignItems:"center",onClick:()=>w(B),aspectRatio:"1/1",style:{width:`calc(25% - ${ve.space[2]})`}},S.createElement(q,{className:p8,flexDirection:"column",alignItems:"center",justifyContent:"center"},S.createElement(z,null)))})))))};function h8e(t){if(t==null)throw new TypeError("Cannot destructure "+t)}const p8e=t=>{let e=Mc({},(h8e(t),t));return S.createElement(S.Fragment,null,S.createElement("svg",Mc({xmlns:"http://www.w3.org/2000/svg",style:{fill:"none"},id:"svg1316",version:"1.1",viewBox:"0 0 396 396"},e),S.createElement("g",{transform:"translate(0,38)",id:"g1256",clipPath:"url(#clip0_5_131)"},S.createElement("g",{id:"g1254",clipPath:"url(#clip1_5_131)"},S.createElement("path",{style:{fill:"#111111"},id:"path1232",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint0_linear_5_13"},id:"path1234",d:"M 0,67.5049 V 250.165 c 0,37.282 30.1402,67.505 67.32,67.505 h 261.36 c 37.18,0 67.32,-30.223 67.32,-67.505 V 67.5049 C 396,30.223 365.86,0 328.68,0 H 67.32 C 30.1402,0 0,30.223 0,67.5049 Z"}),S.createElement("path",{style:{fill:"url(#paint1_linear_5_131"},id:"path1236",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint2_linear_5_131)"},id:"path1238",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint3_linear_5_131)"},id:"path1240",d:"m 98.9999,79.4176 c 0,-10.9653 -8.8648,-19.8544 -19.8,-19.8544 -10.9352,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.8648,19.8544 19.8,19.8544 10.9352,0 19.8,-8.8892 19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint4_linear_5_131)"},id:"path1242",d:"m 98.9999,238.126 c 0,-10.965 -8.8648,-19.854 -19.8,-19.854 -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.966 8.8648,19.855 19.8,19.855 10.9352,0 19.8,-8.889 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint5_linear_5_131)"},id:"path1244",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint6_linear_5_131)"},id:"path1246",d:"m 336.6,158.835 c 0,-10.965 -8.865,-19.854 -19.8,-19.854 -10.935,0 -19.8,8.889 -19.8,19.854 0,10.965 8.865,19.855 19.8,19.855 10.935,0 19.8,-8.89 19.8,-19.855 z"}),S.createElement("path",{style:{fill:"url(#paint7_linear_5_131)"},id:"path1248",d:"M 316.8,59.5632 H 158.4 c -10.935,0 -19.8,8.8891 -19.8,19.8544 0,10.9652 8.865,19.8544 19.8,19.8544 h 158.4 c 10.935,0 19.8,-8.8892 19.8,-19.8544 0,-10.9653 -8.865,-19.8544 -19.8,-19.8544 z"}),S.createElement("path",{style:{fill:"url(#paint8_linear_5_131)"},id:"path1250",d:"M 316.8,218.272 H 158.4 c -10.935,0 -19.8,8.889 -19.8,19.854 0,10.966 8.865,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.889 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}),S.createElement("path",{style:{fill:"url(#paint9_linear_5_131)"},id:"path1252",d:"M 237.6,138.981 H 79.2 c -10.9352,0 -19.8,8.889 -19.8,19.854 0,10.965 8.8648,19.855 19.8,19.855 h 158.4 c 10.935,0 19.8,-8.89 19.8,-19.855 0,-10.965 -8.865,-19.854 -19.8,-19.854 z"}))),S.createElement("defs",{id:"defs1314"},S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"318",x2:"198",y1:"4.0585401e-05",x1:"198",id:"paint0_linear_5_131"},S.createElement("stop",{id:"stop1258",stopColor:"#1D273D"}),S.createElement("stop",{id:"stop1260",stopColor:"#0D0F13",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"63",x2:"92.5",y1:"99",x1:"65.5",id:"paint1_linear_5_131"},S.createElement("stop",{id:"stop1263",stopColor:"#4462FE"}),S.createElement("stop",{id:"stop1265",stopColor:"#7D69FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint2_linear_5_131"},S.createElement("stop",{id:"stop1268",stopColor:"#3757FD"}),S.createElement("stop",{id:"stop1270",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"97.591103",x2:"96.137703",y1:"99.291199",x1:"62.879902",id:"paint3_linear_5_131"},S.createElement("stop",{id:"stop1273",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1275",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"223.5",x2:"91.5",y1:"251.5",x1:"65",id:"paint4_linear_5_131"},S.createElement("stop",{id:"stop1278",stopColor:"#BC3EE6"}),S.createElement("stop",{id:"stop1280",stopColor:"#D972F1",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"146",x2:"329.5",y1:"172",x1:"305",id:"paint5_linear_5_131"},S.createElement("stop",{id:"stop1283",stopColor:"#29BDFF"}),S.createElement("stop",{id:"stop1285",stopColor:"#96E7FB",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"176.772",x2:"334.56699",y1:"178.418",x1:"300.17999",id:"paint6_linear_5_131"},S.createElement("stop",{id:"stop1288",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1290",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"60",x2:"317.5",y1:"99",x1:"154.5",id:"paint7_linear_5_131"},S.createElement("stop",{id:"stop1293",stopColor:"#23BBFF"}),S.createElement("stop",{id:"stop1295",stopColor:"#85E7FF",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"218",x2:"312.5",y1:"258",x1:"156",id:"paint8_linear_5_131"},S.createElement("stop",{id:"stop1298",stopColor:"#2447FF"}),S.createElement("stop",{id:"stop1300",stopColor:"#6980FA",offset:"1"})),S.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",y2:"139",x2:"235.5",y1:"179",x1:"86.000099",id:"paint9_linear_5_131"},S.createElement("stop",{id:"stop1303",stopColor:"#6634FF"}),S.createElement("stop",{id:"stop1305",stopColor:"#9C6DFF",offset:"1"})),S.createElement("clipPath",{id:"clip0_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1308",height:"317.67001",width:"396"})),S.createElement("clipPath",{id:"clip1_5_131"},S.createElement("rect",{style:{fill:"#ffffff"},y:"0",x:"0",id:"rect1311",height:"317.67001",width:"396"})))))},[QW,v8e]=Yc(),[m8e,y8e]=Yc(),[g8e,b8e]=Yc(),[w8e,x8e]=Yc(),E8e={dark:"dark",light:"light"},C8e=t=>{const{config:e,children:r}=t,{projectAccessKey:n,defaultTheme:i="dark",signIn:s={},position:o="center",displayedAssets:a=[],ethAuth:c={},disableAnalytics:l=!1}=e,u=s.projectName||"app",{expiry:f=GW,app:d=u,origin:h=location.origin,nonce:p}=c,{projectName:v}=s,[m,g]=k.useState(!1),[y,b]=k.useState(i||E8e.dark),[C,A]=k.useState(o),[O,w]=k.useState(a),[I,B]=k.useState(),{address:z,isConnected:H}=fn(),K=x=>{const $=M4.initWallet(x).client.analytics;B($)};k.useEffect(()=>{if(!H){I==null||I.reset();return}z&&(I==null||I.identify(z.toLowerCase()))},[I,z,H]);const F=()=>{window.open("https://sequence.xyz")};return k.useEffect(()=>{l||K(n),localStorage.setItem(Dn.ProjectAccessKey,n)},[n]),k.useEffect(()=>{y!==i&&b(i)},[i]),k.useEffect(()=>{C!==o&&A(o)},[o]),k.useEffect(()=>{typeof y=="object"||localStorage.setItem(Dn.Theme,y),localStorage.setItem(Dn.EthAuthSettings,JSON.stringify({expiry:f,app:d,origin:h,nonce:p}))},[y,c]),k.useEffect(()=>{w(O)},[a]),S.createElement(b8e,{value:{theme:y,setTheme:b,position:C,setPosition:A}},S.createElement(y8e,{value:{setOpenConnectModal:g,openConnectModalState:m}},S.createElement(x8e,{value:{setDisplayedAssets:w,displayedAssets:O}},S.createElement(v8e,{value:{setAnalytics:B,analytics:I}},S.createElement("div",{id:"kit-provider"},S.createElement(_b,{root:"#kit-provider",scope:"kit",theme:y},S.createElement(db,null,m&&S.createElement(HC,{scroll:!1,backdropColor:"backgroundBackdrop",size:"sm",contentProps:{style:Mc({maxWidth:"364px"},KS(o))},onClose:()=>g(!1)},S.createElement(q,{padding:"4",className:GS},S.createElement(q,{justifyContent:"center",color:"text100",alignItems:"center",fontWeight:"medium",style:{marginTop:"4px"}},S.createElement(ie,null,"Sign in ",v?`to ${v}`:"")),S.createElement(d8e,Mc({openConnectModal:m,setOpenConnectModal:g},t)),S.createElement(q,{onClick:F,className:Em,gap:"1",marginTop:"2",flexDirection:"row",alignItems:"center",justifyContent:"center"},S.createElement(ie,{fontSize:"small",color:"text100"},"Powered by Sequence"),S.createElement(q,{height:"5",width:"5"},S.createElement(p8e,null)))))))),r))))},S8e=()=>{const{setOpenConnectModal:t,openConnectModalState:e}=m8e();return{setOpenConnectModal:t,openConnectModalState:e}},Pp=()=>{const{setTheme:t,theme:e,position:r,setPosition:n}=g8e();return{setTheme:t,theme:e,position:r,setPosition:n}},k8e=()=>{const{setDisplayedAssets:t,displayedAssets:e}=w8e();return{displayedAssets:e,setDisplayedAssets:t}};function A8e(t,e,r){return t===t&&(r!==void 0&&(t=t<=r?t:r),e!==void 0&&(t=t>=e?t:e)),t}var YW=A8e;function _8e(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r-1&&t%1==0&&t-1&&t%1==0&&t<=IEe}var sH=OEe,REe=_2,$Ee=sH,MEe=P2,NEe="[object Arguments]",DEe="[object Array]",LEe="[object Boolean]",BEe="[object Date]",FEe="[object Error]",jEe="[object Function]",UEe="[object Map]",zEe="[object Number]",WEe="[object Object]",HEe="[object RegExp]",qEe="[object Set]",VEe="[object String]",GEe="[object WeakMap]",KEe="[object ArrayBuffer]",QEe="[object DataView]",YEe="[object Float32Array]",JEe="[object Float64Array]",XEe="[object Int8Array]",ZEe="[object Int16Array]",eCe="[object Int32Array]",tCe="[object Uint8Array]",rCe="[object Uint8ClampedArray]",nCe="[object Uint16Array]",iCe="[object Uint32Array]",Ht={};Ht[YEe]=Ht[JEe]=Ht[XEe]=Ht[ZEe]=Ht[eCe]=Ht[tCe]=Ht[rCe]=Ht[nCe]=Ht[iCe]=!0;Ht[NEe]=Ht[DEe]=Ht[KEe]=Ht[LEe]=Ht[QEe]=Ht[BEe]=Ht[FEe]=Ht[jEe]=Ht[UEe]=Ht[zEe]=Ht[WEe]=Ht[HEe]=Ht[qEe]=Ht[VEe]=Ht[GEe]=!1;function sCe(t){return MEe(t)&&$Ee(t.length)&&!!Ht[REe(t)]}var oCe=sCe;function aCe(t){return function(e){return t(e)}}var cCe=aCe,yg={exports:{}};yg.exports;(function(t,e){var r=XW,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===n,o=s&&r.process,a=function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();t.exports=a})(yg,yg.exports);var lCe=yg.exports,uCe=oCe,fCe=cCe,VT=lCe,GT=VT&&VT.isTypedArray,dCe=GT?fCe(GT):uCe,hCe=dCe,pCe=V8e,vCe=EEe,mCe=nH,yCe=AEe,gCe=iH,bCe=hCe,wCe=Object.prototype,xCe=wCe.hasOwnProperty;function ECe(t,e){var r=mCe(t),n=!r&&vCe(t),i=!r&&!n&&yCe(t),s=!r&&!n&&!i&&bCe(t),o=r||n||i||s,a=o?pCe(t.length,String):[],c=a.length;for(var l in t)(e||xCe.call(t,l))&&!(o&&(l=="length"||i&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||gCe(l,c)))&&a.push(l);return a}var CCe=ECe,SCe=Object.prototype;function kCe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||SCe;return t===r}var ACe=kCe;function _Ce(t,e){return function(r){return t(e(r))}}var PCe=_Ce,TCe=PCe,ICe=TCe(Object.keys,Object),OCe=ICe,RCe=ACe,$Ce=OCe,MCe=Object.prototype,NCe=MCe.hasOwnProperty;function DCe(t){if(!RCe(t))return $Ce(t);var e=[];for(var r in Object(t))NCe.call(t,r)&&r!="constructor"&&e.push(r);return e}var LCe=DCe;function BCe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var QS=BCe,FCe=_2,jCe=QS,UCe="[object AsyncFunction]",zCe="[object Function]",WCe="[object GeneratorFunction]",HCe="[object Proxy]";function qCe(t){if(!jCe(t))return!1;var e=FCe(t);return e==zCe||e==WCe||e==UCe||e==HCe}var VCe=qCe,GCe=VCe,KCe=sH;function QCe(t){return t!=null&&KCe(t.length)&&!GCe(t)}var oH=QCe,YCe=CCe,JCe=LCe,XCe=oH;function ZCe(t){return XCe(t)?YCe(t):JCe(t)}var e4e=ZCe,t4e=H8e,r4e=e4e;function n4e(t){return t==null?[]:t4e(t,r4e(t))}var i4e=n4e,s4e=YW,o4e=JW,a4e=i4e;function c4e(t,e){var r=a4e(t);return o4e(r,s4e(e,0,r.length))}var l4e=c4e;function u4e(t,e){return t===e||t!==t&&e!==e}var f4e=u4e,d4e=f4e,h4e=oH,p4e=iH,v4e=QS;function m4e(t,e,r){if(!v4e(r))return!1;var n=typeof e;return(n=="number"?h4e(r)&&p4e(e,r.length):n=="string"&&e in r)?d4e(r[e],t):!1}var y4e=m4e,g4e=/\s/;function b4e(t){for(var e=t.length;e--&&g4e.test(t.charAt(e)););return e}var w4e=b4e,x4e=w4e,E4e=/^\s+/;function C4e(t){return t&&t.slice(0,x4e(t)+1).replace(E4e,"")}var S4e=C4e,k4e=_2,A4e=P2,_4e="[object Symbol]";function P4e(t){return typeof t=="symbol"||A4e(t)&&k4e(t)==_4e}var T4e=P4e,I4e=S4e,KT=QS,O4e=T4e,QT=0/0,R4e=/^[-+]0x[0-9a-f]+$/i,$4e=/^0b[01]+$/i,M4e=/^0o[0-7]+$/i,N4e=parseInt;function D4e(t){if(typeof t=="number")return t;if(O4e(t))return QT;if(KT(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=KT(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=I4e(t);var r=$4e.test(t);return r||M4e.test(t)?N4e(t.slice(2),r?2:8):R4e.test(t)?QT:+t}var L4e=D4e,B4e=L4e,YT=1/0,F4e=17976931348623157e292;function j4e(t){if(!t)return t===0?t:0;if(t=B4e(t),t===YT||t===-YT){var e=t<0?-1:1;return e*F4e}return t===t?t:0}var U4e=j4e,z4e=U4e;function W4e(t){var e=z4e(t),r=e%1;return e===e?r?e-r:e:0}var H4e=W4e,q4e=F8e,V4e=l4e,G4e=nH,K4e=y4e,Q4e=H4e;function Y4e(t,e,r){(r?K4e(t,e,r):e===void 0)?e=1:e=Q4e(e);var n=G4e(t)?q4e:V4e;return n(t,e)}var J4e=Y4e;const X4e=ki(J4e);var T2={},Z4e=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],n=0;n"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=JT[e.format]||JT.default;window.clipboardData.setData(f,t)}else u.clipboardData.clearData(),u.clipboardData.setData(e.format,t);e.onCopy&&(u.preventDefault(),e.onCopy(u.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=rSe("message"in e?e.message:tSe),window.prompt(n,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var iSe=nSe;function m8(t){"@babel/helpers - typeof";return m8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m8(t)}Object.defineProperty(T2,"__esModule",{value:!0});T2.CopyToClipboard=void 0;var Pv=aH(k),sSe=aH(iSe),oSe=["text","onCopy","options","children"];function aH(t){return t&&t.__esModule?t:{default:t}}function XT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ZT(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function cSe(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}function lSe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function eI(t,e){for(var r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gg(t){return gg=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},gg(t)}function YS(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var lH=function(t){fSe(r,t);var e=dSe(r);function r(){var n;lSe(this,r);for(var i=arguments.length,s=new Array(i),o=0;oe in t?mSe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D1=(t,e)=>{for(var r in e||(e={}))fH.call(e,r)&&tI(t,r,e[r]);if(bg)for(var r of bg(e))dH.call(e,r)&&tI(t,r,e[r]);return t},JS=(t,e)=>{var r={};for(var n in t)fH.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&bg)for(var n of bg(t))e.indexOf(n)<0&&dH.call(t,n)&&(r[n]=t[n]);return r};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT diff --git a/assets/index-c40c73d5.js b/assets/index-d66c3ebc.js similarity index 99% rename from assets/index-c40c73d5.js rename to assets/index-d66c3ebc.js index 97ee6f17..5cae3c59 100644 --- a/assets/index-c40c73d5.js +++ b/assets/index-d66c3ebc.js @@ -1,4 +1,4 @@ -import{i as bt,c as F,r as Oc,b as ds,g as xr,t as D0,_ as I,a as j0}from"./index-cfc0b18f.js";import{e as Nc}from"./events-16b8e254.js";import{b as ps}from"./index-cc134824.js";function B0(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var Lc={},Qn={},bs={};Object.defineProperty(bs,"__esModule",{value:!0});bs.walletLogo=void 0;const F0=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};bs.walletLogo=F0;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});gs.LINK_API_URL=void 0;gs.LINK_API_URL="https://www.walletlink.org";var ys={};Object.defineProperty(ys,"__esModule",{value:!0});ys.ScopedLocalStorage=void 0;class W0{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}ys.ScopedLocalStorage=W0;var tn={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});const H0=Nc;function qu(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function V0(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")qu(s,this,r);else{const o=s.length,a=V0(s);for(let c=0;c"u"&&(n=wh()),nc(t,"",0,[],void 0,0,n);var i;try{br.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,Eh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;_r.length!==0;){var s=_r.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Qr(t,e,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:t}),_r.push([n,r,e,i])):br.push([e,r,t]):(n[r]=t,_r.push([n,r,e]))}function nc(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Qr(Xi,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Qr(Xi,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function Sh(t,e,r,n){typeof n>"u"&&(n=wh());var i=ic(t,"",0,[],void 0,0,n)||t,s;try{br.length===0?s=JSON.stringify(i,e,r):s=JSON.stringify(i,Eh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;_r.length!==0;){var o=_r.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function ic(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Qr(Xi,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Qr(Xi,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function Z0(t,e){if(e!=="[Circular]")return e}var $c={},er={};Object.defineProperty(er,"__esModule",{value:!0});er.errorValues=er.errorCodes=void 0;er.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};er.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=er,r=Xt,n=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(h,p=i){if(Number.isInteger(h)){const v=h.toString();if(f(e.errorValues,v))return e.errorValues[v].message;if(u(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return p}t.getMessageFromCode=o;function a(h){if(!Number.isInteger(h))return!1;const p=h.toString();return!!(e.errorValues[p]||u(h))}t.isValidCode=a;function c(h,{fallbackError:p=s,shouldIncludeStack:v=!1}={}){var E,_;if(!p||!Number.isInteger(p.code)||typeof p.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(h instanceof r.EthereumRpcError)return h.serialize();const d={};if(h&&typeof h=="object"&&!Array.isArray(h)&&f(h,"code")&&a(h.code)){const m=h;d.code=m.code,m.message&&typeof m.message=="string"?(d.message=m.message,f(m,"data")&&(d.data=m.data)):(d.message=o(d.code),d.data={originalError:l(h)})}else{d.code=p.code;const m=(E=h)===null||E===void 0?void 0:E.message;d.message=m&&typeof m=="string"?m:p.message,d.data={originalError:l(h)}}const y=(_=h)===null||_===void 0?void 0:_.stack;return v&&h&&y&&typeof y=="string"&&(d.stack=y),d}t.serializeError=c;function u(h){return h>=-32099&&h<=-32e3}function l(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function f(h,p){return Object.prototype.hasOwnProperty.call(h,p)}})($c);var vs={};Object.defineProperty(vs,"__esModule",{value:!0});vs.ethErrors=void 0;const Dc=Xt,xh=$c,De=er;vs.ethErrors={rpc:{parse:t=>Xe(De.errorCodes.rpc.parse,t),invalidRequest:t=>Xe(De.errorCodes.rpc.invalidRequest,t),invalidParams:t=>Xe(De.errorCodes.rpc.invalidParams,t),methodNotFound:t=>Xe(De.errorCodes.rpc.methodNotFound,t),internal:t=>Xe(De.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Xe(e,t)},invalidInput:t=>Xe(De.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>Xe(De.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>Xe(De.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>Xe(De.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>Xe(De.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>Xe(De.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Nn(De.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>Nn(De.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>Nn(De.errorCodes.provider.unsupportedMethod,t),disconnected:t=>Nn(De.errorCodes.provider.disconnected,t),chainDisconnected:t=>Nn(De.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Dc.EthereumProviderError(e,r,n)}}};function Xe(t,e){const[r,n]=Ih(e);return new Dc.EthereumRpcError(t,r||xh.getMessageFromCode(t),n)}function Nn(t,e){const[r,n]=Ih(e);return new Dc.EthereumProviderError(t,r||xh.getMessageFromCode(t),n)}function Ih(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Xt;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=$c;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=vs;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=er;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(Pc);var be={},ms={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Web3Method=void 0,function(e){e.requestEthereumAccounts="requestEthereumAccounts",e.signEthereumMessage="signEthereumMessage",e.signEthereumTransaction="signEthereumTransaction",e.submitEthereumTransaction="submitEthereumTransaction",e.ethereumAddressFromSignedMessage="ethereumAddressFromSignedMessage",e.scanQRCode="scanQRCode",e.generic="generic",e.childRequestEthereumAccounts="childRequestEthereumAccounts",e.addEthereumChain="addEthereumChain",e.switchEthereumChain="switchEthereumChain",e.makeEthereumJSONRPCRequest="makeEthereumJSONRPCRequest",e.watchAsset="watchAsset",e.selectProvider="selectProvider"}(t.Web3Method||(t.Web3Method={}))})(ms);Object.defineProperty(be,"__esModule",{value:!0});be.EthereumAddressFromSignedMessageResponse=be.SubmitEthereumTransactionResponse=be.SignEthereumTransactionResponse=be.SignEthereumMessageResponse=be.isRequestEthereumAccountsResponse=be.SelectProviderResponse=be.WatchAssetReponse=be.RequestEthereumAccountsResponse=be.SwitchEthereumChainResponse=be.AddEthereumChainResponse=be.isErrorResponse=void 0;const Tt=ms;function Y0(t){var e,r;return((e=t)===null||e===void 0?void 0:e.method)!==void 0&&((r=t)===null||r===void 0?void 0:r.errorMessage)!==void 0}be.isErrorResponse=Y0;function K0(t){return{method:Tt.Web3Method.addEthereumChain,result:t}}be.AddEthereumChainResponse=K0;function X0(t){return{method:Tt.Web3Method.switchEthereumChain,result:t}}be.SwitchEthereumChainResponse=X0;function eb(t){return{method:Tt.Web3Method.requestEthereumAccounts,result:t}}be.RequestEthereumAccountsResponse=eb;function tb(t){return{method:Tt.Web3Method.watchAsset,result:t}}be.WatchAssetReponse=tb;function rb(t){return{method:Tt.Web3Method.selectProvider,result:t}}be.SelectProviderResponse=rb;function nb(t){return t&&t.method===Tt.Web3Method.requestEthereumAccounts}be.isRequestEthereumAccountsResponse=nb;function ib(t){return{method:Tt.Web3Method.signEthereumMessage,result:t}}be.SignEthereumMessageResponse=ib;function sb(t){return{method:Tt.Web3Method.signEthereumTransaction,result:t}}be.SignEthereumTransactionResponse=sb;function ob(t){return{method:Tt.Web3Method.submitEthereumTransaction,result:t}}be.SubmitEthereumTransactionResponse=ob;function ab(t){return{method:Tt.Web3Method.ethereumAddressFromSignedMessage,result:t}}be.EthereumAddressFromSignedMessageResponse=ab;var mn={};Object.defineProperty(mn,"__esModule",{value:!0});mn.LIB_VERSION=void 0;mn.LIB_VERSION="3.7.2";(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCode=t.serializeError=t.standardErrors=t.standardErrorMessage=t.standardErrorCodes=void 0;const e=Pc,r=be,n=mn;t.standardErrorCodes=Object.freeze(Object.assign(Object.assign({},e.errorCodes),{provider:Object.freeze(Object.assign(Object.assign({},e.errorCodes.provider),{unsupportedChain:4902}))}));function i(l){return l!==void 0?(0,e.getMessageFromCode)(l):"Unknown error"}t.standardErrorMessage=i,t.standardErrors=Object.freeze(Object.assign(Object.assign({},e.ethErrors),{provider:Object.freeze(Object.assign(Object.assign({},e.ethErrors.provider),{unsupportedChain:(l="")=>e.ethErrors.provider.custom({code:t.standardErrorCodes.provider.unsupportedChain,message:`Unrecognized chain ID ${l}. Try adding the chain using wallet_addEthereumChain first.`})}))}));function s(l,f){const h=(0,e.serializeError)(o(l),{shouldIncludeStack:!0}),p=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");p.searchParams.set("version",n.LIB_VERSION),p.searchParams.set("code",h.code.toString());const v=a(h.data,f);return v&&p.searchParams.set("method",v),p.searchParams.set("message",h.message),Object.assign(Object.assign({},h),{docUrl:p.href})}t.serializeError=s;function o(l){return typeof l=="string"?{message:l,code:t.standardErrorCodes.rpc.internal}:(0,r.isErrorResponse)(l)?Object.assign(Object.assign({},l),{message:l.errorMessage,code:l.errorCode,data:{method:l.method,result:l.result}}):l}function a(l,f){var h;const p=(h=l)===null||h===void 0?void 0:h.method;if(p)return p;if(f!==void 0)return typeof f=="string"?f:Array.isArray(f)?f.length>0?f[0].method:void 0:f.method}function c(l){var f;if(typeof l=="number")return l;if(u(l))return(f=l.code)!==null&&f!==void 0?f:l.errorCode}t.getErrorCode=c;function u(l){return typeof l=="object"&&l!==null&&(typeof l.code=="number"||typeof l.errorCode=="number")}})(ni);var _n={},Rh={exports:{}},sc={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(t,e){var r=ps,n=r.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=s);function s(o,a,c){return n(o,a,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=n(o);return a!==void 0?typeof c=="string"?u.fill(a,c):u.fill(a):u.fill(0),u},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(sc,sc.exports);var ir=sc.exports,Ah=ir.Buffer;function _s(t,e){this._block=Ah.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}_s.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=Ah.from(t,e));for(var r=this._block,n=this._blockSize,i=t.length,s=this._len,o=0;o=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};_s.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var wn=_s,cb=bt,Mh=wn,ub=ir.Buffer,lb=[1518500249,1859775393,-1894007588,-899497514],fb=new Array(80);function ii(){this.init(),this._w=fb,Mh.call(this,64,56)}cb(ii,Mh);ii.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function hb(t){return t<<5|t>>>27}function db(t){return t<<30|t>>>2}function pb(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}ii.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var c=0;c<80;++c){var u=~~(c/20),l=hb(r)+pb(u,n,i,s)+o+e[c]+lb[u]|0;o=s,s=i,i=db(n),n=r,r=l}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};ii.prototype._hash=function(){var t=ub.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var bb=ii,gb=bt,kh=wn,yb=ir.Buffer,vb=[1518500249,1859775393,-1894007588,-899497514],mb=new Array(80);function si(){this.init(),this._w=mb,kh.call(this,64,56)}gb(si,kh);si.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function _b(t){return t<<1|t>>>31}function wb(t){return t<<5|t>>>27}function Sb(t){return t<<30|t>>>2}function Eb(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}si.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=_b(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var c=0;c<80;++c){var u=~~(c/20),l=wb(r)+Eb(u,n,i,s)+o+e[c]+vb[u]|0;o=s,s=i,i=Sb(n),n=r,r=l}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};si.prototype._hash=function(){var t=yb.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var Cb=si,xb=bt,Th=wn,Ib=ir.Buffer,Rb=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ab=new Array(64);function oi(){this.init(),this._w=Ab,Th.call(this,64,56)}xb(oi,Th);oi.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function Mb(t,e,r){return r^t&(e^r)}function kb(t,e,r){return t&e|r&(t|e)}function Tb(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Ob(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Nb(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Lb(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}oi.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=this._f|0,c=this._g|0,u=this._h|0,l=0;l<16;++l)e[l]=t.readInt32BE(l*4);for(;l<64;++l)e[l]=Lb(e[l-2])+e[l-7]+Nb(e[l-15])+e[l-16]|0;for(var f=0;f<64;++f){var h=u+Ob(o)+Mb(o,a,c)+Rb[f]+e[f]|0,p=Tb(r)+kb(r,n,i)|0;u=c,c=a,a=o,o=s+h|0,s=i,i=n,n=r,r=h+p|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=a+this._f|0,this._g=c+this._g|0,this._h=u+this._h|0};oi.prototype._hash=function(){var t=Ib.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Oh=oi,Pb=bt,$b=Oh,Db=wn,jb=ir.Buffer,Bb=new Array(64);function ws(){this.init(),this._w=Bb,Db.call(this,64,56)}Pb(ws,$b);ws.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};ws.prototype._hash=function(){var t=jb.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var Fb=ws,Wb=bt,Nh=wn,Hb=ir.Buffer,Gu=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Vb=new Array(160);function ai(){this.init(),this._w=Vb,Nh.call(this,128,112)}Wb(ai,Nh);ai.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ju(t,e,r){return r^t&(e^r)}function Qu(t,e,r){return t&e|r&(t|e)}function Zu(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Yu(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Ub(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function zb(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function qb(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Gb(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function Ae(t,e){return t>>>0>>0?1:0}ai.prototype._update=function(t){for(var e=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,o=this._eh|0,a=this._fh|0,c=this._gh|0,u=this._hh|0,l=this._al|0,f=this._bl|0,h=this._cl|0,p=this._dl|0,v=this._el|0,E=this._fl|0,_=this._gl|0,d=this._hl|0,y=0;y<32;y+=2)e[y]=t.readInt32BE(y*4),e[y+1]=t.readInt32BE(y*4+4);for(;y<160;y+=2){var m=e[y-30],x=e[y-15*2+1],C=Ub(m,x),T=zb(x,m);m=e[y-2*2],x=e[y-2*2+1];var j=qb(m,x),$=Gb(x,m),A=e[y-7*2],U=e[y-7*2+1],ce=e[y-16*2],Z=e[y-16*2+1],R=T+U|0,M=C+A+Ae(R,T)|0;R=R+$|0,M=M+j+Ae(R,$)|0,R=R+Z|0,M=M+ce+Ae(R,Z)|0,e[y]=M,e[y+1]=R}for(var N=0;N<160;N+=2){M=e[N],R=e[N+1];var L=Qu(r,n,i),B=Qu(l,f,h),D=Zu(r,l),H=Zu(l,r),Y=Yu(o,v),J=Yu(v,o),se=Gu[N],he=Gu[N+1],le=Ju(o,a,c),We=Ju(v,E,_),w=d+J|0,S=u+Y+Ae(w,d)|0;w=w+We|0,S=S+le+Ae(w,We)|0,w=w+he|0,S=S+se+Ae(w,he)|0,w=w+R|0,S=S+M+Ae(w,R)|0;var O=H+B|0,z=D+L+Ae(O,H)|0;u=c,d=_,c=a,_=E,a=o,E=v,v=p+w|0,o=s+S+Ae(v,p)|0,s=i,p=h,i=n,h=f,n=r,f=l,l=w+O|0,r=S+z+Ae(l,w)|0}this._al=this._al+l|0,this._bl=this._bl+f|0,this._cl=this._cl+h|0,this._dl=this._dl+p|0,this._el=this._el+v|0,this._fl=this._fl+E|0,this._gl=this._gl+_|0,this._hl=this._hl+d|0,this._ah=this._ah+r+Ae(this._al,l)|0,this._bh=this._bh+n+Ae(this._bl,f)|0,this._ch=this._ch+i+Ae(this._cl,h)|0,this._dh=this._dh+s+Ae(this._dl,p)|0,this._eh=this._eh+o+Ae(this._el,v)|0,this._fh=this._fh+a+Ae(this._fl,E)|0,this._gh=this._gh+c+Ae(this._gl,_)|0,this._hh=this._hh+u+Ae(this._hl,d)|0};ai.prototype._hash=function(){var t=Hb.allocUnsafe(64);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};var Lh=ai,Jb=bt,Qb=Lh,Zb=wn,Yb=ir.Buffer,Kb=new Array(160);function Ss(){this.init(),this._w=Kb,Zb.call(this,128,112)}Jb(Ss,Qb);Ss.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Ss.prototype._hash=function(){var t=Yb.allocUnsafe(48);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};var Xb=Ss,Rr=Rh.exports=function(e){e=e.toLowerCase();var r=Rr[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};Rr.sha=bb;Rr.sha1=Cb;Rr.sha224=Fb;Rr.sha256=Oh;Rr.sha384=Xb;Rr.sha512=Lh;var eg=Rh.exports,W={},tg=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0},Ku=typeof Symbol<"u"&&Symbol,rg=tg,ng=function(){return typeof Ku!="function"||typeof Symbol!="function"||typeof Ku("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:rg()},Xu={foo:{}},ig=Object,sg=function(){return{__proto__:Xu}.foo===Xu.foo&&!({__proto__:null}instanceof ig)},og="Function.prototype.bind called on incompatible ",ag=Object.prototype.toString,cg=Math.max,ug="[object Function]",el=function(e,r){for(var n=[],i=0;i"u"||!Te?ne:Te(Uint8Array),mr={"%AggregateError%":typeof AggregateError>"u"?ne:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ne:ArrayBuffer,"%ArrayIteratorPrototype%":jr&&Te?Te([][Symbol.iterator]()):ne,"%AsyncFromSyncIteratorPrototype%":ne,"%AsyncFunction%":zr,"%AsyncGenerator%":zr,"%AsyncGeneratorFunction%":zr,"%AsyncIteratorPrototype%":zr,"%Atomics%":typeof Atomics>"u"?ne:Atomics,"%BigInt%":typeof BigInt>"u"?ne:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ne:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ne:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ne:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?ne:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ne:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ne:FinalizationRegistry,"%Function%":Ph,"%GeneratorFunction%":zr,"%Int8Array%":typeof Int8Array>"u"?ne:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ne:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ne:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":jr&&Te?Te(Te([][Symbol.iterator]())):ne,"%JSON%":typeof JSON=="object"?JSON:ne,"%Map%":typeof Map>"u"?ne:Map,"%MapIteratorPrototype%":typeof Map>"u"||!jr||!Te?ne:Te(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ne:Promise,"%Proxy%":typeof Proxy>"u"?ne:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?ne:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ne:Set,"%SetIteratorPrototype%":typeof Set>"u"||!jr||!Te?ne:Te(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ne:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":jr&&Te?Te(""[Symbol.iterator]()):ne,"%Symbol%":jr?Symbol:ne,"%SyntaxError%":rn,"%ThrowTypeError%":vg,"%TypedArray%":_g,"%TypeError%":Zr,"%Uint8Array%":typeof Uint8Array>"u"?ne:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ne:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ne:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ne:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?ne:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ne:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ne:WeakSet};if(Te)try{null.error}catch(t){var wg=Te(Te(t));mr["%Error.prototype%"]=wg}var Sg=function t(e){var r;if(e==="%AsyncFunction%")r=pa("async function () {}");else if(e==="%GeneratorFunction%")r=pa("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=pa("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Te&&(r=Te(i.prototype))}return mr[e]=r,r},tl={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ci=jc,es=yg,Eg=ci.call(Function.call,Array.prototype.concat),Cg=ci.call(Function.apply,Array.prototype.splice),rl=ci.call(Function.call,String.prototype.replace),ts=ci.call(Function.call,String.prototype.slice),xg=ci.call(Function.call,RegExp.prototype.exec),Ig=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Rg=/\\(\\)?/g,Ag=function(e){var r=ts(e,0,1),n=ts(e,-1);if(r==="%"&&n!=="%")throw new rn("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new rn("invalid intrinsic syntax, expected opening `%`");var i=[];return rl(e,Ig,function(s,o,a,c){i[i.length]=a?rl(c,Rg,"$1"):o||s}),i},Mg=function(e,r){var n=e,i;if(es(tl,n)&&(i=tl[n],n="%"+i[0]+"%"),es(mr,n)){var s=mr[n];if(s===zr&&(s=Sg(n)),typeof s>"u"&&!r)throw new Zr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new rn("intrinsic "+e+" does not exist!")},Ar=function(e,r){if(typeof e!="string"||e.length===0)throw new Zr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Zr('"allowMissing" argument must be a boolean');if(xg(/^%?[^%]*%?$/,e)===null)throw new rn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Ag(e),i=n.length>0?n[0]:"",s=Mg("%"+i+"%",r),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],Cg(n,Eg([0,1],u)));for(var l=1,f=!0;l=n.length){var E=vr(a,h);f=!!E,f&&"get"in E&&!("originalValue"in E.get)?a=E.get:a=a[h]}else f=es(a,h),a=a[h];f&&!c&&(mr[o]=a)}}return a},$h={exports:{}},kg=Ar,oc=kg("%Object.defineProperty%",!0),ac=function(){if(oc)try{return oc({},"a",{value:1}),!0}catch{return!1}return!1};ac.hasArrayLengthDefineBug=function(){if(!ac())return null;try{return oc([],"length",{value:1}).length!==1}catch{return!0}};var Dh=ac,Tg=Ar,qi=Tg("%Object.getOwnPropertyDescriptor%",!0);if(qi)try{qi([],"length")}catch{qi=null}var jh=qi,Og=Dh(),Bc=Ar,Fn=Og&&Bc("%Object.defineProperty%",!0);if(Fn)try{Fn({},"a",{value:1})}catch{Fn=!1}var Ng=Bc("%SyntaxError%"),Br=Bc("%TypeError%"),nl=jh,Lg=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Br("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Br("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Br("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Br("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Br("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Br("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!nl&&nl(e,r);if(Fn)Fn(e,r,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:n,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new Ng("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Bh=Ar,il=Lg,Pg=Dh(),sl=jh,ol=Bh("%TypeError%"),$g=Bh("%Math.floor%"),Dg=function(e,r){if(typeof e!="function")throw new ol("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||$g(r)!==r)throw new ol("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&sl){var o=sl(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Pg?il(e,"length",r,!0,!0):il(e,"length",r)),e};(function(t){var e=jc,r=Ar,n=Dg,i=r("%TypeError%"),s=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(o,s),c=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch{c=null}t.exports=function(h){if(typeof h!="function")throw new i("a function is required");var p=a(e,o,arguments);return n(p,1+u(0,h.length-(arguments.length-1)),!0)};var l=function(){return a(e,s,arguments)};c?c(t.exports,"apply",{value:l}):t.exports.apply=l})($h);var jg=$h.exports,Fh=Ar,Wh=jg,Bg=Wh(Fh("String.prototype.indexOf")),Fg=function(e,r){var n=Fh(e,!!r);return typeof n=="function"&&Bg(e,".prototype.")>-1?Wh(n):n},Fc=typeof Map=="function"&&Map.prototype,ga=Object.getOwnPropertyDescriptor&&Fc?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,rs=Fc&&ga&&typeof ga.get=="function"?ga.get:null,al=Fc&&Map.prototype.forEach,Wc=typeof Set=="function"&&Set.prototype,ya=Object.getOwnPropertyDescriptor&&Wc?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ns=Wc&&ya&&typeof ya.get=="function"?ya.get:null,cl=Wc&&Set.prototype.forEach,Wg=typeof WeakMap=="function"&&WeakMap.prototype,Wn=Wg?WeakMap.prototype.has:null,Hg=typeof WeakSet=="function"&&WeakSet.prototype,Hn=Hg?WeakSet.prototype.has:null,Vg=typeof WeakRef=="function"&&WeakRef.prototype,ul=Vg?WeakRef.prototype.deref:null,Ug=Boolean.prototype.valueOf,zg=Object.prototype.toString,qg=Function.prototype.toString,Gg=String.prototype.match,Hc=String.prototype.slice,Yt=String.prototype.replace,Jg=String.prototype.toUpperCase,ll=String.prototype.toLowerCase,Hh=RegExp.prototype.test,fl=Array.prototype.concat,xt=Array.prototype.join,Qg=Array.prototype.slice,hl=Math.floor,cc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,va=Object.getOwnPropertySymbols,uc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,nn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Fe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===nn||"symbol")?Symbol.toStringTag:null,Vh=Object.prototype.propertyIsEnumerable,dl=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function pl(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Hh.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-hl(-t):hl(t);if(n!==t){var i=String(n),s=Hc.call(e,i.length+1);return Yt.call(i,r,"$&_")+"."+Yt.call(Yt.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yt.call(e,r,"$&_")}var lc=Oc,bl=lc.custom,gl=zh(bl)?bl:null,Zg=function t(e,r,n,i){var s=r||{};if(Jt(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Jt(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Jt(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Jt(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Jt(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Gh(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?pl(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?pl(e,u):u}var l=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=l&&l>0&&typeof e=="object")return fc(e)?"[Array]":"[Object]";var f=py(s,n);if(typeof i>"u")i=[];else if(qh(i,e)>=0)return"[Circular]";function h(R,M,N){if(M&&(i=Qg.call(i),i.push(M)),N){var L={depth:s.depth};return Jt(s,"quoteStyle")&&(L.quoteStyle=s.quoteStyle),t(R,L,n+1,i)}return t(R,s,n+1,i)}if(typeof e=="function"&&!yl(e)){var p=sy(e),v=ki(e,h);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(v.length>0?" { "+xt.call(v,", ")+" }":"")}if(zh(e)){var E=nn?Yt.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):uc.call(e);return typeof e=="object"&&!nn?Ln(E):E}if(fy(e)){for(var _="<"+ll.call(String(e.nodeName)),d=e.attributes||[],y=0;y",_}if(fc(e)){if(e.length===0)return"[]";var m=ki(e,h);return f&&!dy(m)?"["+hc(m,f)+"]":"[ "+xt.call(m,", ")+" ]"}if(Xg(e)){var x=ki(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!Vh.call(e,"cause")?"{ ["+String(e)+"] "+xt.call(fl.call("[cause]: "+h(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+xt.call(x,", ")+" }"}if(typeof e=="object"&&o){if(gl&&typeof e[gl]=="function"&&lc)return lc(e,{depth:l-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(oy(e)){var C=[];return al&&al.call(e,function(R,M){C.push(h(M,e,!0)+" => "+h(R,e))}),vl("Map",rs.call(e),C,f)}if(uy(e)){var T=[];return cl&&cl.call(e,function(R){T.push(h(R,e))}),vl("Set",ns.call(e),T,f)}if(ay(e))return ma("WeakMap");if(ly(e))return ma("WeakSet");if(cy(e))return ma("WeakRef");if(ty(e))return Ln(h(Number(e)));if(ny(e))return Ln(h(cc.call(e)));if(ry(e))return Ln(Ug.call(e));if(ey(e))return Ln(h(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===F)return"{ [object globalThis] }";if(!Kg(e)&&!yl(e)){var j=ki(e,h),$=dl?dl(e)===Object.prototype:e instanceof Object||e.constructor===Object,A=e instanceof Object?"":"null prototype",U=!$&&Fe&&Object(e)===e&&Fe in e?Hc.call(sr(e),8,-1):A?"Object":"",ce=$||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Z=ce+(U||A?"["+xt.call(fl.call([],U||[],A||[]),": ")+"] ":"");return j.length===0?Z+"{}":f?Z+"{"+hc(j,f)+"}":Z+"{ "+xt.call(j,", ")+" }"}return String(e)};function Uh(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Yg(t){return Yt.call(String(t),/"/g,""")}function fc(t){return sr(t)==="[object Array]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function Kg(t){return sr(t)==="[object Date]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function yl(t){return sr(t)==="[object RegExp]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function Xg(t){return sr(t)==="[object Error]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function ey(t){return sr(t)==="[object String]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function ty(t){return sr(t)==="[object Number]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function ry(t){return sr(t)==="[object Boolean]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function zh(t){if(nn)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!uc)return!1;try{return uc.call(t),!0}catch{}return!1}function ny(t){if(!t||typeof t!="object"||!cc)return!1;try{return cc.call(t),!0}catch{}return!1}var iy=Object.prototype.hasOwnProperty||function(t){return t in this};function Jt(t,e){return iy.call(t,e)}function sr(t){return zg.call(t)}function sy(t){if(t.name)return t.name;var e=Gg.call(qg.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function qh(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Gh(Hc.call(t,0,e.maxStringLength),e)+n}var i=Yt.call(Yt.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,hy);return Uh(i,"single",e)}function hy(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Jg.call(e.toString(16))}function Ln(t){return"Object("+t+")"}function ma(t){return t+" { ? }"}function vl(t,e,r,n){var i=n?hc(r,n):xt.call(r,", ");return t+" ("+e+") {"+i+"}"}function dy(t){for(var e=0;en[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var Lc={},Qn={},bs={};Object.defineProperty(bs,"__esModule",{value:!0});bs.walletLogo=void 0;const F0=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};bs.walletLogo=F0;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});gs.LINK_API_URL=void 0;gs.LINK_API_URL="https://www.walletlink.org";var ys={};Object.defineProperty(ys,"__esModule",{value:!0});ys.ScopedLocalStorage=void 0;class W0{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}ys.ScopedLocalStorage=W0;var tn={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});const H0=Nc;function qu(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function V0(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")qu(s,this,r);else{const o=s.length,a=V0(s);for(let c=0;c"u"&&(n=wh()),nc(t,"",0,[],void 0,0,n);var i;try{br.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,Eh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;_r.length!==0;){var s=_r.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Qr(t,e,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:t}),_r.push([n,r,e,i])):br.push([e,r,t]):(n[r]=t,_r.push([n,r,e]))}function nc(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Qr(Xi,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Qr(Xi,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function Sh(t,e,r,n){typeof n>"u"&&(n=wh());var i=ic(t,"",0,[],void 0,0,n)||t,s;try{br.length===0?s=JSON.stringify(i,e,r):s=JSON.stringify(i,Eh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;_r.length!==0;){var o=_r.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function ic(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Qr(Xi,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Qr(Xi,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function Z0(t,e){if(e!=="[Circular]")return e}var $c={},er={};Object.defineProperty(er,"__esModule",{value:!0});er.errorValues=er.errorCodes=void 0;er.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};er.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=er,r=Xt,n=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(h,p=i){if(Number.isInteger(h)){const v=h.toString();if(f(e.errorValues,v))return e.errorValues[v].message;if(u(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return p}t.getMessageFromCode=o;function a(h){if(!Number.isInteger(h))return!1;const p=h.toString();return!!(e.errorValues[p]||u(h))}t.isValidCode=a;function c(h,{fallbackError:p=s,shouldIncludeStack:v=!1}={}){var E,_;if(!p||!Number.isInteger(p.code)||typeof p.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(h instanceof r.EthereumRpcError)return h.serialize();const d={};if(h&&typeof h=="object"&&!Array.isArray(h)&&f(h,"code")&&a(h.code)){const m=h;d.code=m.code,m.message&&typeof m.message=="string"?(d.message=m.message,f(m,"data")&&(d.data=m.data)):(d.message=o(d.code),d.data={originalError:l(h)})}else{d.code=p.code;const m=(E=h)===null||E===void 0?void 0:E.message;d.message=m&&typeof m=="string"?m:p.message,d.data={originalError:l(h)}}const y=(_=h)===null||_===void 0?void 0:_.stack;return v&&h&&y&&typeof y=="string"&&(d.stack=y),d}t.serializeError=c;function u(h){return h>=-32099&&h<=-32e3}function l(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function f(h,p){return Object.prototype.hasOwnProperty.call(h,p)}})($c);var vs={};Object.defineProperty(vs,"__esModule",{value:!0});vs.ethErrors=void 0;const Dc=Xt,xh=$c,De=er;vs.ethErrors={rpc:{parse:t=>Xe(De.errorCodes.rpc.parse,t),invalidRequest:t=>Xe(De.errorCodes.rpc.invalidRequest,t),invalidParams:t=>Xe(De.errorCodes.rpc.invalidParams,t),methodNotFound:t=>Xe(De.errorCodes.rpc.methodNotFound,t),internal:t=>Xe(De.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Xe(e,t)},invalidInput:t=>Xe(De.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>Xe(De.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>Xe(De.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>Xe(De.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>Xe(De.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>Xe(De.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Nn(De.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>Nn(De.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>Nn(De.errorCodes.provider.unsupportedMethod,t),disconnected:t=>Nn(De.errorCodes.provider.disconnected,t),chainDisconnected:t=>Nn(De.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Dc.EthereumProviderError(e,r,n)}}};function Xe(t,e){const[r,n]=Ih(e);return new Dc.EthereumRpcError(t,r||xh.getMessageFromCode(t),n)}function Nn(t,e){const[r,n]=Ih(e);return new Dc.EthereumProviderError(t,r||xh.getMessageFromCode(t),n)}function Ih(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Xt;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=$c;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=vs;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=er;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(Pc);var be={},ms={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Web3Method=void 0,function(e){e.requestEthereumAccounts="requestEthereumAccounts",e.signEthereumMessage="signEthereumMessage",e.signEthereumTransaction="signEthereumTransaction",e.submitEthereumTransaction="submitEthereumTransaction",e.ethereumAddressFromSignedMessage="ethereumAddressFromSignedMessage",e.scanQRCode="scanQRCode",e.generic="generic",e.childRequestEthereumAccounts="childRequestEthereumAccounts",e.addEthereumChain="addEthereumChain",e.switchEthereumChain="switchEthereumChain",e.makeEthereumJSONRPCRequest="makeEthereumJSONRPCRequest",e.watchAsset="watchAsset",e.selectProvider="selectProvider"}(t.Web3Method||(t.Web3Method={}))})(ms);Object.defineProperty(be,"__esModule",{value:!0});be.EthereumAddressFromSignedMessageResponse=be.SubmitEthereumTransactionResponse=be.SignEthereumTransactionResponse=be.SignEthereumMessageResponse=be.isRequestEthereumAccountsResponse=be.SelectProviderResponse=be.WatchAssetReponse=be.RequestEthereumAccountsResponse=be.SwitchEthereumChainResponse=be.AddEthereumChainResponse=be.isErrorResponse=void 0;const Tt=ms;function Y0(t){var e,r;return((e=t)===null||e===void 0?void 0:e.method)!==void 0&&((r=t)===null||r===void 0?void 0:r.errorMessage)!==void 0}be.isErrorResponse=Y0;function K0(t){return{method:Tt.Web3Method.addEthereumChain,result:t}}be.AddEthereumChainResponse=K0;function X0(t){return{method:Tt.Web3Method.switchEthereumChain,result:t}}be.SwitchEthereumChainResponse=X0;function eb(t){return{method:Tt.Web3Method.requestEthereumAccounts,result:t}}be.RequestEthereumAccountsResponse=eb;function tb(t){return{method:Tt.Web3Method.watchAsset,result:t}}be.WatchAssetReponse=tb;function rb(t){return{method:Tt.Web3Method.selectProvider,result:t}}be.SelectProviderResponse=rb;function nb(t){return t&&t.method===Tt.Web3Method.requestEthereumAccounts}be.isRequestEthereumAccountsResponse=nb;function ib(t){return{method:Tt.Web3Method.signEthereumMessage,result:t}}be.SignEthereumMessageResponse=ib;function sb(t){return{method:Tt.Web3Method.signEthereumTransaction,result:t}}be.SignEthereumTransactionResponse=sb;function ob(t){return{method:Tt.Web3Method.submitEthereumTransaction,result:t}}be.SubmitEthereumTransactionResponse=ob;function ab(t){return{method:Tt.Web3Method.ethereumAddressFromSignedMessage,result:t}}be.EthereumAddressFromSignedMessageResponse=ab;var mn={};Object.defineProperty(mn,"__esModule",{value:!0});mn.LIB_VERSION=void 0;mn.LIB_VERSION="3.7.2";(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCode=t.serializeError=t.standardErrors=t.standardErrorMessage=t.standardErrorCodes=void 0;const e=Pc,r=be,n=mn;t.standardErrorCodes=Object.freeze(Object.assign(Object.assign({},e.errorCodes),{provider:Object.freeze(Object.assign(Object.assign({},e.errorCodes.provider),{unsupportedChain:4902}))}));function i(l){return l!==void 0?(0,e.getMessageFromCode)(l):"Unknown error"}t.standardErrorMessage=i,t.standardErrors=Object.freeze(Object.assign(Object.assign({},e.ethErrors),{provider:Object.freeze(Object.assign(Object.assign({},e.ethErrors.provider),{unsupportedChain:(l="")=>e.ethErrors.provider.custom({code:t.standardErrorCodes.provider.unsupportedChain,message:`Unrecognized chain ID ${l}. Try adding the chain using wallet_addEthereumChain first.`})}))}));function s(l,f){const h=(0,e.serializeError)(o(l),{shouldIncludeStack:!0}),p=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");p.searchParams.set("version",n.LIB_VERSION),p.searchParams.set("code",h.code.toString());const v=a(h.data,f);return v&&p.searchParams.set("method",v),p.searchParams.set("message",h.message),Object.assign(Object.assign({},h),{docUrl:p.href})}t.serializeError=s;function o(l){return typeof l=="string"?{message:l,code:t.standardErrorCodes.rpc.internal}:(0,r.isErrorResponse)(l)?Object.assign(Object.assign({},l),{message:l.errorMessage,code:l.errorCode,data:{method:l.method,result:l.result}}):l}function a(l,f){var h;const p=(h=l)===null||h===void 0?void 0:h.method;if(p)return p;if(f!==void 0)return typeof f=="string"?f:Array.isArray(f)?f.length>0?f[0].method:void 0:f.method}function c(l){var f;if(typeof l=="number")return l;if(u(l))return(f=l.code)!==null&&f!==void 0?f:l.errorCode}t.getErrorCode=c;function u(l){return typeof l=="object"&&l!==null&&(typeof l.code=="number"||typeof l.errorCode=="number")}})(ni);var _n={},Rh={exports:{}},sc={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(t,e){var r=ps,n=r.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=s);function s(o,a,c){return n(o,a,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=n(o);return a!==void 0?typeof c=="string"?u.fill(a,c):u.fill(a):u.fill(0),u},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(sc,sc.exports);var ir=sc.exports,Ah=ir.Buffer;function _s(t,e){this._block=Ah.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}_s.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=Ah.from(t,e));for(var r=this._block,n=this._blockSize,i=t.length,s=this._len,o=0;o=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};_s.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var wn=_s,cb=bt,Mh=wn,ub=ir.Buffer,lb=[1518500249,1859775393,-1894007588,-899497514],fb=new Array(80);function ii(){this.init(),this._w=fb,Mh.call(this,64,56)}cb(ii,Mh);ii.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function hb(t){return t<<5|t>>>27}function db(t){return t<<30|t>>>2}function pb(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}ii.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=e[a-3]^e[a-8]^e[a-14]^e[a-16];for(var c=0;c<80;++c){var u=~~(c/20),l=hb(r)+pb(u,n,i,s)+o+e[c]+lb[u]|0;o=s,s=i,i=db(n),n=r,r=l}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};ii.prototype._hash=function(){var t=ub.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var bb=ii,gb=bt,kh=wn,yb=ir.Buffer,vb=[1518500249,1859775393,-1894007588,-899497514],mb=new Array(80);function si(){this.init(),this._w=mb,kh.call(this,64,56)}gb(si,kh);si.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function _b(t){return t<<1|t>>>31}function wb(t){return t<<5|t>>>27}function Sb(t){return t<<30|t>>>2}function Eb(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}si.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=_b(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var c=0;c<80;++c){var u=~~(c/20),l=wb(r)+Eb(u,n,i,s)+o+e[c]+vb[u]|0;o=s,s=i,i=Sb(n),n=r,r=l}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};si.prototype._hash=function(){var t=yb.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};var Cb=si,xb=bt,Th=wn,Ib=ir.Buffer,Rb=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ab=new Array(64);function oi(){this.init(),this._w=Ab,Th.call(this,64,56)}xb(oi,Th);oi.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function Mb(t,e,r){return r^t&(e^r)}function kb(t,e,r){return t&e|r&(t|e)}function Tb(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Ob(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function Nb(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function Lb(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}oi.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=this._f|0,c=this._g|0,u=this._h|0,l=0;l<16;++l)e[l]=t.readInt32BE(l*4);for(;l<64;++l)e[l]=Lb(e[l-2])+e[l-7]+Nb(e[l-15])+e[l-16]|0;for(var f=0;f<64;++f){var h=u+Ob(o)+Mb(o,a,c)+Rb[f]+e[f]|0,p=Tb(r)+kb(r,n,i)|0;u=c,c=a,a=o,o=s+h|0,s=i,i=n,n=r,r=h+p|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=a+this._f|0,this._g=c+this._g|0,this._h=u+this._h|0};oi.prototype._hash=function(){var t=Ib.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Oh=oi,Pb=bt,$b=Oh,Db=wn,jb=ir.Buffer,Bb=new Array(64);function ws(){this.init(),this._w=Bb,Db.call(this,64,56)}Pb(ws,$b);ws.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};ws.prototype._hash=function(){var t=jb.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var Fb=ws,Wb=bt,Nh=wn,Hb=ir.Buffer,Gu=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Vb=new Array(160);function ai(){this.init(),this._w=Vb,Nh.call(this,128,112)}Wb(ai,Nh);ai.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Ju(t,e,r){return r^t&(e^r)}function Qu(t,e,r){return t&e|r&(t|e)}function Zu(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Yu(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Ub(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function zb(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function qb(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Gb(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function Ae(t,e){return t>>>0>>0?1:0}ai.prototype._update=function(t){for(var e=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,o=this._eh|0,a=this._fh|0,c=this._gh|0,u=this._hh|0,l=this._al|0,f=this._bl|0,h=this._cl|0,p=this._dl|0,v=this._el|0,E=this._fl|0,_=this._gl|0,d=this._hl|0,y=0;y<32;y+=2)e[y]=t.readInt32BE(y*4),e[y+1]=t.readInt32BE(y*4+4);for(;y<160;y+=2){var m=e[y-30],x=e[y-15*2+1],C=Ub(m,x),T=zb(x,m);m=e[y-2*2],x=e[y-2*2+1];var j=qb(m,x),$=Gb(x,m),A=e[y-7*2],U=e[y-7*2+1],ce=e[y-16*2],Z=e[y-16*2+1],R=T+U|0,M=C+A+Ae(R,T)|0;R=R+$|0,M=M+j+Ae(R,$)|0,R=R+Z|0,M=M+ce+Ae(R,Z)|0,e[y]=M,e[y+1]=R}for(var N=0;N<160;N+=2){M=e[N],R=e[N+1];var L=Qu(r,n,i),B=Qu(l,f,h),D=Zu(r,l),H=Zu(l,r),Y=Yu(o,v),J=Yu(v,o),se=Gu[N],he=Gu[N+1],le=Ju(o,a,c),We=Ju(v,E,_),w=d+J|0,S=u+Y+Ae(w,d)|0;w=w+We|0,S=S+le+Ae(w,We)|0,w=w+he|0,S=S+se+Ae(w,he)|0,w=w+R|0,S=S+M+Ae(w,R)|0;var O=H+B|0,z=D+L+Ae(O,H)|0;u=c,d=_,c=a,_=E,a=o,E=v,v=p+w|0,o=s+S+Ae(v,p)|0,s=i,p=h,i=n,h=f,n=r,f=l,l=w+O|0,r=S+z+Ae(l,w)|0}this._al=this._al+l|0,this._bl=this._bl+f|0,this._cl=this._cl+h|0,this._dl=this._dl+p|0,this._el=this._el+v|0,this._fl=this._fl+E|0,this._gl=this._gl+_|0,this._hl=this._hl+d|0,this._ah=this._ah+r+Ae(this._al,l)|0,this._bh=this._bh+n+Ae(this._bl,f)|0,this._ch=this._ch+i+Ae(this._cl,h)|0,this._dh=this._dh+s+Ae(this._dl,p)|0,this._eh=this._eh+o+Ae(this._el,v)|0,this._fh=this._fh+a+Ae(this._fl,E)|0,this._gh=this._gh+c+Ae(this._gl,_)|0,this._hh=this._hh+u+Ae(this._hl,d)|0};ai.prototype._hash=function(){var t=Hb.allocUnsafe(64);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};var Lh=ai,Jb=bt,Qb=Lh,Zb=wn,Yb=ir.Buffer,Kb=new Array(160);function Ss(){this.init(),this._w=Kb,Zb.call(this,128,112)}Jb(Ss,Qb);Ss.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Ss.prototype._hash=function(){var t=Yb.allocUnsafe(48);function e(r,n,i){t.writeInt32BE(r,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};var Xb=Ss,Rr=Rh.exports=function(e){e=e.toLowerCase();var r=Rr[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};Rr.sha=bb;Rr.sha1=Cb;Rr.sha224=Fb;Rr.sha256=Oh;Rr.sha384=Xb;Rr.sha512=Lh;var eg=Rh.exports,W={},tg=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0},Ku=typeof Symbol<"u"&&Symbol,rg=tg,ng=function(){return typeof Ku!="function"||typeof Symbol!="function"||typeof Ku("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:rg()},Xu={foo:{}},ig=Object,sg=function(){return{__proto__:Xu}.foo===Xu.foo&&!({__proto__:null}instanceof ig)},og="Function.prototype.bind called on incompatible ",ag=Object.prototype.toString,cg=Math.max,ug="[object Function]",el=function(e,r){for(var n=[],i=0;i"u"||!Te?ne:Te(Uint8Array),mr={"%AggregateError%":typeof AggregateError>"u"?ne:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ne:ArrayBuffer,"%ArrayIteratorPrototype%":jr&&Te?Te([][Symbol.iterator]()):ne,"%AsyncFromSyncIteratorPrototype%":ne,"%AsyncFunction%":zr,"%AsyncGenerator%":zr,"%AsyncGeneratorFunction%":zr,"%AsyncIteratorPrototype%":zr,"%Atomics%":typeof Atomics>"u"?ne:Atomics,"%BigInt%":typeof BigInt>"u"?ne:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ne:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ne:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ne:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?ne:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ne:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ne:FinalizationRegistry,"%Function%":Ph,"%GeneratorFunction%":zr,"%Int8Array%":typeof Int8Array>"u"?ne:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ne:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ne:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":jr&&Te?Te(Te([][Symbol.iterator]())):ne,"%JSON%":typeof JSON=="object"?JSON:ne,"%Map%":typeof Map>"u"?ne:Map,"%MapIteratorPrototype%":typeof Map>"u"||!jr||!Te?ne:Te(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ne:Promise,"%Proxy%":typeof Proxy>"u"?ne:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?ne:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ne:Set,"%SetIteratorPrototype%":typeof Set>"u"||!jr||!Te?ne:Te(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ne:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":jr&&Te?Te(""[Symbol.iterator]()):ne,"%Symbol%":jr?Symbol:ne,"%SyntaxError%":rn,"%ThrowTypeError%":vg,"%TypedArray%":_g,"%TypeError%":Zr,"%Uint8Array%":typeof Uint8Array>"u"?ne:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ne:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ne:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ne:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?ne:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ne:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ne:WeakSet};if(Te)try{null.error}catch(t){var wg=Te(Te(t));mr["%Error.prototype%"]=wg}var Sg=function t(e){var r;if(e==="%AsyncFunction%")r=pa("async function () {}");else if(e==="%GeneratorFunction%")r=pa("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=pa("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Te&&(r=Te(i.prototype))}return mr[e]=r,r},tl={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ci=jc,es=yg,Eg=ci.call(Function.call,Array.prototype.concat),Cg=ci.call(Function.apply,Array.prototype.splice),rl=ci.call(Function.call,String.prototype.replace),ts=ci.call(Function.call,String.prototype.slice),xg=ci.call(Function.call,RegExp.prototype.exec),Ig=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Rg=/\\(\\)?/g,Ag=function(e){var r=ts(e,0,1),n=ts(e,-1);if(r==="%"&&n!=="%")throw new rn("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new rn("invalid intrinsic syntax, expected opening `%`");var i=[];return rl(e,Ig,function(s,o,a,c){i[i.length]=a?rl(c,Rg,"$1"):o||s}),i},Mg=function(e,r){var n=e,i;if(es(tl,n)&&(i=tl[n],n="%"+i[0]+"%"),es(mr,n)){var s=mr[n];if(s===zr&&(s=Sg(n)),typeof s>"u"&&!r)throw new Zr("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new rn("intrinsic "+e+" does not exist!")},Ar=function(e,r){if(typeof e!="string"||e.length===0)throw new Zr("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Zr('"allowMissing" argument must be a boolean');if(xg(/^%?[^%]*%?$/,e)===null)throw new rn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Ag(e),i=n.length>0?n[0]:"",s=Mg("%"+i+"%",r),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],Cg(n,Eg([0,1],u)));for(var l=1,f=!0;l=n.length){var E=vr(a,h);f=!!E,f&&"get"in E&&!("originalValue"in E.get)?a=E.get:a=a[h]}else f=es(a,h),a=a[h];f&&!c&&(mr[o]=a)}}return a},$h={exports:{}},kg=Ar,oc=kg("%Object.defineProperty%",!0),ac=function(){if(oc)try{return oc({},"a",{value:1}),!0}catch{return!1}return!1};ac.hasArrayLengthDefineBug=function(){if(!ac())return null;try{return oc([],"length",{value:1}).length!==1}catch{return!0}};var Dh=ac,Tg=Ar,qi=Tg("%Object.getOwnPropertyDescriptor%",!0);if(qi)try{qi([],"length")}catch{qi=null}var jh=qi,Og=Dh(),Bc=Ar,Fn=Og&&Bc("%Object.defineProperty%",!0);if(Fn)try{Fn({},"a",{value:1})}catch{Fn=!1}var Ng=Bc("%SyntaxError%"),Br=Bc("%TypeError%"),nl=jh,Lg=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Br("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Br("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Br("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Br("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Br("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Br("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,c=!!nl&&nl(e,r);if(Fn)Fn(e,r,{configurable:o===null&&c?c.configurable:!o,enumerable:i===null&&c?c.enumerable:!i,value:n,writable:s===null&&c?c.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new Ng("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Bh=Ar,il=Lg,Pg=Dh(),sl=jh,ol=Bh("%TypeError%"),$g=Bh("%Math.floor%"),Dg=function(e,r){if(typeof e!="function")throw new ol("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||$g(r)!==r)throw new ol("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&sl){var o=sl(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Pg?il(e,"length",r,!0,!0):il(e,"length",r)),e};(function(t){var e=jc,r=Ar,n=Dg,i=r("%TypeError%"),s=r("%Function.prototype.apply%"),o=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(o,s),c=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch{c=null}t.exports=function(h){if(typeof h!="function")throw new i("a function is required");var p=a(e,o,arguments);return n(p,1+u(0,h.length-(arguments.length-1)),!0)};var l=function(){return a(e,s,arguments)};c?c(t.exports,"apply",{value:l}):t.exports.apply=l})($h);var jg=$h.exports,Fh=Ar,Wh=jg,Bg=Wh(Fh("String.prototype.indexOf")),Fg=function(e,r){var n=Fh(e,!!r);return typeof n=="function"&&Bg(e,".prototype.")>-1?Wh(n):n},Fc=typeof Map=="function"&&Map.prototype,ga=Object.getOwnPropertyDescriptor&&Fc?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,rs=Fc&&ga&&typeof ga.get=="function"?ga.get:null,al=Fc&&Map.prototype.forEach,Wc=typeof Set=="function"&&Set.prototype,ya=Object.getOwnPropertyDescriptor&&Wc?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ns=Wc&&ya&&typeof ya.get=="function"?ya.get:null,cl=Wc&&Set.prototype.forEach,Wg=typeof WeakMap=="function"&&WeakMap.prototype,Wn=Wg?WeakMap.prototype.has:null,Hg=typeof WeakSet=="function"&&WeakSet.prototype,Hn=Hg?WeakSet.prototype.has:null,Vg=typeof WeakRef=="function"&&WeakRef.prototype,ul=Vg?WeakRef.prototype.deref:null,Ug=Boolean.prototype.valueOf,zg=Object.prototype.toString,qg=Function.prototype.toString,Gg=String.prototype.match,Hc=String.prototype.slice,Yt=String.prototype.replace,Jg=String.prototype.toUpperCase,ll=String.prototype.toLowerCase,Hh=RegExp.prototype.test,fl=Array.prototype.concat,xt=Array.prototype.join,Qg=Array.prototype.slice,hl=Math.floor,cc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,va=Object.getOwnPropertySymbols,uc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,nn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Fe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===nn||"symbol")?Symbol.toStringTag:null,Vh=Object.prototype.propertyIsEnumerable,dl=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function pl(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Hh.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-hl(-t):hl(t);if(n!==t){var i=String(n),s=Hc.call(e,i.length+1);return Yt.call(i,r,"$&_")+"."+Yt.call(Yt.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yt.call(e,r,"$&_")}var lc=Oc,bl=lc.custom,gl=zh(bl)?bl:null,Zg=function t(e,r,n,i){var s=r||{};if(Jt(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Jt(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Jt(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Jt(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Jt(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Gh(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return a?pl(e,c):c}if(typeof e=="bigint"){var u=String(e)+"n";return a?pl(e,u):u}var l=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=l&&l>0&&typeof e=="object")return fc(e)?"[Array]":"[Object]";var f=py(s,n);if(typeof i>"u")i=[];else if(qh(i,e)>=0)return"[Circular]";function h(R,M,N){if(M&&(i=Qg.call(i),i.push(M)),N){var L={depth:s.depth};return Jt(s,"quoteStyle")&&(L.quoteStyle=s.quoteStyle),t(R,L,n+1,i)}return t(R,s,n+1,i)}if(typeof e=="function"&&!yl(e)){var p=sy(e),v=ki(e,h);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(v.length>0?" { "+xt.call(v,", ")+" }":"")}if(zh(e)){var E=nn?Yt.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):uc.call(e);return typeof e=="object"&&!nn?Ln(E):E}if(fy(e)){for(var _="<"+ll.call(String(e.nodeName)),d=e.attributes||[],y=0;y",_}if(fc(e)){if(e.length===0)return"[]";var m=ki(e,h);return f&&!dy(m)?"["+hc(m,f)+"]":"[ "+xt.call(m,", ")+" ]"}if(Xg(e)){var x=ki(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!Vh.call(e,"cause")?"{ ["+String(e)+"] "+xt.call(fl.call("[cause]: "+h(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+xt.call(x,", ")+" }"}if(typeof e=="object"&&o){if(gl&&typeof e[gl]=="function"&&lc)return lc(e,{depth:l-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(oy(e)){var C=[];return al&&al.call(e,function(R,M){C.push(h(M,e,!0)+" => "+h(R,e))}),vl("Map",rs.call(e),C,f)}if(uy(e)){var T=[];return cl&&cl.call(e,function(R){T.push(h(R,e))}),vl("Set",ns.call(e),T,f)}if(ay(e))return ma("WeakMap");if(ly(e))return ma("WeakSet");if(cy(e))return ma("WeakRef");if(ty(e))return Ln(h(Number(e)));if(ny(e))return Ln(h(cc.call(e)));if(ry(e))return Ln(Ug.call(e));if(ey(e))return Ln(h(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===F)return"{ [object globalThis] }";if(!Kg(e)&&!yl(e)){var j=ki(e,h),$=dl?dl(e)===Object.prototype:e instanceof Object||e.constructor===Object,A=e instanceof Object?"":"null prototype",U=!$&&Fe&&Object(e)===e&&Fe in e?Hc.call(sr(e),8,-1):A?"Object":"",ce=$||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Z=ce+(U||A?"["+xt.call(fl.call([],U||[],A||[]),": ")+"] ":"");return j.length===0?Z+"{}":f?Z+"{"+hc(j,f)+"}":Z+"{ "+xt.call(j,", ")+" }"}return String(e)};function Uh(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Yg(t){return Yt.call(String(t),/"/g,""")}function fc(t){return sr(t)==="[object Array]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function Kg(t){return sr(t)==="[object Date]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function yl(t){return sr(t)==="[object RegExp]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function Xg(t){return sr(t)==="[object Error]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function ey(t){return sr(t)==="[object String]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function ty(t){return sr(t)==="[object Number]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function ry(t){return sr(t)==="[object Boolean]"&&(!Fe||!(typeof t=="object"&&Fe in t))}function zh(t){if(nn)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!uc)return!1;try{return uc.call(t),!0}catch{}return!1}function ny(t){if(!t||typeof t!="object"||!cc)return!1;try{return cc.call(t),!0}catch{}return!1}var iy=Object.prototype.hasOwnProperty||function(t){return t in this};function Jt(t,e){return iy.call(t,e)}function sr(t){return zg.call(t)}function sy(t){if(t.name)return t.name;var e=Gg.call(qg.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function qh(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Gh(Hc.call(t,0,e.maxStringLength),e)+n}var i=Yt.call(Yt.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,hy);return Uh(i,"single",e)}function hy(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Jg.call(e.toString(16))}function Ln(t){return"Object("+t+")"}function ma(t){return t+" { ? }"}function vl(t,e,r,n){var i=n?hc(r,n):xt.call(r,", ");return t+" ("+e+") {"+i+"}"}function dy(t){for(var e=0;e=0)return!1;return!0}function py(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=xt.call(Array(t.indent+1)," ");else return null;return{base:r,prev:xt.call(Array(e+1),r)}}function hc(t,e){if(t.length===0)return"";var r=` `+e.prev+e.base;return r+xt.call(t,","+r)+` `+e.prev}function ki(t,e){var r=fc(t),n=[];if(r){n.length=t.length;for(var i=0;i1;){var r=e.pop(),n=r.obj[r.prop];if(lr(n)){for(var i=[],s=0;s=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||s===My.RFC1738&&(u===40||u===41)){a+=o.charAt(c);continue}if(u<128){a=a+mt[u];continue}if(u<2048){a=a+(mt[192|u>>6]+mt[128|u&63]);continue}if(u<55296||u>=57344){a=a+(mt[224|u>>12]+mt[128|u>>6&63]+mt[128|u&63]);continue}c+=1,u=65536+((u&1023)<<10|o.charCodeAt(c)&1023),a+=mt[240|u>>18]+mt[128|u>>12&63]+mt[128|u>>6&63]+mt[128|u&63]}return a},Py=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i"u"&&(m=0)}if(typeof c=="function"?d=c(r,d):d instanceof Date?d=f(d):n==="comma"&&$t(d)&&(d=Gi.maybeMap(d,function(L){return L instanceof Date?f(L):L})),d===null){if(s)return a&&!v?a(r,Be.encoder,E,"key",h):r;d=""}if(Vy(d)||Gi.isBuffer(d)){if(a){var T=v?r:a(r,Be.encoder,E,"key",h);return[p(T)+"="+p(a(d,Be.encoder,E,"value",h))]}return[p(r)+"="+p(String(d))]}var j=[];if(typeof d>"u")return j;var $;if(n==="comma"&&$t(d))v&&a&&(d=Gi.maybeMap(d,a)),$=[{value:d.length>0?d.join(",")||null:void 0}];else if($t(c))$=c;else{var A=Object.keys(d);$=u?A.sort(u):A}for(var U=i&&$t(d)&&d.length===1?r+"[]":r,ce=0;ce<$.length;++ce){var Z=$[ce],R=typeof Z=="object"&&typeof Z.value<"u"?Z.value:d[Z];if(!(o&&R===null)){var M=$t(d)?typeof n=="function"?n(U,Z):U:U+(l?"."+Z:"["+Z+"]");_.set(e,m);var N=Zh();N.set(Sa,_),Yh(j,t(R,M,n,i,s,o,n==="comma"&&v&&$t(d)?null:a,c,u,l,f,h,p,v,E,N))}}return j},zy=function(e){if(!e)return Be;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||Be.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=Vn.default;if(typeof e.format<"u"){if(!Fy.call(Vn.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=Vn.formatters[n],s=Be.filter;return(typeof e.filter=="function"||$t(e.filter))&&(s=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Be.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Be.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Be.charsetSentinel,delimiter:typeof e.delimiter>"u"?Be.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Be.encode,encoder:typeof e.encoder=="function"?e.encoder:Be.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Be.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Be.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Be.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Be.strictNullHandling}},qy=function(t,e){var r=t,n=zy(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):$t(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in ml?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var c=ml[a];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=c==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=Zh(),f=0;f0?v+p:""},sn=Qh,dc=Object.prototype.hasOwnProperty,Gy=Array.isArray,Me={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:sn.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Jy=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Kh=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Qy="utf8=%26%2310003%3B",Zy="utf8=%E2%9C%93",Yy=function(e,r){var n={__proto__:null},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,c,u=r.charset;if(r.charsetSentinel)for(c=0;c-1&&(v=Gy(v)?[v]:v),dc.call(n,p)?n[p]=sn.combine(n[p],v):n[p]=v}return n},Ky=function(t,e,r,n){for(var i=n?e:Kh(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var c=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,u=parseInt(c,10);!r.parseArrays&&c===""?o={0:i}:!isNaN(u)&&a!==c&&String(u)===c&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(o=[],o[u]=i):c!=="__proto__"&&(o[c]=i)}i=o}return i},Xy=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,c=n.depth>0&&o.exec(s),u=c?s.slice(0,c.index):s,l=[];if(u){if(!n.plainObjects&&dc.call(Object.prototype,u)&&!n.allowPrototypes)return;l.push(u)}for(var f=0;n.depth>0&&(c=a.exec(s))!==null&&f"u"?Me.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Me.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Me.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Me.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Me.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Me.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Me.comma,decoder:typeof e.decoder=="function"?e.decoder:Me.decoder,delimiter:typeof e.delimiter=="string"||sn.isRegExp(e.delimiter)?e.delimiter:Me.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Me.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Me.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Me.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Me.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Me.strictNullHandling}},tv=function(t,e){var r=ev(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Yy(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;on}t.OpaqueType=e,t.HexString=e(),t.AddressString=e(),t.BigIntString=e();function r(n){return Math.floor(n)}t.IntNumber=r,t.RegExpString=e(),function(n){n.CoinbaseWallet="CoinbaseWallet",n.MetaMask="MetaMask",n.Unselected=""}(t.ProviderType||(t.ProviderType={}))})(ui);var ov=F&&F.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(W,"__esModule",{value:!0});W.isInIFrame=W.createQrUrl=W.getFavicon=W.range=W.isBigNumber=W.ensureParsedJSONObject=W.ensureBN=W.ensureRegExpString=W.ensureIntNumber=W.ensureBuffer=W.ensureAddressString=W.ensureEvenLengthHexString=W.ensureHexString=W.isHexString=W.prepend0x=W.strip0x=W.has0xPrefix=W.hexStringFromIntNumber=W.intNumberFromHexString=W.bigIntStringFromBN=W.hexStringFromBuffer=W.hexStringToUint8Array=W.uint8ArrayToHex=W.randomBytesHex=void 0;const Qt=ov(ds),av=sv,Mr=ni,st=ui,Xh=/^[0-9]*$/,ed=/^[a-f0-9]*$/;function cv(t){return td(crypto.getRandomValues(new Uint8Array(t)))}W.randomBytesHex=cv;function td(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}W.uint8ArrayToHex=td;function uv(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}W.hexStringToUint8Array=uv;function lv(t,e=!1){const r=t.toString("hex");return(0,st.HexString)(e?"0x"+r:r)}W.hexStringFromBuffer=lv;function fv(t){return(0,st.BigIntString)(t.toString(10))}W.bigIntStringFromBN=fv;function hv(t){return(0,st.IntNumber)(new Qt.default(fi(t,!1),16).toNumber())}W.intNumberFromHexString=hv;function dv(t){return(0,st.HexString)("0x"+new Qt.default(t).toString(16))}W.hexStringFromIntNumber=dv;function qc(t){return t.startsWith("0x")||t.startsWith("0X")}W.has0xPrefix=qc;function Es(t){return qc(t)?t.slice(2):t}W.strip0x=Es;function rd(t){return qc(t)?"0x"+t.slice(2):"0x"+t}W.prepend0x=rd;function li(t){if(typeof t!="string")return!1;const e=Es(t).toLowerCase();return ed.test(e)}W.isHexString=li;function nd(t,e=!1){if(typeof t=="string"){const r=Es(t).toLowerCase();if(ed.test(r))return(0,st.HexString)(e?"0x"+r:r)}throw Mr.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}W.ensureHexString=nd;function fi(t,e=!1){let r=nd(t,!1);return r.length%2===1&&(r=(0,st.HexString)("0"+r)),e?(0,st.HexString)("0x"+r):r}W.ensureEvenLengthHexString=fi;function pv(t){if(typeof t=="string"){const e=Es(t).toLowerCase();if(li(e)&&e.length===40)return(0,st.AddressString)(rd(e))}throw Mr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}W.ensureAddressString=pv;function bv(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string")if(li(t)){const e=fi(t,!1);return Buffer.from(e,"hex")}else return Buffer.from(t,"utf8");throw Mr.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}W.ensureBuffer=bv;function id(t){if(typeof t=="number"&&Number.isInteger(t))return(0,st.IntNumber)(t);if(typeof t=="string"){if(Xh.test(t))return(0,st.IntNumber)(Number(t));if(li(t))return(0,st.IntNumber)(new Qt.default(fi(t,!1),16).toNumber())}throw Mr.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}W.ensureIntNumber=id;function gv(t){if(t instanceof RegExp)return(0,st.RegExpString)(t.toString());throw Mr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}W.ensureRegExpString=gv;function yv(t){if(t!==null&&(Qt.default.isBN(t)||sd(t)))return new Qt.default(t.toString(10),10);if(typeof t=="number")return new Qt.default(id(t));if(typeof t=="string"){if(Xh.test(t))return new Qt.default(t,10);if(li(t))return new Qt.default(fi(t,!1),16)}throw Mr.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}W.ensureBN=yv;function vv(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Mr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}W.ensureParsedJSONObject=vv;function sd(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}W.isBigNumber=sd;function mv(t,e){return Array.from({length:e-t},(r,n)=>t+n)}W.range=mv;function _v(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:r}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}W.getFavicon=_v;function wv(t,e,r,n,i,s){const o=n?"parent-id":"id",a=(0,av.stringify)({[o]:t,secret:e,server:r,v:i,chainId:s});return`${r}/#/link?${a}`}W.createQrUrl=wv;function Sv(){try{return window.frameElement!==null}catch{return!1}}W.isInIFrame=Sv;Object.defineProperty(_n,"__esModule",{value:!0});_n.Session=void 0;const wl=eg,Sl=W,El="session:id",Cl="session:secret",xl="session:linked";class Gc{constructor(e,r,n,i){this._storage=e,this._id=r||(0,Sl.randomBytesHex)(16),this._secret=n||(0,Sl.randomBytesHex)(32),this._key=new wl.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(e){const r=e.getItem(El),n=e.getItem(xl),i=e.getItem(Cl);return r&&i?new Gc(e,r,i,n==="1"):null}static hash(e){return new wl.sha256().update(e).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(El,this._id),this._storage.setItem(Cl,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(xl,this._linked?"1":"0")}}_n.Session=Gc;var pt={};Object.defineProperty(pt,"__esModule",{value:!0});pt.WalletSDKRelayAbstract=pt.APP_VERSION_KEY=pt.LOCAL_STORAGE_ADDRESSES_KEY=pt.WALLET_USER_NAME_KEY=void 0;const Il=ni;pt.WALLET_USER_NAME_KEY="walletUsername";pt.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";pt.APP_VERSION_KEY="AppVersion";class Ev{async makeEthereumJSONRPCRequest(e,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(e),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw Il.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,Il.serializeError)(s,e.method);return i})}}pt.WalletSDKRelayAbstract=Ev;var pc={exports:{}},od=Nc.EventEmitter,Ea,Rl;function Cv(){if(Rl)return Ea;Rl=1;function t(v,E){var _=Object.keys(v);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(v);E&&(d=d.filter(function(y){return Object.getOwnPropertyDescriptor(v,y).enumerable})),_.push.apply(_,d)}return _}function e(v){for(var E=1;E0?this.tail.next=d:this.head=d,this.tail=d,++this.length}},{key:"unshift",value:function(_){var d={data:_,next:this.head};this.length===0&&(this.tail=d),this.head=d,++this.length}},{key:"shift",value:function(){if(this.length!==0){var _=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,_}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(_){if(this.length===0)return"";for(var d=this.head,y=""+d.data;d=d.next;)y+=_+d.data;return y}},{key:"concat",value:function(_){if(this.length===0)return u.alloc(0);for(var d=u.allocUnsafe(_>>>0),y=this.head,m=0;y;)p(y.data,d,m),m+=y.data.length,y=y.next;return d}},{key:"consume",value:function(_,d){var y;return _x.length?x.length:_;if(C===x.length?m+=x:m+=x.slice(0,_),_-=C,_===0){C===x.length?(++y,d.next?this.head=d.next:this.head=this.tail=null):(this.head=d,d.data=x.slice(C));break}++y}return this.length-=y,m}},{key:"_getBuffer",value:function(_){var d=u.allocUnsafe(_),y=this.head,m=1;for(y.data.copy(d),_-=y.data.length;y=y.next;){var x=y.data,C=_>x.length?x.length:_;if(x.copy(d,d.length-_,0,C),_-=C,_===0){C===x.length?(++m,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=x.slice(C));break}++m}return this.length-=m,d}},{key:h,value:function(_,d){return f(this,e(e({},d),{},{depth:0,customInspect:!1}))}}]),v}(),Ea}function xv(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(bc,this,t)):process.nextTick(bc,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Ji,r):(r._writableState.errorEmitted=!0,process.nextTick(Al,r,s)):process.nextTick(Al,r,s):e?(process.nextTick(Ji,r),e(s)):process.nextTick(Ji,r)}),this)}function Al(t,e){bc(t,e),Ji(t)}function Ji(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Iv(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function bc(t,e){t.emit("error",e)}function Rv(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}var ad={destroy:xv,undestroy:Iv,errorOrDestroy:Rv},kr={};function Av(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var cd={};function at(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){Av(o,s);function o(a,c,u){return s.call(this,n(a,c,u))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,cd[t]=i}function Ml(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function Mv(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function kv(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Tv(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}at("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);at("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&Mv(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(kv(t," argument"))i="The ".concat(t," ").concat(n," ").concat(Ml(e,"type"));else{var s=Tv(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(Ml(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);at("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");at("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});at("ERR_STREAM_PREMATURE_CLOSE","Premature close");at("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});at("ERR_MULTIPLE_CALLBACK","Callback called multiple times");at("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");at("ERR_STREAM_WRITE_AFTER_END","write after end");at("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);at("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);at("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");kr.codes=cd;var Ov=kr.codes.ERR_INVALID_OPT_VALUE;function Nv(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Lv(t,e,r,n){var i=Nv(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new Ov(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}var ud={getHighWaterMark:Lv},Pv=$v;function $v(t,e){if(Ca("noDeprecation"))return t;var r=!1;function n(){if(!r){if(Ca("throwDeprecation"))throw new Error(e);Ca("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function Ca(t){try{if(!F.localStorage)return!1}catch{return!1}var e=F.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}var xa,kl;function ld(){if(kl)return xa;kl=1,xa=$;function t(w){var S=this;this.next=null,this.entry=null,this.finish=function(){We(S,w)}}var e;$.WritableState=T;var r={deprecate:Pv},n=od,i=ps.Buffer,s=(typeof F<"u"?F:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(w){return i.from(w)}function a(w){return i.isBuffer(w)||w instanceof s}var c=ad,u=ud,l=u.getHighWaterMark,f=kr.codes,h=f.ERR_INVALID_ARG_TYPE,p=f.ERR_METHOD_NOT_IMPLEMENTED,v=f.ERR_MULTIPLE_CALLBACK,E=f.ERR_STREAM_CANNOT_PIPE,_=f.ERR_STREAM_DESTROYED,d=f.ERR_STREAM_NULL_VALUES,y=f.ERR_STREAM_WRITE_AFTER_END,m=f.ERR_UNKNOWN_ENCODING,x=c.errorOrDestroy;bt($,n);function C(){}function T(w,S,O){e=e||on(),w=w||{},typeof O!="boolean"&&(O=S instanceof e),this.objectMode=!!w.objectMode,O&&(this.objectMode=this.objectMode||!!w.writableObjectMode),this.highWaterMark=l(this,w,"writableHighWaterMark",O),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var z=w.decodeStrings===!1;this.decodeStrings=!z,this.defaultEncoding=w.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(te){L(S,te)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}T.prototype.getBuffer=function(){for(var S=this.bufferedRequest,O=[];S;)O.push(S),S=S.next;return O},function(){try{Object.defineProperty(T.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var j;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(j=Function.prototype[Symbol.hasInstance],Object.defineProperty($,Symbol.hasInstance,{value:function(S){return j.call(this,S)?!0:this!==$?!1:S&&S._writableState instanceof T}})):j=function(S){return S instanceof this};function $(w){e=e||on();var S=this instanceof e;if(!S&&!j.call($,this))return new $(w);this._writableState=new T(w,this,S),this.writable=!0,w&&(typeof w.write=="function"&&(this._write=w.write),typeof w.writev=="function"&&(this._writev=w.writev),typeof w.destroy=="function"&&(this._destroy=w.destroy),typeof w.final=="function"&&(this._final=w.final)),n.call(this)}$.prototype.pipe=function(){x(this,new E)};function A(w,S){var O=new y;x(w,O),process.nextTick(S,O)}function U(w,S,O,z){var te;return O===null?te=new d:typeof O!="string"&&!S.objectMode&&(te=new h("chunk",["string","Buffer"],O)),te?(x(w,te),process.nextTick(z,te),!1):!0}$.prototype.write=function(w,S,O){var z=this._writableState,te=!1,b=!z.objectMode&&a(w);return b&&!i.isBuffer(w)&&(w=o(w)),typeof S=="function"&&(O=S,S=null),b?S="buffer":S||(S=z.defaultEncoding),typeof O!="function"&&(O=C),z.ending?A(this,O):(b||U(this,z,w,O))&&(z.pendingcb++,te=Z(this,z,b,w,S,O)),te},$.prototype.cork=function(){this._writableState.corked++},$.prototype.uncork=function(){var w=this._writableState;w.corked&&(w.corked--,!w.writing&&!w.corked&&!w.bufferProcessing&&w.bufferedRequest&&H(this,w))},$.prototype.setDefaultEncoding=function(S){if(typeof S=="string"&&(S=S.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((S+"").toLowerCase())>-1))throw new m(S);return this._writableState.defaultEncoding=S,this},Object.defineProperty($.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ce(w,S,O){return!w.objectMode&&w.decodeStrings!==!1&&typeof S=="string"&&(S=i.from(S,O)),S}Object.defineProperty($.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(w,S,O,z,te,b){if(!O){var g=ce(S,z,te);z!==g&&(O=!0,te="buffer",z=g)}var k=S.objectMode?1:z.length;S.length+=k;var P=S.length>5===6?2:d>>4===14?3:d>>3===30?4:d>>6===2?-1:-2}function o(d,y,m){var x=y.length-1;if(x=0?(C>0&&(d.lastNeed=C-1),C):--x=0?(C>0&&(d.lastNeed=C-2),C):--x=0?(C>0&&(C===2?C=0:d.lastNeed=C-3),C):0))}function a(d,y,m){if((y[0]&192)!==128)return d.lastNeed=0,"�";if(d.lastNeed>1&&y.length>1){if((y[1]&192)!==128)return d.lastNeed=1,"�";if(d.lastNeed>2&&y.length>2&&(y[2]&192)!==128)return d.lastNeed=2,"�"}}function c(d){var y=this.lastTotal-this.lastNeed,m=a(this,d);if(m!==void 0)return m;if(this.lastNeed<=d.length)return d.copy(this.lastChar,y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);d.copy(this.lastChar,y,0,d.length),this.lastNeed-=d.length}function u(d,y){var m=o(this,d,y);if(!this.lastNeed)return d.toString("utf8",y);this.lastTotal=m;var x=d.length-(m-this.lastNeed);return d.copy(this.lastChar,0,x),d.toString("utf8",y,x)}function l(d){var y=d&&d.length?this.write(d):"";return this.lastNeed?y+"�":y}function f(d,y){if((d.length-y)%2===0){var m=d.toString("utf16le",y);if(m){var x=m.charCodeAt(m.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=d[d.length-2],this.lastChar[1]=d[d.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=d[d.length-1],d.toString("utf16le",y,d.length-1)}function h(d){var y=d&&d.length?this.write(d):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return y+this.lastChar.toString("utf16le",0,m)}return y}function p(d,y){var m=(d.length-y)%3;return m===0?d.toString("base64",y):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=d[d.length-1]:(this.lastChar[0]=d[d.length-2],this.lastChar[1]=d[d.length-1]),d.toString("base64",y,d.length-m))}function v(d){var y=d&&d.length?this.write(d):"";return this.lastNeed?y+this.lastChar.toString("base64",0,3-this.lastNeed):y}function E(d){return d.toString(this.encoding)}function _(d){return d&&d.length?this.write(d):""}return Ra}var Ll=kr.codes.ERR_STREAM_PREMATURE_CLOSE;function Dv(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof g!="string"&&!K.objectMode&&Object.getPrototypeOf(g)!==n.prototype&&(g=s(g)),P)K.endEmitted?C(b,new d):ce(b,K,g,!0);else if(K.ended)C(b,new E);else{if(K.destroyed)return!1;K.reading=!1,K.decoder&&!k?(g=K.decoder.write(g),K.objectMode||g.length!==0?ce(b,K,g,!1):H(b,K)):ce(b,K,g,!1)}else P||(K.reading=!1,H(b,K))}return!K.ended&&(K.length=R?b=R:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function N(b,g){return b<=0||g.length===0&&g.ended?0:g.objectMode?1:b!==b?g.flowing&&g.length?g.buffer.head.data.length:g.length:(b>g.highWaterMark&&(g.highWaterMark=M(b)),b<=g.length?b:g.ended?g.length:(g.needReadable=!0,0))}A.prototype.read=function(b){c("read",b),b=parseInt(b,10);var g=this._readableState,k=b;if(b!==0&&(g.emittedReadable=!1),b===0&&g.needReadable&&((g.highWaterMark!==0?g.length>=g.highWaterMark:g.length>0)||g.ended))return c("read: emitReadable",g.length,g.ended),g.length===0&&g.ended?O(this):B(this),null;if(b=N(b,g),b===0&&g.ended)return g.length===0&&O(this),null;var P=g.needReadable;c("need readable",P),(g.length===0||g.length-b0?ge=S(b,g):ge=null,ge===null?(g.needReadable=g.length<=g.highWaterMark,b=0):(g.length-=b,g.awaitDrain=0),g.length===0&&(g.ended||(g.needReadable=!0),k!==b&&g.ended&&O(this)),ge!==null&&this.emit("data",ge),ge};function L(b,g){if(c("onEofChunk"),!g.ended){if(g.decoder){var k=g.decoder.end();k&&k.length&&(g.buffer.push(k),g.length+=g.objectMode?1:k.length)}g.ended=!0,g.sync?B(b):(g.needReadable=!1,g.emittedReadable||(g.emittedReadable=!0,D(b)))}}function B(b){var g=b._readableState;c("emitReadable",g.needReadable,g.emittedReadable),g.needReadable=!1,g.emittedReadable||(c("emitReadable",g.flowing),g.emittedReadable=!0,process.nextTick(D,b))}function D(b){var g=b._readableState;c("emitReadable_",g.destroyed,g.length,g.ended),!g.destroyed&&(g.length||g.ended)&&(b.emit("readable"),g.emittedReadable=!1),g.needReadable=!g.flowing&&!g.ended&&g.length<=g.highWaterMark,w(b)}function H(b,g){g.readingMore||(g.readingMore=!0,process.nextTick(Y,b,g))}function Y(b,g){for(;!g.reading&&!g.ended&&(g.length1&&te(P.pipes,b)!==-1)&&!Tn&&(c("false write response, pause",P.awaitDrain),P.awaitDrain++),k.pause())}function Pr(Nt){c("onerror",Nt),Ut(),b.removeListener("error",Pr),e(b,"error")===0&&C(b,Nt)}j(b,"error",Pr);function $r(){b.removeListener("finish",Dr),Ut()}b.once("close",$r);function Dr(){c("onfinish"),b.removeListener("close",$r),Ut()}b.once("finish",Dr);function Ut(){c("unpipe"),k.unpipe(b)}return b.emit("pipe",k),P.flowing||(c("pipe resume"),k.resume()),b};function J(b){return function(){var k=b._readableState;c("pipeOnDrain",k.awaitDrain),k.awaitDrain&&k.awaitDrain--,k.awaitDrain===0&&e(b,"data")&&(k.flowing=!0,w(b))}}A.prototype.unpipe=function(b){var g=this._readableState,k={hasUnpiped:!1};if(g.pipesCount===0)return this;if(g.pipesCount===1)return b&&b!==g.pipes?this:(b||(b=g.pipes),g.pipes=null,g.pipesCount=0,g.flowing=!1,b&&b.emit("unpipe",this,k),this);if(!b){var P=g.pipes,ge=g.pipesCount;g.pipes=null,g.pipesCount=0,g.flowing=!1;for(var K=0;K0,P.flowing!==!1&&this.resume()):b==="readable"&&!P.endEmitted&&!P.readableListening&&(P.readableListening=P.needReadable=!0,P.flowing=!1,P.emittedReadable=!1,c("on readable",P.length,P.reading),P.length?B(this):P.reading||process.nextTick(he,this)),k},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(b,g){var k=r.prototype.removeListener.call(this,b,g);return b==="readable"&&process.nextTick(se,this),k},A.prototype.removeAllListeners=function(b){var g=r.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&process.nextTick(se,this),g};function se(b){var g=b._readableState;g.readableListening=b.listenerCount("readable")>0,g.resumeScheduled&&!g.paused?g.flowing=!0:b.listenerCount("data")>0&&b.resume()}function he(b){c("readable nexttick read 0"),b.read(0)}A.prototype.resume=function(){var b=this._readableState;return b.flowing||(c("resume"),b.flowing=!b.readableListening,le(this,b)),b.paused=!1,this};function le(b,g){g.resumeScheduled||(g.resumeScheduled=!0,process.nextTick(We,b,g))}function We(b,g){c("resume",g.reading),g.reading||b.read(0),g.resumeScheduled=!1,b.emit("resume"),w(b),g.flowing&&!g.reading&&b.read(0)}A.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function w(b){var g=b._readableState;for(c("flow",g.flowing);g.flowing&&b.read()!==null;);}A.prototype.wrap=function(b){var g=this,k=this._readableState,P=!1;b.on("end",function(){if(c("wrapped end"),k.decoder&&!k.ended){var fe=k.decoder.end();fe&&fe.length&&g.push(fe)}g.push(null)}),b.on("data",function(fe){if(c("wrapped data"),k.decoder&&(fe=k.decoder.write(fe)),!(k.objectMode&&fe==null)&&!(!k.objectMode&&(!fe||!fe.length))){var Ot=g.push(fe);Ot||(P=!0,b.pause())}});for(var ge in b)this[ge]===void 0&&typeof b[ge]=="function"&&(this[ge]=function(Ot){return function(){return b[Ot].apply(b,arguments)}}(ge));for(var K=0;K=g.length?(g.decoder?k=g.buffer.join(""):g.buffer.length===1?k=g.buffer.first():k=g.buffer.concat(g.length),g.buffer.clear()):k=g.buffer.consume(b,g.decoder),k}function O(b){var g=b._readableState;c("endReadable",g.endEmitted),g.endEmitted||(g.ended=!0,process.nextTick(z,g,b))}function z(b,g){if(c("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,g.readable=!1,g.emit("end"),b.autoDestroy)){var k=g._writableState;(!k||k.autoDestroy&&k.finished)&&g.destroy()}}typeof Symbol=="function"&&(A.from=function(b,g){return x===void 0&&(x=Wv()),x(A,b,g)});function te(b,g){for(var k=0,P=b.length;k0;return Xv(o,c,u,function(l){i||(i=l),l&&s.forEach(Fl),!c&&(s.forEach(Fl),n(i))})});return e.reduce(em)}var nm=rm;(function(t,e){e=t.exports=hd(),e.Stream=e,e.Readable=e,e.Writable=ld(),e.Duplex=on(),e.Transform=dd,e.PassThrough=Jv,e.finished=Jc,e.pipeline=nm})(pc,pc.exports);var gd=pc.exports;const{Transform:im}=gd;var sm=t=>class yd extends im{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new yd(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:om}=gd;var am=t=>class vd extends om{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new vd(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const cm=sm,um=am;var lm=function(t){const e=cm(t),r=um(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},md={};const Wl=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];md.p1600=function(t){for(let e=0;e<24;++e){const r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],u=t[7]^t[17]^t[27]^t[37]^t[47],l=t[8]^t[18]^t[28]^t[38]^t[48],f=t[9]^t[19]^t[29]^t[39]^t[49];let h=l^(i<<1|s>>>31),p=f^(s<<1|i>>>31);const v=t[0]^h,E=t[1]^p,_=t[10]^h,d=t[11]^p,y=t[20]^h,m=t[21]^p,x=t[30]^h,C=t[31]^p,T=t[40]^h,j=t[41]^p;h=r^(o<<1|a>>>31),p=n^(a<<1|o>>>31);const $=t[2]^h,A=t[3]^p,U=t[12]^h,ce=t[13]^p,Z=t[22]^h,R=t[23]^p,M=t[32]^h,N=t[33]^p,L=t[42]^h,B=t[43]^p;h=i^(c<<1|u>>>31),p=s^(u<<1|c>>>31);const D=t[4]^h,H=t[5]^p,Y=t[14]^h,J=t[15]^p,se=t[24]^h,he=t[25]^p,le=t[34]^h,We=t[35]^p,w=t[44]^h,S=t[45]^p;h=o^(l<<1|f>>>31),p=a^(f<<1|l>>>31);const O=t[6]^h,z=t[7]^p,te=t[16]^h,b=t[17]^p,g=t[26]^h,k=t[27]^p,P=t[36]^h,ge=t[37]^p,K=t[46]^h,fe=t[47]^p;h=c^(r<<1|n>>>31),p=u^(n<<1|r>>>31);const Ot=t[8]^h,or=t[9]^p,Tn=t[18]^h,Mi=t[19]^p,On=t[28]^h,Pr=t[29]^p,$r=t[38]^h,Dr=t[39]^p,Ut=t[48]^h,Nt=t[49]^p,vt=v,mo=E,_o=d<<4|_>>>28,wo=_<<4|d>>>28,So=y<<3|m>>>29,Eo=m<<3|y>>>29,Co=C<<9|x>>>23,xo=x<<9|C>>>23,Io=T<<18|j>>>14,Ro=j<<18|T>>>14,Ao=$<<1|A>>>31,Mo=A<<1|$>>>31,ko=ce<<12|U>>>20,To=U<<12|ce>>>20,Oo=Z<<10|R>>>22,No=R<<10|Z>>>22,Lo=N<<13|M>>>19,Po=M<<13|N>>>19,$o=L<<2|B>>>30,Do=B<<2|L>>>30,jo=H<<30|D>>>2,Bo=D<<30|H>>>2,Fo=Y<<6|J>>>26,Wo=J<<6|Y>>>26,Ho=he<<11|se>>>21,Vo=se<<11|he>>>21,Uo=le<<15|We>>>17,zo=We<<15|le>>>17,qo=S<<29|w>>>3,Go=w<<29|S>>>3,Jo=O<<28|z>>>4,Qo=z<<28|O>>>4,Zo=b<<23|te>>>9,Yo=te<<23|b>>>9,Ko=g<<25|k>>>7,Xo=k<<25|g>>>7,ea=P<<21|ge>>>11,ta=ge<<21|P>>>11,ra=fe<<24|K>>>8,na=K<<24|fe>>>8,ia=Ot<<27|or>>>5,sa=or<<27|Ot>>>5,oa=Tn<<20|Mi>>>12,aa=Mi<<20|Tn>>>12,ca=Pr<<7|On>>>25,ua=On<<7|Pr>>>25,la=$r<<8|Dr>>>24,fa=Dr<<8|$r>>>24,ha=Ut<<14|Nt>>>18,da=Nt<<14|Ut>>>18;t[0]=vt^~ko&Ho,t[1]=mo^~To&Vo,t[10]=Jo^~oa&So,t[11]=Qo^~aa&Eo,t[20]=Ao^~Fo&Ko,t[21]=Mo^~Wo&Xo,t[30]=ia^~_o&Oo,t[31]=sa^~wo&No,t[40]=jo^~Zo&ca,t[41]=Bo^~Yo&ua,t[2]=ko^~Ho&ea,t[3]=To^~Vo&ta,t[12]=oa^~So&Lo,t[13]=aa^~Eo&Po,t[22]=Fo^~Ko&la,t[23]=Wo^~Xo&fa,t[32]=_o^~Oo&Uo,t[33]=wo^~No&zo,t[42]=Zo^~ca&Co,t[43]=Yo^~ua&xo,t[4]=Ho^~ea&ha,t[5]=Vo^~ta&da,t[14]=So^~Lo&qo,t[15]=Eo^~Po&Go,t[24]=Ko^~la&Io,t[25]=Xo^~fa&Ro,t[34]=Oo^~Uo&ra,t[35]=No^~zo&na,t[44]=ca^~Co&$o,t[45]=ua^~xo&Do,t[6]=ea^~ha&vt,t[7]=ta^~da&mo,t[16]=Lo^~qo&Jo,t[17]=Po^~Go&Qo,t[26]=la^~Io&Ao,t[27]=fa^~Ro&Mo,t[36]=Uo^~ra&ia,t[37]=zo^~na&sa,t[46]=Co^~$o&jo,t[47]=xo^~Do&Bo,t[8]=ha^~vt&ko,t[9]=da^~mo&To,t[18]=qo^~Jo&oa,t[19]=Go^~Qo&aa,t[28]=Io^~Ao&Fo,t[29]=Ro^~Mo&Wo,t[38]=ra^~ia&_o,t[39]=na^~sa&wo,t[48]=$o^~jo&Zo,t[49]=Do^~Bo&Yo,t[0]^=Wl[e*2],t[1]^=Wl[e*2+1]}};const is=md;function En(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}En.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};En.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(is.p1600(this.state),this.count=0);return e};En.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};var fm=En,hm=lm(fm);const dm=hm,pm=ds;function _d(t){return Buffer.allocUnsafe(t).fill(0)}function wd(t,e,r){const n=_d(e);return t=Is(t),r?t.length"u")throw new Error("Not an array?");if(r=Id(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(Et(t,e[s]));if(r==="dynamic"){var o=Et("uint256",e.length);i.unshift(o)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([Et("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,wr.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Yr(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return wr.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Yr(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=fr(e),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(t.startsWith("int")){if(r=Yr(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=fr(e),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(t.startsWith("ufixed")){if(r=Hl(t),n=fr(e),n<0)throw new Error("Supplied ufixed is negative");return Et("uint256",n.mul(new gr(2).pow(new gr(r[1]))))}else if(t.startsWith("fixed"))return r=Hl(t),Et("int256",fr(e).mul(new gr(2).pow(new gr(r[1]))))}throw new Error("Unsupported or invalid type: "+t)}function mm(t){return t==="string"||t==="bytes"||Id(t)==="dynamic"}function _m(t){return t.lastIndexOf("]")===t.length-1}function wm(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var o=xd(t[s]),a=e[s],c=Et(o,a);mm(o)?(r.push(Et("uint256",i)),n.push(c),i+=c.length):r.push(c)}return Buffer.concat(r.concat(n))}function Rd(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(wr.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=Yr(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=fr(a),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(o.startsWith("int")){if(r=Yr(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=fr(a),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function Sm(t,e){return wr.keccak(Rd(t,e))}var Em={rawEncode:wm,solidityPack:Rd,soliditySHA3:Sm};const ft=Cd,Un=Em,Ad={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Oa={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const o=(a,c,u)=>{if(r[c]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":ft.keccak(this.encodeData(c,u,r,n))];if(u===void 0)throw new Error(`missing value for field ${a} of type ${c}`);if(c==="bytes")return["bytes32",ft.keccak(u)];if(c==="string")return typeof u=="string"&&(u=Buffer.from(u,"utf8")),["bytes32",ft.keccak(u)];if(c.lastIndexOf("]")===c.length-1){const l=c.slice(0,c.lastIndexOf("[")),f=u.map(h=>o(a,l,h));return["bytes32",ft.keccak(Un.rawEncode(f.map(([h])=>h),f.map(([,h])=>h)))]}return[c,u]};for(const a of r[t]){const[c,u]=o(a.name,a.type,e[a.name]);i.push(c),s.push(u)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=ft.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=ft.keccak(a),s.push(a);else if(r[o.type]!==void 0)i.push("bytes32"),a=ft.keccak(this.encodeData(o.type,a,r,n)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return Un.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return ft.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return ft.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in Ad.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),ft.keccak(Buffer.concat(n))}};var Cm={TYPED_MESSAGE_SCHEMA:Ad,TypedDataUtils:Oa,hashForSignTypedDataLegacy:function(t){return xm(t.data)},hashForSignTypedData_v3:function(t){return Oa.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return Oa.hash(t.data)}};function xm(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?ft.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return Un.soliditySHA3(["bytes32","bytes32"],[Un.soliditySHA3(new Array(t.length).fill("string"),i),Un.soliditySHA3(n,r)])}var an={};Object.defineProperty(an,"__esModule",{value:!0});an.filterFromParam=an.FilterPolyfill=void 0;const qr=ui,He=W,Im=5*60*1e3,hr={jsonrpc:"2.0",id:0};class Rm{constructor(e){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,qr.IntNumber)(1),this.provider=e}async newFilter(e){const r=Md(e),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.log(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,He.hexStringFromIntNumber)(n)}async newBlockFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.log(`Installing new block filter (${e}) with initial cursor position:`,r),this.blockFilters.add(e),this.setFilterTimeout(e),(0,He.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.log(`Installing new block filter (${e}) with initial cursor position:`,r),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,He.hexStringFromIntNumber)(e)}uninstallFilter(e){const r=(0,He.intNumberFromHexString)(e);return console.log(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(e){const r=(0,He.intNumberFromHexString)(e);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(Ni())}async getFilterLogs(e){const r=(0,He.intNumberFromHexString)(e),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},hr),{method:"eth_getLogs",params:[Vl(n)]})):Ni()}makeFilterId(){return(0,qr.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise((r,n)=>{this.provider.sendAsync(e,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(e){console.log(`Deleting filter (${e})`),this.logFilters.delete(e),this.blockFilters.delete(e),this.pendingTransactionFilters.delete(e),this.cursors.delete(e),this.timeouts.delete(e)}async getLogFilterChanges(e){const r=this.logFilters.get(e),n=this.cursors.get(e);if(!n||!r)return Ni();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>r.toBlock)return Li();console.log(`Fetching logs from ${n} to ${s} for filter ${e}`);const o=await this.sendAsyncPromise(Object.assign(Object.assign({},hr),{method:"eth_getLogs",params:[Vl(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(o.result)){const a=o.result.map(u=>(0,He.intNumberFromHexString)(u.blockNumber||"0x0")),c=Math.max(...a);if(c&&c>n){const u=(0,qr.IntNumber)(c+1);console.log(`Moving cursor position for filter (${e}) from ${n} to ${u}`),this.cursors.set(e,u)}}return o}async getBlockFilterChanges(e){const r=this.cursors.get(e);if(!r)return Ni();const n=await this.getCurrentBlockHeight();if(r>n)return Li();console.log(`Fetching blocks from ${r} to ${n} for filter (${e})`);const i=(await Promise.all((0,He.range)(r,n+1).map(o=>this.getBlockHashByNumber((0,qr.IntNumber)(o))))).filter(o=>!!o),s=(0,qr.IntNumber)(r+i.length);return console.log(`Moving cursor position for filter (${e}) from ${r} to ${s}`),this.cursors.set(e,s),Object.assign(Object.assign({},hr),{result:i})}async getPendingTransactionFilterChanges(e){return Promise.resolve(Li())}async setInitialCursorPosition(e,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(e,i),i}setFilterTimeout(e){const r=this.timeouts.get(e);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.log(`Filter (${e}) timed out`),this.deleteFilter(e)},Im);this.timeouts.set(e,n)}async getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},hr),{method:"eth_blockNumber",params:[]}));return(0,He.intNumberFromHexString)((0,He.ensureHexString)(e))}async getBlockHashByNumber(e){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},hr),{method:"eth_getBlockByNumber",params:[(0,He.hexStringFromIntNumber)(e),!1]}));return r.result&&typeof r.result.hash=="string"?(0,He.ensureHexString)(r.result.hash):null}}an.FilterPolyfill=Rm;function Md(t){return{fromBlock:Ul(t.fromBlock),toBlock:Ul(t.toBlock),addresses:t.address===void 0?null:Array.isArray(t.address)?t.address:[t.address],topics:t.topics||[]}}an.filterFromParam=Md;function Vl(t){const e={fromBlock:zl(t.fromBlock),toBlock:zl(t.toBlock),topics:t.topics};return t.addresses!==null&&(e.address=t.addresses),e}function Ul(t){if(t===void 0||t==="latest"||t==="pending")return"latest";if(t==="earliest")return(0,qr.IntNumber)(0);if((0,He.isHexString)(t))return(0,He.intNumberFromHexString)(t);throw new Error(`Invalid block option: ${String(t)}`)}function zl(t){return t==="latest"?t:(0,He.hexStringFromIntNumber)(t)}function Ni(){return Object.assign(Object.assign({},hr),{error:{code:-32e3,message:"filter not found"}})}function Li(){return Object.assign(Object.assign({},hr),{result:[]})}var kd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.JSONRPCMethod=void 0,function(e){e.eth_accounts="eth_accounts",e.eth_coinbase="eth_coinbase",e.net_version="net_version",e.eth_chainId="eth_chainId",e.eth_uninstallFilter="eth_uninstallFilter",e.eth_requestAccounts="eth_requestAccounts",e.eth_sign="eth_sign",e.eth_ecRecover="eth_ecRecover",e.personal_sign="personal_sign",e.personal_ecRecover="personal_ecRecover",e.eth_signTransaction="eth_signTransaction",e.eth_sendRawTransaction="eth_sendRawTransaction",e.eth_sendTransaction="eth_sendTransaction",e.eth_signTypedData_v1="eth_signTypedData_v1",e.eth_signTypedData_v2="eth_signTypedData_v2",e.eth_signTypedData_v3="eth_signTypedData_v3",e.eth_signTypedData_v4="eth_signTypedData_v4",e.eth_signTypedData="eth_signTypedData",e.cbWallet_arbitrary="walletlink_arbitrary",e.wallet_addEthereumChain="wallet_addEthereumChain",e.wallet_switchEthereumChain="wallet_switchEthereumChain",e.wallet_watchAsset="wallet_watchAsset",e.eth_subscribe="eth_subscribe",e.eth_unsubscribe="eth_unsubscribe",e.eth_newFilter="eth_newFilter",e.eth_newBlockFilter="eth_newBlockFilter",e.eth_newPendingTransactionFilter="eth_newPendingTransactionFilter",e.eth_getFilterChanges="eth_getFilterChanges",e.eth_getFilterLogs="eth_getFilterLogs"}(t.JSONRPCMethod||(t.JSONRPCMethod={}))})(kd);var Rs={},Td={},As={},Qc=Am;function Am(t){t=t||{};var e=t.max||Number.MAX_SAFE_INTEGER,r=typeof t.start<"u"?t.start:Math.floor(Math.random()*e);return function(){return r=r%e,r++}}const ql=(t,e)=>function(){const r=e.promiseModule,n=new Array(arguments.length);for(let i=0;i{e.errorFirst?n.push(function(o,a){if(e.multiArgs){const c=new Array(arguments.length-1);for(let u=1;u{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const r=i=>{const s=o=>typeof o=="string"?i===o:o.test(i);return e.include?e.include.some(s):!e.exclude.some(s)};let n;typeof t=="function"?n=function(){return e.excludeMain?t.apply(this,arguments):ql(t,e).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(t));for(const i in t){const s=t[i];n[i]=typeof s=="function"&&r(i)?ql(s,e):s}return n},hi={},km=F&&F.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hi,"__esModule",{value:!0});hi.BaseBlockTracker=void 0;const Tm=km(Ir),Om=1e3,Nm=(t,e)=>t+e,Gl=["sync","latest"];class Lm extends Tm.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||20*Om,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(e){return e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e){Gl.includes(e)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return Gl.map(e=>this.listenerCount(e)).reduce(Nm)}_newPotentialLatest(e){const r=this._currentBlock;r&&Jl(e)<=Jl(r)||this._setCurrentBlock(e)}_setCurrentBlock(e){const r=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:r,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}hi.BaseBlockTracker=Lm;function Jl(t){return Number.parseInt(t,16)}var Od={},Nd={},$e={};class Ld extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...o}=e,{path:a}=e,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function Pm(t){return ot(t)&&typeof t[Symbol.iterator]=="function"}function ot(t){return typeof t=="object"&&t!=null}function Ql(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Re(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function $m(t){const{done:e,value:r}=t.next();return e?void 0:r}function Dm(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${Re(n)}\``}=t;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:c}}function*gc(t,e,r,n){Pm(t)||(t=[t]);for(const i of t){const s=Dm(i,e,r,n);s&&(yield s)}}function*Zc(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),o&&e.type!=="type"&&ot(e.schema)&&ot(t)&&!Array.isArray(t)))for(const u in t)e.schema[u]===void 0&&delete t[u];let c="valid";for(const u of e.validator(t,a))u.explanation=r.message,c="not_valid",yield[u,void 0];for(let[u,l,f]of e.entries(t,a)){const h=Zc(l,f,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const p of h)p[0]?(c=p[0].refinement!=null?"not_refined":"not_valid",yield[p[0],void 0]):s&&(l=p[1],u===void 0?t=l:t instanceof Map?t.set(u,l):t instanceof Set?t.add(l):ot(t)&&(l!==void 0||u in t)&&(t[u]=l))}if(c!=="not_valid")for(const u of e.refiner(t,a))u.explanation=r.message,c="not_refined",yield[u,void 0];c==="valid"&&(yield[void 0,t])}class Ce{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return gc(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return gc(l,u,this,c)}:this.refiner=()=>[]}assert(e,r){return Pd(e,this,r)}create(e,r){return $d(e,this,r)}is(e){return Yc(e,this)}mask(e,r){return Dd(e,this,r)}validate(e,r={}){return Cn(e,this,r)}}function Pd(t,e,r){const n=Cn(t,e,{message:r});if(n[0])throw n[0]}function $d(t,e,r){const n=Cn(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Dd(t,e,r){const n=Cn(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Yc(t,e){return!Cn(t,e)[0]}function Cn(t,e,r={}){const n=Zc(t,e,r),i=$m(n);return i[0]?[new Ld(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function jm(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Xc(n):di(n)}function Je(t,e){return new Ce({type:t,schema:null,validator:e})}function Bm(t,e){return new Ce({...t,refiner:(r,n)=>r===void 0||t.refiner(r,n),validator(r,n){return r===void 0?!0:(e(r,n),t.validator(r,n))}})}function Fm(t){return new Ce({type:"dynamic",schema:null,*entries(e,r){yield*t(e,r).entries(e,r)},validator(e,r){return t(e,r).validator(e,r)},coercer(e,r){return t(e,r).coercer(e,r)},refiner(e,r){return t(e,r).refiner(e,r)}})}function Wm(t){let e;return new Ce({type:"lazy",schema:null,*entries(r,n){e??(e=t()),yield*e.entries(r,n)},validator(r,n){return e??(e=t()),e.validator(r,n)},coercer(r,n){return e??(e=t()),e.coercer(r,n)},refiner(r,n){return e??(e=t()),e.refiner(r,n)}})}function Hm(t,e){const{schema:r}=t,n={...r};for(const i of e)delete n[i];switch(t.type){case"type":return Xc(n);default:return di(n)}}function Vm(t){const e=t instanceof Ce?{...t.schema}:{...t};for(const r in e)e[r]=jd(e[r]);return di(e)}function Um(t,e){const{schema:r}=t,n={};for(const i of e)n[i]=r[i];return di(n)}function zm(t,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Je(t,e)}function qm(){return Je("any",()=>!0)}function Gm(t){return new Ce({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${Re(e)}`}})}function Jm(){return Je("bigint",t=>typeof t=="bigint")}function Qm(){return Je("boolean",t=>typeof t=="boolean")}function Zm(){return Je("date",t=>t instanceof Date&&!isNaN(t.getTime())||`Expected a valid \`Date\` object, but received: ${Re(t)}`)}function Ym(t){const e={},r=t.map(n=>Re(n)).join();for(const n of t)e[n]=n;return new Ce({type:"enums",schema:e,validator(n){return t.includes(n)||`Expected one of \`${r}\`, but received: ${Re(n)}`}})}function Km(){return Je("func",t=>typeof t=="function"||`Expected a function, but received: ${Re(t)}`)}function Xm(t){return Je("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${Re(e)}`)}function e1(){return Je("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${Re(t)}`)}function t1(t){return new Ce({type:"intersection",schema:null,*entries(e,r){for(const n of t)yield*n.entries(e,r)},*validator(e,r){for(const n of t)yield*n.validator(e,r)},*refiner(e,r){for(const n of t)yield*n.refiner(e,r)}})}function r1(t){const e=Re(t),r=typeof t;return new Ce({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${Re(n)}`}})}function n1(t,e){return new Ce({type:"map",schema:null,*entries(r){if(t&&e&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,t],yield[n,i,e]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Re(r)}`}})}function Kc(){return Je("never",()=>!1)}function i1(t){return new Ce({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function s1(){return Je("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Re(t)}`)}function di(t){const e=t?Object.keys(t):[],r=Kc();return new Ce({type:"object",schema:t||null,*entries(n){if(t&&ot(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return ot(n)||`Expected an object, but received: ${Re(n)}`},coercer(n){return ot(n)?{...n}:n}})}function jd(t){return new Ce({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function o1(t,e){return new Ce({type:"record",schema:null,*entries(r){if(ot(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return ot(r)||`Expected an object, but received: ${Re(r)}`}})}function a1(){return Je("regexp",t=>t instanceof RegExp)}function c1(t){return new Ce({type:"set",schema:null,*entries(e){if(t&&e instanceof Set)for(const r of e)yield[r,r,t]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||`Expected a \`Set\` object, but received: ${Re(e)}`}})}function Bd(){return Je("string",t=>typeof t=="string"||`Expected a string, but received: ${Re(t)}`)}function u1(t){const e=Kc();return new Ce({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;ir.type).join(" | ");return new Ce({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...o]=Zc(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Re(r)}`,...i]}})}function Fd(){return Je("unknown",()=>!0)}function eu(t,e,r){return new Ce({...t,coercer:(n,i)=>Yc(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}function f1(t,e,r={}){return eu(t,Fd(),n=>{const i=typeof e=="function"?e():e;if(n===void 0)return i;if(!r.strict&&Ql(n)&&Ql(i)){const s={...n};let o=!1;for(const a in i)s[a]===void 0&&(s[a]=i[a],o=!0);if(o)return s}return n})}function h1(t){return eu(t,Bd(),e=>e.trim())}function d1(t){return Tr(t,"empty",e=>{const r=Wd(e);return r===0||`Expected an empty ${t.type} but received one with a size of \`${r}\``})}function Wd(t){return t instanceof Map||t instanceof Set?t.size:t.length}function p1(t,e,r={}){const{exclusive:n}=r;return Tr(t,"max",i=>n?in?i>e:i>=e||`Expected a ${t.type} greater than ${n?"":"or equal to "}${e} but received \`${i}\``)}function g1(t){return Tr(t,"nonempty",e=>Wd(e)>0||`Expected a nonempty ${t.type} but received an empty one`)}function y1(t,e){return Tr(t,"pattern",r=>e.test(r)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${r}"`)}function v1(t,e,r=e){const n=`Expected a ${t.type}`,i=e===r?`of \`${e}\``:`between \`${e}\` and \`${r}\``;return Tr(t,"size",s=>{if(typeof s=="number"||s instanceof Date)return e<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:o}=s;return e<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}else{const{length:o}=s;return e<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}})}function Tr(t,e,r){return new Ce({...t,*refiner(n,i){yield*t.refiner(n,i);const s=r(n,i),o=gc(s,i,t,n);for(const a of o)yield{...a,refinement:e}}})}const m1=Object.freeze(Object.defineProperty({__proto__:null,Struct:Ce,StructError:Ld,any:qm,array:Gm,assert:Pd,assign:jm,bigint:Jm,boolean:Qm,coerce:eu,create:$d,date:Zm,defaulted:f1,define:Je,deprecated:Bm,dynamic:Fm,empty:d1,enums:Ym,func:Km,instance:Xm,integer:e1,intersection:t1,is:Yc,lazy:Wm,literal:r1,map:n1,mask:Dd,max:p1,min:b1,never:Kc,nonempty:g1,nullable:i1,number:s1,object:di,omit:Hm,optional:jd,partial:Vm,pattern:y1,pick:Um,record:o1,refine:Tr,regexp:a1,set:c1,size:v1,string:Bd,struct:zm,trimmed:h1,tuple:u1,type:Xc,union:l1,unknown:Fd,validate:Cn},Symbol.toStringTag,{value:"Module"})),Or=xr(m1);Object.defineProperty($e,"__esModule",{value:!0});$e.assertExhaustive=$e.assertStruct=$e.assert=$e.AssertionError=void 0;const _1=Or;function w1(t){return typeof t=="object"&&t!==null&&"message"in t}function S1(t){var e,r;return typeof((r=(e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.name)=="string"}function E1(t){const e=w1(t)?t.message:String(t);return e.endsWith(".")?e.slice(0,-1):e}function Hd(t,e){return S1(t)?new t({message:e}):t({message:e})}class tu extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}$e.AssertionError=tu;function C1(t,e="Assertion failed.",r=tu){if(!t)throw e instanceof Error?e:Hd(r,e)}$e.assert=C1;function x1(t,e,r="Assertion failed",n=tu){try{(0,_1.assert)(t,e)}catch(i){throw Hd(n,`${r}: ${E1(i)}.`)}}$e.assertStruct=x1;function I1(t){throw new Error("Invalid branch reached. Should be detected during compilation.")}$e.assertExhaustive=I1;var pi={};Object.defineProperty(pi,"__esModule",{value:!0});pi.base64=void 0;const R1=Or,A1=$e,M1=(t,e={})=>{var r,n;const i=(r=e.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=e.characterSet)!==null&&n!==void 0?n:"base64";let o;s==="base64"?o=String.raw`[A-Za-z0-9+\/]`:((0,A1.assert)(s==="base64url"),o=String.raw`[-_A-Za-z0-9]`);let a;return i?a=new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):a=new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,R1.pattern)(t,a)};pi.base64=M1;var oe={},bi={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.remove0x=t.add0x=t.assertIsStrictHexString=t.assertIsHexString=t.isStrictHexString=t.isHexString=t.StrictHexStruct=t.HexStruct=void 0;const e=Or,r=$e;t.HexStruct=(0,e.pattern)((0,e.string)(),/^(?:0x)?[0-9a-f]+$/iu),t.StrictHexStruct=(0,e.pattern)((0,e.string)(),/^0x[0-9a-f]+$/iu);function n(u){return(0,e.is)(u,t.HexStruct)}t.isHexString=n;function i(u){return(0,e.is)(u,t.StrictHexStruct)}t.isStrictHexString=i;function s(u){(0,r.assert)(n(u),"Value must be a hexadecimal string.")}t.assertIsHexString=s;function o(u){(0,r.assert)(i(u),'Value must be a hexadecimal string, starting with "0x".')}t.assertIsStrictHexString=o;function a(u){return u.startsWith("0x")?u:u.startsWith("0X")?`0x${u.substring(2)}`:`0x${u}`}t.add0x=a;function c(u){return u.startsWith("0x")||u.startsWith("0X")?u.substring(2):u}t.remove0x=c})(bi);Object.defineProperty(oe,"__esModule",{value:!0});oe.createDataView=oe.concatBytes=oe.valueToBytes=oe.stringToBytes=oe.numberToBytes=oe.signedBigIntToBytes=oe.bigIntToBytes=oe.hexToBytes=oe.bytesToString=oe.bytesToNumber=oe.bytesToSignedBigInt=oe.bytesToBigInt=oe.bytesToHex=oe.assertIsBytes=oe.isBytes=void 0;const Ze=$e,yc=bi,Zl=48,Yl=58,Kl=87;function k1(){const t=[];return()=>{if(t.length===0)for(let e=0;e<256;e++)t.push(e.toString(16).padStart(2,"0"));return t}}const T1=k1();function ru(t){return t instanceof Uint8Array}oe.isBytes=ru;function xn(t){(0,Ze.assert)(ru(t),"Value must be a Uint8Array.")}oe.assertIsBytes=xn;function Vd(t){if(xn(t),t.length===0)return"0x";const e=T1(),r=new Array(t.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");const e=t.toString(16);return Ms(e)}oe.bigIntToBytes=zd;function P1(t,e){(0,Ze.assert)(e>0);const r=t>>BigInt(31);return!((~t&r)+(t&~r)>>BigInt(e*8+-1))}function $1(t,e){(0,Ze.assert)(typeof t=="bigint","Value must be a bigint."),(0,Ze.assert)(typeof e=="number","Byte length must be a number."),(0,Ze.assert)(e>0,"Byte length must be greater than 0."),(0,Ze.assert)(P1(t,e),"Byte length is too small to represent the given value.");let r=t;const n=new Uint8Array(e);for(let i=0;i>=BigInt(8);return n.reverse()}oe.signedBigIntToBytes=$1;function qd(t){(0,Ze.assert)(typeof t=="number","Value must be a number."),(0,Ze.assert)(t>=0,"Value must be a non-negative number."),(0,Ze.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToBytes` instead.");const e=t.toString(16);return Ms(e)}oe.numberToBytes=qd;function Gd(t){return(0,Ze.assert)(typeof t=="string","Value must be a string."),new TextEncoder().encode(t)}oe.stringToBytes=Gd;function Jd(t){if(typeof t=="bigint")return zd(t);if(typeof t=="number")return qd(t);if(typeof t=="string")return t.startsWith("0x")?Ms(t):Gd(t);if(ru(t))return t;throw new TypeError(`Unsupported value type: "${typeof t}".`)}oe.valueToBytes=Jd;function D1(t){const e=new Array(t.length);let r=0;for(let i=0;ie.call(r,n,i,this))}get(e){return Ve(this,ut,"f").get(e)}has(e){return Ve(this,ut,"f").has(e)}keys(){return Ve(this,ut,"f").keys()}values(){return Ve(this,ut,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,r])=>`${String(e)} => ${String(r)}`).join(", ")} `:""}}`}}cn.FrozenMap=nu;class iu{constructor(e){_t.set(this,void 0),Yd(this,_t,new Set(e),"f"),Object.freeze(this)}get size(){return Ve(this,_t,"f").size}[(_t=new WeakMap,Symbol.iterator)](){return Ve(this,_t,"f")[Symbol.iterator]()}entries(){return Ve(this,_t,"f").entries()}forEach(e,r){return Ve(this,_t,"f").forEach((n,i,s)=>e.call(r,n,i,this))}has(e){return Ve(this,_t,"f").has(e)}keys(){return Ve(this,_t,"f").keys()}values(){return Ve(this,_t,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}}cn.FrozenSet=iu;Object.freeze(nu);Object.freeze(nu.prototype);Object.freeze(iu);Object.freeze(iu.prototype);var Kd={},su={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateNumberSize=t.calculateStringSize=t.isASCII=t.isPlainObject=t.ESCAPE_CHARACTERS_REGEXP=t.JsonSize=t.hasProperty=t.isObject=t.isNullOrUndefined=t.isNonEmptyArray=void 0;function e(u){return Array.isArray(u)&&u.length>0}t.isNonEmptyArray=e;function r(u){return u==null}t.isNullOrUndefined=r;function n(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}t.isObject=n;const i=(u,l)=>Object.hasOwnProperty.call(u,l);t.hasProperty=i,function(u){u[u.Null=4]="Null",u[u.Comma=1]="Comma",u[u.Wrapper=1]="Wrapper",u[u.True=4]="True",u[u.False=5]="False",u[u.Quote=1]="Quote",u[u.Colon=1]="Colon",u[u.Date=24]="Date"}(t.JsonSize||(t.JsonSize={})),t.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(u){if(typeof u!="object"||u===null)return!1;try{let l=u;for(;Object.getPrototypeOf(l)!==null;)l=Object.getPrototypeOf(l);return Object.getPrototypeOf(u)===l}catch{return!1}}t.isPlainObject=s;function o(u){return u.charCodeAt(0)<=127}t.isASCII=o;function a(u){var l;return u.split("").reduce((h,p)=>o(p)?h+1:h+2,0)+((l=u.match(t.ESCAPE_CHARACTERS_REGEXP))!==null&&l!==void 0?l:[]).length}t.calculateStringSize=a;function c(u){return u.toString().length}t.calculateNumberSize=c})(su);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateJsonAndGetSize=t.getJsonRpcIdValidator=t.assertIsJsonRpcError=t.isJsonRpcError=t.assertIsJsonRpcFailure=t.isJsonRpcFailure=t.assertIsJsonRpcSuccess=t.isJsonRpcSuccess=t.assertIsJsonRpcResponse=t.isJsonRpcResponse=t.assertIsPendingJsonRpcResponse=t.isPendingJsonRpcResponse=t.JsonRpcResponseStruct=t.JsonRpcFailureStruct=t.JsonRpcSuccessStruct=t.PendingJsonRpcResponseStruct=t.assertIsJsonRpcRequest=t.isJsonRpcRequest=t.assertIsJsonRpcNotification=t.isJsonRpcNotification=t.JsonRpcNotificationStruct=t.JsonRpcRequestStruct=t.JsonRpcParamsStruct=t.JsonRpcErrorStruct=t.JsonRpcIdStruct=t.JsonRpcVersionStruct=t.jsonrpc2=t.isValidJson=t.JsonStruct=void 0;const e=Or,r=$e,n=su;t.JsonStruct=(0,e.define)("Json",C=>{const[T]=x(C,!0);return T?!0:"Expected a valid JSON-serializable value"});function i(C){return(0,e.is)(C,t.JsonStruct)}t.isValidJson=i,t.jsonrpc2="2.0",t.JsonRpcVersionStruct=(0,e.literal)(t.jsonrpc2),t.JsonRpcIdStruct=(0,e.nullable)((0,e.union)([(0,e.number)(),(0,e.string)()])),t.JsonRpcErrorStruct=(0,e.object)({code:(0,e.integer)(),message:(0,e.string)(),data:(0,e.optional)(t.JsonStruct),stack:(0,e.optional)((0,e.string)())}),t.JsonRpcParamsStruct=(0,e.optional)((0,e.union)([(0,e.record)((0,e.string)(),t.JsonStruct),(0,e.array)(t.JsonStruct)])),t.JsonRpcRequestStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,method:(0,e.string)(),params:t.JsonRpcParamsStruct}),t.JsonRpcNotificationStruct=(0,e.omit)(t.JsonRpcRequestStruct,["id"]);function s(C){return(0,e.is)(C,t.JsonRpcNotificationStruct)}t.isJsonRpcNotification=s;function o(C,T){(0,r.assertStruct)(C,t.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",T)}t.assertIsJsonRpcNotification=o;function a(C){return(0,e.is)(C,t.JsonRpcRequestStruct)}t.isJsonRpcRequest=a;function c(C,T){(0,r.assertStruct)(C,t.JsonRpcRequestStruct,"Invalid JSON-RPC request",T)}t.assertIsJsonRpcRequest=c,t.PendingJsonRpcResponseStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:(0,e.optional)((0,e.unknown)()),error:(0,e.optional)(t.JsonRpcErrorStruct)}),t.JsonRpcSuccessStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:t.JsonStruct}),t.JsonRpcFailureStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,error:t.JsonRpcErrorStruct}),t.JsonRpcResponseStruct=(0,e.union)([t.JsonRpcSuccessStruct,t.JsonRpcFailureStruct]);function u(C){return(0,e.is)(C,t.PendingJsonRpcResponseStruct)}t.isPendingJsonRpcResponse=u;function l(C,T){(0,r.assertStruct)(C,t.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",T)}t.assertIsPendingJsonRpcResponse=l;function f(C){return(0,e.is)(C,t.JsonRpcResponseStruct)}t.isJsonRpcResponse=f;function h(C,T){(0,r.assertStruct)(C,t.JsonRpcResponseStruct,"Invalid JSON-RPC response",T)}t.assertIsJsonRpcResponse=h;function p(C){return(0,e.is)(C,t.JsonRpcSuccessStruct)}t.isJsonRpcSuccess=p;function v(C,T){(0,r.assertStruct)(C,t.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",T)}t.assertIsJsonRpcSuccess=v;function E(C){return(0,e.is)(C,t.JsonRpcFailureStruct)}t.isJsonRpcFailure=E;function _(C,T){(0,r.assertStruct)(C,t.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",T)}t.assertIsJsonRpcFailure=_;function d(C){return(0,e.is)(C,t.JsonRpcErrorStruct)}t.isJsonRpcError=d;function y(C,T){(0,r.assertStruct)(C,t.JsonRpcErrorStruct,"Invalid JSON-RPC error",T)}t.assertIsJsonRpcError=y;function m(C){const{permitEmptyString:T,permitFractions:j,permitNull:$}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},C);return U=>!!(typeof U=="number"&&(j||Number.isInteger(U))||typeof U=="string"&&(T||U.length>0)||$&&U===null)}t.getJsonRpcIdValidator=m;function x(C,T=!1){const j=new Set;function $(A,U){if(A===void 0)return[!1,0];if(A===null)return[!0,U?0:n.JsonSize.Null];const ce=typeof A;try{if(ce==="function")return[!1,0];if(ce==="string"||A instanceof String)return[!0,U?0:(0,n.calculateStringSize)(A)+n.JsonSize.Quote*2];if(ce==="boolean"||A instanceof Boolean)return U?[!0,0]:[!0,A==!0?n.JsonSize.True:n.JsonSize.False];if(ce==="number"||A instanceof Number)return U?[!0,0]:[!0,(0,n.calculateNumberSize)(A)];if(A instanceof Date)return U?[!0,0]:[!0,isNaN(A.getDate())?n.JsonSize.Null:n.JsonSize.Date+n.JsonSize.Quote*2]}catch{return[!1,0]}if(!(0,n.isPlainObject)(A)&&!Array.isArray(A))return[!1,0];if(j.has(A))return[!1,0];j.add(A);try{return[!0,Object.entries(A).reduce((Z,[R,M],N,L)=>{let[B,D]=$(M,U);if(!B)throw new Error("JSON validation did not pass. Validation process stopped.");if(j.delete(A),U)return 0;const H=Array.isArray(A)?0:R.length+n.JsonSize.Comma+n.JsonSize.Colon*2,Y=N0)return o(l);if(h==="number"&&isFinite(l))return f.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(f){var h=parseFloat(f[1]),p=(f[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return h*s;case"weeks":case"week":case"w":return h*i;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*r;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(l){var f=Math.abs(l);return f>=n?Math.round(l/n)+"d":f>=r?Math.round(l/r)+"h":f>=e?Math.round(l/e)+"m":f>=t?Math.round(l/t)+"s":l+"ms"}function c(l){var f=Math.abs(l);return f>=n?u(l,f,n,"day"):f>=r?u(l,f,r,"hour"):f>=e?u(l,f,e,"minute"):f>=t?u(l,f,t,"second"):l+" ms"}function u(l,f,h,p){var v=f>=h*1.5;return Math.round(l/h)+" "+p+(v?"s":"")}return Na}function Z1(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=Q1(),r.destroy=u,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let f=0;for(let h=0;h{if(T==="%%")return"%";x++;const $=r.formatters[j];if(typeof $=="function"){const A=_[x];T=$.call(d,A),_.splice(x,1),x--}return T}),r.formatArgs.call(d,_),(d.log||r.log).apply(d,_)}return E.namespace=l,E.useColors=r.useColors(),E.color=r.selectColor(l),E.extend=n,E.destroy=r.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==r.namespaces&&(p=r.namespaces,v=r.enabled(l)),v),set:_=>{h=_}}),typeof r.init=="function"&&r.init(E),E}function n(l,f){const h=r(this.namespace+(typeof f>"u"?":":f)+l);return h.log=this.log,h}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f;const h=(typeof l=="string"?l:"").split(/[\s,]+/),p=h.length;for(f=0;f"-"+f)].join(",");return r.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let f,h;for(f=0,h=r.skips.length;f{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,f=0;c[0].replace(/%[a-zA-Z%]/g,h=>{h!=="%%"&&(l++,h==="%c"&&(f=l))}),c.splice(f,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function s(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c={}.DEBUG),c}function o(){try{return localStorage}catch{}}t.exports=Y1(e);const{formatters:a}=t.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(vc,vc.exports);var K1=vc.exports,X1=F&&F.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(un,"__esModule",{value:!0});un.createModuleLogger=un.createProjectLogger=void 0;const e_=X1(K1),t_=(0,e_.default)("metamask");function r_(t){return t_.extend(t)}un.createProjectLogger=r_;function n_(t,e){return t.extend(e)}un.createModuleLogger=n_;var At={};Object.defineProperty(At,"__esModule",{value:!0});At.hexToBigInt=At.hexToNumber=At.bigIntToHex=At.numberToHex=void 0;const Kr=$e,Kn=bi,i_=t=>((0,Kr.assert)(typeof t=="number","Value must be a number."),(0,Kr.assert)(t>=0,"Value must be a non-negative number."),(0,Kr.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Kn.add0x)(t.toString(16)));At.numberToHex=i_;const s_=t=>((0,Kr.assert)(typeof t=="bigint","Value must be a bigint."),(0,Kr.assert)(t>=0,"Value must be a non-negative bigint."),(0,Kn.add0x)(t.toString(16)));At.bigIntToHex=s_;const o_=t=>{(0,Kn.assertIsHexString)(t);const e=parseInt(t,16);return(0,Kr.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `hexToBigInt` instead."),e};At.hexToNumber=o_;const a_=t=>((0,Kn.assertIsHexString)(t),BigInt((0,Kn.add0x)(t)));At.hexToBigInt=a_;var Xd={};Object.defineProperty(Xd,"__esModule",{value:!0});var ep={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.timeSince=t.inMilliseconds=t.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(t.Duration||(t.Duration={}));const e=s=>Number.isInteger(s)&&s>=0,r=(s,o)=>{if(!e(s))throw new Error(`"${o}" must be a non-negative integer. Received: "${s}".`)};function n(s,o){return r(s,"count"),s*o}t.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}t.timeSince=i})(ep);var tp={},mc={exports:{}};const c_="2.0.0",rp=256,u_=Number.MAX_SAFE_INTEGER||9007199254740991,l_=16,f_=rp-6,h_=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Os={MAX_LENGTH:rp,MAX_SAFE_COMPONENT_LENGTH:l_,MAX_SAFE_BUILD_LENGTH:f_,MAX_SAFE_INTEGER:u_,RELEASE_TYPES:h_,SEMVER_SPEC_VERSION:c_,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const d_=typeof process=="object"&&process.env&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};var Ns=d_;(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Os,s=Ns;e=t.exports={};const o=e.re=[],a=e.safeRe=[],c=e.src=[],u=e.t={};let l=0;const f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",i],[f,n]],p=E=>{for(const[_,d]of h)E=E.split(`${_}*`).join(`${_}{0,${d}}`).split(`${_}+`).join(`${_}{1,${d}}`);return E},v=(E,_,d)=>{const y=p(_),m=l++;s(E,m,_),u[E]=m,c[m]=_,o[m]=new RegExp(_,d?"g":void 0),a[m]=new RegExp(y,d?"g":void 0)};v("NUMERICIDENTIFIER","0|[1-9]\\d*"),v("NUMERICIDENTIFIERLOOSE","\\d+"),v("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),v("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),v("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),v("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),v("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),v("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),v("BUILDIDENTIFIER",`${f}+`),v("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),v("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),v("FULL",`^${c[u.FULLPLAIN]}$`),v("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),v("LOOSE",`^${c[u.LOOSEPLAIN]}$`),v("GTLT","((?:<|>)?=?)"),v("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),v("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),v("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),v("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),v("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),v("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),v("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),v("COERCERTL",c[u.COERCE],!0),v("LONETILDE","(?:~>?)"),v("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",v("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),v("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),v("LONECARET","(?:\\^)"),v("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",v("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),v("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),v("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),v("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),v("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",v("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),v("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),v("STAR","(<|>)?=?\\s*\\*"),v("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),v("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(mc,mc.exports);var gi=mc.exports;const p_=Object.freeze({loose:!0}),b_=Object.freeze({}),g_=t=>t?typeof t!="object"?p_:t:b_;var ou=g_;const tf=/^[0-9]+$/,np=(t,e)=>{const r=tf.test(t),n=tf.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:tnp(e,t);var ip={compareIdentifiers:np,rcompareIdentifiers:y_};const Pi=Ns,{MAX_LENGTH:rf,MAX_SAFE_INTEGER:$i}=Os,{safeRe:nf,t:sf}=gi,v_=ou,{compareIdentifiers:Fr}=ip;let m_=class St{constructor(e,r){if(r=v_(r),e instanceof St){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>rf)throw new TypeError(`version is longer than ${rf} characters`);Pi("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=e.trim().match(r.loose?nf[sf.LOOSE]:nf[sf.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>$i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>$i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>$i||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s<$i)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Pi("SemVer.compare",this.version,this.options,e),!(e instanceof St)){if(typeof e=="string"&&e===this.version)return 0;e=new St(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof St||(e=new St(e,this.options)),Fr(this.major,e.major)||Fr(this.minor,e.minor)||Fr(this.patch,e.patch)}comparePre(e){if(e instanceof St||(e=new St(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],i=e.prerelease[r];if(Pi("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Fr(n,i)}while(++r)}compareBuild(e){e instanceof St||(e=new St(e,this.options));let r=0;do{const n=this.build[r],i=e.build[r];if(Pi("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Fr(n,i)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const i=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Fr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var qe=m_;const of=qe,__=(t,e,r=!1)=>{if(t instanceof of)return t;try{return new of(t,e)}catch(n){if(!r)return null;throw n}};var In=__;const w_=In,S_=(t,e)=>{const r=w_(t,e);return r?r.version:null};var E_=S_;const C_=In,x_=(t,e)=>{const r=C_(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};var I_=x_;const af=qe,R_=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new af(t instanceof af?t.version:t,r).inc(e,n,i).version}catch{return null}};var A_=R_;const cf=In,M_=(t,e)=>{const r=cf(t,null,!0),n=cf(e,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,o=s?r:n,a=s?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c)return!a.patch&&!a.minor?"major":o.patch?"patch":o.minor?"minor":"major";const l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};var k_=M_;const T_=qe,O_=(t,e)=>new T_(t,e).major;var N_=O_;const L_=qe,P_=(t,e)=>new L_(t,e).minor;var $_=P_;const D_=qe,j_=(t,e)=>new D_(t,e).patch;var B_=j_;const F_=In,W_=(t,e)=>{const r=F_(t,e);return r&&r.prerelease.length?r.prerelease:null};var H_=W_;const uf=qe,V_=(t,e,r)=>new uf(t,r).compare(new uf(e,r));var gt=V_;const U_=gt,z_=(t,e,r)=>U_(e,t,r);var q_=z_;const G_=gt,J_=(t,e)=>G_(t,e,!0);var Q_=J_;const lf=qe,Z_=(t,e,r)=>{const n=new lf(t,r),i=new lf(e,r);return n.compare(i)||n.compareBuild(i)};var au=Z_;const Y_=au,K_=(t,e)=>t.sort((r,n)=>Y_(r,n,e));var X_=K_;const ew=au,tw=(t,e)=>t.sort((r,n)=>ew(n,r,e));var rw=tw;const nw=gt,iw=(t,e,r)=>nw(t,e,r)>0;var Ls=iw;const sw=gt,ow=(t,e,r)=>sw(t,e,r)<0;var cu=ow;const aw=gt,cw=(t,e,r)=>aw(t,e,r)===0;var sp=cw;const uw=gt,lw=(t,e,r)=>uw(t,e,r)!==0;var op=lw;const fw=gt,hw=(t,e,r)=>fw(t,e,r)>=0;var uu=hw;const dw=gt,pw=(t,e,r)=>dw(t,e,r)<=0;var lu=pw;const bw=sp,gw=op,yw=Ls,vw=uu,mw=cu,_w=lu,ww=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return bw(t,r,n);case"!=":return gw(t,r,n);case">":return yw(t,r,n);case">=":return vw(t,r,n);case"<":return mw(t,r,n);case"<=":return _w(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var ap=ww;const Sw=qe,Ew=In,{safeRe:Di,t:ji}=gi,Cw=(t,e)=>{if(t instanceof Sw)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(Di[ji.COERCE]);else{let n;for(;(n=Di[ji.COERCERTL].exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||n.index+n[0].length!==r.index+r[0].length)&&(r=n),Di[ji.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;Di[ji.COERCERTL].lastIndex=-1}return r===null?null:Ew(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,e)};var xw=Cw,La,ff;function Iw(){return ff||(ff=1,La=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),La}var Rw=ae;ae.Node=Sr;ae.create=ae;function ae(t){var e=this;if(e instanceof ae||(e=new ae),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(i){e.push(i)});else if(arguments.length>0)for(var r=0,n=arguments.length;r1)r=e;else if(this.head)n=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var i=0;n!==null;i++)r=t(r,n.value,i),n=n.next;return r};ae.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var i=this.length-1;n!==null;i--)r=t(r,n.value,i),n=n.prev;return r};ae.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};ae.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};ae.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new ae;if(ethis.length&&(e=this.length);for(var n=0,i=this.head;i!==null&&nthis.length&&(e=this.length);for(var n=this.length,i=this.tail;i!==null&&n>e;n--)i=i.prev;for(;i!==null&&n>t;n--,i=i.prev)r.push(i.value);return r};ae.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,i=this.head;i!==null&&n1;class Ow{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");this[dr]=e.max||1/0;const r=e.length||Pa;if(this[Wr]=typeof r!="function"?Pa:r,this[zn]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[yr]=e.maxAge||0,this[Lt]=e.dispose,this[hf]=e.noDisposeOnSet||!1,this[cp]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[dr]=e||1/0,Pn(this)}get max(){return this[dr]}set allowStale(e){this[zn]=!!e}get allowStale(){return this[zn]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[yr]=e,Pn(this)}get maxAge(){return this[yr]}set lengthCalculator(e){typeof e!="function"&&(e=Pa),e!==this[Wr]&&(this[Wr]=e,this[Dt]=0,this[ke].forEach(r=>{r.length=this[Wr](r.value,r.key),this[Dt]+=r.length})),Pn(this)}get lengthCalculator(){return this[Wr]}get length(){return this[Dt]}get itemCount(){return this[ke].length}rforEach(e,r){r=r||this;for(let n=this[ke].tail;n!==null;){const i=n.prev;df(this,e,n,r),n=i}}forEach(e,r){r=r||this;for(let n=this[ke].head;n!==null;){const i=n.next;df(this,e,n,r),n=i}}keys(){return this[ke].toArray().map(e=>e.key)}values(){return this[ke].toArray().map(e=>e.value)}reset(){this[Lt]&&this[ke]&&this[ke].length&&this[ke].forEach(e=>this[Lt](e.key,e.value)),this[ht]=new Map,this[ke]=new Tw,this[Dt]=0}dump(){return this[ke].map(e=>ss(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[ke]}set(e,r,n){if(n=n||this[yr],n&&typeof n!="number")throw new TypeError("maxAge must be a number");const i=n?Date.now():0,s=this[Wr](r,e);if(this[ht].has(e)){if(s>this[dr])return Xr(this,this[ht].get(e)),!1;const c=this[ht].get(e).value;return this[Lt]&&(this[hf]||this[Lt](e,c.value)),c.now=i,c.maxAge=n,c.value=r,this[Dt]+=s-c.length,c.length=s,this.get(e),Pn(this),!0}const o=new Nw(e,r,s,i,n);return o.length>this[dr]?(this[Lt]&&this[Lt](e,r),!1):(this[Dt]+=o.length,this[ke].unshift(o),this[ht].set(e,this[ke].head),Pn(this),!0)}has(e){if(!this[ht].has(e))return!1;const r=this[ht].get(e).value;return!ss(this,r)}get(e){return $a(this,e,!0)}peek(e){return $a(this,e,!1)}pop(){const e=this[ke].tail;return e?(Xr(this,e),e.value):null}del(e){Xr(this,this[ht].get(e))}load(e){this.reset();const r=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],s=i.e||0;if(s===0)this.set(i.k,i.v);else{const o=s-r;o>0&&this.set(i.k,i.v,o)}}}prune(){this[ht].forEach((e,r)=>$a(this,r,!1))}}const $a=(t,e,r)=>{const n=t[ht].get(e);if(n){const i=n.value;if(ss(t,i)){if(Xr(t,n),!t[zn])return}else r&&(t[cp]&&(n.value.now=Date.now()),t[ke].unshiftNode(n));return i.value}},ss=(t,e)=>{if(!e||!e.maxAge&&!t[yr])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[yr]&&r>t[yr]},Pn=t=>{if(t[Dt]>t[dr])for(let e=t[ke].tail;t[Dt]>t[dr]&&e!==null;){const r=e.prev;Xr(t,e),e=r}},Xr=(t,e)=>{if(e){const r=e.value;t[Lt]&&t[Lt](r.key,r.value),t[Dt]-=r.length,t[ht].delete(r.key),t[ke].removeNode(e)}};class Nw{constructor(e,r,n,i,s){this.key=e,this.value=r,this.length=n,this.now=i,this.maxAge=s||0}}const df=(t,e,r,n)=>{let i=r.value;ss(t,i)&&(Xr(t,r),t[zn]||(i=void 0)),i&&e.call(n,i.value,i.key,t)};var Lw=Ow,Da,pf;function yt(){if(pf)return Da;pf=1;class t{constructor(M,N){if(N=n(N),M instanceof t)return M.loose===!!N.loose&&M.includePrerelease===!!N.includePrerelease?M:new t(M.raw,N);if(M instanceof i)return this.raw=M.value,this.set=[[M]],this.format(),this;if(this.options=N,this.loose=!!N.loose,this.includePrerelease=!!N.includePrerelease,this.raw=M.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(L=>this.parseRange(L.trim())).filter(L=>L.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const L=this.set[0];if(this.set=this.set.filter(B=>!v(B[0])),this.set.length===0)this.set=[L];else if(this.set.length>1){for(const B of this.set)if(B.length===1&&E(B[0])){this.set=[B];break}}}this.format()}format(){return this.range=this.set.map(M=>M.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(M){const L=((this.options.includePrerelease&&h)|(this.options.loose&&p))+":"+M,B=r.get(L);if(B)return B;const D=this.options.loose,H=D?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];M=M.replace(H,ce(this.options.includePrerelease)),s("hyphen replace",M),M=M.replace(a[c.COMPARATORTRIM],u),s("comparator trim",M),M=M.replace(a[c.TILDETRIM],l),s("tilde trim",M),M=M.replace(a[c.CARETTRIM],f),s("caret trim",M);let Y=M.split(" ").map(le=>d(le,this.options)).join(" ").split(/\s+/).map(le=>U(le,this.options));D&&(Y=Y.filter(le=>(s("loose invalid filter",le,this.options),!!le.match(a[c.COMPARATORLOOSE])))),s("range list",Y);const J=new Map,se=Y.map(le=>new i(le,this.options));for(const le of se){if(v(le))return[le];J.set(le.value,le)}J.size>1&&J.has("")&&J.delete("");const he=[...J.values()];return r.set(L,he),he}intersects(M,N){if(!(M instanceof t))throw new TypeError("a Range is required");return this.set.some(L=>_(L,N)&&M.set.some(B=>_(B,N)&&L.every(D=>B.every(H=>D.intersects(H,N)))))}test(M){if(!M)return!1;if(typeof M=="string")try{M=new o(M,this.options)}catch{return!1}for(let N=0;NR.value==="<0.0.0-0",E=R=>R.value==="",_=(R,M)=>{let N=!0;const L=R.slice();let B=L.pop();for(;N&&L.length;)N=L.every(D=>B.intersects(D,M)),B=L.pop();return N},d=(R,M)=>(s("comp",R,M),R=C(R,M),s("caret",R),R=m(R,M),s("tildes",R),R=j(R,M),s("xrange",R),R=A(R,M),s("stars",R),R),y=R=>!R||R.toLowerCase()==="x"||R==="*",m=(R,M)=>R.trim().split(/\s+/).map(N=>x(N,M)).join(" "),x=(R,M)=>{const N=M.loose?a[c.TILDELOOSE]:a[c.TILDE];return R.replace(N,(L,B,D,H,Y)=>{s("tilde",R,L,B,D,H,Y);let J;return y(B)?J="":y(D)?J=`>=${B}.0.0 <${+B+1}.0.0-0`:y(H)?J=`>=${B}.${D}.0 <${B}.${+D+1}.0-0`:Y?(s("replaceTilde pr",Y),J=`>=${B}.${D}.${H}-${Y} <${B}.${+D+1}.0-0`):J=`>=${B}.${D}.${H} <${B}.${+D+1}.0-0`,s("tilde return",J),J})},C=(R,M)=>R.trim().split(/\s+/).map(N=>T(N,M)).join(" "),T=(R,M)=>{s("caret",R,M);const N=M.loose?a[c.CARETLOOSE]:a[c.CARET],L=M.includePrerelease?"-0":"";return R.replace(N,(B,D,H,Y,J)=>{s("caret",R,B,D,H,Y,J);let se;return y(D)?se="":y(H)?se=`>=${D}.0.0${L} <${+D+1}.0.0-0`:y(Y)?D==="0"?se=`>=${D}.${H}.0${L} <${D}.${+H+1}.0-0`:se=`>=${D}.${H}.0${L} <${+D+1}.0.0-0`:J?(s("replaceCaret pr",J),D==="0"?H==="0"?se=`>=${D}.${H}.${Y}-${J} <${D}.${H}.${+Y+1}-0`:se=`>=${D}.${H}.${Y}-${J} <${D}.${+H+1}.0-0`:se=`>=${D}.${H}.${Y}-${J} <${+D+1}.0.0-0`):(s("no pr"),D==="0"?H==="0"?se=`>=${D}.${H}.${Y}${L} <${D}.${H}.${+Y+1}-0`:se=`>=${D}.${H}.${Y}${L} <${D}.${+H+1}.0-0`:se=`>=${D}.${H}.${Y} <${+D+1}.0.0-0`),s("caret return",se),se})},j=(R,M)=>(s("replaceXRanges",R,M),R.split(/\s+/).map(N=>$(N,M)).join(" ")),$=(R,M)=>{R=R.trim();const N=M.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return R.replace(N,(L,B,D,H,Y,J)=>{s("xRange",R,L,B,D,H,Y,J);const se=y(D),he=se||y(H),le=he||y(Y),We=le;return B==="="&&We&&(B=""),J=M.includePrerelease?"-0":"",se?B===">"||B==="<"?L="<0.0.0-0":L="*":B&&We?(he&&(H=0),Y=0,B===">"?(B=">=",he?(D=+D+1,H=0,Y=0):(H=+H+1,Y=0)):B==="<="&&(B="<",he?D=+D+1:H=+H+1),B==="<"&&(J="-0"),L=`${B+D}.${H}.${Y}${J}`):he?L=`>=${D}.0.0${J} <${+D+1}.0.0-0`:le&&(L=`>=${D}.${H}.0${J} <${D}.${+H+1}.0-0`),s("xRange return",L),L})},A=(R,M)=>(s("replaceStars",R,M),R.trim().replace(a[c.STAR],"")),U=(R,M)=>(s("replaceGTE0",R,M),R.trim().replace(a[M.includePrerelease?c.GTE0PRE:c.GTE0],"")),ce=R=>(M,N,L,B,D,H,Y,J,se,he,le,We,w)=>(y(L)?N="":y(B)?N=`>=${L}.0.0${R?"-0":""}`:y(D)?N=`>=${L}.${B}.0${R?"-0":""}`:H?N=`>=${N}`:N=`>=${N}${R?"-0":""}`,y(se)?J="":y(he)?J=`<${+se+1}.0.0-0`:y(le)?J=`<${se}.${+he+1}.0-0`:We?J=`<=${se}.${he}.${le}-${We}`:R?J=`<${se}.${he}.${+le+1}-0`:J=`<=${J}`,`${N} ${J}`.trim()),Z=(R,M,N)=>{for(let L=0;L0){const B=R[L].semver;if(B.major===M.major&&B.minor===M.minor&&B.patch===M.patch)return!0}return!1}return!0};return Da}var ja,bf;function Ps(){if(bf)return ja;bf=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(l,f){if(f=r(f),l instanceof e){if(l.loose===!!f.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),o("comparator",l,f),this.options=f,this.loose=!!f.loose,this.parse(l),this.semver===t?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(l){const f=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],h=l.match(f);if(!h)throw new TypeError(`Invalid comparator: ${l}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new a(h[2],this.options.loose):this.semver=t}toString(){return this.value}test(l){if(o("Comparator.test",l,this.options.loose),this.semver===t||l===t)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return s(l,this.operator,this.semver,this.options)}intersects(l,f){if(!(l instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,f).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,f).test(l.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||s(this.semver,"<",l.semver,f)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||s(this.semver,">",l.semver,f)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}ja=e;const r=ou,{safeRe:n,t:i}=gi,s=ap,o=Ns,a=qe,c=yt();return ja}const Pw=yt(),$w=(t,e,r)=>{try{e=new Pw(e,r)}catch{return!1}return e.test(t)};var $s=$w;const Dw=yt(),jw=(t,e)=>new Dw(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Bw=jw;const Fw=qe,Ww=yt(),Hw=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Ww(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Fw(n,r))}),n};var Vw=Hw;const Uw=qe,zw=yt(),qw=(t,e,r)=>{let n=null,i=null,s=null;try{s=new zw(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new Uw(n,r))}),n};var Gw=qw;const Ba=qe,Jw=yt(),gf=Ls,Qw=(t,e)=>{t=new Jw(t,e);let r=new Ba("0.0.0");if(t.test(r)||(r=new Ba("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{const a=new Ba(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||gf(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||gf(r,s))&&(r=s)}return r&&t.test(r)?r:null};var Zw=Qw;const Yw=yt(),Kw=(t,e)=>{try{return new Yw(t,e).range||"*"}catch{return null}};var Xw=Kw;const eS=qe,up=Ps(),{ANY:tS}=up,rS=yt(),nS=$s,yf=Ls,vf=cu,iS=lu,sS=uu,oS=(t,e,r,n)=>{t=new eS(t,n),e=new rS(e,n);let i,s,o,a,c;switch(r){case">":i=yf,s=iS,o=vf,a=">",c=">=";break;case"<":i=vf,s=sS,o=yf,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(nS(t,e,n))return!1;for(let u=0;u{p.semver===tS&&(p=new up(">=0.0.0")),f=f||p,h=h||p,i(p.semver,f.semver,n)?f=p:o(p.semver,h.semver,n)&&(h=p)}),f.operator===a||f.operator===c||(!h.operator||h.operator===a)&&s(t,h.semver))return!1;if(h.operator===c&&o(t,h.semver))return!1}return!0};var fu=oS;const aS=fu,cS=(t,e,r)=>aS(t,e,">",r);var uS=cS;const lS=fu,fS=(t,e,r)=>lS(t,e,"<",r);var hS=fS;const mf=yt(),dS=(t,e,r)=>(t=new mf(t,r),e=new mf(e,r),t.intersects(e,r));var pS=dS;const bS=$s,gS=gt;var yS=(t,e,r)=>{const n=[];let i=null,s=null;const o=t.sort((l,f)=>gS(l,f,r));for(const l of o)bS(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const a=[];for(const[l,f]of n)l===f?a.push(l):!f&&l===o[0]?a.push("*"):f?l===o[0]?a.push(`<=${f}`):a.push(`${l} - ${f}`):a.push(`>=${l}`);const c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length{if(t===e)return!0;t=new _f(t,r),e=new _f(e,r);let n=!1;e:for(const i of t.set){for(const s of e.set){const o=_S(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},mS=[new hu(">=0.0.0-0")],wf=[new hu(">=0.0.0")],_S=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Fa){if(e.length===1&&e[0].semver===Fa)return!0;r.includePrerelease?t=mS:t=wf}if(e.length===1&&e[0].semver===Fa){if(r.includePrerelease)return!0;e=wf}const n=new Set;let i,s;for(const p of t)p.operator===">"||p.operator===">="?i=Sf(i,p,r):p.operator==="<"||p.operator==="<="?s=Ef(s,p,r):n.add(p.semver);if(n.size>1)return null;let o;if(i&&s){if(o=du(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const p of n){if(i&&!$n(p,String(i),r)||s&&!$n(p,String(s),r))return null;for(const v of e)if(!$n(p,String(v),r))return!1;return!0}let a,c,u,l,f=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;f&&f.prerelease.length===1&&s.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(const p of e){if(l=l||p.operator===">"||p.operator===">=",u=u||p.operator==="<"||p.operator==="<=",i){if(h&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===h.major&&p.semver.minor===h.minor&&p.semver.patch===h.patch&&(h=!1),p.operator===">"||p.operator===">="){if(a=Sf(i,p,r),a===p&&a!==i)return!1}else if(i.operator===">="&&!$n(i.semver,String(p),r))return!1}if(s){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator==="<"||p.operator==="<="){if(c=Ef(s,p,r),c===p&&c!==s)return!1}else if(s.operator==="<="&&!$n(s.semver,String(p),r))return!1}if(!p.operator&&(s||i)&&o!==0)return!1}return!(i&&u&&!s&&o!==0||s&&l&&!i&&o!==0||h||f)},Sf=(t,e,r)=>{if(!t)return e;const n=du(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Ef=(t,e,r)=>{if(!t)return e;const n=du(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};var wS=vS;const Wa=gi,Cf=Os,SS=qe,xf=ip,ES=In,CS=E_,xS=I_,IS=A_,RS=k_,AS=N_,MS=$_,kS=B_,TS=H_,OS=gt,NS=q_,LS=Q_,PS=au,$S=X_,DS=rw,jS=Ls,BS=cu,FS=sp,WS=op,HS=uu,VS=lu,US=ap,zS=xw,qS=Ps(),GS=yt(),JS=$s,QS=Bw,ZS=Vw,YS=Gw,KS=Zw,XS=Xw,e2=fu,t2=uS,r2=hS,n2=pS,i2=yS,s2=wS;var o2={parse:ES,valid:CS,clean:xS,inc:IS,diff:RS,major:AS,minor:MS,patch:kS,prerelease:TS,compare:OS,rcompare:NS,compareLoose:LS,compareBuild:PS,sort:$S,rsort:DS,gt:jS,lt:BS,eq:FS,neq:WS,gte:HS,lte:VS,cmp:US,coerce:zS,Comparator:qS,Range:GS,satisfies:JS,toComparators:QS,maxSatisfying:ZS,minSatisfying:YS,minVersion:KS,validRange:XS,outside:e2,gtr:t2,ltr:r2,intersects:n2,simplifyRange:i2,subset:s2,SemVer:SS,re:Wa.re,src:Wa.src,tokens:Wa.t,SEMVER_SPEC_VERSION:Cf.SEMVER_SPEC_VERSION,RELEASE_TYPES:Cf.RELEASE_TYPES,compareIdentifiers:xf.compareIdentifiers,rcompareIdentifiers:xf.rcompareIdentifiers};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.satisfiesVersionRange=t.gtRange=t.gtVersion=t.assertIsSemVerRange=t.assertIsSemVerVersion=t.isValidSemVerRange=t.isValidSemVerVersion=t.VersionRangeStruct=t.VersionStruct=void 0;const e=o2,r=Or,n=$e;t.VersionStruct=(0,r.refine)((0,r.string)(),"Version",f=>(0,e.valid)(f)===null?`Expected SemVer version, got "${f}"`:!0),t.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",f=>(0,e.validRange)(f)===null?`Expected SemVer range, got "${f}"`:!0);function i(f){return(0,r.is)(f,t.VersionStruct)}t.isValidSemVerVersion=i;function s(f){return(0,r.is)(f,t.VersionRangeStruct)}t.isValidSemVerRange=s;function o(f){(0,n.assertStruct)(f,t.VersionStruct)}t.assertIsSemVerVersion=o;function a(f){(0,n.assertStruct)(f,t.VersionRangeStruct)}t.assertIsSemVerRange=a;function c(f,h){return(0,e.gt)(f,h)}t.gtVersion=c;function u(f,h){return(0,e.gtr)(f,h)}t.gtRange=u;function l(f,h){return(0,e.satisfies)(f,h,{includePrerelease:!0})}t.satisfiesVersionRange=l})(tp);(function(t){var e=F&&F.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=F&&F.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r($e,t),r(pi,t),r(oe,t),r(ks,t),r(Rt,t),r(cn,t),r(bi,t),r(Kd,t),r(un,t),r(su,t),r(At,t),r(Xd,t),r(ep,t),r(tp,t)})(Nd);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createModuleLogger=t.projectLogger=void 0;const e=Nd;Object.defineProperty(t,"createModuleLogger",{enumerable:!0,get:function(){return e.createModuleLogger}}),t.projectLogger=(0,e.createProjectLogger)("eth-block-tracker")})(Od);var lp=F&&F.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(As,"__esModule",{value:!0});As.PollingBlockTracker=void 0;const a2=lp(Qc),c2=lp(Mm),u2=hi,If=Od,Rf=(0,If.createModuleLogger)(If.projectLogger,"polling-block-tracker"),l2=(0,a2.default)(),f2=1e3;class h2 extends u2.BaseBlockTracker{constructor(e={}){var r;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super({blockResetDuration:(r=e.blockResetDuration)!==null&&r!==void 0?r:e.pollingInterval}),this._provider=e.provider,this._pollingInterval=e.pollingInterval||20*f2,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=e.keepEventLoopActive===void 0?!0:e.keepEventLoopActive,this._setSkipCacheFlag=e.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var e;this._isRunning;)try{await this._updateLatestBlock();const r=Af(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block: diff --git a/assets/index-198de436.js b/assets/index-e5e7bd9b.js similarity index 98% rename from assets/index-198de436.js rename to assets/index-e5e7bd9b.js index 3ce05e44..e3cb380f 100644 --- a/assets/index-198de436.js +++ b/assets/index-e5e7bd9b.js @@ -1 +1 @@ -import{ar as le}from"./index-cfc0b18f.js";import{b as ce}from"./index-cc134824.js";const de=Symbol(),X=Object.getPrototypeOf,F=new WeakMap,ue=e=>e&&(F.has(e)?F.get(e):X(e)===Object.prototype||X(e)===Array.prototype),fe=e=>ue(e)&&e[de]||null,Y=(e,t=!0)=>{F.set(e,t)},J=e=>typeof e=="object"&&e!==null,C=new WeakMap,B=new WeakSet,pe=(e=Object.is,t=(o,h)=>new Proxy(o,h),s=o=>J(o)&&!B.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),r=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,h,I=r)=>{const w=l.get(o);if((w==null?void 0:w[0])===h)return w[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return Y(b,!0),l.set(o,[h,b]),Reflect.ownKeys(o).forEach(P=>{if(Object.getOwnPropertyDescriptor(b,P))return;const O=Reflect.get(o,P),D={value:O,enumerable:!0,configurable:!0};if(B.has(O))Y(O,!1);else if(O instanceof Promise)delete D.value,D.get=()=>I(O);else if(C.has(O)){const[y,z]=C.get(O);D.value=c(y,z(),I)}Object.defineProperty(b,P,D)}),b},m=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const h=m.get(o);if(h)return h;let I=f[0];const w=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,w.forEach(n=>n(i,a)))};let P=f[1];const O=(i=++f[1])=>(P!==i&&!w.size&&(P=i,y.forEach(([a])=>{const n=a[1](i);n>I&&(I=n)})),I),D=i=>(a,n)=>{const g=[...a];g[1]=[i,...g[1]],b(g,n)},y=new Map,z=(i,a)=>{if(w.size){const n=a[3](D(i));y.set(i,[a,n])}else y.set(i,[a])},Q=i=>{var a;const n=y.get(i);n&&(y.delete(i),(a=n[1])==null||a.call(n))},ae=i=>(w.add(i),w.size===1&&y.forEach(([n,g],R)=>{const k=n[3](D(R));y.set(R,[n,k])}),()=>{w.delete(i),w.size===0&&y.forEach(([n,g],R)=>{g&&(g(),y.set(R,[n]))})}),H=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),V=t(H,{deleteProperty(i,a){const n=Reflect.get(i,a);Q(a);const g=Reflect.deleteProperty(i,a);return g&&b(["delete",[a],n]),g},set(i,a,n,g){const R=Reflect.has(i,a),k=Reflect.get(i,a,g);if(R&&(e(k,n)||m.has(n)&&e(k,m.get(n))))return!0;Q(a),J(n)&&(n=fe(n)||n);let $=n;if(n instanceof Promise)n.then(A=>{n.status="fulfilled",n.value=A,b(["resolve",[a],A])}).catch(A=>{n.status="rejected",n.reason=A,b(["reject",[a],A])});else{!C.has(n)&&s(n)&&($=W(n));const A=!B.has($)&&C.get($);A&&z(a,A)}return Reflect.set(i,a,$,g),b(["set",[a],n,k]),!0}});m.set(o,V);const ie=[H,O,c,ae];return C.set(V,ie),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(V[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(H,i,a)}),V})=>[W,C,B,e,t,s,r,l,c,m,f],[me]=pe();function S(e={}){return me(e)}function j(e,t,s){const r=C.get(e);let l;const c=[],m=r[3];let f=!1;const o=m(h=>{if(c.push(h),s){t(c.splice(0));return}l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function ge(e,t){const s=C.get(e),[r,l,c]=s;return c(r,l(),t)}const d=S({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),re={state:d,subscribe(e){return j(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.5.9")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=re.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},he=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=S({enabled:he,userSessionId:"",events:[],connectedWalletId:void 0}),we={state:u,subscribe(e){return j(u.events,()=>e(ge(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},E=S({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),v={state:E,subscribe(e){return j(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},x=S({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),N={state:x,subscribe(e){return j(x,()=>e(x))},setConfig(e){var t,s;we.initialize(),v.setChains(e.chains),v.setIsAuth(!!e.enableAuthMode),v.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),v.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(x,e)}},G="https://explorer-api.walletconnect.com";async function K(e,t){const s=new URL(e,G);return s.searchParams.append("projectId",N.state.projectId),Object.entries(t).forEach(([r,l])=>{l&&s.searchParams.append(r,String(l))}),(await fetch(s)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${N.state.projectId}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${N.state.projectId}`}};var be=Object.defineProperty,Z=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,ee=(e,t,s)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ie=(e,t)=>{for(var s in t||(t={}))ye.call(t,s)&&ee(e,s,t[s]);if(Z)for(var s of Z(t))ve.call(t,s)&&ee(e,s,t[s]);return e};const te=p.isMobile(),L=S({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ue={state:L,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=N.state;if(e==="NONE"||t==="ALL"&&!e)return L.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await M.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),L.recomendedWallets=l}else{const{chains:s,isAuth:r}=v.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=te?await M.getMobileListings(m):await M.getDesktopListings(m);L.recomendedWallets=Object.values(f)}return L.recomendedWallets},async getWallets(e){const t=Ie({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=N.state,{recomendedWallets:l}=L;if(r==="ALL")return L.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),v.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=te?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),h=m?"search":"wallets";return L[h]={listings:[...L[h].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){L.search={listings:[],total:0,page:1}}},_=S({open:!1}),q={state:_,subscribe(e){return j(_,()=>e(_))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=v.state;if(v.setWalletConnectUri(e==null?void 0:e.uri),v.setChains(e==null?void 0:e.chains),re.reset("ConnectWallet"),s&&r)_.open=!0,t();else{const l=setInterval(()=>{const c=v.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),_.open=!0,t())},200)}})},close(){_.open=!1}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,oe=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&oe(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&oe(e,s,t[s]);return e};function Ae(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const T=S({themeMode:Ae()?"dark":"light"}),ne={state:T,subscribe(e){return j(T,()=>e(T))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=We({},s))}},U=S({open:!1,message:"",variant:"success"}),je={state:U,subscribe(e){return j(U,()=>e(U))},openToast(e,t){U.open=!0,U.message=e,U.variant=t},closeToast(){U.open=!1}};typeof window<"u"&&(window.Buffer||(window.Buffer=ce.Buffer),window.global||(window.global=window),window.process||(window.process={env:{}}),window.global||(window.global=window));class Ce{constructor(t){this.openModal=q.open,this.closeModal=q.close,this.subscribeModal=q.subscribe,this.setTheme=ne.setThemeConfig,ne.setThemeConfig(t),N.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await le(()=>import("./index-96953dd3.js"),["./index-96953dd3.js","./index-cfc0b18f.js","./index-f4824932.css","./index-cc134824.js"],import.meta.url);const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),v.setIsUiLoaded(!0)}}}const Pe=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ce},Symbol.toStringTag,{value:"Module"}));export{we as $,N as C,Ue as G,re as N,q as Q,ne as X,je as Y,Pe as a,v as c,p as i}; +import{ar as le}from"./index-6a2af3e6.js";import{b as ce}from"./index-cc134824.js";const de=Symbol(),X=Object.getPrototypeOf,F=new WeakMap,ue=e=>e&&(F.has(e)?F.get(e):X(e)===Object.prototype||X(e)===Array.prototype),fe=e=>ue(e)&&e[de]||null,Y=(e,t=!0)=>{F.set(e,t)},J=e=>typeof e=="object"&&e!==null,C=new WeakMap,B=new WeakSet,pe=(e=Object.is,t=(o,h)=>new Proxy(o,h),s=o=>J(o)&&!B.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),r=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,h,I=r)=>{const w=l.get(o);if((w==null?void 0:w[0])===h)return w[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return Y(b,!0),l.set(o,[h,b]),Reflect.ownKeys(o).forEach(P=>{if(Object.getOwnPropertyDescriptor(b,P))return;const O=Reflect.get(o,P),D={value:O,enumerable:!0,configurable:!0};if(B.has(O))Y(O,!1);else if(O instanceof Promise)delete D.value,D.get=()=>I(O);else if(C.has(O)){const[y,z]=C.get(O);D.value=c(y,z(),I)}Object.defineProperty(b,P,D)}),b},m=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const h=m.get(o);if(h)return h;let I=f[0];const w=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,w.forEach(n=>n(i,a)))};let P=f[1];const O=(i=++f[1])=>(P!==i&&!w.size&&(P=i,y.forEach(([a])=>{const n=a[1](i);n>I&&(I=n)})),I),D=i=>(a,n)=>{const g=[...a];g[1]=[i,...g[1]],b(g,n)},y=new Map,z=(i,a)=>{if(w.size){const n=a[3](D(i));y.set(i,[a,n])}else y.set(i,[a])},Q=i=>{var a;const n=y.get(i);n&&(y.delete(i),(a=n[1])==null||a.call(n))},ae=i=>(w.add(i),w.size===1&&y.forEach(([n,g],R)=>{const k=n[3](D(R));y.set(R,[n,k])}),()=>{w.delete(i),w.size===0&&y.forEach(([n,g],R)=>{g&&(g(),y.set(R,[n]))})}),H=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),V=t(H,{deleteProperty(i,a){const n=Reflect.get(i,a);Q(a);const g=Reflect.deleteProperty(i,a);return g&&b(["delete",[a],n]),g},set(i,a,n,g){const R=Reflect.has(i,a),k=Reflect.get(i,a,g);if(R&&(e(k,n)||m.has(n)&&e(k,m.get(n))))return!0;Q(a),J(n)&&(n=fe(n)||n);let $=n;if(n instanceof Promise)n.then(A=>{n.status="fulfilled",n.value=A,b(["resolve",[a],A])}).catch(A=>{n.status="rejected",n.reason=A,b(["reject",[a],A])});else{!C.has(n)&&s(n)&&($=W(n));const A=!B.has($)&&C.get($);A&&z(a,A)}return Reflect.set(i,a,$,g),b(["set",[a],n,k]),!0}});m.set(o,V);const ie=[H,O,c,ae];return C.set(V,ie),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(V[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(H,i,a)}),V})=>[W,C,B,e,t,s,r,l,c,m,f],[me]=pe();function S(e={}){return me(e)}function j(e,t,s){const r=C.get(e);let l;const c=[],m=r[3];let f=!1;const o=m(h=>{if(c.push(h),s){t(c.splice(0));return}l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function ge(e,t){const s=C.get(e),[r,l,c]=s;return c(r,l(),t)}const d=S({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),re={state:d,subscribe(e){return j(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.5.9")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=re.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},he=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=S({enabled:he,userSessionId:"",events:[],connectedWalletId:void 0}),we={state:u,subscribe(e){return j(u.events,()=>e(ge(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},E=S({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),v={state:E,subscribe(e){return j(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},x=S({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),N={state:x,subscribe(e){return j(x,()=>e(x))},setConfig(e){var t,s;we.initialize(),v.setChains(e.chains),v.setIsAuth(!!e.enableAuthMode),v.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),v.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(x,e)}},G="https://explorer-api.walletconnect.com";async function K(e,t){const s=new URL(e,G);return s.searchParams.append("projectId",N.state.projectId),Object.entries(t).forEach(([r,l])=>{l&&s.searchParams.append(r,String(l))}),(await fetch(s)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${N.state.projectId}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${N.state.projectId}`}};var be=Object.defineProperty,Z=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,ee=(e,t,s)=>t in e?be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ie=(e,t)=>{for(var s in t||(t={}))ye.call(t,s)&&ee(e,s,t[s]);if(Z)for(var s of Z(t))ve.call(t,s)&&ee(e,s,t[s]);return e};const te=p.isMobile(),L=S({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ue={state:L,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=N.state;if(e==="NONE"||t==="ALL"&&!e)return L.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await M.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),L.recomendedWallets=l}else{const{chains:s,isAuth:r}=v.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=te?await M.getMobileListings(m):await M.getDesktopListings(m);L.recomendedWallets=Object.values(f)}return L.recomendedWallets},async getWallets(e){const t=Ie({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=N.state,{recomendedWallets:l}=L;if(r==="ALL")return L.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),v.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=te?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),h=m?"search":"wallets";return L[h]={listings:[...L[h].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){L.search={listings:[],total:0,page:1}}},_=S({open:!1}),q={state:_,subscribe(e){return j(_,()=>e(_))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=v.state;if(v.setWalletConnectUri(e==null?void 0:e.uri),v.setChains(e==null?void 0:e.chains),re.reset("ConnectWallet"),s&&r)_.open=!0,t();else{const l=setInterval(()=>{const c=v.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),_.open=!0,t())},200)}})},close(){_.open=!1}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,oe=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&oe(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&oe(e,s,t[s]);return e};function Ae(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const T=S({themeMode:Ae()?"dark":"light"}),ne={state:T,subscribe(e){return j(T,()=>e(T))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=We({},s))}},U=S({open:!1,message:"",variant:"success"}),je={state:U,subscribe(e){return j(U,()=>e(U))},openToast(e,t){U.open=!0,U.message=e,U.variant=t},closeToast(){U.open=!1}};typeof window<"u"&&(window.Buffer||(window.Buffer=ce.Buffer),window.global||(window.global=window),window.process||(window.process={env:{}}),window.global||(window.global=window));class Ce{constructor(t){this.openModal=q.open,this.closeModal=q.close,this.subscribeModal=q.subscribe,this.setTheme=ne.setThemeConfig,ne.setThemeConfig(t),N.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await le(()=>import("./index-371e0848.js"),["./index-371e0848.js","./index-6a2af3e6.js","./index-f4824932.css","./index-cc134824.js"],import.meta.url);const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),v.setIsUiLoaded(!0)}}}const Pe=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ce},Symbol.toStringTag,{value:"Module"}));export{we as $,N as C,Ue as G,re as N,q as Q,ne as X,je as Y,Pe as a,v as c,p as i}; diff --git a/assets/index.es-97978cd1.js b/assets/index.es-044e61fa.js similarity index 99% rename from assets/index.es-97978cd1.js rename to assets/index.es-044e61fa.js index 07ebbef0..6bde7f9a 100644 --- a/assets/index.es-97978cd1.js +++ b/assets/index.es-044e61fa.js @@ -1,4 +1,4 @@ -import{g as im,d as ds,e as ne,f as sm,w as Dl,h as Fl,j as yc,k as fo,l as nm,c as Mr,a as Ll,I as _i,A as om,U as am,m as Q,n as cm,o as oc,p as um,q as hm,P as lm,V as Ah,s as fm,D as pm,C as dm,Z as Ch,$ as gm,u as ym,v as co,x as vm,y as $l,z as Lr,B as mm,E as wm,X as hs,F as Ft,G as tr,H as wi,J as ur,K as _m,L as ls,M as Ml,N as bm,O as Em,Q as Im,R as jl,S as xm,T as zl,Y as Ul,W as fs,a0 as ac,a1 as io,a2 as ps,a3 as Sm,a4 as so,a5 as Pm,a6 as Am,a7 as Cm,a8 as Om,a9 as Rm,aa as Ha,ab as Oh,ac as Tm,ad as Nm,ae as Dm,af as Rh,ag as Fm,ah as Lm,ai as $m,aj as Mm,ak as jm,al as zm,am as Um,an as no,ao as ql,ap as ka,aq as qm,ar as Bm}from"./index-cfc0b18f.js";import{e as Cr,N as vc}from"./events-16b8e254.js";const Hm=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,km=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Km=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Vm(c,r){if(c==="__proto__"||c==="constructor"&&r&&typeof r=="object"&&"prototype"in r){Gm(c);return}return r}function Gm(c){console.warn(`[destr] Dropping "${c}" key to prevent prototype pollution.`)}function Zn(c,r={}){if(typeof c!="string")return c;const i=c.trim();if(c[0]==='"'&&c.at(-1)==='"'&&!c.includes("\\"))return i.slice(1,-1);if(i.length<=9){const n=i.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Km.test(c)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return c}try{if(Hm.test(c)||km.test(c)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(c,Vm)}return JSON.parse(c)}catch(n){if(r.strict)throw n;return c}}function Wm(c){return!c||typeof c.then!="function"?Promise.resolve(c):c}function qt(c,...r){try{return Wm(c(...r))}catch(i){return Promise.reject(i)}}function Jm(c){const r=typeof c;return c===null||r!=="object"&&r!=="function"}function Ym(c){const r=Object.getPrototypeOf(c);return!r||r.isPrototypeOf(Object)}function oo(c){if(Jm(c))return String(c);if(Ym(c)||Array.isArray(c))return JSON.stringify(c);if(typeof c.toJSON=="function")return oo(c.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Bl(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const cc="base64:";function Xm(c){if(typeof c=="string")return c;Bl();const r=Buffer.from(c).toString("base64");return cc+r}function Zm(c){return typeof c!="string"||!c.startsWith(cc)?c:(Bl(),Buffer.from(c.slice(cc.length),"base64"))}function cr(c){return c?c.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function Qm(...c){return cr(c.join(":"))}function Qn(c){return c=cr(c),c?c+":":""}const e1="memory",t1=()=>{const c=new Map;return{name:e1,options:{},hasItem(r){return c.has(r)},getItem(r){return c.get(r)??null},getItemRaw(r){return c.get(r)??null},setItem(r,i){c.set(r,i)},setItemRaw(r,i){c.set(r,i)},removeItem(r){c.delete(r)},getKeys(){return Array.from(c.keys())},clear(){c.clear()},dispose(){c.clear()}}};function r1(c={}){const r={mounts:{"":c.driver||t1()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},i=m=>{for(const S of r.mountpoints)if(m.startsWith(S))return{base:S,relativeKey:m.slice(S.length),driver:r.mounts[S]};return{base:"",relativeKey:m,driver:r.mounts[""]}},n=(m,S)=>r.mountpoints.filter(O=>O.startsWith(m)||S&&m.startsWith(O)).map(O=>({relativeBase:m.length>O.length?m.slice(O.length):void 0,mountpoint:O,driver:r.mounts[O]})),o=(m,S)=>{if(r.watching){S=cr(S);for(const O of r.watchListeners)O(m,S)}},l=async()=>{if(!r.watching){r.watching=!0;for(const m in r.mounts)r.unwatch[m]=await Th(r.mounts[m],o,m)}},d=async()=>{if(r.watching){for(const m in r.unwatch)await r.unwatch[m]();r.unwatch={},r.watching=!1}},v=(m,S,O)=>{const F=new Map,z=R=>{let K=F.get(R.base);return K||(K={driver:R.driver,base:R.base,items:[]},F.set(R.base,K)),K};for(const R of m){const K=typeof R=="string",re=cr(K?R:R.key),he=K?void 0:R.value,le=K||!R.options?S:{...S,...R.options},fe=i(re);z(fe).items.push({key:re,value:he,relativeKey:fe.relativeKey,options:le})}return Promise.all([...F.values()].map(R=>O(R))).then(R=>R.flat())},b={hasItem(m,S={}){m=cr(m);const{relativeKey:O,driver:F}=i(m);return qt(F.hasItem,O,S)},getItem(m,S={}){m=cr(m);const{relativeKey:O,driver:F}=i(m);return qt(F.getItem,O,S).then(z=>Zn(z))},getItems(m,S){return v(m,S,O=>O.driver.getItems?qt(O.driver.getItems,O.items.map(F=>({key:F.relativeKey,options:F.options})),S).then(F=>F.map(z=>({key:Qm(O.base,z.key),value:Zn(z.value)}))):Promise.all(O.items.map(F=>qt(O.driver.getItem,F.relativeKey,F.options).then(z=>({key:F.key,value:Zn(z)})))))},getItemRaw(m,S={}){m=cr(m);const{relativeKey:O,driver:F}=i(m);return F.getItemRaw?qt(F.getItemRaw,O,S):qt(F.getItem,O,S).then(z=>Zm(z))},async setItem(m,S,O={}){if(S===void 0)return b.removeItem(m);m=cr(m);const{relativeKey:F,driver:z}=i(m);z.setItem&&(await qt(z.setItem,F,oo(S),O),z.watch||o("update",m))},async setItems(m,S){await v(m,S,async O=>{O.driver.setItems&&await qt(O.driver.setItems,O.items.map(F=>({key:F.relativeKey,value:oo(F.value),options:F.options})),S),O.driver.setItem&&await Promise.all(O.items.map(F=>qt(O.driver.setItem,F.relativeKey,oo(F.value),F.options)))})},async setItemRaw(m,S,O={}){if(S===void 0)return b.removeItem(m,O);m=cr(m);const{relativeKey:F,driver:z}=i(m);if(z.setItemRaw)await qt(z.setItemRaw,F,S,O);else if(z.setItem)await qt(z.setItem,F,Xm(S),O);else return;z.watch||o("update",m)},async removeItem(m,S={}){typeof S=="boolean"&&(S={removeMeta:S}),m=cr(m);const{relativeKey:O,driver:F}=i(m);F.removeItem&&(await qt(F.removeItem,O,S),(S.removeMeta||S.removeMata)&&await qt(F.removeItem,O+"$",S),F.watch||o("remove",m))},async getMeta(m,S={}){typeof S=="boolean"&&(S={nativeOnly:S}),m=cr(m);const{relativeKey:O,driver:F}=i(m),z=Object.create(null);if(F.getMeta&&Object.assign(z,await qt(F.getMeta,O,S)),!S.nativeOnly){const R=await qt(F.getItem,O+"$",S).then(K=>Zn(K));R&&typeof R=="object"&&(typeof R.atime=="string"&&(R.atime=new Date(R.atime)),typeof R.mtime=="string"&&(R.mtime=new Date(R.mtime)),Object.assign(z,R))}return z},setMeta(m,S,O={}){return this.setItem(m+"$",S,O)},removeMeta(m,S={}){return this.removeItem(m+"$",S)},async getKeys(m,S={}){m=Qn(m);const O=n(m,!0);let F=[];const z=[];for(const R of O){const re=(await qt(R.driver.getKeys,R.relativeBase,S)).map(he=>R.mountpoint+cr(he)).filter(he=>!F.some(le=>he.startsWith(le)));z.push(...re),F=[R.mountpoint,...F.filter(he=>!he.startsWith(R.mountpoint))]}return m?z.filter(R=>R.startsWith(m)&&!R.endsWith("$")):z.filter(R=>!R.endsWith("$"))},async clear(m,S={}){m=Qn(m),await Promise.all(n(m,!1).map(async O=>{if(O.driver.clear)return qt(O.driver.clear,O.relativeBase,S);if(O.driver.removeItem){const F=await O.driver.getKeys(O.relativeBase||"",S);return Promise.all(F.map(z=>O.driver.removeItem(z,S)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(m=>Nh(m)))},async watch(m){return await l(),r.watchListeners.push(m),async()=>{r.watchListeners=r.watchListeners.filter(S=>S!==m),r.watchListeners.length===0&&await d()}},async unwatch(){r.watchListeners=[],await d()},mount(m,S){if(m=Qn(m),m&&r.mounts[m])throw new Error(`already mounted at ${m}`);return m&&(r.mountpoints.push(m),r.mountpoints.sort((O,F)=>F.length-O.length)),r.mounts[m]=S,r.watching&&Promise.resolve(Th(S,o,m)).then(O=>{r.unwatch[m]=O}).catch(console.error),b},async unmount(m,S=!0){m=Qn(m),!(!m||!r.mounts[m])&&(r.watching&&m in r.unwatch&&(r.unwatch[m](),delete r.unwatch[m]),S&&await Nh(r.mounts[m]),r.mountpoints=r.mountpoints.filter(O=>O!==m),delete r.mounts[m])},getMount(m=""){m=cr(m)+":";const S=i(m);return{driver:S.driver,base:S.base}},getMounts(m="",S={}){return m=cr(m),n(m,S.parents).map(F=>({driver:F.driver,base:F.mountpoint}))}};return b}function Th(c,r,i){return c.watch?c.watch((n,o)=>r(n,i+o)):()=>{}}async function Nh(c){typeof c.dispose=="function"&&await qt(c.dispose)}function qi(c){return new Promise((r,i)=>{c.oncomplete=c.onsuccess=()=>r(c.result),c.onabort=c.onerror=()=>i(c.error)})}function Hl(c,r){const i=indexedDB.open(c);i.onupgradeneeded=()=>i.result.createObjectStore(r);const n=qi(i);return(o,l)=>n.then(d=>l(d.transaction(r,o).objectStore(r)))}let Ka;function ks(){return Ka||(Ka=Hl("keyval-store","keyval")),Ka}function Dh(c,r=ks()){return r("readonly",i=>qi(i.get(c)))}function i1(c,r,i=ks()){return i("readwrite",n=>(n.put(r,c),qi(n.transaction)))}function s1(c,r=ks()){return r("readwrite",i=>(i.delete(c),qi(i.transaction)))}function n1(c=ks()){return c("readwrite",r=>(r.clear(),qi(r.transaction)))}function o1(c,r){return c.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},qi(c.transaction)}function a1(c=ks()){return c("readonly",r=>{if(r.getAllKeys)return qi(r.getAllKeys());const i=[];return o1(r,n=>i.push(n.key)).then(()=>i)})}const c1=c=>JSON.stringify(c,(r,i)=>typeof i=="bigint"?i.toString()+"n":i),u1=c=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,i=c.replace(r,'$1"$2n"$3');return JSON.parse(i,(n,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Ks(c){if(typeof c!="string")throw new Error(`Cannot safe json parse value of type ${typeof c}`);try{return u1(c)}catch{return c}}function Ui(c){return typeof c=="string"?c:c1(c)||""}const h1="idb-keyval";var l1=(c={})=>{const r=c.base&&c.base.length>0?`${c.base}:`:"",i=o=>r+o;let n;return c.dbName&&c.storeName&&(n=Hl(c.dbName,c.storeName)),{name:h1,options:c,async hasItem(o){return!(typeof await Dh(i(o),n)>"u")},async getItem(o){return await Dh(i(o),n)??null},setItem(o,l){return i1(i(o),l,n)},removeItem(o){return s1(i(o),n)},getKeys(){return a1(n)},clear(){return n1(n)}}};const f1="WALLET_CONNECT_V2_INDEXED_DB",p1="keyvaluestorage";let d1=class{constructor(){this.indexedDb=r1({driver:l1({dbName:f1,storeName:p1})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const i=await this.indexedDb.getItem(r);if(i!==null)return i}async setItem(r,i){await this.indexedDb.setItem(r,Ui(i))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Va=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ao={exports:{}};(function(){let c;function r(){}c=r,c.prototype.getItem=function(i){return this.hasOwnProperty(i)?String(this[i]):null},c.prototype.setItem=function(i,n){this[i]=String(n)},c.prototype.removeItem=function(i){delete this[i]},c.prototype.clear=function(){const i=this;Object.keys(i).forEach(function(n){i[n]=void 0,delete i[n]})},c.prototype.key=function(i){return i=i||0,Object.keys(this)[i]},c.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Va<"u"&&Va.localStorage?ao.exports=Va.localStorage:typeof window<"u"&&window.localStorage?ao.exports=window.localStorage:ao.exports=new r})();function g1(c){var r;return[c[0],Ks((r=c[1])!=null?r:"")]}let y1=class{constructor(){this.localStorage=ao.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(g1)}async getItem(r){const i=this.localStorage.getItem(r);if(i!==null)return Ks(i)}async setItem(r,i){this.localStorage.setItem(r,Ui(i))}async removeItem(r){this.localStorage.removeItem(r)}};const v1="wc_storage_version",Fh=1,m1=async(c,r,i)=>{const n=v1,o=await r.getItem(n);if(o&&o>=Fh){i(r);return}const l=await c.getKeys();if(!l.length){i(r);return}const d=[];for(;l.length;){const v=l.shift();if(!v)continue;const b=v.toLowerCase();if(b.includes("wc@")||b.includes("walletconnect")||b.includes("wc_")||b.includes("wallet_connect")){const m=await c.getItem(v);await r.setItem(v,m),d.push(v)}}await r.setItem(n,Fh),i(r),w1(c,d)},w1=async(c,r)=>{r.length&&r.forEach(async i=>{await c.removeItem(i)})};let _1=class{constructor(){this.initialized=!1,this.setInitialized=i=>{this.storage=i,this.initialized=!0};const r=new y1;this.storage=r;try{const i=new d1;m1(r,i,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,i){return await this.initialize(),this.storage.setItem(r,i)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const i=setInterval(()=>{this.initialized&&(clearInterval(i),r())},20)})}};var gs={},Ls={},Ga={},$s={};let Bi=class{};const b1=Object.freeze(Object.defineProperty({__proto__:null,IEvents:Bi},Symbol.toStringTag,{value:"Module"})),E1=im(b1);var Lh;function I1(){if(Lh)return $s;Lh=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.IHeartBeat=void 0;const c=E1;class r extends c.IEvents{constructor(n){super()}}return $s.IHeartBeat=r,$s}var $h;function kl(){return $h||($h=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),ds.__exportStar(I1(),c)}(Ga)),Ga}var Wa={},ji={},Mh;function x1(){if(Mh)return ji;Mh=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.HEARTBEAT_EVENTS=ji.HEARTBEAT_INTERVAL=void 0;const c=ne;return ji.HEARTBEAT_INTERVAL=c.FIVE_SECONDS,ji.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},ji}var jh;function Kl(){return jh||(jh=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),ds.__exportStar(x1(),c)}(Wa)),Wa}var zh;function S1(){if(zh)return Ls;zh=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.HeartBeat=void 0;const c=ds,r=Cr,i=ne,n=kl(),o=Kl();class l extends n.IHeartBeat{constructor(v){super(v),this.events=new r.EventEmitter,this.interval=o.HEARTBEAT_INTERVAL,this.interval=(v==null?void 0:v.interval)||o.HEARTBEAT_INTERVAL}static init(v){return c.__awaiter(this,void 0,void 0,function*(){const b=new l(v);return yield b.init(),b})}init(){return c.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(v,b){this.events.on(v,b)}once(v,b){this.events.once(v,b)}off(v,b){this.events.off(v,b)}removeListener(v,b){this.events.removeListener(v,b)}initialize(){return c.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),i.toMiliseconds(this.interval))})}pulse(){this.events.emit(o.HEARTBEAT_EVENTS.pulse)}}return Ls.HeartBeat=l,Ls}(function(c){Object.defineProperty(c,"__esModule",{value:!0});const r=ds;r.__exportStar(S1(),c),r.__exportStar(kl(),c),r.__exportStar(Kl(),c)})(gs);var Re={},Ja,Uh;function P1(){if(Uh)return Ja;Uh=1;function c(i){try{return JSON.stringify(i)}catch{return'"[Circular]"'}}Ja=r;function r(i,n,o){var l=o&&o.stringify||c,d=1;if(typeof i=="object"&&i!==null){var v=n.length+d;if(v===1)return i;var b=new Array(v);b[0]=l(i);for(var m=1;m-1?z:0,i.charCodeAt(K+1)){case 100:case 102:if(F>=S||n[F]==null)break;z=S||n[F]==null)break;z=S||n[F]===void 0)break;z",z=K+2,K++;break}O+=l(n[F]),z=K+2,K++;break;case 115:if(F>=S)break;z-1&&(ue=!1);const Te=["error","fatal","warn","info","debug","trace"];typeof W=="function"&&(W.error=W.fatal=W.warn=W.info=W.debug=W.trace=W),L.enabled===!1&&(L.level="silent");const Ue=L.level||"info",y=Object.create(W);y.log||(y.log=re),Object.defineProperty(y,"levelVal",{get:X}),Object.defineProperty(y,"level",{get:ce,set:V});const I={transmit:q,serialize:ie,asObject:L.browser.asObject,levels:Te,timestamp:z(L)};y.levels=o.levels,y.level=Ue,y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=re,y.serializers=ve,y._serialize=ie,y._stdErrSerialize=ue,y.child=B,q&&(y._logEvent=O());function X(){return this.level==="silent"?1/0:this.levels.values[this.level]}function ce(){return this._level}function V(k){if(k!=="silent"&&!this.levels.values[k])throw Error("unknown level "+k);this._level=k,l(I,y,"error","log"),l(I,y,"fatal","error"),l(I,y,"warn","error"),l(I,y,"info","log"),l(I,y,"debug","log"),l(I,y,"trace","log")}function B(k,G){if(!k)throw new Error("missing bindings for child Pino");G=G||{},ie&&k.serializers&&(G.serializers=k.serializers);const Je=G.serializers;if(ie&&Je){var He=Object.assign({},ve,Je),jr=L.browser.serialize===!0?Object.keys(He):ie;delete k.serializers,b([k],jr,He,this._stdErrSerialize)}function Ie(xt){this._childLevel=(xt._childLevel|0)+1,this.error=m(xt,k,"error"),this.fatal=m(xt,k,"fatal"),this.warn=m(xt,k,"warn"),this.info=m(xt,k,"info"),this.debug=m(xt,k,"debug"),this.trace=m(xt,k,"trace"),He&&(this.serializers=He,this._serialize=jr),q&&(this._logEvent=O([].concat(xt._logEvent.bindings,k)))}return Ie.prototype=this,new Ie(this)}return y}o.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},o.stdSerializers=i,o.stdTimeFunctions=Object.assign({},{nullTime:he,epochTime:le,unixTime:fe,isoTime:pe});function l(L,q,W,ve){const ie=Object.getPrototypeOf(q);q[W]=q.levelVal>q.levels.values[W]?re:ie[W]?ie[W]:r[W]||r[ve]||re,d(L,q,W)}function d(L,q,W){!L.transmit&&q[W]===re||(q[W]=function(ve){return function(){const ue=L.timestamp(),Te=new Array(arguments.length),Ue=Object.getPrototypeOf&&Object.getPrototypeOf(this)===r?r:this;for(var y=0;y-1&&ue in W&&(L[ie][ue]=W[ue](L[ie][ue]))}function m(L,q,W){return function(){const ve=new Array(1+arguments.length);ve[0]=q;for(var ie=1;ie"u"?m=i(v,b):m=v.bindings().context||"",m}er.getLoggerContext=o;function l(v,b,m=c.PINO_CUSTOM_CONTEXT_KEY){const S=o(v,m);return S.trim()?`${S}/${b}`:b}er.formatChildLoggerContext=l;function d(v,b,m=c.PINO_CUSTOM_CONTEXT_KEY){const S=l(v,b,m),O=v.child({context:S});return n(O,S,m)}return er.generateChildLogger=d,er}(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.pino=void 0;const r=ds,i=r.__importDefault(A1());Object.defineProperty(c,"pino",{enumerable:!0,get:function(){return i.default}}),r.__exportStar(Vl(),c),r.__exportStar(C1(),c)})(Re);class O1 extends Bi{constructor(r){super(),this.opts=r,this.protocol="wc",this.version=2}}class R1 extends Bi{constructor(r,i){super(),this.core=r,this.logger=i,this.records=new Map}}class T1{constructor(r,i){this.logger=r,this.core=i}}let N1=class extends Bi{constructor(r,i){super(),this.relayer=r,this.logger=i}},D1=class extends Bi{constructor(r){super()}},F1=class{constructor(r,i,n,o){this.core=r,this.logger=i,this.name=n}};class L1 extends Bi{constructor(r,i){super(),this.relayer=r,this.logger=i}}let $1=class extends Bi{constructor(r,i){super(),this.core=r,this.logger=i}},M1=class{constructor(r,i){this.projectId=r,this.logger=i}},j1=class{constructor(r){this.opts=r,this.protocol="wc",this.version=2}},z1=class{constructor(r){this.client=r}};var mc={},Gl={};(function(c){Object.defineProperty(c,"__esModule",{value:!0});var r=sm,i=Dl;c.DIGEST_LENGTH=64,c.BLOCK_SIZE=128;var n=function(){function v(){this.digestLength=c.DIGEST_LENGTH,this.blockSize=c.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return v.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},v.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},v.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},v.prototype.update=function(b,m){if(m===void 0&&(m=b.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var S=0;if(this._bytesHashed+=m,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=b[S++],m--;this._bufferLength===this.blockSize&&(l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(m>=this.blockSize&&(S=l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,b,S,m),m%=this.blockSize);m>0;)this._buffer[this._bufferLength++]=b[S++],m--;return this},v.prototype.finish=function(b){if(!this._finished){var m=this._bytesHashed,S=this._bufferLength,O=m/536870912|0,F=m<<3,z=m%128<112?128:256;this._buffer[S]=128;for(var R=S+1;R0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},v.prototype.restoreState=function(b){return this._stateHi.set(b.stateHi),this._stateLo.set(b.stateLo),this._bufferLength=b.bufferLength,b.buffer&&this._buffer.set(b.buffer),this._bytesHashed=b.bytesHashed,this._finished=!1,this},v.prototype.cleanSavedState=function(b){i.wipe(b.stateHi),i.wipe(b.stateLo),b.buffer&&i.wipe(b.buffer),b.bufferLength=0,b.bytesHashed=0},v}();c.SHA512=n;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function l(v,b,m,S,O,F,z){for(var R=m[0],K=m[1],re=m[2],he=m[3],le=m[4],fe=m[5],pe=m[6],de=m[7],L=S[0],q=S[1],W=S[2],ve=S[3],ie=S[4],ue=S[5],Te=S[6],Ue=S[7],y,I,X,ce,V,B,k,G;z>=128;){for(var Je=0;Je<16;Je++){var He=8*Je+F;v[Je]=r.readUint32BE(O,He),b[Je]=r.readUint32BE(O,He+4)}for(var Je=0;Je<80;Je++){var jr=R,Ie=K,xt=re,D=he,N=le,C=fe,u=pe,E=de,ee=L,ge=q,be=W,Ne=ve,Fe=ie,Pe=ue,St=Te,mt=Ue;if(y=de,I=Ue,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=(le>>>14|ie<<32-14)^(le>>>18|ie<<32-18)^(ie>>>41-32|le<<32-(41-32)),I=(ie>>>14|le<<32-14)^(ie>>>18|le<<32-18)^(le>>>41-32|ie<<32-(41-32)),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=le&fe^~le&pe,I=ie&ue^~ie&Te,V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=o[Je*2],I=o[Je*2+1],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=v[Je%16],I=b[Je%16],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,X=k&65535|G<<16,ce=V&65535|B<<16,y=X,I=ce,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=(R>>>28|L<<32-28)^(L>>>34-32|R<<32-(34-32))^(L>>>39-32|R<<32-(39-32)),I=(L>>>28|R<<32-28)^(R>>>34-32|L<<32-(34-32))^(R>>>39-32|L<<32-(39-32)),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=R&K^R&re^K&re,I=L&q^L&W^q&W,V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,E=k&65535|G<<16,mt=V&65535|B<<16,y=D,I=Ne,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=X,I=ce,V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,D=k&65535|G<<16,Ne=V&65535|B<<16,K=jr,re=Ie,he=xt,le=D,fe=N,pe=C,de=u,R=E,q=ee,W=ge,ve=be,ie=Ne,ue=Fe,Te=Pe,Ue=St,L=mt,Je%16===15)for(var He=0;He<16;He++)y=v[He],I=b[He],V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=v[(He+9)%16],I=b[(He+9)%16],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,X=v[(He+1)%16],ce=b[(He+1)%16],y=(X>>>1|ce<<32-1)^(X>>>8|ce<<32-8)^X>>>7,I=(ce>>>1|X<<32-1)^(ce>>>8|X<<32-8)^(ce>>>7|X<<32-7),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,X=v[(He+14)%16],ce=b[(He+14)%16],y=(X>>>19|ce<<32-19)^(ce>>>61-32|X<<32-(61-32))^X>>>6,I=(ce>>>19|X<<32-19)^(X>>>61-32|ce<<32-(61-32))^(ce>>>6|X<<32-6),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,v[He]=k&65535|G<<16,b[He]=V&65535|B<<16}y=R,I=L,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[0],I=S[0],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[0]=R=k&65535|G<<16,S[0]=L=V&65535|B<<16,y=K,I=q,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[1],I=S[1],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[1]=K=k&65535|G<<16,S[1]=q=V&65535|B<<16,y=re,I=W,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[2],I=S[2],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[2]=re=k&65535|G<<16,S[2]=W=V&65535|B<<16,y=he,I=ve,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[3],I=S[3],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[3]=he=k&65535|G<<16,S[3]=ve=V&65535|B<<16,y=le,I=ie,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[4],I=S[4],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[4]=le=k&65535|G<<16,S[4]=ie=V&65535|B<<16,y=fe,I=ue,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[5],I=S[5],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[5]=fe=k&65535|G<<16,S[5]=ue=V&65535|B<<16,y=pe,I=Te,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[6],I=S[6],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[6]=pe=k&65535|G<<16,S[6]=Te=V&65535|B<<16,y=de,I=Ue,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[7],I=S[7],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[7]=de=k&65535|G<<16,S[7]=Ue=V&65535|B<<16,F+=128,z-=128}return F}function d(v){var b=new n;b.update(v);var m=b.digest();return b.clean(),m}c.hash=d})(Gl);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.convertSecretKeyToX25519=c.convertPublicKeyToX25519=c.verify=c.sign=c.extractPublicKeyFromSecretKey=c.generateKeyPair=c.generateKeyPairFromSeed=c.SEED_LENGTH=c.SECRET_KEY_LENGTH=c.PUBLIC_KEY_LENGTH=c.SIGNATURE_LENGTH=void 0;const r=Fl,i=Gl,n=Dl;c.SIGNATURE_LENGTH=64,c.PUBLIC_KEY_LENGTH=32,c.SECRET_KEY_LENGTH=64,c.SEED_LENGTH=32;function o(D){const N=new Float64Array(16);if(D)for(let C=0;C>16&1),C[ge-1]&=65535;C[15]=u[15]-32767-(C[14]>>16&1);const ee=C[15]>>16&1;C[14]&=65535,K(u,C,1-ee)}for(let E=0;E<16;E++)D[2*E]=u[E]&255,D[2*E+1]=u[E]>>8}function he(D,N){let C=0;for(let u=0;u<32;u++)C|=D[u]^N[u];return(1&C-1>>>8)-1}function le(D,N){const C=new Uint8Array(32),u=new Uint8Array(32);return re(C,D),re(u,N),he(C,u)}function fe(D){const N=new Uint8Array(32);return re(N,D),N[0]&1}function pe(D,N){for(let C=0;C<16;C++)D[C]=N[2*C]+(N[2*C+1]<<8);D[15]&=32767}function de(D,N,C){for(let u=0;u<16;u++)D[u]=N[u]+C[u]}function L(D,N,C){for(let u=0;u<16;u++)D[u]=N[u]-C[u]}function q(D,N,C){let u,E,ee=0,ge=0,be=0,Ne=0,Fe=0,Pe=0,St=0,mt=0,nt=0,$e=0,Xe=0,Ze=0,ot=0,qe=0,Qe=0,De=0,ke=0,ut=0,je=0,Pt=0,Lt=0,Bt=0,Ht=0,jt=0,Wt=0,rr=0,zr=0,Jt=0,Gr=0,ci=0,xi=0,ht=C[0],rt=C[1],lt=C[2],ft=C[3],at=C[4],it=C[5],At=C[6],Ct=C[7],pt=C[8],Ot=C[9],dt=C[10],wt=C[11],gt=C[12],Ye=C[13],Rt=C[14],Tt=C[15];u=N[0],ee+=u*ht,ge+=u*rt,be+=u*lt,Ne+=u*ft,Fe+=u*at,Pe+=u*it,St+=u*At,mt+=u*Ct,nt+=u*pt,$e+=u*Ot,Xe+=u*dt,Ze+=u*wt,ot+=u*gt,qe+=u*Ye,Qe+=u*Rt,De+=u*Tt,u=N[1],ge+=u*ht,be+=u*rt,Ne+=u*lt,Fe+=u*ft,Pe+=u*at,St+=u*it,mt+=u*At,nt+=u*Ct,$e+=u*pt,Xe+=u*Ot,Ze+=u*dt,ot+=u*wt,qe+=u*gt,Qe+=u*Ye,De+=u*Rt,ke+=u*Tt,u=N[2],be+=u*ht,Ne+=u*rt,Fe+=u*lt,Pe+=u*ft,St+=u*at,mt+=u*it,nt+=u*At,$e+=u*Ct,Xe+=u*pt,Ze+=u*Ot,ot+=u*dt,qe+=u*wt,Qe+=u*gt,De+=u*Ye,ke+=u*Rt,ut+=u*Tt,u=N[3],Ne+=u*ht,Fe+=u*rt,Pe+=u*lt,St+=u*ft,mt+=u*at,nt+=u*it,$e+=u*At,Xe+=u*Ct,Ze+=u*pt,ot+=u*Ot,qe+=u*dt,Qe+=u*wt,De+=u*gt,ke+=u*Ye,ut+=u*Rt,je+=u*Tt,u=N[4],Fe+=u*ht,Pe+=u*rt,St+=u*lt,mt+=u*ft,nt+=u*at,$e+=u*it,Xe+=u*At,Ze+=u*Ct,ot+=u*pt,qe+=u*Ot,Qe+=u*dt,De+=u*wt,ke+=u*gt,ut+=u*Ye,je+=u*Rt,Pt+=u*Tt,u=N[5],Pe+=u*ht,St+=u*rt,mt+=u*lt,nt+=u*ft,$e+=u*at,Xe+=u*it,Ze+=u*At,ot+=u*Ct,qe+=u*pt,Qe+=u*Ot,De+=u*dt,ke+=u*wt,ut+=u*gt,je+=u*Ye,Pt+=u*Rt,Lt+=u*Tt,u=N[6],St+=u*ht,mt+=u*rt,nt+=u*lt,$e+=u*ft,Xe+=u*at,Ze+=u*it,ot+=u*At,qe+=u*Ct,Qe+=u*pt,De+=u*Ot,ke+=u*dt,ut+=u*wt,je+=u*gt,Pt+=u*Ye,Lt+=u*Rt,Bt+=u*Tt,u=N[7],mt+=u*ht,nt+=u*rt,$e+=u*lt,Xe+=u*ft,Ze+=u*at,ot+=u*it,qe+=u*At,Qe+=u*Ct,De+=u*pt,ke+=u*Ot,ut+=u*dt,je+=u*wt,Pt+=u*gt,Lt+=u*Ye,Bt+=u*Rt,Ht+=u*Tt,u=N[8],nt+=u*ht,$e+=u*rt,Xe+=u*lt,Ze+=u*ft,ot+=u*at,qe+=u*it,Qe+=u*At,De+=u*Ct,ke+=u*pt,ut+=u*Ot,je+=u*dt,Pt+=u*wt,Lt+=u*gt,Bt+=u*Ye,Ht+=u*Rt,jt+=u*Tt,u=N[9],$e+=u*ht,Xe+=u*rt,Ze+=u*lt,ot+=u*ft,qe+=u*at,Qe+=u*it,De+=u*At,ke+=u*Ct,ut+=u*pt,je+=u*Ot,Pt+=u*dt,Lt+=u*wt,Bt+=u*gt,Ht+=u*Ye,jt+=u*Rt,Wt+=u*Tt,u=N[10],Xe+=u*ht,Ze+=u*rt,ot+=u*lt,qe+=u*ft,Qe+=u*at,De+=u*it,ke+=u*At,ut+=u*Ct,je+=u*pt,Pt+=u*Ot,Lt+=u*dt,Bt+=u*wt,Ht+=u*gt,jt+=u*Ye,Wt+=u*Rt,rr+=u*Tt,u=N[11],Ze+=u*ht,ot+=u*rt,qe+=u*lt,Qe+=u*ft,De+=u*at,ke+=u*it,ut+=u*At,je+=u*Ct,Pt+=u*pt,Lt+=u*Ot,Bt+=u*dt,Ht+=u*wt,jt+=u*gt,Wt+=u*Ye,rr+=u*Rt,zr+=u*Tt,u=N[12],ot+=u*ht,qe+=u*rt,Qe+=u*lt,De+=u*ft,ke+=u*at,ut+=u*it,je+=u*At,Pt+=u*Ct,Lt+=u*pt,Bt+=u*Ot,Ht+=u*dt,jt+=u*wt,Wt+=u*gt,rr+=u*Ye,zr+=u*Rt,Jt+=u*Tt,u=N[13],qe+=u*ht,Qe+=u*rt,De+=u*lt,ke+=u*ft,ut+=u*at,je+=u*it,Pt+=u*At,Lt+=u*Ct,Bt+=u*pt,Ht+=u*Ot,jt+=u*dt,Wt+=u*wt,rr+=u*gt,zr+=u*Ye,Jt+=u*Rt,Gr+=u*Tt,u=N[14],Qe+=u*ht,De+=u*rt,ke+=u*lt,ut+=u*ft,je+=u*at,Pt+=u*it,Lt+=u*At,Bt+=u*Ct,Ht+=u*pt,jt+=u*Ot,Wt+=u*dt,rr+=u*wt,zr+=u*gt,Jt+=u*Ye,Gr+=u*Rt,ci+=u*Tt,u=N[15],De+=u*ht,ke+=u*rt,ut+=u*lt,je+=u*ft,Pt+=u*at,Lt+=u*it,Bt+=u*At,Ht+=u*Ct,jt+=u*pt,Wt+=u*Ot,rr+=u*dt,zr+=u*wt,Jt+=u*gt,Gr+=u*Ye,ci+=u*Rt,xi+=u*Tt,ee+=38*ke,ge+=38*ut,be+=38*je,Ne+=38*Pt,Fe+=38*Lt,Pe+=38*Bt,St+=38*Ht,mt+=38*jt,nt+=38*Wt,$e+=38*rr,Xe+=38*zr,Ze+=38*Jt,ot+=38*Gr,qe+=38*ci,Qe+=38*xi,E=1,u=ee+E+65535,E=Math.floor(u/65536),ee=u-E*65536,u=ge+E+65535,E=Math.floor(u/65536),ge=u-E*65536,u=be+E+65535,E=Math.floor(u/65536),be=u-E*65536,u=Ne+E+65535,E=Math.floor(u/65536),Ne=u-E*65536,u=Fe+E+65535,E=Math.floor(u/65536),Fe=u-E*65536,u=Pe+E+65535,E=Math.floor(u/65536),Pe=u-E*65536,u=St+E+65535,E=Math.floor(u/65536),St=u-E*65536,u=mt+E+65535,E=Math.floor(u/65536),mt=u-E*65536,u=nt+E+65535,E=Math.floor(u/65536),nt=u-E*65536,u=$e+E+65535,E=Math.floor(u/65536),$e=u-E*65536,u=Xe+E+65535,E=Math.floor(u/65536),Xe=u-E*65536,u=Ze+E+65535,E=Math.floor(u/65536),Ze=u-E*65536,u=ot+E+65535,E=Math.floor(u/65536),ot=u-E*65536,u=qe+E+65535,E=Math.floor(u/65536),qe=u-E*65536,u=Qe+E+65535,E=Math.floor(u/65536),Qe=u-E*65536,u=De+E+65535,E=Math.floor(u/65536),De=u-E*65536,ee+=E-1+37*(E-1),E=1,u=ee+E+65535,E=Math.floor(u/65536),ee=u-E*65536,u=ge+E+65535,E=Math.floor(u/65536),ge=u-E*65536,u=be+E+65535,E=Math.floor(u/65536),be=u-E*65536,u=Ne+E+65535,E=Math.floor(u/65536),Ne=u-E*65536,u=Fe+E+65535,E=Math.floor(u/65536),Fe=u-E*65536,u=Pe+E+65535,E=Math.floor(u/65536),Pe=u-E*65536,u=St+E+65535,E=Math.floor(u/65536),St=u-E*65536,u=mt+E+65535,E=Math.floor(u/65536),mt=u-E*65536,u=nt+E+65535,E=Math.floor(u/65536),nt=u-E*65536,u=$e+E+65535,E=Math.floor(u/65536),$e=u-E*65536,u=Xe+E+65535,E=Math.floor(u/65536),Xe=u-E*65536,u=Ze+E+65535,E=Math.floor(u/65536),Ze=u-E*65536,u=ot+E+65535,E=Math.floor(u/65536),ot=u-E*65536,u=qe+E+65535,E=Math.floor(u/65536),qe=u-E*65536,u=Qe+E+65535,E=Math.floor(u/65536),Qe=u-E*65536,u=De+E+65535,E=Math.floor(u/65536),De=u-E*65536,ee+=E-1+37*(E-1),D[0]=ee,D[1]=ge,D[2]=be,D[3]=Ne,D[4]=Fe,D[5]=Pe,D[6]=St,D[7]=mt,D[8]=nt,D[9]=$e,D[10]=Xe,D[11]=Ze,D[12]=ot,D[13]=qe,D[14]=Qe,D[15]=De}function W(D,N){q(D,N,N)}function ve(D,N){const C=o();let u;for(u=0;u<16;u++)C[u]=N[u];for(u=253;u>=0;u--)W(C,C),u!==2&&u!==4&&q(C,C,N);for(u=0;u<16;u++)D[u]=C[u]}function ie(D,N){const C=o();let u;for(u=0;u<16;u++)C[u]=N[u];for(u=250;u>=0;u--)W(C,C),u!==1&&q(C,C,N);for(u=0;u<16;u++)D[u]=C[u]}function ue(D,N){const C=o(),u=o(),E=o(),ee=o(),ge=o(),be=o(),Ne=o(),Fe=o(),Pe=o();L(C,D[1],D[0]),L(Pe,N[1],N[0]),q(C,C,Pe),de(u,D[0],D[1]),de(Pe,N[0],N[1]),q(u,u,Pe),q(E,D[3],N[3]),q(E,E,m),q(ee,D[2],N[2]),de(ee,ee,ee),L(ge,u,C),L(be,ee,E),de(Ne,ee,E),de(Fe,u,C),q(D[0],ge,be),q(D[1],Fe,Ne),q(D[2],Ne,be),q(D[3],ge,Fe)}function Te(D,N,C){for(let u=0;u<4;u++)K(D[u],N[u],C)}function Ue(D,N){const C=o(),u=o(),E=o();ve(E,N[2]),q(C,N[0],E),q(u,N[1],E),re(D,u),D[31]^=fe(C)<<7}function y(D,N,C){z(D[0],d),z(D[1],v),z(D[2],v),z(D[3],d);for(let u=255;u>=0;--u){const E=C[u/8|0]>>(u&7)&1;Te(D,N,E),ue(N,D),ue(D,D),Te(D,N,E)}}function I(D,N){const C=[o(),o(),o(),o()];z(C[0],S),z(C[1],O),z(C[2],v),q(C[3],S,O),y(D,C,N)}function X(D){if(D.length!==c.SEED_LENGTH)throw new Error(`ed25519: seed must be ${c.SEED_LENGTH} bytes`);const N=(0,i.hash)(D);N[0]&=248,N[31]&=127,N[31]|=64;const C=new Uint8Array(32),u=[o(),o(),o(),o()];I(u,N),Ue(C,u);const E=new Uint8Array(64);return E.set(D),E.set(C,32),{publicKey:C,secretKey:E}}c.generateKeyPairFromSeed=X;function ce(D){const N=(0,r.randomBytes)(32,D),C=X(N);return(0,n.wipe)(N),C}c.generateKeyPair=ce;function V(D){if(D.length!==c.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${c.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(D.subarray(32))}c.extractPublicKeyFromSecretKey=V;const B=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function k(D,N){let C,u,E,ee;for(u=63;u>=32;--u){for(C=0,E=u-32,ee=u-12;E>4)*B[E],C=N[E]>>8,N[E]&=255;for(E=0;E<32;E++)N[E]-=C*B[E];for(u=0;u<32;u++)N[u+1]+=N[u]>>8,D[u]=N[u]&255}function G(D){const N=new Float64Array(64);for(let C=0;C<64;C++)N[C]=D[C];for(let C=0;C<64;C++)D[C]=0;k(D,N)}function Je(D,N){const C=new Float64Array(64),u=[o(),o(),o(),o()],E=(0,i.hash)(D.subarray(0,32));E[0]&=248,E[31]&=127,E[31]|=64;const ee=new Uint8Array(64);ee.set(E.subarray(32),32);const ge=new i.SHA512;ge.update(ee.subarray(32)),ge.update(N);const be=ge.digest();ge.clean(),G(be),I(u,be),Ue(ee,u),ge.reset(),ge.update(ee.subarray(0,32)),ge.update(D.subarray(32)),ge.update(N);const Ne=ge.digest();G(Ne);for(let Fe=0;Fe<32;Fe++)C[Fe]=be[Fe];for(let Fe=0;Fe<32;Fe++)for(let Pe=0;Pe<32;Pe++)C[Fe+Pe]+=Ne[Fe]*E[Pe];return k(ee.subarray(32),C),ee}c.sign=Je;function He(D,N){const C=o(),u=o(),E=o(),ee=o(),ge=o(),be=o(),Ne=o();return z(D[2],v),pe(D[1],N),W(E,D[1]),q(ee,E,b),L(E,E,D[2]),de(ee,D[2],ee),W(ge,ee),W(be,ge),q(Ne,be,ge),q(C,Ne,E),q(C,C,ee),ie(C,C),q(C,C,E),q(C,C,ee),q(C,C,ee),q(D[0],C,ee),W(u,D[0]),q(u,u,ee),le(u,E)&&q(D[0],D[0],F),W(u,D[0]),q(u,u,ee),le(u,E)?-1:(fe(D[0])===N[31]>>7&&L(D[0],d,D[0]),q(D[3],D[0],D[1]),0)}function jr(D,N,C){const u=new Uint8Array(32),E=[o(),o(),o(),o()],ee=[o(),o(),o(),o()];if(C.length!==c.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${c.SIGNATURE_LENGTH} bytes`);if(He(ee,D))return!1;const ge=new i.SHA512;ge.update(C.subarray(0,32)),ge.update(D),ge.update(N);const be=ge.digest();return G(be),y(E,ee,be),I(ee,C.subarray(32)),ue(E,ee),Ue(u,E),!he(C,u)}c.verify=jr;function Ie(D){let N=[o(),o(),o(),o()];if(He(N,D))throw new Error("Ed25519: invalid public key");let C=o(),u=o(),E=N[1];de(C,v,E),L(u,v,E),ve(u,u),q(C,C,u);let ee=new Uint8Array(32);return re(ee,C),ee}c.convertPublicKeyToX25519=Ie;function xt(D){const N=(0,i.hash)(D.subarray(0,32));N[0]&=248,N[31]&=127,N[31]|=64;const C=new Uint8Array(N.subarray(0,32));return(0,n.wipe)(N),C}c.convertSecretKeyToX25519=xt})(mc);const U1="EdDSA",q1="JWT",Wl=".",Jl="base64url",B1="utf8",H1="utf8",k1=":",K1="did",V1="key",kh="base58btc",G1="z",W1="K36",J1=32;function uo(c){return fo(yc(Ui(c),B1),Jl)}function Yl(c){const r=yc(W1,kh),i=G1+fo(nm([r,c]),kh);return[K1,V1,i].join(k1)}function Y1(c){return fo(c,Jl)}function X1(c){return yc([uo(c.header),uo(c.payload)].join(Wl),H1)}function Z1(c){return[uo(c.header),uo(c.payload),Y1(c.signature)].join(Wl)}function Kh(c=Fl.randomBytes(J1)){return mc.generateKeyPairFromSeed(c)}async function Q1(c,r,i,n,o=ne.fromMiliseconds(Date.now())){const l={alg:U1,typ:q1},d=Yl(n.publicKey),v=o+i,b={iss:d,sub:c,aud:r,iat:o,exp:v},m=X1({header:l,payload:b}),S=mc.sign(n.secretKey,m);return Z1({header:l,payload:b,signature:S})}const ew="PARSE_ERROR",tw="INVALID_REQUEST",rw="METHOD_NOT_FOUND",iw="INVALID_PARAMS",Xl="INTERNAL_ERROR",wc="SERVER_ERROR",sw=[-32700,-32600,-32601,-32602,-32603],Hs={[ew]:{code:-32700,message:"Parse error"},[tw]:{code:-32600,message:"Invalid Request"},[rw]:{code:-32601,message:"Method not found"},[iw]:{code:-32602,message:"Invalid params"},[Xl]:{code:-32603,message:"Internal error"},[wc]:{code:-32e3,message:"Server error"}},Zl=wc;function nw(c){return sw.includes(c)}function Vh(c){return Object.keys(Hs).includes(c)?Hs[c]:Hs[Zl]}function ow(c){const r=Object.values(Hs).find(i=>i.code===c);return r||Hs[Zl]}function Ql(c,r,i){return c.message.includes("getaddrinfo ENOTFOUND")||c.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${i} RPC url at ${r}`):c}var ef={},ni={},Gh;function aw(){if(Gh)return ni;Gh=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.isBrowserCryptoAvailable=ni.getSubtleCrypto=ni.getBrowerCrypto=void 0;function c(){return(Mr===null||Mr===void 0?void 0:Mr.crypto)||(Mr===null||Mr===void 0?void 0:Mr.msCrypto)||{}}ni.getBrowerCrypto=c;function r(){const n=c();return n.subtle||n.webkitSubtle}ni.getSubtleCrypto=r;function i(){return!!c()&&!!r()}return ni.isBrowserCryptoAvailable=i,ni}var oi={},Wh;function cw(){if(Wh)return oi;Wh=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.isBrowser=oi.isNode=oi.isReactNative=void 0;function c(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}oi.isReactNative=c;function r(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}oi.isNode=r;function i(){return!c()&&!r()}return oi.isBrowser=i,oi}(function(c){Object.defineProperty(c,"__esModule",{value:!0});const r=ds;r.__exportStar(aw(),c),r.__exportStar(cw(),c)})(ef);function tf(c=3){const r=Date.now()*Math.pow(10,c),i=Math.floor(Math.random()*Math.pow(10,c));return r+i}function _c(c=6){return BigInt(tf(c))}function po(c,r,i){return{id:i||tf(),jsonrpc:"2.0",method:c,params:r}}function bc(c,r){return{id:c,jsonrpc:"2.0",result:r}}function go(c,r,i){return{id:c,jsonrpc:"2.0",error:uw(r,i)}}function uw(c,r){return typeof c>"u"?Vh(Xl):(typeof c=="string"&&(c=Object.assign(Object.assign({},Vh(wc)),{message:c})),typeof r<"u"&&(c.data=r),nw(c.code)&&(c=ow(c.code)),c)}class hw{}class lw extends hw{constructor(){super()}}class fw extends lw{constructor(r){super()}}const pw="^https?:",dw="^wss?:";function gw(c){const r=c.match(new RegExp(/^\w+:/,"gi"));if(!(!r||!r.length))return r[0]}function rf(c,r){const i=gw(c);return typeof i>"u"?!1:new RegExp(r).test(i)}function Jh(c){return rf(c,pw)}function Yh(c){return rf(c,dw)}function yw(c){return new RegExp("wss?://localhost(:d{2,5})?").test(c)}function sf(c){return typeof c=="object"&&"id"in c&&"jsonrpc"in c&&c.jsonrpc==="2.0"}function Ec(c){return sf(c)&&"method"in c}function yo(c){return sf(c)&&(ai(c)||$r(c))}function ai(c){return"result"in c}function $r(c){return"error"in c}class Ei extends fw{constructor(r){super(r),this.events=new Cr.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(r),this.connection.connected&&this.registerEventListeners()}async connect(r=this.connection){await this.open(r)}async disconnect(){await this.close()}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async request(r,i){return this.requestStrict(po(r.method,r.params||[],r.id||_c().toString()),i)}async requestStrict(r,i){return new Promise(async(n,o)=>{if(!this.connection.connected)try{await this.open()}catch(l){o(l)}this.events.on(`${r.id}`,l=>{$r(l)?o(l.error):n(l.result)});try{await this.connection.send(r,i)}catch(l){o(l)}})}setConnection(r=this.connection){return r}onPayload(r){this.events.emit("payload",r),yo(r)?this.events.emit(`${r.id}`,r):this.events.emit("message",{type:r.method,data:r.params})}onClose(r){r&&r.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${r.code} ${r.reason?`(${r.reason})`:""}`)),this.events.emit("disconnect")}async open(r=this.connection){this.connection===r&&this.connection.connected||(this.connection.connected&&this.close(),typeof r=="string"&&(await this.connection.open(r),r=this.connection),this.connection=this.setConnection(r),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",r=>this.onPayload(r)),this.connection.on("close",r=>this.onClose(r)),this.connection.on("error",r=>this.events.emit("error",r)),this.connection.on("register_error",r=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const vw=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:require("ws"),mw=()=>typeof window<"u",Xh=c=>c.split("?")[0],Zh=10,ww=vw();class _w{constructor(r){if(this.url=r,this.events=new Cr.EventEmitter,this.registering=!1,!Yh(r))throw new Error(`Provided URL is not compatible with WebSocket connection: ${r}`);this.url=r}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async open(r=this.url){await this.register(r)}async close(){return new Promise((r,i)=>{if(typeof this.socket>"u"){i(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),r()},this.socket.close()})}async send(r,i){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ui(r))}catch(n){this.onError(r.id,n)}}register(r=this.url){if(!Yh(r))throw new Error(`Provided URL is not compatible with WebSocket connection: ${r}`);if(this.registering){const i=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=i||this.events.listenerCount("open")>=i)&&this.events.setMaxListeners(i+1),new Promise((n,o)=>{this.events.once("register_error",l=>{this.resetMaxListeners(),o(l)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return o(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=r,this.registering=!0,new Promise((i,n)=>{const o=ef.isReactNative()?void 0:{rejectUnauthorized:!yw(r)},l=new ww(r,[],o);mw()?l.onerror=d=>{const v=d;n(this.emitError(v.error))}:l.on("error",d=>{n(this.emitError(d))}),l.onopen=()=>{this.onOpen(l),i(l)}})}onOpen(r){r.onmessage=i=>this.onPayload(i),r.onclose=i=>this.onClose(i),this.socket=r,this.registering=!1,this.events.emit("open")}onClose(r){this.socket=void 0,this.registering=!1,this.events.emit("close",r)}onPayload(r){if(typeof r.data>"u")return;const i=typeof r.data=="string"?Ks(r.data):r.data;this.events.emit("payload",i)}onError(r,i){const n=this.parseError(i),o=n.message||n.toString(),l=go(r,o);this.events.emit("payload",l)}parseError(r,i=this.url){return Ql(r,Xh(i),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Zh&&this.events.setMaxListeners(Zh)}emitError(r){const i=this.parseError(new Error((r==null?void 0:r.message)||`WebSocket connection failed for host: ${Xh(this.url)}`));return this.events.emit("register_error",i),i}}var ho={exports:{}};ho.exports;(function(c,r){var i=200,n="__lodash_hash_undefined__",o=1,l=2,d=9007199254740991,v="[object Arguments]",b="[object Array]",m="[object AsyncFunction]",S="[object Boolean]",O="[object Date]",F="[object Error]",z="[object Function]",R="[object GeneratorFunction]",K="[object Map]",re="[object Number]",he="[object Null]",le="[object Object]",fe="[object Promise]",pe="[object Proxy]",de="[object RegExp]",L="[object Set]",q="[object String]",W="[object Symbol]",ve="[object Undefined]",ie="[object WeakMap]",ue="[object ArrayBuffer]",Te="[object DataView]",Ue="[object Float32Array]",y="[object Float64Array]",I="[object Int8Array]",X="[object Int16Array]",ce="[object Int32Array]",V="[object Uint8Array]",B="[object Uint8ClampedArray]",k="[object Uint16Array]",G="[object Uint32Array]",Je=/[\\^$.*+?()[\]{}|]/g,He=/^\[object .+?Constructor\]$/,jr=/^(?:0|[1-9]\d*)$/,Ie={};Ie[Ue]=Ie[y]=Ie[I]=Ie[X]=Ie[ce]=Ie[V]=Ie[B]=Ie[k]=Ie[G]=!0,Ie[v]=Ie[b]=Ie[ue]=Ie[S]=Ie[Te]=Ie[O]=Ie[F]=Ie[z]=Ie[K]=Ie[re]=Ie[le]=Ie[de]=Ie[L]=Ie[q]=Ie[ie]=!1;var xt=typeof Mr=="object"&&Mr&&Mr.Object===Object&&Mr,D=typeof self=="object"&&self&&self.Object===Object&&self,N=xt||D||Function("return this")(),C=r&&!r.nodeType&&r,u=C&&!0&&c&&!c.nodeType&&c,E=u&&u.exports===C,ee=E&&xt.process,ge=function(){try{return ee&&ee.binding&&ee.binding("util")}catch{}}(),be=ge&&ge.isTypedArray;function Ne(g,x){for(var U=-1,Y=g==null?0:g.length,Ve=0,me=[];++U-1}function Po(g,x){var U=this.__data__,Y=Si(U,g);return Y<0?(++this.size,U.push([g,x])):U[Y][1]=x,this}yr.prototype.clear=Eo,yr.prototype.delete=Io,yr.prototype.get=xo,yr.prototype.has=So,yr.prototype.set=Po;function Wr(g){var x=-1,U=g==null?0:g.length;for(this.clear();++xNt))return!1;var Ge=me.get(g);if(Ge&&me.get(x))return Ge==x;var _t=-1,ir=!0,Dt=U&l?new Vi:void 0;for(me.set(g,x),me.set(x,g);++_t-1&&g%1==0&&g-1&&g%1==0&&g<=d}function ln(g){var x=typeof g;return g!=null&&(x=="object"||x=="function")}function Ci(g){return g!=null&&typeof g=="object"}var fn=be?mt(be):Zs;function zo(g){return Mo(g)?Ys(g):Qs(g)}function Ke(){return[]}function Be(){return!1}c.exports=jo})(ho,ho.exports);var bw=ho.exports;const Ew=Ll(bw);function Iw(c,r){if(c.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),n=0;n>>0,pe=new Uint8Array(fe);he!==le;){for(var de=R[he],L=0,q=fe-1;(de!==0||L>>0,pe[q]=de%v>>>0,de=de/v>>>0;if(de!==0)throw new Error("Non-zero carry");re=L,he++}for(var W=fe-re;W!==fe&&pe[W]===0;)W++;for(var ve=b.repeat(K);W>>0,fe=new Uint8Array(le);R[K];){var pe=i[R.charCodeAt(K)];if(pe===255)return;for(var de=0,L=le-1;(pe!==0||de>>0,fe[L]=pe%256>>>0,pe=pe/256>>>0;if(pe!==0)throw new Error("Non-zero carry");he=de,K++}if(R[K]!==" "){for(var q=le-he;q!==le&&fe[q]===0;)q++;for(var W=new Uint8Array(re+(le-q)),ve=re;q!==le;)W[ve++]=fe[q++];return W}}}function z(R){var K=F(R);if(K)return K;throw new Error(`Non-${r} character`)}return{encode:O,decodeUnsafe:F,decode:z}}var xw=Iw,Sw=xw;const nf=c=>{if(c instanceof Uint8Array&&c.constructor.name==="Uint8Array")return c;if(c instanceof ArrayBuffer)return new Uint8Array(c);if(ArrayBuffer.isView(c))return new Uint8Array(c.buffer,c.byteOffset,c.byteLength);throw new Error("Unknown type, must be binary type")},Pw=c=>new TextEncoder().encode(c),Aw=c=>new TextDecoder().decode(c);class Cw{constructor(r,i,n){this.name=r,this.prefix=i,this.baseEncode=n}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Ow{constructor(r,i,n){if(this.name=r,this.prefix=i,i.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i.codePointAt(0),this.baseDecode=n}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return of(this,r)}}class Rw{constructor(r){this.decoders=r}or(r){return of(this,r)}decode(r){const i=r[0],n=this.decoders[i];if(n)return n.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const of=(c,r)=>new Rw({...c.decoders||{[c.prefix]:c},...r.decoders||{[r.prefix]:r}});class Tw{constructor(r,i,n,o){this.name=r,this.prefix=i,this.baseEncode=n,this.baseDecode=o,this.encoder=new Cw(r,i,n),this.decoder=new Ow(r,i,o)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const vo=({name:c,prefix:r,encode:i,decode:n})=>new Tw(c,r,i,n),Vs=({prefix:c,name:r,alphabet:i})=>{const{encode:n,decode:o}=Sw(i,r);return vo({prefix:c,name:r,encode:n,decode:l=>nf(o(l))})},Nw=(c,r,i,n)=>{const o={};for(let S=0;S=8&&(v-=8,d[m++]=255&b>>v)}if(v>=i||255&b<<8-v)throw new SyntaxError("Unexpected end of data");return d},Dw=(c,r,i)=>{const n=r[r.length-1]==="=",o=(1<i;)d-=i,l+=r[o&v>>d];if(d&&(l+=r[o&v<vo({prefix:r,name:c,encode(o){return Dw(o,n,i)},decode(o){return Nw(o,n,i,c)}}),Fw=vo({prefix:"\0",name:"identity",encode:c=>Aw(c),decode:c=>Pw(c)});var Lw=Object.freeze({__proto__:null,identity:Fw});const $w=Kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Mw=Object.freeze({__proto__:null,base2:$w});const jw=Kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var zw=Object.freeze({__proto__:null,base8:jw});const Uw=Vs({prefix:"9",name:"base10",alphabet:"0123456789"});var qw=Object.freeze({__proto__:null,base10:Uw});const Bw=Kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Hw=Kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var kw=Object.freeze({__proto__:null,base16:Bw,base16upper:Hw});const Kw=Kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vw=Kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Gw=Kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ww=Kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jw=Kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yw=Kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xw=Kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Zw=Kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qw=Kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var e_=Object.freeze({__proto__:null,base32:Kw,base32upper:Vw,base32pad:Gw,base32padupper:Ww,base32hex:Jw,base32hexupper:Yw,base32hexpad:Xw,base32hexpadupper:Zw,base32z:Qw});const t_=Vs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),r_=Vs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var i_=Object.freeze({__proto__:null,base36:t_,base36upper:r_});const s_=Vs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),n_=Vs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var o_=Object.freeze({__proto__:null,base58btc:s_,base58flickr:n_});const a_=Kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),c_=Kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),u_=Kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),h_=Kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var l_=Object.freeze({__proto__:null,base64:a_,base64pad:c_,base64url:u_,base64urlpad:h_});const af=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),f_=af.reduce((c,r,i)=>(c[i]=r,c),[]),p_=af.reduce((c,r,i)=>(c[r.codePointAt(0)]=i,c),[]);function d_(c){return c.reduce((r,i)=>(r+=f_[i],r),"")}function g_(c){const r=[];for(const i of c){const n=p_[i.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${i}`);r.push(n)}return new Uint8Array(r)}const y_=vo({prefix:"🚀",name:"base256emoji",encode:d_,decode:g_});var v_=Object.freeze({__proto__:null,base256emoji:y_}),m_=cf,Qh=128,w_=127,__=~w_,b_=Math.pow(2,31);function cf(c,r,i){r=r||[],i=i||0;for(var n=i;c>=b_;)r[i++]=c&255|Qh,c/=128;for(;c&__;)r[i++]=c&255|Qh,c>>>=7;return r[i]=c|0,cf.bytes=i-n+1,r}var E_=uc,I_=128,el=127;function uc(c,n){var i=0,n=n||0,o=0,l=n,d,v=c.length;do{if(l>=v)throw uc.bytes=0,new RangeError("Could not decode varint");d=c[l++],i+=o<28?(d&el)<=I_);return uc.bytes=l-n,i}var x_=Math.pow(2,7),S_=Math.pow(2,14),P_=Math.pow(2,21),A_=Math.pow(2,28),C_=Math.pow(2,35),O_=Math.pow(2,42),R_=Math.pow(2,49),T_=Math.pow(2,56),N_=Math.pow(2,63),D_=function(c){return c(uf.encode(c,r,i),r),rl=c=>uf.encodingLength(c),hc=(c,r)=>{const i=r.byteLength,n=rl(c),o=n+rl(i),l=new Uint8Array(o+i);return tl(c,l,0),tl(i,l,n),l.set(r,o),new L_(c,i,r,l)};class L_{constructor(r,i,n,o){this.code=r,this.size=i,this.digest=n,this.bytes=o}}const hf=({name:c,code:r,encode:i})=>new $_(c,r,i);class $_{constructor(r,i,n){this.name=r,this.code=i,this.encode=n}digest(r){if(r instanceof Uint8Array){const i=this.encode(r);return i instanceof Uint8Array?hc(this.code,i):i.then(n=>hc(this.code,n))}else throw Error("Unknown type, must be binary type")}}const lf=c=>async r=>new Uint8Array(await crypto.subtle.digest(c,r)),M_=hf({name:"sha2-256",code:18,encode:lf("SHA-256")}),j_=hf({name:"sha2-512",code:19,encode:lf("SHA-512")});var z_=Object.freeze({__proto__:null,sha256:M_,sha512:j_});const ff=0,U_="identity",pf=nf,q_=c=>hc(ff,pf(c)),B_={code:ff,name:U_,encode:pf,digest:q_};var H_=Object.freeze({__proto__:null,identity:B_});new TextEncoder,new TextDecoder;const il={...Lw,...Mw,...zw,...qw,...kw,...e_,...i_,...o_,...l_,...v_};({...z_,...H_});function df(c){return globalThis.Buffer!=null?new Uint8Array(c.buffer,c.byteOffset,c.byteLength):c}function k_(c=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?df(globalThis.Buffer.allocUnsafe(c)):new Uint8Array(c)}function gf(c,r,i,n){return{name:c,prefix:r,encoder:{name:c,prefix:r,encode:i},decoder:{decode:n}}}const sl=gf("utf8","u",c=>"u"+new TextDecoder("utf8").decode(c),c=>new TextEncoder().encode(c.substring(1))),Xa=gf("ascii","a",c=>{let r="a";for(let i=0;i{c=c.substring(1);const r=k_(c.length);for(let i=0;i{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,o)=>{this.isInitialized(),this.keychain.set(n,o),await this.persist()},this.get=n=>{this.isInitialized();const o=this.keychain.get(n);if(typeof o>"u"){const{message:l}=Q("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(l)}return o},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=r,this.logger=Re.generateChildLogger(i,this.name)}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(r){await this.core.storage.setItem(this.storageKey,zl(r))}async getKeyChain(){const r=await this.core.storage.getItem(this.storageKey);return typeof r<"u"?Ul(r):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Eb{constructor(r,i,n){this.core=r,this.logger=i,this.name=Y_,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=o=>(this.isInitialized(),this.keychain.has(o)),this.getClientId=async()=>{this.isInitialized();const o=await this.getClientSeed(),l=Kh(o);return Yl(l.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const o=cm();return this.setPrivateKey(o.publicKey,o.privateKey)},this.signJWT=async o=>{this.isInitialized();const l=await this.getClientSeed(),d=Kh(l),v=oc();return await Q1(v,o,X_,d)},this.generateSharedKey=(o,l,d)=>{this.isInitialized();const v=this.getPrivateKey(o),b=um(v,l);return this.setSymKey(b,d)},this.setSymKey=async(o,l)=>{this.isInitialized();const d=l||hm(o);return await this.keychain.set(d,o),d},this.deleteKeyPair=async o=>{this.isInitialized(),await this.keychain.del(o)},this.deleteSymKey=async o=>{this.isInitialized(),await this.keychain.del(o)},this.encode=async(o,l,d)=>{this.isInitialized();const v=lm(d),b=Ui(l);if(Ah(v)){const F=v.senderPublicKey,z=v.receiverPublicKey;o=await this.generateSharedKey(F,z)}const m=this.getSymKey(o),{type:S,senderPublicKey:O}=v;return fm({type:S,symKey:m,message:b,senderPublicKey:O})},this.decode=async(o,l,d)=>{this.isInitialized();const v=pm(l,d);if(Ah(v)){const S=v.receiverPublicKey,O=v.senderPublicKey;o=await this.generateSharedKey(S,O)}const b=this.getSymKey(o),m=dm({symKey:b,encoded:l});return Ks(m)},this.getPayloadType=o=>{const l=Ch(o);return gm(l.type)},this.getPayloadSenderPublicKey=o=>{const l=Ch(o);return l.senderPublicKey?fo(l.senderPublicKey,ym):void 0},this.core=r,this.logger=Re.generateChildLogger(i,this.name),this.keychain=n||new bb(this.core,this.logger)}get context(){return Re.getLoggerContext(this.logger)}async setPrivateKey(r,i){return await this.keychain.set(r,i),r}getPrivateKey(r){return this.keychain.get(r)}async getClientSeed(){let r="";try{r=this.keychain.get(nl)}catch{r=oc(),await this.keychain.set(nl,r)}return V_(r,"base16")}getSymKey(r){return this.keychain.get(r)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Ib extends T1{constructor(r,i){super(r,i),this.logger=r,this.core=i,this.messages=new Map,this.name=eb,this.version=tb,this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,o)=>{this.isInitialized();const l=fs(o);let d=this.messages.get(n);return typeof d>"u"&&(d={}),typeof d[l]<"u"||(d[l]=o,this.messages.set(n,d),await this.persist()),l},this.get=n=>{this.isInitialized();let o=this.messages.get(n);return typeof o>"u"&&(o={}),o},this.has=(n,o)=>{this.isInitialized();const l=this.get(n),d=fs(o);return typeof l[d]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Re.generateChildLogger(r,this.name),this.core=i}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(r){await this.core.storage.setItem(this.storageKey,zl(r))}async getRelayerMessages(){const r=await this.core.storage.getItem(this.storageKey);return typeof r<"u"?Ul(r):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class xb extends N1{constructor(r,i){super(r,i),this.relayer=r,this.logger=i,this.events=new Cr.EventEmitter,this.name=ib,this.queue=new Map,this.publishTimeout=ne.toMiliseconds(ne.TEN_SECONDS),this.queueTimeout=ne.toMiliseconds(ne.FIVE_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,o,l)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:o,opts:l}});try{const d=(l==null?void 0:l.ttl)||rb,v=ac(l),b=(l==null?void 0:l.prompt)||!1,m=(l==null?void 0:l.tag)||0,S=(l==null?void 0:l.id)||_c().toString(),O={topic:n,message:o,opts:{ttl:d,relay:v,prompt:b,tag:m,id:S}},F=setTimeout(()=>this.queue.set(S,O),this.queueTimeout);try{await await co(this.rpcPublish(n,o,d,v,b,m,S),this.publishTimeout),clearTimeout(F),this.relayer.events.emit(vt.publish,O)}catch{this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0;return}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:o,opts:l}})}catch(d){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(d),d}},this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.relayer=r,this.logger=Re.generateChildLogger(i,this.name),this.registerEventListeners()}get context(){return Re.getLoggerContext(this.logger)}rpcPublish(r,i,n,o,l,d,v){var b,m,S,O;const F={method:io(o.protocol).publish,params:{topic:r,message:i,ttl:n,prompt:l,tag:d},id:v};return _i((b=F.params)==null?void 0:b.prompt)&&((m=F.params)==null||delete m.prompt),_i((S=F.params)==null?void 0:S.tag)&&((O=F.params)==null||delete O.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:F}),this.relayer.request(F)}onPublish(r){this.queue.delete(r)}checkQueue(){this.queue.forEach(async r=>{const{topic:i,message:n,opts:o}=r;await this.publish(i,n,o)})}registerEventListeners(){this.relayer.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(vt.connection_stalled);return}this.checkQueue()}),this.relayer.on(vt.message_ack,r=>{this.onPublish(r.id.toString())})}}class Sb{constructor(){this.map=new Map,this.set=(r,i)=>{const n=this.get(r);this.exists(r,i)||this.map.set(r,[...n,i])},this.get=r=>this.map.get(r)||[],this.exists=(r,i)=>this.get(r).includes(i),this.delete=(r,i)=>{if(typeof i>"u"){this.map.delete(r);return}if(!this.map.has(r))return;const n=this.get(r);if(!this.exists(r,i))return;const o=n.filter(l=>l!==i);if(!o.length){this.map.delete(r);return}this.map.set(r,o)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Pb=Object.defineProperty,Ab=Object.defineProperties,Cb=Object.getOwnPropertyDescriptors,cl=Object.getOwnPropertySymbols,Ob=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable,ul=(c,r,i)=>r in c?Pb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,zs=(c,r)=>{for(var i in r||(r={}))Ob.call(r,i)&&ul(c,i,r[i]);if(cl)for(var i of cl(r))Rb.call(r,i)&&ul(c,i,r[i]);return c},Qa=(c,r)=>Ab(c,Cb(r));class Tb extends L1{constructor(r,i){super(r,i),this.relayer=r,this.logger=i,this.subscriptions=new Map,this.topicMap=new Sb,this.events=new Cr.EventEmitter,this.name=fb,this.version=pb,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=bi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,o)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:o}});try{const l=ac(o),d={topic:n,relay:l};this.pending.set(n,d);const v=await this.rpcSubscribe(n,l);return this.onSubscribe(v,d),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:o}}),v}catch(l){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(l),l}},this.unsubscribe=async(n,o)=>{await this.restartToComplete(),this.isInitialized(),typeof(o==null?void 0:o.id)<"u"?await this.unsubscribeById(n,o.id,o):await this.unsubscribeByTopic(n,o)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((o,l)=>{const d=new ne.Watch;d.start(this.pendingSubscriptionWatchLabel);const v=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(v),d.stop(this.pendingSubscriptionWatchLabel),o(!0)),d.elapsed(this.pendingSubscriptionWatchLabel)>=db&&(clearInterval(v),d.stop(this.pendingSubscriptionWatchLabel),l(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=r,this.logger=Re.generateChildLogger(i,this.name),this.clientId=""}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(r,i){let n=!1;try{n=this.getSubscription(r).topic===i}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(r,i){const n=this.topicMap.get(r);await Promise.all(n.map(async o=>await this.unsubscribeById(r,o,i)))}async unsubscribeById(r,i,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:r,id:i,opts:n}});try{const o=ac(n);await this.rpcUnsubscribe(r,i,o);const l=tr("USER_DISCONNECTED",`${this.name}, ${r}`);await this.onUnsubscribe(r,i,l),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:r,id:i,opts:n}})}catch(o){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(o),o}}async rpcSubscribe(r,i){const n={method:io(i.protocol).subscribe,params:{topic:r}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await co(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(vt.connection_stalled)}return fs(r+this.clientId)}async rpcBatchSubscribe(r){if(!r.length)return;const i=r[0].relay,n={method:io(i.protocol).batchSubscribe,params:{topics:r.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await co(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(vt.connection_stalled)}}rpcUnsubscribe(r,i,n){const o={method:io(n.protocol).unsubscribe,params:{topic:r,id:i}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o}),this.relayer.request(o)}onSubscribe(r,i){this.setSubscription(r,Qa(zs({},i),{id:r})),this.pending.delete(i.topic)}onBatchSubscribe(r){r.length&&r.forEach(i=>{this.setSubscription(i.id,zs({},i)),this.pending.delete(i.topic)})}async onUnsubscribe(r,i,n){this.events.removeAllListeners(i),this.hasSubscription(i,r)&&this.deleteSubscription(i,n),await this.relayer.messages.del(r)}async setRelayerSubscriptions(r){await this.relayer.core.storage.setItem(this.storageKey,r)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(r,i){this.subscriptions.has(r)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:r,subscription:i}),this.addSubscription(r,i))}addSubscription(r,i){this.subscriptions.set(r,zs({},i)),this.topicMap.set(i.topic,r),this.events.emit(Vr.created,i)}getSubscription(r){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:r});const i=this.subscriptions.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(n)}return i}deleteSubscription(r,i){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:r,reason:i});const n=this.getSubscription(r);this.subscriptions.delete(r),this.topicMap.delete(n.topic,r),this.events.emit(Vr.deleted,Qa(zs({},n),{reason:i}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vr.sync)}async reset(){if(this.cached.length){const r=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i"u"||!r.length)return;if(this.subscriptions.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(r){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(r)}}async batchSubscribe(r){if(!r.length)return;const i=await this.rpcBatchSubscribe(r);ps(i)&&this.onBatchSubscribe(i.map((n,o)=>Qa(zs({},r[o]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;const r=[];this.pending.forEach(i=>{r.push(i)}),await this.batchSubscribe(r)}registerEventListeners(){this.relayer.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(vt.connect,async()=>{await this.onConnect()}),this.relayer.on(vt.disconnect,()=>{this.onDisconnect()}),this.events.on(Vr.created,async r=>{const i=Vr.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()}),this.events.on(Vr.deleted,async r=>{const i=Vr.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}async restartToComplete(){this.restartInProgress&&await new Promise(r=>{const i=setInterval(()=>{this.restartInProgress||(clearInterval(i),r())},this.pollingInterval)})}}var Nb=Object.defineProperty,hl=Object.getOwnPropertySymbols,Db=Object.prototype.hasOwnProperty,Fb=Object.prototype.propertyIsEnumerable,ll=(c,r,i)=>r in c?Nb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,Lb=(c,r)=>{for(var i in r||(r={}))Db.call(r,i)&&ll(c,i,r[i]);if(hl)for(var i of hl(r))Fb.call(r,i)&&ll(c,i,r[i]);return c};class $b extends D1{constructor(r){super(r),this.protocol="wc",this.version=2,this.events=new Cr.EventEmitter,this.name=nb,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async i=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(i)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=r.core,this.logger=typeof r.logger<"u"&&typeof r.logger!="string"?Re.generateChildLogger(r.logger,this.name):Re.pino(Re.getDefaultLoggerOptions({level:r.logger||sb})),this.messages=new Ib(this.logger,r.core),this.subscriber=new Tb(this,this.logger),this.publisher=new xb(this,this.logger),this.relayUrl=(r==null?void 0:r.relayUrl)||mf,this.projectId=r.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${ol}...`),await this.restartTransport(ol)}this.registerEventListeners(),this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},ub)}get context(){return Re.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(r,i,n){this.isInitialized(),await this.publisher.publish(r,i,n),await this.recordMessageEvent({topic:r,message:i,publishedAt:Date.now()})}async subscribe(r,i){var n;this.isInitialized();let o=((n=this.subscriber.topicMap.get(r))==null?void 0:n[0])||"";return o||(await Promise.all([new Promise(l=>{this.subscriber.once(Vr.created,d=>{d.topic===r&&l()})}),new Promise(async l=>{o=await this.subscriber.subscribe(r,i),l()})]),o)}async unsubscribe(r,i){this.isInitialized(),await this.subscriber.unsubscribe(r,i)}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(vt.transport_closed))}async transportOpen(r){if(this.transportExplicitlyClosed=!1,!this.reconnecting){this.relayUrl=r||this.relayUrl,this.reconnecting=!0;try{await Promise.all([new Promise(i=>{this.initialized||i(),this.subscriber.once(Vr.resubscribed,()=>{i()})}),await Promise.race([new Promise(async(i,n)=>{await co(this.provider.connect(),5e3,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>n(o)).then(()=>i()).finally(()=>this.removeListener(vt.transport_closed,this.rejectTransportOpen))}),new Promise(i=>this.once(vt.transport_closed,this.rejectTransportOpen))])])}catch(i){this.logger.error(i);const n=i;if(!this.isConnectionStalled(n.message))throw i;this.events.emit(vt.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(r){this.transportExplicitlyClosed||this.reconnecting||(this.relayUrl=r||this.relayUrl,this.connected&&await Promise.all([new Promise(i=>{this.provider.once(Ms.disconnect,()=>{i()})}),this.transportClose()]),await this.createProvider(),await this.transportOpen())}isConnectionStalled(r){return this.staleConnectionErrors.some(i=>r.includes(i))}rejectTransportOpen(){throw new Error("Attempt to connect to relay via `transportOpen` has stalled. Retrying...")}async createProvider(){const r=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ei(new _w(vm({sdkVersion:cb,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:r,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(r){const{topic:i,message:n}=r;await this.messages.set(i,n)}async shouldIgnoreMessageEvent(r){const{topic:i,message:n}=r;return await this.subscriber.isSubscribed(i)?this.messages.has(i,n):!0}async onProviderPayload(r){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:r}),Ec(r)){if(!r.method.endsWith(ob))return;const i=r.params,{topic:n,message:o,publishedAt:l}=i.data,d={topic:n,message:o,publishedAt:l};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Lb({type:"event",event:i.id},d)),this.events.emit(i.id,d),await this.acknowledgePayload(r),await this.onMessageEvent(d)}else yo(r)&&this.events.emit(vt.message_ack,r)}async onMessageEvent(r){await this.shouldIgnoreMessageEvent(r)||(this.events.emit(vt.message,r),await this.recordMessageEvent(r))}async acknowledgePayload(r){const i=bc(r.id,!0);await this.provider.connection.send(i)}registerProviderListeners(){this.provider.on(Ms.payload,r=>this.onProviderPayload(r)),this.provider.on(Ms.connect,()=>{this.events.emit(vt.connect)}),this.provider.on(Ms.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(Ms.error,r=>{this.logger.error(r),this.events.emit(vt.error,r)})}registerEventListeners(){this.events.on(vt.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(vt.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},ne.toMiliseconds(ab))}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(r=>{const i=setInterval(()=>{this.connected&&(clearInterval(i),r())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var Mb=Object.defineProperty,fl=Object.getOwnPropertySymbols,jb=Object.prototype.hasOwnProperty,zb=Object.prototype.propertyIsEnumerable,pl=(c,r,i)=>r in c?Mb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,dl=(c,r)=>{for(var i in r||(r={}))jb.call(r,i)&&pl(c,i,r[i]);if(fl)for(var i of fl(r))zb.call(r,i)&&pl(c,i,r[i]);return c};class mo extends F1{constructor(r,i,n,o=bi,l=void 0){super(r,i,n,o),this.core=r,this.logger=i,this.name=n,this.map=new Map,this.version=hb,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(d=>{this.getKey&&d!==null&&!_i(d)?this.map.set(this.getKey(d),d):om(d)?this.map.set(d.id,d):am(d)&&this.map.set(d.topic,d)}),this.cached=[],this.initialized=!0)},this.set=async(d,v)=>{this.isInitialized(),this.map.has(d)?await this.update(d,v):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:d,value:v}),this.map.set(d,v),await this.persist())},this.get=d=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:d}),this.getData(d)),this.getAll=d=>(this.isInitialized(),d?this.values.filter(v=>Object.keys(d).every(b=>Ew(v[b],d[b]))):this.values),this.update=async(d,v)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:d,update:v});const b=dl(dl({},this.getData(d)),v);this.map.set(d,b),await this.persist()},this.delete=async(d,v)=>{this.isInitialized(),this.map.has(d)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:d,reason:v}),this.map.delete(d),await this.persist())},this.logger=Re.generateChildLogger(i,this.name),this.storagePrefix=o,this.getKey=l}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(r){await this.core.storage.setItem(this.storageKey,r)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(r){const i=this.map.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw this.logger.error(n),new Error(n)}return i}async persist(){await this.setDataStore(this.values)}async restore(){try{const r=await this.getDataStore();if(typeof r>"u"||!r.length)return;if(this.map.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(r){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(r)}}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Ub{constructor(r,i){this.core=r,this.logger=i,this.name=gb,this.version=yb,this.events=new vc,this.initialized=!1,this.storagePrefix=bi,this.ignoredPayloadTypes=[$l],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=oc(),o=await this.core.crypto.setSymKey(n),l=Lr(ne.FIVE_MINUTES),d={protocol:vf},v={topic:o,expiry:l,relay:d,active:!1},b=mm({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:n,relay:d});return await this.pairings.set(o,v),await this.core.relayer.subscribe(o),this.core.expirer.set(o,l),{topic:o,uri:b}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:o,symKey:l,relay:d}=wm(n.uri);if(this.pairings.keys.includes(o))throw new Error(`Pairing already exists: ${o}`);if(this.core.crypto.hasKeys(o))throw new Error(`Keychain already exists: ${o}`);const v=Lr(ne.FIVE_MINUTES),b={topic:o,relay:d,expiry:v,active:!1};return await this.pairings.set(o,b),await this.core.crypto.setSymKey(l,o),await this.core.relayer.subscribe(o,{relay:d}),this.core.expirer.set(o,v),n.activatePairing&&await this.activate({topic:o}),b},this.activate=async({topic:n})=>{this.isInitialized();const o=Lr(ne.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:o}),this.core.expirer.set(n,o)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:o}=n;if(this.pairings.keys.includes(o)){const l=await this.sendRequest(o,"wc_pairingPing",{}),{done:d,resolve:v,reject:b}=hs();this.events.once(Ft("pairing_ping",l),({error:m})=>{m?b(m):v()}),await d()}},this.updateExpiry=async({topic:n,expiry:o})=>{this.isInitialized(),await this.pairings.update(n,{expiry:o})},this.updateMetadata=async({topic:n,metadata:o})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:o})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:o}=n;this.pairings.keys.includes(o)&&(await this.sendRequest(o,"wc_pairingDelete",tr("USER_DISCONNECTED")),await this.deletePairing(o))},this.sendRequest=async(n,o,l)=>{const d=po(o,l),v=await this.core.crypto.encode(n,d),b=js[o].req;return this.core.history.set(n,d),this.core.relayer.publish(n,v,b),d.id},this.sendResult=async(n,o,l)=>{const d=bc(n,l),v=await this.core.crypto.encode(o,d),b=await this.core.history.get(o,n),m=js[b.request.method].res;await this.core.relayer.publish(o,v,m),await this.core.history.resolve(d)},this.sendError=async(n,o,l)=>{const d=go(n,l),v=await this.core.crypto.encode(o,d),b=await this.core.history.get(o,n),m=js[b.request.method]?js[b.request.method].res:js.unregistered_method.res;await this.core.relayer.publish(o,v,m),await this.core.history.resolve(d)},this.deletePairing=async(n,o)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,tr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),o?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(o=>wi(o.expiry));await Promise.all(n.map(o=>this.deletePairing(o.topic)))},this.onRelayEventRequest=n=>{const{topic:o,payload:l}=n,d=l.method;if(this.pairings.keys.includes(o))switch(d){case"wc_pairingPing":return this.onPairingPingRequest(o,l);case"wc_pairingDelete":return this.onPairingDeleteRequest(o,l);default:return this.onUnknownRpcMethodRequest(o,l)}},this.onRelayEventResponse=async n=>{const{topic:o,payload:l}=n,d=(await this.core.history.get(o,l.id)).request.method;if(this.pairings.keys.includes(o))switch(d){case"wc_pairingPing":return this.onPairingPingResponse(o,l);default:return this.onUnknownRpcMethodResponse(d)}},this.onPairingPingRequest=async(n,o)=>{const{id:l}=o;try{this.isValidPing({topic:n}),await this.sendResult(l,n,!0),this.events.emit("pairing_ping",{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onPairingPingResponse=(n,o)=>{const{id:l}=o;setTimeout(()=>{ai(o)?this.events.emit(Ft("pairing_ping",l),{}):$r(o)&&this.events.emit(Ft("pairing_ping",l),{error:o.error})},500)},this.onPairingDeleteRequest=async(n,o)=>{const{id:l}=o;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onUnknownRpcMethodRequest=async(n,o)=>{const{id:l,method:d}=o;try{if(this.registeredMethods.includes(d))return;const v=tr("WC_METHOD_UNSUPPORTED",d);await this.sendError(l,n,v),this.logger.error(v)}catch(v){await this.sendError(l,n,v),this.logger.error(v)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(tr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ur(n)){const{message:o}=Q("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!_m(n.uri)){const{message:o}=Q("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}},this.isValidPing=async n=>{if(!ur(n)){const{message:l}=Q("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(l)}const{topic:o}=n;await this.isValidPairingTopic(o)},this.isValidDisconnect=async n=>{if(!ur(n)){const{message:l}=Q("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(l)}const{topic:o}=n;await this.isValidPairingTopic(o)},this.isValidPairingTopic=async n=>{if(!ls(n,!1)){const{message:o}=Q("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(o)}if(!this.pairings.keys.includes(n)){const{message:o}=Q("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(o)}if(wi(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:o}=Q("EXPIRED",`pairing topic: ${n}`);throw new Error(o)}},this.core=r,this.logger=Re.generateChildLogger(i,this.name),this.pairings=new mo(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Re.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}registerRelayerEvents(){this.core.relayer.on(vt.message,async r=>{const{topic:i,message:n}=r;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const o=await this.core.crypto.decode(i,n);Ec(o)?(this.core.history.set(i,o),this.onRelayEventRequest({topic:i,payload:o})):yo(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:i,payload:o}),this.core.history.delete(i,o.id))})}registerExpirerEvents(){this.core.expirer.on(Pr.expired,async r=>{const{topic:i}=Ml(r.target);i&&this.pairings.keys.includes(i)&&(await this.deletePairing(i,!0),this.events.emit("pairing_expire",{topic:i}))})}}class qb extends R1{constructor(r,i){super(r,i),this.core=r,this.logger=i,this.records=new Map,this.events=new Cr.EventEmitter,this.name=vb,this.version=mb,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,o,l)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:o,chainId:l}),this.records.has(o.id))return;const d={id:o.id,topic:n,request:{method:o.method,params:o.params||null},chainId:l,expiry:Lr(ne.THIRTY_DAYS)};this.records.set(d.id,d),this.events.emit(Kr.created,d)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const o=await this.getRecord(n.id);typeof o.response>"u"&&(o.response=$r(n)?{error:n.error}:{result:n.result},this.records.set(o.id,o),this.events.emit(Kr.updated,o))},this.get=async(n,o)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:o}),await this.getRecord(o)),this.delete=(n,o)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:o}),this.values.forEach(l=>{if(l.topic===n){if(typeof o<"u"&&l.id!==o)return;this.records.delete(l.id),this.events.emit(Kr.deleted,l)}})},this.exists=async(n,o)=>(this.isInitialized(),this.records.has(o)?(await this.getRecord(o)).topic===n:!1),this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.logger=Re.generateChildLogger(i,this.name)}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const r=[];return this.values.forEach(i=>{if(typeof i.response<"u")return;const n={topic:i.topic,request:po(i.request.method,i.request.params,i.id),chainId:i.chainId};return r.push(n)}),r}async setJsonRpcRecords(r){await this.core.storage.setItem(this.storageKey,r)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(r){this.isInitialized();const i=this.records.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(n)}return i}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Kr.sync)}async restore(){try{const r=await this.getJsonRpcRecords();if(typeof r>"u"||!r.length)return;if(this.records.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}}registerEventListeners(){this.events.on(Kr.created,r=>{const i=Kr.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:r}),this.persist()}),this.events.on(Kr.updated,r=>{const i=Kr.updated;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:r}),this.persist()}),this.events.on(Kr.deleted,r=>{const i=Kr.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:r}),this.persist()}),this.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(r=>{ne.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.delete(r.topic,r.id))})}catch(r){this.logger.warn(r)}}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Bb extends $1{constructor(r,i){super(r,i),this.core=r,this.logger=i,this.expirations=new Map,this.events=new Cr.EventEmitter,this.name=wb,this.version=_b,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const o=this.formatTarget(n);return typeof this.getExpiration(o)<"u"}catch{return!1}},this.set=(n,o)=>{this.isInitialized();const l=this.formatTarget(n),d={target:l,expiry:o};this.expirations.set(l,d),this.checkExpiry(l,d),this.events.emit(Pr.created,{target:l,expiration:d})},this.get=n=>{this.isInitialized();const o=this.formatTarget(n);return this.getExpiration(o)},this.del=n=>{if(this.isInitialized(),this.has(n)){const o=this.formatTarget(n),l=this.getExpiration(o);this.expirations.delete(o),this.events.emit(Pr.deleted,{target:o,expiration:l})}},this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.logger=Re.generateChildLogger(i,this.name)}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(r){if(typeof r=="string")return bm(r);if(typeof r=="number")return Em(r);const{message:i}=Q("UNKNOWN_TYPE",`Target type: ${typeof r}`);throw new Error(i)}async setExpirations(r){await this.core.storage.setItem(this.storageKey,r)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Pr.sync)}async restore(){try{const r=await this.getExpirations();if(typeof r>"u"||!r.length)return;if(this.expirations.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(r){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(r)}}getExpiration(r){const i=this.expirations.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw this.logger.error(n),new Error(n)}return i}checkExpiry(r,i){const{expiry:n}=i;ne.toMiliseconds(n)-Date.now()<=0&&this.expire(r,i)}expire(r,i){this.expirations.delete(r),this.events.emit(Pr.expired,{target:r,expiration:i})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((r,i)=>this.checkExpiry(i,r))}registerEventListeners(){this.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Pr.created,r=>{const i=Pr.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),this.persist()}),this.events.on(Pr.expired,r=>{const i=Pr.expired;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),this.persist()}),this.events.on(Pr.deleted,r=>{const i=Pr.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),this.persist()})}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Hb extends M1{constructor(r,i){super(r,i),this.projectId=r,this.logger=i,this.name=Za,this.initialized=!1,this.init=async n=>{Im()||!jl()||(this.verifyUrl=(n==null?void 0:n.verifyUrl)||al,await this.createIframe())},this.register=async n=>{var o;if(this.initialized||await this.init(),!!this.iframe)try{(o=this.iframe.contentWindow)==null||o.postMessage(n.attestationId,this.verifyUrl),this.logger.info(`postMessage sent: ${n.attestationId} ${this.verifyUrl}`)}catch{}},this.resolve=async n=>{var o;if(this.isDevEnv)return"";this.logger.info(`resolving attestation: ${n.attestationId}`);const l=this.startAbortTimer(ne.FIVE_SECONDS),d=await fetch(`${this.verifyUrl}/attestation/${n.attestationId}`,{signal:this.abortController.signal});return clearTimeout(l),d.status===200?(o=await d.json())==null?void 0:o.origin:""},this.createIframe=async()=>{try{await Promise.race([new Promise((n,o)=>{if(document.getElementById(Za))return n();const l=document.createElement("iframe");l.setAttribute("id",Za),l.setAttribute("src",`${this.verifyUrl}/${this.projectId}`),l.style.display="none",l.addEventListener("load",()=>{this.initialized=!0,n()}),l.addEventListener("error",d=>{o(d)}),document.body.append(l),this.iframe=l}),new Promise(n=>{setTimeout(()=>n("iframe load timeout"),ne.toMiliseconds(ne.ONE_SECOND/2))})])}catch(n){this.logger.error(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.error(n)}},this.logger=Re.generateChildLogger(i,this.name),this.verifyUrl=al,this.abortController=new AbortController,this.isDevEnv=xm()&&{}.IS_VITEST}get context(){return Re.getLoggerContext(this.logger)}startAbortTimer(r){return setTimeout(()=>this.abortController.abort(),ne.toMiliseconds(r))}}var kb=Object.defineProperty,gl=Object.getOwnPropertySymbols,Kb=Object.prototype.hasOwnProperty,Vb=Object.prototype.propertyIsEnumerable,yl=(c,r,i)=>r in c?kb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,vl=(c,r)=>{for(var i in r||(r={}))Kb.call(r,i)&&yl(c,i,r[i]);if(gl)for(var i of gl(r))Vb.call(r,i)&&yl(c,i,r[i]);return c};class xc extends O1{constructor(r){super(r),this.protocol=yf,this.version=G_,this.name=Ic,this.events=new Cr.EventEmitter,this.initialized=!1,this.on=(n,o)=>this.events.on(n,o),this.once=(n,o)=>this.events.once(n,o),this.off=(n,o)=>this.events.off(n,o),this.removeListener=(n,o)=>this.events.removeListener(n,o),this.projectId=r==null?void 0:r.projectId,this.relayUrl=(r==null?void 0:r.relayUrl)||mf;const i=typeof(r==null?void 0:r.logger)<"u"&&typeof(r==null?void 0:r.logger)!="string"?r.logger:Re.pino(Re.getDefaultLoggerOptions({level:(r==null?void 0:r.logger)||W_.logger}));this.logger=Re.generateChildLogger(i,this.name),this.heartbeat=new gs.HeartBeat,this.crypto=new Eb(this,this.logger,r==null?void 0:r.keychain),this.history=new qb(this,this.logger),this.expirer=new Bb(this,this.logger),this.storage=r!=null&&r.storage?r.storage:new _1(vl(vl({},J_),r==null?void 0:r.storageOptions)),this.relayer=new $b({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Ub(this,this.logger),this.verify=new Hb(this.projectId||"",this.logger)}static async init(r){const i=new xc(r);await i.initialize();const n=await i.crypto.getClientId();return await i.storage.setItem(lb,n),i}get context(){return Re.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(r){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,r),this.logger.error(r.message),r}}}const Gb=xc,wf="wc",_f=2,bf="client",Sc=`${wf}@${_f}:${bf}:`,ec={name:bf,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},Wb="WALLETCONNECT_DEEPLINK_CHOICE",Jb="proposal",Ef="Proposal expired",Yb="session",eo=ne.SEVEN_DAYS,Xb="engine",Us={wc_sessionPropose:{req:{ttl:ne.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ne.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ne.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ne.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ne.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ne.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ne.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ne.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ne.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ne.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ne.THIRTY_SECONDS,prompt:!1,tag:1115}}},tc={min:ne.FIVE_MINUTES,max:ne.SEVEN_DAYS},Zb="request",Qb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var eE=Object.defineProperty,tE=Object.defineProperties,rE=Object.getOwnPropertyDescriptors,ml=Object.getOwnPropertySymbols,iE=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,wl=(c,r,i)=>r in c?eE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,Sr=(c,r)=>{for(var i in r||(r={}))iE.call(r,i)&&wl(c,i,r[i]);if(ml)for(var i of ml(r))sE.call(r,i)&&wl(c,i,r[i]);return c},rc=(c,r)=>tE(c,rE(r));class nE extends z1{constructor(r){super(r),this.name=Xb,this.events=new vc,this.initialized=!1,this.ignoredPayloadTypes=[$l],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Us)}),this.initialized=!0)},this.connect=async i=>{this.isInitialized();const n=rc(Sr({},i),{requiredNamespaces:i.requiredNamespaces||{},optionalNamespaces:i.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:o,requiredNamespaces:l,optionalNamespaces:d,sessionProperties:v,relays:b}=n;let m=o,S,O=!1;if(m&&(O=this.client.core.pairing.pairings.get(m).active),!m||!O){const{topic:fe,uri:pe}=await this.client.core.pairing.create();m=fe,S=pe}const F=await this.client.core.crypto.generateKeyPair(),z=Sr({requiredNamespaces:l,optionalNamespaces:d,relays:b??[{protocol:vf}],proposer:{publicKey:F,metadata:this.client.metadata}},v&&{sessionProperties:v}),{reject:R,resolve:K,done:re}=hs(ne.FIVE_MINUTES,Ef);if(this.events.once(Ft("session_connect"),async({error:fe,session:pe})=>{if(fe)R(fe);else if(pe){pe.self.publicKey=F;const de=rc(Sr({},pe),{requiredNamespaces:pe.requiredNamespaces,optionalNamespaces:pe.optionalNamespaces});await this.client.session.set(pe.topic,de),await this.setExpiry(pe.topic,pe.expiry),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:pe.peer.metadata}),K(de)}}),!m){const{message:fe}=Q("NO_MATCHING_KEY",`connect() pairing topic: ${m}`);throw new Error(fe)}const he=await this.sendRequest(m,"wc_sessionPropose",z),le=Lr(ne.FIVE_MINUTES);return await this.setProposal(he,Sr({id:he,expiry:le},z)),{uri:S,approval:re}},this.pair=async i=>(this.isInitialized(),await this.client.core.pairing.pair(i)),this.approve=async i=>{this.isInitialized(),await this.isValidApprove(i);const{id:n,relayProtocol:o,namespaces:l,sessionProperties:d}=i,v=this.client.proposal.get(n);let{pairingTopic:b,proposer:m,requiredNamespaces:S,optionalNamespaces:O}=v;b=b||"",so(S)||(S=Pm(l,"approve()"));const F=await this.client.core.crypto.generateKeyPair(),z=m.publicKey,R=await this.client.core.crypto.generateSharedKey(F,z);b&&n&&(await this.client.core.pairing.updateMetadata({topic:b,metadata:m.metadata}),await this.sendResult(n,b,{relay:{protocol:o??"irn"},responderPublicKey:F}),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:b}));const K=Sr({relay:{protocol:o??"irn"},namespaces:l,requiredNamespaces:S,optionalNamespaces:O,pairingTopic:b,controller:{publicKey:F,metadata:this.client.metadata},expiry:Lr(eo)},d&&{sessionProperties:d});await this.client.core.relayer.subscribe(R),await this.sendRequest(R,"wc_sessionSettle",K);const re=rc(Sr({},K),{topic:R,pairingTopic:b,acknowledged:!1,self:K.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:F});return await this.client.session.set(R,re),await this.setExpiry(R,Lr(eo)),{topic:R,acknowledged:()=>new Promise(he=>setTimeout(()=>he(this.client.session.get(R)),500))}},this.reject=async i=>{this.isInitialized(),await this.isValidReject(i);const{id:n,reason:o}=i,{pairingTopic:l}=this.client.proposal.get(n);l&&(await this.sendError(n,l,o),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")))},this.update=async i=>{this.isInitialized(),await this.isValidUpdate(i);const{topic:n,namespaces:o}=i,l=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:o}),{done:d,resolve:v,reject:b}=hs();return this.events.once(Ft("session_update",l),({error:m})=>{m?b(m):v()}),await this.client.session.update(n,{namespaces:o}),{acknowledged:d}},this.extend=async i=>{this.isInitialized(),await this.isValidExtend(i);const{topic:n}=i,o=await this.sendRequest(n,"wc_sessionExtend",{}),{done:l,resolve:d,reject:v}=hs();return this.events.once(Ft("session_extend",o),({error:b})=>{b?v(b):d()}),await this.setExpiry(n,Lr(eo)),{acknowledged:l}},this.request=async i=>{this.isInitialized(),await this.isValidRequest(i);const{chainId:n,request:o,topic:l,expiry:d}=i,v=await this.sendRequest(l,"wc_sessionRequest",{request:o,chainId:n},d),{done:b,resolve:m,reject:S}=hs(d);this.events.once(Ft("session_request",v),({error:F,result:z})=>{F?S(F):m(z)}),this.client.events.emit("session_request_sent",{topic:l,request:o,chainId:n,id:v});const O=await this.client.core.storage.getItem(Wb);return Am({id:v,topic:l,wcDeepLink:O}),await b()},this.respond=async i=>{this.isInitialized(),await this.isValidRespond(i);const{topic:n,response:o}=i,{id:l}=o;ai(o)?await this.sendResult(l,n,o.result):$r(o)&&await this.sendError(l,n,o.error),this.deletePendingSessionRequest(i.response.id,{message:"fulfilled",code:0})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.client.session.keys.includes(n)){const o=await this.sendRequest(n,"wc_sessionPing",{}),{done:l,resolve:d,reject:v}=hs();this.events.once(Ft("session_ping",o),({error:b})=>{b?v(b):d()}),await l()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async i=>{this.isInitialized(),await this.isValidEmit(i);const{topic:n,event:o,chainId:l}=i;await this.sendRequest(n,"wc_sessionEvent",{event:o,chainId:l})},this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;if(this.client.session.keys.includes(n)){const o=_c().toString();let l;const d=v=>{(v==null?void 0:v.id.toString())===o&&(this.client.core.relayer.events.removeListener(vt.message_ack,d),l())};await Promise.all([new Promise(v=>{l=v,this.client.core.relayer.on(vt.message_ack,d)}),this.sendRequest(n,"wc_sessionDelete",tr("USER_DISCONNECTED"),void 0,o)]),await this.deleteSession(n)}else await this.client.core.pairing.disconnect({topic:n})},this.find=i=>(this.isInitialized(),this.client.session.getAll().filter(n=>Cm(n,i))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async i=>{if(i.pairingTopic)try{const n=this.client.core.pairing.pairings.get(i.pairingTopic),o=this.client.core.pairing.pairings.getAll().filter(l=>{var d,v;return((d=l.peerMetadata)==null?void 0:d.url)&&((v=l.peerMetadata)==null?void 0:v.url)===i.peer.metadata.url&&l.topic&&l.topic!==n.topic});if(o.length===0)return;this.client.logger.info(`Cleaning up ${o.length} duplicate pairing(s)`),await Promise.all(o.map(l=>this.client.core.pairing.disconnect({topic:l.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(i,n)=>{const{self:o}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),this.client.session.delete(i,tr("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),n||this.client.core.expirer.del(i)},this.deleteProposal=async(i,n)=>{await Promise.all([this.client.proposal.delete(i,tr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(i)])},this.deletePendingSessionRequest=async(i,n,o=!1)=>{await Promise.all([this.client.pendingRequest.delete(i,n),o?Promise.resolve():this.client.core.expirer.del(i)])},this.setExpiry=async(i,n)=>{this.client.session.keys.includes(i)&&await this.client.session.update(i,{expiry:n}),this.client.core.expirer.set(i,n)},this.setProposal=async(i,n)=>{await this.client.proposal.set(i,n),this.client.core.expirer.set(i,n.expiry)},this.setPendingSessionRequest=async i=>{const n=Us.wc_sessionRequest.req.ttl,{id:o,topic:l,params:d}=i;await this.client.pendingRequest.set(o,{id:o,topic:l,params:d}),n&&this.client.core.expirer.set(o,Lr(n))},this.sendRequest=async(i,n,o,l,d)=>{const v=po(n,o);if(jl()&&Qb.includes(n)){const S=fs(JSON.stringify(v));await this.client.core.verify.register({attestationId:S})}const b=await this.client.core.crypto.encode(i,v),m=Us[n].req;return l&&(m.ttl=l),d&&(m.id=d),this.client.core.history.set(i,v),this.client.core.relayer.publish(i,b,m),v.id},this.sendResult=async(i,n,o)=>{const l=bc(i,o),d=await this.client.core.crypto.encode(n,l),v=await this.client.core.history.get(n,i),b=Us[v.request.method].res;this.client.core.relayer.publish(n,d,b),await this.client.core.history.resolve(l)},this.sendError=async(i,n,o)=>{const l=go(i,o),d=await this.client.core.crypto.encode(n,l),v=await this.client.core.history.get(n,i),b=Us[v.request.method].res;this.client.core.relayer.publish(n,d,b),await this.client.core.history.resolve(l)},this.cleanup=async()=>{const i=[],n=[];this.client.session.getAll().forEach(o=>{wi(o.expiry)&&i.push(o.topic)}),this.client.proposal.getAll().forEach(o=>{wi(o.expiry)&&n.push(o.id)}),await Promise.all([...i.map(o=>this.deleteSession(o)),...n.map(o=>this.deleteProposal(o))])},this.onRelayEventRequest=i=>{const{topic:n,payload:o}=i,l=o.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeRequest(n,o);case"wc_sessionSettle":return this.onSessionSettleRequest(n,o);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,o);case"wc_sessionExtend":return this.onSessionExtendRequest(n,o);case"wc_sessionPing":return this.onSessionPingRequest(n,o);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,o);case"wc_sessionRequest":return this.onSessionRequest(n,o);case"wc_sessionEvent":return this.onSessionEventRequest(n,o);default:return this.client.logger.info(`Unsupported request method ${l}`)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:o}=i,l=(await this.client.core.history.get(n,o.id)).request.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeResponse(n,o);case"wc_sessionSettle":return this.onSessionSettleResponse(n,o);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,o);case"wc_sessionExtend":return this.onSessionExtendResponse(n,o);case"wc_sessionPing":return this.onSessionPingResponse(n,o);case"wc_sessionRequest":return this.onSessionRequestResponse(n,o);default:return this.client.logger.info(`Unsupported response method ${l}`)}},this.onRelayEventUnknownPayload=i=>{const{topic:n}=i,{message:o}=Q("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(o)},this.onSessionProposeRequest=async(i,n)=>{const{params:o,id:l}=n;try{this.isValidConnect(Sr({},n.params));const d=Lr(ne.FIVE_MINUTES),v=Sr({id:l,pairingTopic:i,expiry:d},o);await this.setProposal(l,v);const b=fs(JSON.stringify(n)),m=await this.getVerifyContext(b,v.proposer.metadata);this.client.events.emit("session_proposal",{id:l,params:v,verifyContext:m})}catch(d){await this.sendError(l,i,d),this.client.logger.error(d)}},this.onSessionProposeResponse=async(i,n)=>{const{id:o}=n;if(ai(n)){const{result:l}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:l});const d=this.client.proposal.get(o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:d});const v=d.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:v});const b=l.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:b});const m=await this.client.core.crypto.generateSharedKey(v,b);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:m});const S=await this.client.core.relayer.subscribe(m);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:S}),await this.client.core.pairing.activate({topic:i})}else $r(n)&&(await this.client.proposal.delete(o,tr("USER_DISCONNECTED")),this.events.emit(Ft("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(i,n)=>{const{id:o,params:l}=n;try{this.isValidSessionSettleRequest(l);const{relay:d,controller:v,expiry:b,namespaces:m,requiredNamespaces:S,optionalNamespaces:O,sessionProperties:F,pairingTopic:z}=n.params,R=Sr({topic:i,relay:d,expiry:b,namespaces:m,acknowledged:!0,pairingTopic:z,requiredNamespaces:S,optionalNamespaces:O,controller:v.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:v.publicKey,metadata:v.metadata}},F&&{sessionProperties:F});await this.sendResult(n.id,i,!0),this.events.emit(Ft("session_connect"),{session:R}),this.cleanupDuplicatePairings(R)}catch(d){await this.sendError(o,i,d),this.client.logger.error(d)}},this.onSessionSettleResponse=async(i,n)=>{const{id:o}=n;ai(n)?(await this.client.session.update(i,{acknowledged:!0}),this.events.emit(Ft("session_approve",o),{})):$r(n)&&(await this.client.session.delete(i,tr("USER_DISCONNECTED")),this.events.emit(Ft("session_approve",o),{error:n.error}))},this.onSessionUpdateRequest=async(i,n)=>{const{params:o,id:l}=n;try{this.isValidUpdate(Sr({topic:i},o)),await this.client.session.update(i,{namespaces:o.namespaces}),await this.sendResult(l,i,!0),this.client.events.emit("session_update",{id:l,topic:i,params:o})}catch(d){await this.sendError(l,i,d),this.client.logger.error(d)}},this.onSessionUpdateResponse=(i,n)=>{const{id:o}=n;ai(n)?this.events.emit(Ft("session_update",o),{}):$r(n)&&this.events.emit(Ft("session_update",o),{error:n.error})},this.onSessionExtendRequest=async(i,n)=>{const{id:o}=n;try{this.isValidExtend({topic:i}),await this.setExpiry(i,Lr(eo)),await this.sendResult(o,i,!0),this.client.events.emit("session_extend",{id:o,topic:i})}catch(l){await this.sendError(o,i,l),this.client.logger.error(l)}},this.onSessionExtendResponse=(i,n)=>{const{id:o}=n;ai(n)?this.events.emit(Ft("session_extend",o),{}):$r(n)&&this.events.emit(Ft("session_extend",o),{error:n.error})},this.onSessionPingRequest=async(i,n)=>{const{id:o}=n;try{this.isValidPing({topic:i}),await this.sendResult(o,i,!0),this.client.events.emit("session_ping",{id:o,topic:i})}catch(l){await this.sendError(o,i,l),this.client.logger.error(l)}},this.onSessionPingResponse=(i,n)=>{const{id:o}=n;setTimeout(()=>{ai(n)?this.events.emit(Ft("session_ping",o),{}):$r(n)&&this.events.emit(Ft("session_ping",o),{error:n.error})},500)},this.onSessionDeleteRequest=async(i,n)=>{const{id:o}=n;try{this.isValidDisconnect({topic:i,reason:n.params}),await Promise.all([new Promise(l=>{this.client.core.relayer.once(vt.publish,async()=>{l(await this.deleteSession(i))})}),this.sendResult(o,i,!0)]),this.client.events.emit("session_delete",{id:o,topic:i})}catch(l){this.client.logger.error(l)}},this.onSessionRequest=async(i,n)=>{const{id:o,params:l}=n;try{this.isValidRequest(Sr({topic:i},l)),await this.setPendingSessionRequest({id:o,topic:i,params:l});const d=fs(JSON.stringify(n)),v=this.client.session.get(i),b=await this.getVerifyContext(d,v.peer.metadata);this.client.events.emit("session_request",{id:o,topic:i,params:l,verifyContext:b})}catch(d){await this.sendError(o,i,d),this.client.logger.error(d)}},this.onSessionRequestResponse=(i,n)=>{const{id:o}=n;ai(n)?this.events.emit(Ft("session_request",o),{result:n.result}):$r(n)&&this.events.emit(Ft("session_request",o),{error:n.error})},this.onSessionEventRequest=async(i,n)=>{const{id:o,params:l}=n;try{this.isValidEmit(Sr({topic:i},l)),this.client.events.emit("session_event",{id:o,topic:i,params:l})}catch(d){await this.sendError(o,i,d),this.client.logger.error(d)}},this.isValidConnect=async i=>{if(!ur(i)){const{message:b}=Q("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(i)}`);throw new Error(b)}const{pairingTopic:n,requiredNamespaces:o,optionalNamespaces:l,sessionProperties:d,relays:v}=i;if(_i(n)||await this.isValidPairingTopic(n),!Om(v,!0)){const{message:b}=Q("MISSING_OR_INVALID",`connect() relays: ${v}`);throw new Error(b)}!_i(o)&&so(o)!==0&&this.validateNamespaces(o,"requiredNamespaces"),!_i(l)&&so(l)!==0&&this.validateNamespaces(l,"optionalNamespaces"),_i(d)||this.validateSessionProps(d,"sessionProperties")},this.validateNamespaces=(i,n)=>{const o=Rm(i,"connect()",n);if(o)throw new Error(o.message)},this.isValidApprove=async i=>{if(!ur(i))throw new Error(Q("MISSING_OR_INVALID",`approve() params: ${i}`).message);const{id:n,namespaces:o,relayProtocol:l,sessionProperties:d}=i;await this.isValidProposalId(n);const v=this.client.proposal.get(n),b=Ha(o,"approve()");if(b)throw new Error(b.message);const m=Oh(v.requiredNamespaces,o,"approve()");if(m)throw new Error(m.message);if(!ls(l,!0)){const{message:S}=Q("MISSING_OR_INVALID",`approve() relayProtocol: ${l}`);throw new Error(S)}_i(d)||this.validateSessionProps(d,"sessionProperties")},this.isValidReject=async i=>{if(!ur(i)){const{message:l}=Q("MISSING_OR_INVALID",`reject() params: ${i}`);throw new Error(l)}const{id:n,reason:o}=i;if(await this.isValidProposalId(n),!Tm(o)){const{message:l}=Q("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(o)}`);throw new Error(l)}},this.isValidSessionSettleRequest=i=>{if(!ur(i)){const{message:m}=Q("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${i}`);throw new Error(m)}const{relay:n,controller:o,namespaces:l,expiry:d}=i;if(!Nm(n)){const{message:m}=Q("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(m)}const v=Dm(o,"onSessionSettleRequest()");if(v)throw new Error(v.message);const b=Ha(l,"onSessionSettleRequest()");if(b)throw new Error(b.message);if(wi(d)){const{message:m}=Q("EXPIRED","onSessionSettleRequest()");throw new Error(m)}},this.isValidUpdate=async i=>{if(!ur(i)){const{message:b}=Q("MISSING_OR_INVALID",`update() params: ${i}`);throw new Error(b)}const{topic:n,namespaces:o}=i;await this.isValidSessionTopic(n);const l=this.client.session.get(n),d=Ha(o,"update()");if(d)throw new Error(d.message);const v=Oh(l.requiredNamespaces,o,"update()");if(v)throw new Error(v.message)},this.isValidExtend=async i=>{if(!ur(i)){const{message:o}=Q("MISSING_OR_INVALID",`extend() params: ${i}`);throw new Error(o)}const{topic:n}=i;await this.isValidSessionTopic(n)},this.isValidRequest=async i=>{if(!ur(i)){const{message:b}=Q("MISSING_OR_INVALID",`request() params: ${i}`);throw new Error(b)}const{topic:n,request:o,chainId:l,expiry:d}=i;await this.isValidSessionTopic(n);const{namespaces:v}=this.client.session.get(n);if(!Rh(v,l)){const{message:b}=Q("MISSING_OR_INVALID",`request() chainId: ${l}`);throw new Error(b)}if(!Fm(o)){const{message:b}=Q("MISSING_OR_INVALID",`request() ${JSON.stringify(o)}`);throw new Error(b)}if(!Lm(v,l,o.method)){const{message:b}=Q("MISSING_OR_INVALID",`request() method: ${o.method}`);throw new Error(b)}if(d&&!$m(d,tc)){const{message:b}=Q("MISSING_OR_INVALID",`request() expiry: ${d}. Expiry must be a number (in seconds) between ${tc.min} and ${tc.max}`);throw new Error(b)}},this.isValidRespond=async i=>{if(!ur(i)){const{message:l}=Q("MISSING_OR_INVALID",`respond() params: ${i}`);throw new Error(l)}const{topic:n,response:o}=i;if(await this.isValidSessionTopic(n),!Mm(o)){const{message:l}=Q("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(l)}},this.isValidPing=async i=>{if(!ur(i)){const{message:o}=Q("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(o)}const{topic:n}=i;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async i=>{if(!ur(i)){const{message:v}=Q("MISSING_OR_INVALID",`emit() params: ${i}`);throw new Error(v)}const{topic:n,event:o,chainId:l}=i;await this.isValidSessionTopic(n);const{namespaces:d}=this.client.session.get(n);if(!Rh(d,l)){const{message:v}=Q("MISSING_OR_INVALID",`emit() chainId: ${l}`);throw new Error(v)}if(!jm(o)){const{message:v}=Q("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(v)}if(!zm(d,l,o.name)){const{message:v}=Q("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(v)}},this.isValidDisconnect=async i=>{if(!ur(i)){const{message:o}=Q("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(o)}const{topic:n}=i;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(i,n)=>{const o={verified:{verifyUrl:n.verifyUrl||"",validation:"UNKNOWN",origin:n.url||""}};try{const l=await this.client.core.verify.resolve({attestationId:i,verifyUrl:n.verifyUrl});l&&(o.verified.origin=l,o.verified.validation=l===n.url?"VALID":"INVALID")}catch(l){this.client.logger.error(l)}return this.client.logger.info(`Verify context: ${JSON.stringify(o)}`),o},this.validateSessionProps=(i,n)=>{Object.values(i).forEach(o=>{if(!ls(o,!1)){const{message:l}=Q("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(o)}`);throw new Error(l)}})}}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}registerRelayerEvents(){this.client.core.relayer.on(vt.message,async r=>{const{topic:i,message:n}=r;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const o=await this.client.core.crypto.decode(i,n);Ec(o)?(this.client.core.history.set(i,o),this.onRelayEventRequest({topic:i,payload:o})):yo(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:i,payload:o}),this.client.core.history.delete(i,o.id)):this.onRelayEventUnknownPayload({topic:i,payload:o})})}registerExpirerEvents(){this.client.core.expirer.on(Pr.expired,async r=>{const{topic:i,id:n}=Ml(r.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,Q("EXPIRED"),!0);i?this.client.session.keys.includes(i)&&(await this.deleteSession(i,!0),this.client.events.emit("session_expire",{topic:i})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(r){if(!ls(r,!1)){const{message:i}=Q("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(i)}if(!this.client.core.pairing.pairings.keys.includes(r)){const{message:i}=Q("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(i)}if(wi(this.client.core.pairing.pairings.get(r).expiry)){const{message:i}=Q("EXPIRED",`pairing topic: ${r}`);throw new Error(i)}}async isValidSessionTopic(r){if(!ls(r,!1)){const{message:i}=Q("MISSING_OR_INVALID",`session topic should be a string: ${r}`);throw new Error(i)}if(!this.client.session.keys.includes(r)){const{message:i}=Q("NO_MATCHING_KEY",`session topic doesn't exist: ${r}`);throw new Error(i)}if(wi(this.client.session.get(r).expiry)){await this.deleteSession(r);const{message:i}=Q("EXPIRED",`session topic: ${r}`);throw new Error(i)}}async isValidSessionOrPairingTopic(r){if(this.client.session.keys.includes(r))await this.isValidSessionTopic(r);else if(this.client.core.pairing.pairings.keys.includes(r))this.isValidPairingTopic(r);else if(ls(r,!1)){const{message:i}=Q("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${r}`);throw new Error(i)}else{const{message:i}=Q("MISSING_OR_INVALID",`session or pairing topic should be a string: ${r}`);throw new Error(i)}}async isValidProposalId(r){if(!Um(r)){const{message:i}=Q("MISSING_OR_INVALID",`proposal id should be a number: ${r}`);throw new Error(i)}if(!this.client.proposal.keys.includes(r)){const{message:i}=Q("NO_MATCHING_KEY",`proposal id doesn't exist: ${r}`);throw new Error(i)}if(wi(this.client.proposal.get(r).expiry)){await this.deleteProposal(r);const{message:i}=Q("EXPIRED",`proposal id: ${r}`);throw new Error(i)}}}class oE extends mo{constructor(r,i){super(r,i,Jb,Sc),this.core=r,this.logger=i}}class aE extends mo{constructor(r,i){super(r,i,Yb,Sc),this.core=r,this.logger=i}}class cE extends mo{constructor(r,i){super(r,i,Zb,Sc,n=>n.id),this.core=r,this.logger=i}}let uE=class If extends j1{constructor(r){super(r),this.protocol=wf,this.version=_f,this.name=ec.name,this.events=new Cr.EventEmitter,this.on=(n,o)=>this.events.on(n,o),this.once=(n,o)=>this.events.once(n,o),this.off=(n,o)=>this.events.off(n,o),this.removeListener=(n,o)=>this.events.removeListener(n,o),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(o){throw this.logger.error(o.message),o}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(o){throw this.logger.error(o.message),o}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(o){throw this.logger.error(o.message),o}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(o){throw this.logger.error(o.message),o}},this.update=async n=>{try{return await this.engine.update(n)}catch(o){throw this.logger.error(o.message),o}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(o){throw this.logger.error(o.message),o}},this.request=async n=>{try{return await this.engine.request(n)}catch(o){throw this.logger.error(o.message),o}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(o){throw this.logger.error(o.message),o}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(o){throw this.logger.error(o.message),o}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(o){throw this.logger.error(o.message),o}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(o){throw this.logger.error(o.message),o}},this.find=n=>{try{return this.engine.find(n)}catch(o){throw this.logger.error(o.message),o}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=(r==null?void 0:r.name)||ec.name,this.metadata=(r==null?void 0:r.metadata)||Sm();const i=typeof(r==null?void 0:r.logger)<"u"&&typeof(r==null?void 0:r.logger)!="string"?r.logger:Re.pino(Re.getDefaultLoggerOptions({level:(r==null?void 0:r.logger)||ec.logger}));this.core=(r==null?void 0:r.core)||new Gb(r),this.logger=Re.generateChildLogger(i,this.name),this.session=new aE(this.core,this.logger),this.proposal=new oE(this.core,this.logger),this.pendingRequest=new cE(this.core,this.logger),this.engine=new nE(this)}static async init(r){const i=new If(r);return await i.initialize(),i}get context(){return Re.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(r){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(r.message),r}}};var lc={exports:{}};(function(c,r){var i=typeof self<"u"?self:Mr,n=function(){function l(){this.fetch=!1,this.DOMException=i.DOMException}return l.prototype=i,new l}();(function(l){(function(d){var v={searchParams:"URLSearchParams"in l,iterable:"Symbol"in l&&"iterator"in Symbol,blob:"FileReader"in l&&"Blob"in l&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in l,arrayBuffer:"ArrayBuffer"in l};function b(y){return y&&DataView.prototype.isPrototypeOf(y)}if(v.arrayBuffer)var m=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],S=ArrayBuffer.isView||function(y){return y&&m.indexOf(Object.prototype.toString.call(y))>-1};function O(y){if(typeof y!="string"&&(y=String(y)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(y))throw new TypeError("Invalid character in header field name");return y.toLowerCase()}function F(y){return typeof y!="string"&&(y=String(y)),y}function z(y){var I={next:function(){var X=y.shift();return{done:X===void 0,value:X}}};return v.iterable&&(I[Symbol.iterator]=function(){return I}),I}function R(y){this.map={},y instanceof R?y.forEach(function(I,X){this.append(X,I)},this):Array.isArray(y)?y.forEach(function(I){this.append(I[0],I[1])},this):y&&Object.getOwnPropertyNames(y).forEach(function(I){this.append(I,y[I])},this)}R.prototype.append=function(y,I){y=O(y),I=F(I);var X=this.map[y];this.map[y]=X?X+", "+I:I},R.prototype.delete=function(y){delete this.map[O(y)]},R.prototype.get=function(y){return y=O(y),this.has(y)?this.map[y]:null},R.prototype.has=function(y){return this.map.hasOwnProperty(O(y))},R.prototype.set=function(y,I){this.map[O(y)]=F(I)},R.prototype.forEach=function(y,I){for(var X in this.map)this.map.hasOwnProperty(X)&&y.call(I,this.map[X],X,this)},R.prototype.keys=function(){var y=[];return this.forEach(function(I,X){y.push(X)}),z(y)},R.prototype.values=function(){var y=[];return this.forEach(function(I){y.push(I)}),z(y)},R.prototype.entries=function(){var y=[];return this.forEach(function(I,X){y.push([X,I])}),z(y)},v.iterable&&(R.prototype[Symbol.iterator]=R.prototype.entries);function K(y){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}function re(y){return new Promise(function(I,X){y.onload=function(){I(y.result)},y.onerror=function(){X(y.error)}})}function he(y){var I=new FileReader,X=re(I);return I.readAsArrayBuffer(y),X}function le(y){var I=new FileReader,X=re(I);return I.readAsText(y),X}function fe(y){for(var I=new Uint8Array(y),X=new Array(I.length),ce=0;ce-1?I:y}function W(y,I){I=I||{};var X=I.body;if(y instanceof W){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,I.headers||(this.headers=new R(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!X&&y._bodyInit!=null&&(X=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=I.credentials||this.credentials||"same-origin",(I.headers||!this.headers)&&(this.headers=new R(I.headers)),this.method=q(I.method||this.method||"GET"),this.mode=I.mode||this.mode||null,this.signal=I.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(X)}W.prototype.clone=function(){return new W(this,{body:this._bodyInit})};function ve(y){var I=new FormData;return y.trim().split("&").forEach(function(X){if(X){var ce=X.split("="),V=ce.shift().replace(/\+/g," "),B=ce.join("=").replace(/\+/g," ");I.append(decodeURIComponent(V),decodeURIComponent(B))}}),I}function ie(y){var I=new R,X=y.replace(/\r?\n[\t ]+/g," ");return X.split(/\r?\n/).forEach(function(ce){var V=ce.split(":"),B=V.shift().trim();if(B){var k=V.join(":").trim();I.append(B,k)}}),I}de.call(W.prototype);function ue(y,I){I||(I={}),this.type="default",this.status=I.status===void 0?200:I.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in I?I.statusText:"OK",this.headers=new R(I.headers),this.url=I.url||"",this._initBody(y)}de.call(ue.prototype),ue.prototype.clone=function(){return new ue(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new R(this.headers),url:this.url})},ue.error=function(){var y=new ue(null,{status:0,statusText:""});return y.type="error",y};var Te=[301,302,303,307,308];ue.redirect=function(y,I){if(Te.indexOf(I)===-1)throw new RangeError("Invalid status code");return new ue(null,{status:I,headers:{location:y}})},d.DOMException=l.DOMException;try{new d.DOMException}catch{d.DOMException=function(I,X){this.message=I,this.name=X;var ce=Error(I);this.stack=ce.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function Ue(y,I){return new Promise(function(X,ce){var V=new W(y,I);if(V.signal&&V.signal.aborted)return ce(new d.DOMException("Aborted","AbortError"));var B=new XMLHttpRequest;function k(){B.abort()}B.onload=function(){var G={status:B.status,statusText:B.statusText,headers:ie(B.getAllResponseHeaders()||"")};G.url="responseURL"in B?B.responseURL:G.headers.get("X-Request-URL");var Je="response"in B?B.response:B.responseText;X(new ue(Je,G))},B.onerror=function(){ce(new TypeError("Network request failed"))},B.ontimeout=function(){ce(new TypeError("Network request failed"))},B.onabort=function(){ce(new d.DOMException("Aborted","AbortError"))},B.open(V.method,V.url,!0),V.credentials==="include"?B.withCredentials=!0:V.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&v.blob&&(B.responseType="blob"),V.headers.forEach(function(G,Je){B.setRequestHeader(Je,G)}),V.signal&&(V.signal.addEventListener("abort",k),B.onreadystatechange=function(){B.readyState===4&&V.signal.removeEventListener("abort",k)}),B.send(typeof V._bodyInit>"u"?null:V._bodyInit)})}return Ue.polyfill=!0,l.fetch||(l.fetch=Ue,l.Headers=R,l.Request=W,l.Response=ue),d.Headers=R,d.Request=W,d.Response=ue,d.fetch=Ue,Object.defineProperty(d,"__esModule",{value:!0}),d})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;r=o.fetch,r.default=o.fetch,r.fetch=o.fetch,r.Headers=o.Headers,r.Request=o.Request,r.Response=o.Response,c.exports=r})(lc,lc.exports);var hE=lc.exports;const _l=Ll(hE),lE={Accept:"application/json","Content-Type":"application/json"},fE="POST",bl={headers:lE,method:fE},El=10;class Hi{constructor(r,i=!1){if(this.url=r,this.disableProviderPing=i,this.events=new Cr.EventEmitter,this.isAvailable=!1,this.registering=!1,!Jh(r))throw new Error(`Provided URL is not compatible with HTTP connection: ${r}`);this.url=r,this.disableProviderPing=i}get connected(){return this.isAvailable}get connecting(){return this.registering}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async open(r=this.url){await this.register(r)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(r,i){this.isAvailable||await this.register();try{const n=Ui(r),l=await(await _l(this.url,Object.assign(Object.assign({},bl),{body:n}))).json();this.onPayload({data:l})}catch(n){this.onError(r.id,n)}}async register(r=this.url){if(!Jh(r))throw new Error(`Provided URL is not compatible with HTTP connection: ${r}`);if(this.registering){const i=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=i||this.events.listenerCount("open")>=i)&&this.events.setMaxListeners(i+1),new Promise((n,o)=>{this.events.once("register_error",l=>{this.resetMaxListeners(),o(l)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return o(new Error("HTTP connection is missing or invalid"));n()})})}this.url=r,this.registering=!0;try{if(!this.disableProviderPing){const i=Ui({id:1,jsonrpc:"2.0",method:"test",params:[]});await _l(r,Object.assign(Object.assign({},bl),{body:i}))}this.onOpen()}catch(i){const n=this.parseError(i);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(r){if(typeof r.data>"u")return;const i=typeof r.data=="string"?Ks(r.data):r.data;this.events.emit("payload",i)}onError(r,i){const n=this.parseError(i),o=n.message||n.toString(),l=go(r,o);this.events.emit("payload",l)}parseError(r,i=this.url){return Ql(r,i,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>El&&this.events.setMaxListeners(El)}}const Il="error",pE="wss://relay.walletconnect.com",dE="wc",gE="universal_provider",xl=`${dE}@2:${gE}:`,yE="https://rpc.walletconnect.com/v1",Ii={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},fc={exports:{}};/** +import{g as im,d as ds,e as ne,f as sm,w as Dl,h as Fl,j as yc,k as fo,l as nm,c as Mr,a as Ll,I as _i,A as om,U as am,m as Q,n as cm,o as oc,p as um,q as hm,P as lm,V as Ah,s as fm,D as pm,C as dm,Z as Ch,$ as gm,u as ym,v as co,x as vm,y as $l,z as Lr,B as mm,E as wm,X as hs,F as Ft,G as tr,H as wi,J as ur,K as _m,L as ls,M as Ml,N as bm,O as Em,Q as Im,R as jl,S as xm,T as zl,Y as Ul,W as fs,a0 as ac,a1 as io,a2 as ps,a3 as Sm,a4 as so,a5 as Pm,a6 as Am,a7 as Cm,a8 as Om,a9 as Rm,aa as Ha,ab as Oh,ac as Tm,ad as Nm,ae as Dm,af as Rh,ag as Fm,ah as Lm,ai as $m,aj as Mm,ak as jm,al as zm,am as Um,an as no,ao as ql,ap as ka,aq as qm,ar as Bm}from"./index-6a2af3e6.js";import{e as Cr,N as vc}from"./events-fe40c1a3.js";const Hm=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,km=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Km=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Vm(c,r){if(c==="__proto__"||c==="constructor"&&r&&typeof r=="object"&&"prototype"in r){Gm(c);return}return r}function Gm(c){console.warn(`[destr] Dropping "${c}" key to prevent prototype pollution.`)}function Zn(c,r={}){if(typeof c!="string")return c;const i=c.trim();if(c[0]==='"'&&c.at(-1)==='"'&&!c.includes("\\"))return i.slice(1,-1);if(i.length<=9){const n=i.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Km.test(c)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return c}try{if(Hm.test(c)||km.test(c)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(c,Vm)}return JSON.parse(c)}catch(n){if(r.strict)throw n;return c}}function Wm(c){return!c||typeof c.then!="function"?Promise.resolve(c):c}function qt(c,...r){try{return Wm(c(...r))}catch(i){return Promise.reject(i)}}function Jm(c){const r=typeof c;return c===null||r!=="object"&&r!=="function"}function Ym(c){const r=Object.getPrototypeOf(c);return!r||r.isPrototypeOf(Object)}function oo(c){if(Jm(c))return String(c);if(Ym(c)||Array.isArray(c))return JSON.stringify(c);if(typeof c.toJSON=="function")return oo(c.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Bl(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const cc="base64:";function Xm(c){if(typeof c=="string")return c;Bl();const r=Buffer.from(c).toString("base64");return cc+r}function Zm(c){return typeof c!="string"||!c.startsWith(cc)?c:(Bl(),Buffer.from(c.slice(cc.length),"base64"))}function cr(c){return c?c.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function Qm(...c){return cr(c.join(":"))}function Qn(c){return c=cr(c),c?c+":":""}const e1="memory",t1=()=>{const c=new Map;return{name:e1,options:{},hasItem(r){return c.has(r)},getItem(r){return c.get(r)??null},getItemRaw(r){return c.get(r)??null},setItem(r,i){c.set(r,i)},setItemRaw(r,i){c.set(r,i)},removeItem(r){c.delete(r)},getKeys(){return Array.from(c.keys())},clear(){c.clear()},dispose(){c.clear()}}};function r1(c={}){const r={mounts:{"":c.driver||t1()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},i=m=>{for(const S of r.mountpoints)if(m.startsWith(S))return{base:S,relativeKey:m.slice(S.length),driver:r.mounts[S]};return{base:"",relativeKey:m,driver:r.mounts[""]}},n=(m,S)=>r.mountpoints.filter(O=>O.startsWith(m)||S&&m.startsWith(O)).map(O=>({relativeBase:m.length>O.length?m.slice(O.length):void 0,mountpoint:O,driver:r.mounts[O]})),o=(m,S)=>{if(r.watching){S=cr(S);for(const O of r.watchListeners)O(m,S)}},l=async()=>{if(!r.watching){r.watching=!0;for(const m in r.mounts)r.unwatch[m]=await Th(r.mounts[m],o,m)}},d=async()=>{if(r.watching){for(const m in r.unwatch)await r.unwatch[m]();r.unwatch={},r.watching=!1}},v=(m,S,O)=>{const F=new Map,z=R=>{let K=F.get(R.base);return K||(K={driver:R.driver,base:R.base,items:[]},F.set(R.base,K)),K};for(const R of m){const K=typeof R=="string",re=cr(K?R:R.key),he=K?void 0:R.value,le=K||!R.options?S:{...S,...R.options},fe=i(re);z(fe).items.push({key:re,value:he,relativeKey:fe.relativeKey,options:le})}return Promise.all([...F.values()].map(R=>O(R))).then(R=>R.flat())},b={hasItem(m,S={}){m=cr(m);const{relativeKey:O,driver:F}=i(m);return qt(F.hasItem,O,S)},getItem(m,S={}){m=cr(m);const{relativeKey:O,driver:F}=i(m);return qt(F.getItem,O,S).then(z=>Zn(z))},getItems(m,S){return v(m,S,O=>O.driver.getItems?qt(O.driver.getItems,O.items.map(F=>({key:F.relativeKey,options:F.options})),S).then(F=>F.map(z=>({key:Qm(O.base,z.key),value:Zn(z.value)}))):Promise.all(O.items.map(F=>qt(O.driver.getItem,F.relativeKey,F.options).then(z=>({key:F.key,value:Zn(z)})))))},getItemRaw(m,S={}){m=cr(m);const{relativeKey:O,driver:F}=i(m);return F.getItemRaw?qt(F.getItemRaw,O,S):qt(F.getItem,O,S).then(z=>Zm(z))},async setItem(m,S,O={}){if(S===void 0)return b.removeItem(m);m=cr(m);const{relativeKey:F,driver:z}=i(m);z.setItem&&(await qt(z.setItem,F,oo(S),O),z.watch||o("update",m))},async setItems(m,S){await v(m,S,async O=>{O.driver.setItems&&await qt(O.driver.setItems,O.items.map(F=>({key:F.relativeKey,value:oo(F.value),options:F.options})),S),O.driver.setItem&&await Promise.all(O.items.map(F=>qt(O.driver.setItem,F.relativeKey,oo(F.value),F.options)))})},async setItemRaw(m,S,O={}){if(S===void 0)return b.removeItem(m,O);m=cr(m);const{relativeKey:F,driver:z}=i(m);if(z.setItemRaw)await qt(z.setItemRaw,F,S,O);else if(z.setItem)await qt(z.setItem,F,Xm(S),O);else return;z.watch||o("update",m)},async removeItem(m,S={}){typeof S=="boolean"&&(S={removeMeta:S}),m=cr(m);const{relativeKey:O,driver:F}=i(m);F.removeItem&&(await qt(F.removeItem,O,S),(S.removeMeta||S.removeMata)&&await qt(F.removeItem,O+"$",S),F.watch||o("remove",m))},async getMeta(m,S={}){typeof S=="boolean"&&(S={nativeOnly:S}),m=cr(m);const{relativeKey:O,driver:F}=i(m),z=Object.create(null);if(F.getMeta&&Object.assign(z,await qt(F.getMeta,O,S)),!S.nativeOnly){const R=await qt(F.getItem,O+"$",S).then(K=>Zn(K));R&&typeof R=="object"&&(typeof R.atime=="string"&&(R.atime=new Date(R.atime)),typeof R.mtime=="string"&&(R.mtime=new Date(R.mtime)),Object.assign(z,R))}return z},setMeta(m,S,O={}){return this.setItem(m+"$",S,O)},removeMeta(m,S={}){return this.removeItem(m+"$",S)},async getKeys(m,S={}){m=Qn(m);const O=n(m,!0);let F=[];const z=[];for(const R of O){const re=(await qt(R.driver.getKeys,R.relativeBase,S)).map(he=>R.mountpoint+cr(he)).filter(he=>!F.some(le=>he.startsWith(le)));z.push(...re),F=[R.mountpoint,...F.filter(he=>!he.startsWith(R.mountpoint))]}return m?z.filter(R=>R.startsWith(m)&&!R.endsWith("$")):z.filter(R=>!R.endsWith("$"))},async clear(m,S={}){m=Qn(m),await Promise.all(n(m,!1).map(async O=>{if(O.driver.clear)return qt(O.driver.clear,O.relativeBase,S);if(O.driver.removeItem){const F=await O.driver.getKeys(O.relativeBase||"",S);return Promise.all(F.map(z=>O.driver.removeItem(z,S)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(m=>Nh(m)))},async watch(m){return await l(),r.watchListeners.push(m),async()=>{r.watchListeners=r.watchListeners.filter(S=>S!==m),r.watchListeners.length===0&&await d()}},async unwatch(){r.watchListeners=[],await d()},mount(m,S){if(m=Qn(m),m&&r.mounts[m])throw new Error(`already mounted at ${m}`);return m&&(r.mountpoints.push(m),r.mountpoints.sort((O,F)=>F.length-O.length)),r.mounts[m]=S,r.watching&&Promise.resolve(Th(S,o,m)).then(O=>{r.unwatch[m]=O}).catch(console.error),b},async unmount(m,S=!0){m=Qn(m),!(!m||!r.mounts[m])&&(r.watching&&m in r.unwatch&&(r.unwatch[m](),delete r.unwatch[m]),S&&await Nh(r.mounts[m]),r.mountpoints=r.mountpoints.filter(O=>O!==m),delete r.mounts[m])},getMount(m=""){m=cr(m)+":";const S=i(m);return{driver:S.driver,base:S.base}},getMounts(m="",S={}){return m=cr(m),n(m,S.parents).map(F=>({driver:F.driver,base:F.mountpoint}))}};return b}function Th(c,r,i){return c.watch?c.watch((n,o)=>r(n,i+o)):()=>{}}async function Nh(c){typeof c.dispose=="function"&&await qt(c.dispose)}function qi(c){return new Promise((r,i)=>{c.oncomplete=c.onsuccess=()=>r(c.result),c.onabort=c.onerror=()=>i(c.error)})}function Hl(c,r){const i=indexedDB.open(c);i.onupgradeneeded=()=>i.result.createObjectStore(r);const n=qi(i);return(o,l)=>n.then(d=>l(d.transaction(r,o).objectStore(r)))}let Ka;function ks(){return Ka||(Ka=Hl("keyval-store","keyval")),Ka}function Dh(c,r=ks()){return r("readonly",i=>qi(i.get(c)))}function i1(c,r,i=ks()){return i("readwrite",n=>(n.put(r,c),qi(n.transaction)))}function s1(c,r=ks()){return r("readwrite",i=>(i.delete(c),qi(i.transaction)))}function n1(c=ks()){return c("readwrite",r=>(r.clear(),qi(r.transaction)))}function o1(c,r){return c.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},qi(c.transaction)}function a1(c=ks()){return c("readonly",r=>{if(r.getAllKeys)return qi(r.getAllKeys());const i=[];return o1(r,n=>i.push(n.key)).then(()=>i)})}const c1=c=>JSON.stringify(c,(r,i)=>typeof i=="bigint"?i.toString()+"n":i),u1=c=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,i=c.replace(r,'$1"$2n"$3');return JSON.parse(i,(n,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Ks(c){if(typeof c!="string")throw new Error(`Cannot safe json parse value of type ${typeof c}`);try{return u1(c)}catch{return c}}function Ui(c){return typeof c=="string"?c:c1(c)||""}const h1="idb-keyval";var l1=(c={})=>{const r=c.base&&c.base.length>0?`${c.base}:`:"",i=o=>r+o;let n;return c.dbName&&c.storeName&&(n=Hl(c.dbName,c.storeName)),{name:h1,options:c,async hasItem(o){return!(typeof await Dh(i(o),n)>"u")},async getItem(o){return await Dh(i(o),n)??null},setItem(o,l){return i1(i(o),l,n)},removeItem(o){return s1(i(o),n)},getKeys(){return a1(n)},clear(){return n1(n)}}};const f1="WALLET_CONNECT_V2_INDEXED_DB",p1="keyvaluestorage";let d1=class{constructor(){this.indexedDb=r1({driver:l1({dbName:f1,storeName:p1})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const i=await this.indexedDb.getItem(r);if(i!==null)return i}async setItem(r,i){await this.indexedDb.setItem(r,Ui(i))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Va=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ao={exports:{}};(function(){let c;function r(){}c=r,c.prototype.getItem=function(i){return this.hasOwnProperty(i)?String(this[i]):null},c.prototype.setItem=function(i,n){this[i]=String(n)},c.prototype.removeItem=function(i){delete this[i]},c.prototype.clear=function(){const i=this;Object.keys(i).forEach(function(n){i[n]=void 0,delete i[n]})},c.prototype.key=function(i){return i=i||0,Object.keys(this)[i]},c.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Va<"u"&&Va.localStorage?ao.exports=Va.localStorage:typeof window<"u"&&window.localStorage?ao.exports=window.localStorage:ao.exports=new r})();function g1(c){var r;return[c[0],Ks((r=c[1])!=null?r:"")]}let y1=class{constructor(){this.localStorage=ao.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(g1)}async getItem(r){const i=this.localStorage.getItem(r);if(i!==null)return Ks(i)}async setItem(r,i){this.localStorage.setItem(r,Ui(i))}async removeItem(r){this.localStorage.removeItem(r)}};const v1="wc_storage_version",Fh=1,m1=async(c,r,i)=>{const n=v1,o=await r.getItem(n);if(o&&o>=Fh){i(r);return}const l=await c.getKeys();if(!l.length){i(r);return}const d=[];for(;l.length;){const v=l.shift();if(!v)continue;const b=v.toLowerCase();if(b.includes("wc@")||b.includes("walletconnect")||b.includes("wc_")||b.includes("wallet_connect")){const m=await c.getItem(v);await r.setItem(v,m),d.push(v)}}await r.setItem(n,Fh),i(r),w1(c,d)},w1=async(c,r)=>{r.length&&r.forEach(async i=>{await c.removeItem(i)})};let _1=class{constructor(){this.initialized=!1,this.setInitialized=i=>{this.storage=i,this.initialized=!0};const r=new y1;this.storage=r;try{const i=new d1;m1(r,i,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,i){return await this.initialize(),this.storage.setItem(r,i)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const i=setInterval(()=>{this.initialized&&(clearInterval(i),r())},20)})}};var gs={},Ls={},Ga={},$s={};let Bi=class{};const b1=Object.freeze(Object.defineProperty({__proto__:null,IEvents:Bi},Symbol.toStringTag,{value:"Module"})),E1=im(b1);var Lh;function I1(){if(Lh)return $s;Lh=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.IHeartBeat=void 0;const c=E1;class r extends c.IEvents{constructor(n){super()}}return $s.IHeartBeat=r,$s}var $h;function kl(){return $h||($h=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),ds.__exportStar(I1(),c)}(Ga)),Ga}var Wa={},ji={},Mh;function x1(){if(Mh)return ji;Mh=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.HEARTBEAT_EVENTS=ji.HEARTBEAT_INTERVAL=void 0;const c=ne;return ji.HEARTBEAT_INTERVAL=c.FIVE_SECONDS,ji.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},ji}var jh;function Kl(){return jh||(jh=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),ds.__exportStar(x1(),c)}(Wa)),Wa}var zh;function S1(){if(zh)return Ls;zh=1,Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.HeartBeat=void 0;const c=ds,r=Cr,i=ne,n=kl(),o=Kl();class l extends n.IHeartBeat{constructor(v){super(v),this.events=new r.EventEmitter,this.interval=o.HEARTBEAT_INTERVAL,this.interval=(v==null?void 0:v.interval)||o.HEARTBEAT_INTERVAL}static init(v){return c.__awaiter(this,void 0,void 0,function*(){const b=new l(v);return yield b.init(),b})}init(){return c.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(v,b){this.events.on(v,b)}once(v,b){this.events.once(v,b)}off(v,b){this.events.off(v,b)}removeListener(v,b){this.events.removeListener(v,b)}initialize(){return c.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),i.toMiliseconds(this.interval))})}pulse(){this.events.emit(o.HEARTBEAT_EVENTS.pulse)}}return Ls.HeartBeat=l,Ls}(function(c){Object.defineProperty(c,"__esModule",{value:!0});const r=ds;r.__exportStar(S1(),c),r.__exportStar(kl(),c),r.__exportStar(Kl(),c)})(gs);var Re={},Ja,Uh;function P1(){if(Uh)return Ja;Uh=1;function c(i){try{return JSON.stringify(i)}catch{return'"[Circular]"'}}Ja=r;function r(i,n,o){var l=o&&o.stringify||c,d=1;if(typeof i=="object"&&i!==null){var v=n.length+d;if(v===1)return i;var b=new Array(v);b[0]=l(i);for(var m=1;m-1?z:0,i.charCodeAt(K+1)){case 100:case 102:if(F>=S||n[F]==null)break;z=S||n[F]==null)break;z=S||n[F]===void 0)break;z",z=K+2,K++;break}O+=l(n[F]),z=K+2,K++;break;case 115:if(F>=S)break;z-1&&(ue=!1);const Te=["error","fatal","warn","info","debug","trace"];typeof W=="function"&&(W.error=W.fatal=W.warn=W.info=W.debug=W.trace=W),L.enabled===!1&&(L.level="silent");const Ue=L.level||"info",y=Object.create(W);y.log||(y.log=re),Object.defineProperty(y,"levelVal",{get:X}),Object.defineProperty(y,"level",{get:ce,set:V});const I={transmit:q,serialize:ie,asObject:L.browser.asObject,levels:Te,timestamp:z(L)};y.levels=o.levels,y.level=Ue,y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=re,y.serializers=ve,y._serialize=ie,y._stdErrSerialize=ue,y.child=B,q&&(y._logEvent=O());function X(){return this.level==="silent"?1/0:this.levels.values[this.level]}function ce(){return this._level}function V(k){if(k!=="silent"&&!this.levels.values[k])throw Error("unknown level "+k);this._level=k,l(I,y,"error","log"),l(I,y,"fatal","error"),l(I,y,"warn","error"),l(I,y,"info","log"),l(I,y,"debug","log"),l(I,y,"trace","log")}function B(k,G){if(!k)throw new Error("missing bindings for child Pino");G=G||{},ie&&k.serializers&&(G.serializers=k.serializers);const Je=G.serializers;if(ie&&Je){var He=Object.assign({},ve,Je),jr=L.browser.serialize===!0?Object.keys(He):ie;delete k.serializers,b([k],jr,He,this._stdErrSerialize)}function Ie(xt){this._childLevel=(xt._childLevel|0)+1,this.error=m(xt,k,"error"),this.fatal=m(xt,k,"fatal"),this.warn=m(xt,k,"warn"),this.info=m(xt,k,"info"),this.debug=m(xt,k,"debug"),this.trace=m(xt,k,"trace"),He&&(this.serializers=He,this._serialize=jr),q&&(this._logEvent=O([].concat(xt._logEvent.bindings,k)))}return Ie.prototype=this,new Ie(this)}return y}o.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},o.stdSerializers=i,o.stdTimeFunctions=Object.assign({},{nullTime:he,epochTime:le,unixTime:fe,isoTime:pe});function l(L,q,W,ve){const ie=Object.getPrototypeOf(q);q[W]=q.levelVal>q.levels.values[W]?re:ie[W]?ie[W]:r[W]||r[ve]||re,d(L,q,W)}function d(L,q,W){!L.transmit&&q[W]===re||(q[W]=function(ve){return function(){const ue=L.timestamp(),Te=new Array(arguments.length),Ue=Object.getPrototypeOf&&Object.getPrototypeOf(this)===r?r:this;for(var y=0;y-1&&ue in W&&(L[ie][ue]=W[ue](L[ie][ue]))}function m(L,q,W){return function(){const ve=new Array(1+arguments.length);ve[0]=q;for(var ie=1;ie"u"?m=i(v,b):m=v.bindings().context||"",m}er.getLoggerContext=o;function l(v,b,m=c.PINO_CUSTOM_CONTEXT_KEY){const S=o(v,m);return S.trim()?`${S}/${b}`:b}er.formatChildLoggerContext=l;function d(v,b,m=c.PINO_CUSTOM_CONTEXT_KEY){const S=l(v,b,m),O=v.child({context:S});return n(O,S,m)}return er.generateChildLogger=d,er}(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.pino=void 0;const r=ds,i=r.__importDefault(A1());Object.defineProperty(c,"pino",{enumerable:!0,get:function(){return i.default}}),r.__exportStar(Vl(),c),r.__exportStar(C1(),c)})(Re);class O1 extends Bi{constructor(r){super(),this.opts=r,this.protocol="wc",this.version=2}}class R1 extends Bi{constructor(r,i){super(),this.core=r,this.logger=i,this.records=new Map}}class T1{constructor(r,i){this.logger=r,this.core=i}}let N1=class extends Bi{constructor(r,i){super(),this.relayer=r,this.logger=i}},D1=class extends Bi{constructor(r){super()}},F1=class{constructor(r,i,n,o){this.core=r,this.logger=i,this.name=n}};class L1 extends Bi{constructor(r,i){super(),this.relayer=r,this.logger=i}}let $1=class extends Bi{constructor(r,i){super(),this.core=r,this.logger=i}},M1=class{constructor(r,i){this.projectId=r,this.logger=i}},j1=class{constructor(r){this.opts=r,this.protocol="wc",this.version=2}},z1=class{constructor(r){this.client=r}};var mc={},Gl={};(function(c){Object.defineProperty(c,"__esModule",{value:!0});var r=sm,i=Dl;c.DIGEST_LENGTH=64,c.BLOCK_SIZE=128;var n=function(){function v(){this.digestLength=c.DIGEST_LENGTH,this.blockSize=c.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return v.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},v.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},v.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},v.prototype.update=function(b,m){if(m===void 0&&(m=b.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var S=0;if(this._bytesHashed+=m,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=b[S++],m--;this._bufferLength===this.blockSize&&(l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(m>=this.blockSize&&(S=l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,b,S,m),m%=this.blockSize);m>0;)this._buffer[this._bufferLength++]=b[S++],m--;return this},v.prototype.finish=function(b){if(!this._finished){var m=this._bytesHashed,S=this._bufferLength,O=m/536870912|0,F=m<<3,z=m%128<112?128:256;this._buffer[S]=128;for(var R=S+1;R0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},v.prototype.restoreState=function(b){return this._stateHi.set(b.stateHi),this._stateLo.set(b.stateLo),this._bufferLength=b.bufferLength,b.buffer&&this._buffer.set(b.buffer),this._bytesHashed=b.bytesHashed,this._finished=!1,this},v.prototype.cleanSavedState=function(b){i.wipe(b.stateHi),i.wipe(b.stateLo),b.buffer&&i.wipe(b.buffer),b.bufferLength=0,b.bytesHashed=0},v}();c.SHA512=n;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function l(v,b,m,S,O,F,z){for(var R=m[0],K=m[1],re=m[2],he=m[3],le=m[4],fe=m[5],pe=m[6],de=m[7],L=S[0],q=S[1],W=S[2],ve=S[3],ie=S[4],ue=S[5],Te=S[6],Ue=S[7],y,I,X,ce,V,B,k,G;z>=128;){for(var Je=0;Je<16;Je++){var He=8*Je+F;v[Je]=r.readUint32BE(O,He),b[Je]=r.readUint32BE(O,He+4)}for(var Je=0;Je<80;Je++){var jr=R,Ie=K,xt=re,D=he,N=le,C=fe,u=pe,E=de,ee=L,ge=q,be=W,Ne=ve,Fe=ie,Pe=ue,St=Te,mt=Ue;if(y=de,I=Ue,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=(le>>>14|ie<<32-14)^(le>>>18|ie<<32-18)^(ie>>>41-32|le<<32-(41-32)),I=(ie>>>14|le<<32-14)^(ie>>>18|le<<32-18)^(le>>>41-32|ie<<32-(41-32)),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=le&fe^~le&pe,I=ie&ue^~ie&Te,V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=o[Je*2],I=o[Je*2+1],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=v[Je%16],I=b[Je%16],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,X=k&65535|G<<16,ce=V&65535|B<<16,y=X,I=ce,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=(R>>>28|L<<32-28)^(L>>>34-32|R<<32-(34-32))^(L>>>39-32|R<<32-(39-32)),I=(L>>>28|R<<32-28)^(R>>>34-32|L<<32-(34-32))^(R>>>39-32|L<<32-(39-32)),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,y=R&K^R&re^K&re,I=L&q^L&W^q&W,V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,E=k&65535|G<<16,mt=V&65535|B<<16,y=D,I=Ne,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=X,I=ce,V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,D=k&65535|G<<16,Ne=V&65535|B<<16,K=jr,re=Ie,he=xt,le=D,fe=N,pe=C,de=u,R=E,q=ee,W=ge,ve=be,ie=Ne,ue=Fe,Te=Pe,Ue=St,L=mt,Je%16===15)for(var He=0;He<16;He++)y=v[He],I=b[He],V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=v[(He+9)%16],I=b[(He+9)%16],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,X=v[(He+1)%16],ce=b[(He+1)%16],y=(X>>>1|ce<<32-1)^(X>>>8|ce<<32-8)^X>>>7,I=(ce>>>1|X<<32-1)^(ce>>>8|X<<32-8)^(ce>>>7|X<<32-7),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,X=v[(He+14)%16],ce=b[(He+14)%16],y=(X>>>19|ce<<32-19)^(ce>>>61-32|X<<32-(61-32))^X>>>6,I=(ce>>>19|X<<32-19)^(X>>>61-32|ce<<32-(61-32))^(ce>>>6|X<<32-6),V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,v[He]=k&65535|G<<16,b[He]=V&65535|B<<16}y=R,I=L,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[0],I=S[0],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[0]=R=k&65535|G<<16,S[0]=L=V&65535|B<<16,y=K,I=q,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[1],I=S[1],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[1]=K=k&65535|G<<16,S[1]=q=V&65535|B<<16,y=re,I=W,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[2],I=S[2],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[2]=re=k&65535|G<<16,S[2]=W=V&65535|B<<16,y=he,I=ve,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[3],I=S[3],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[3]=he=k&65535|G<<16,S[3]=ve=V&65535|B<<16,y=le,I=ie,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[4],I=S[4],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[4]=le=k&65535|G<<16,S[4]=ie=V&65535|B<<16,y=fe,I=ue,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[5],I=S[5],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[5]=fe=k&65535|G<<16,S[5]=ue=V&65535|B<<16,y=pe,I=Te,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[6],I=S[6],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[6]=pe=k&65535|G<<16,S[6]=Te=V&65535|B<<16,y=de,I=Ue,V=I&65535,B=I>>>16,k=y&65535,G=y>>>16,y=m[7],I=S[7],V+=I&65535,B+=I>>>16,k+=y&65535,G+=y>>>16,B+=V>>>16,k+=B>>>16,G+=k>>>16,m[7]=de=k&65535|G<<16,S[7]=Ue=V&65535|B<<16,F+=128,z-=128}return F}function d(v){var b=new n;b.update(v);var m=b.digest();return b.clean(),m}c.hash=d})(Gl);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.convertSecretKeyToX25519=c.convertPublicKeyToX25519=c.verify=c.sign=c.extractPublicKeyFromSecretKey=c.generateKeyPair=c.generateKeyPairFromSeed=c.SEED_LENGTH=c.SECRET_KEY_LENGTH=c.PUBLIC_KEY_LENGTH=c.SIGNATURE_LENGTH=void 0;const r=Fl,i=Gl,n=Dl;c.SIGNATURE_LENGTH=64,c.PUBLIC_KEY_LENGTH=32,c.SECRET_KEY_LENGTH=64,c.SEED_LENGTH=32;function o(D){const N=new Float64Array(16);if(D)for(let C=0;C>16&1),C[ge-1]&=65535;C[15]=u[15]-32767-(C[14]>>16&1);const ee=C[15]>>16&1;C[14]&=65535,K(u,C,1-ee)}for(let E=0;E<16;E++)D[2*E]=u[E]&255,D[2*E+1]=u[E]>>8}function he(D,N){let C=0;for(let u=0;u<32;u++)C|=D[u]^N[u];return(1&C-1>>>8)-1}function le(D,N){const C=new Uint8Array(32),u=new Uint8Array(32);return re(C,D),re(u,N),he(C,u)}function fe(D){const N=new Uint8Array(32);return re(N,D),N[0]&1}function pe(D,N){for(let C=0;C<16;C++)D[C]=N[2*C]+(N[2*C+1]<<8);D[15]&=32767}function de(D,N,C){for(let u=0;u<16;u++)D[u]=N[u]+C[u]}function L(D,N,C){for(let u=0;u<16;u++)D[u]=N[u]-C[u]}function q(D,N,C){let u,E,ee=0,ge=0,be=0,Ne=0,Fe=0,Pe=0,St=0,mt=0,nt=0,$e=0,Xe=0,Ze=0,ot=0,qe=0,Qe=0,De=0,ke=0,ut=0,je=0,Pt=0,Lt=0,Bt=0,Ht=0,jt=0,Wt=0,rr=0,zr=0,Jt=0,Gr=0,ci=0,xi=0,ht=C[0],rt=C[1],lt=C[2],ft=C[3],at=C[4],it=C[5],At=C[6],Ct=C[7],pt=C[8],Ot=C[9],dt=C[10],wt=C[11],gt=C[12],Ye=C[13],Rt=C[14],Tt=C[15];u=N[0],ee+=u*ht,ge+=u*rt,be+=u*lt,Ne+=u*ft,Fe+=u*at,Pe+=u*it,St+=u*At,mt+=u*Ct,nt+=u*pt,$e+=u*Ot,Xe+=u*dt,Ze+=u*wt,ot+=u*gt,qe+=u*Ye,Qe+=u*Rt,De+=u*Tt,u=N[1],ge+=u*ht,be+=u*rt,Ne+=u*lt,Fe+=u*ft,Pe+=u*at,St+=u*it,mt+=u*At,nt+=u*Ct,$e+=u*pt,Xe+=u*Ot,Ze+=u*dt,ot+=u*wt,qe+=u*gt,Qe+=u*Ye,De+=u*Rt,ke+=u*Tt,u=N[2],be+=u*ht,Ne+=u*rt,Fe+=u*lt,Pe+=u*ft,St+=u*at,mt+=u*it,nt+=u*At,$e+=u*Ct,Xe+=u*pt,Ze+=u*Ot,ot+=u*dt,qe+=u*wt,Qe+=u*gt,De+=u*Ye,ke+=u*Rt,ut+=u*Tt,u=N[3],Ne+=u*ht,Fe+=u*rt,Pe+=u*lt,St+=u*ft,mt+=u*at,nt+=u*it,$e+=u*At,Xe+=u*Ct,Ze+=u*pt,ot+=u*Ot,qe+=u*dt,Qe+=u*wt,De+=u*gt,ke+=u*Ye,ut+=u*Rt,je+=u*Tt,u=N[4],Fe+=u*ht,Pe+=u*rt,St+=u*lt,mt+=u*ft,nt+=u*at,$e+=u*it,Xe+=u*At,Ze+=u*Ct,ot+=u*pt,qe+=u*Ot,Qe+=u*dt,De+=u*wt,ke+=u*gt,ut+=u*Ye,je+=u*Rt,Pt+=u*Tt,u=N[5],Pe+=u*ht,St+=u*rt,mt+=u*lt,nt+=u*ft,$e+=u*at,Xe+=u*it,Ze+=u*At,ot+=u*Ct,qe+=u*pt,Qe+=u*Ot,De+=u*dt,ke+=u*wt,ut+=u*gt,je+=u*Ye,Pt+=u*Rt,Lt+=u*Tt,u=N[6],St+=u*ht,mt+=u*rt,nt+=u*lt,$e+=u*ft,Xe+=u*at,Ze+=u*it,ot+=u*At,qe+=u*Ct,Qe+=u*pt,De+=u*Ot,ke+=u*dt,ut+=u*wt,je+=u*gt,Pt+=u*Ye,Lt+=u*Rt,Bt+=u*Tt,u=N[7],mt+=u*ht,nt+=u*rt,$e+=u*lt,Xe+=u*ft,Ze+=u*at,ot+=u*it,qe+=u*At,Qe+=u*Ct,De+=u*pt,ke+=u*Ot,ut+=u*dt,je+=u*wt,Pt+=u*gt,Lt+=u*Ye,Bt+=u*Rt,Ht+=u*Tt,u=N[8],nt+=u*ht,$e+=u*rt,Xe+=u*lt,Ze+=u*ft,ot+=u*at,qe+=u*it,Qe+=u*At,De+=u*Ct,ke+=u*pt,ut+=u*Ot,je+=u*dt,Pt+=u*wt,Lt+=u*gt,Bt+=u*Ye,Ht+=u*Rt,jt+=u*Tt,u=N[9],$e+=u*ht,Xe+=u*rt,Ze+=u*lt,ot+=u*ft,qe+=u*at,Qe+=u*it,De+=u*At,ke+=u*Ct,ut+=u*pt,je+=u*Ot,Pt+=u*dt,Lt+=u*wt,Bt+=u*gt,Ht+=u*Ye,jt+=u*Rt,Wt+=u*Tt,u=N[10],Xe+=u*ht,Ze+=u*rt,ot+=u*lt,qe+=u*ft,Qe+=u*at,De+=u*it,ke+=u*At,ut+=u*Ct,je+=u*pt,Pt+=u*Ot,Lt+=u*dt,Bt+=u*wt,Ht+=u*gt,jt+=u*Ye,Wt+=u*Rt,rr+=u*Tt,u=N[11],Ze+=u*ht,ot+=u*rt,qe+=u*lt,Qe+=u*ft,De+=u*at,ke+=u*it,ut+=u*At,je+=u*Ct,Pt+=u*pt,Lt+=u*Ot,Bt+=u*dt,Ht+=u*wt,jt+=u*gt,Wt+=u*Ye,rr+=u*Rt,zr+=u*Tt,u=N[12],ot+=u*ht,qe+=u*rt,Qe+=u*lt,De+=u*ft,ke+=u*at,ut+=u*it,je+=u*At,Pt+=u*Ct,Lt+=u*pt,Bt+=u*Ot,Ht+=u*dt,jt+=u*wt,Wt+=u*gt,rr+=u*Ye,zr+=u*Rt,Jt+=u*Tt,u=N[13],qe+=u*ht,Qe+=u*rt,De+=u*lt,ke+=u*ft,ut+=u*at,je+=u*it,Pt+=u*At,Lt+=u*Ct,Bt+=u*pt,Ht+=u*Ot,jt+=u*dt,Wt+=u*wt,rr+=u*gt,zr+=u*Ye,Jt+=u*Rt,Gr+=u*Tt,u=N[14],Qe+=u*ht,De+=u*rt,ke+=u*lt,ut+=u*ft,je+=u*at,Pt+=u*it,Lt+=u*At,Bt+=u*Ct,Ht+=u*pt,jt+=u*Ot,Wt+=u*dt,rr+=u*wt,zr+=u*gt,Jt+=u*Ye,Gr+=u*Rt,ci+=u*Tt,u=N[15],De+=u*ht,ke+=u*rt,ut+=u*lt,je+=u*ft,Pt+=u*at,Lt+=u*it,Bt+=u*At,Ht+=u*Ct,jt+=u*pt,Wt+=u*Ot,rr+=u*dt,zr+=u*wt,Jt+=u*gt,Gr+=u*Ye,ci+=u*Rt,xi+=u*Tt,ee+=38*ke,ge+=38*ut,be+=38*je,Ne+=38*Pt,Fe+=38*Lt,Pe+=38*Bt,St+=38*Ht,mt+=38*jt,nt+=38*Wt,$e+=38*rr,Xe+=38*zr,Ze+=38*Jt,ot+=38*Gr,qe+=38*ci,Qe+=38*xi,E=1,u=ee+E+65535,E=Math.floor(u/65536),ee=u-E*65536,u=ge+E+65535,E=Math.floor(u/65536),ge=u-E*65536,u=be+E+65535,E=Math.floor(u/65536),be=u-E*65536,u=Ne+E+65535,E=Math.floor(u/65536),Ne=u-E*65536,u=Fe+E+65535,E=Math.floor(u/65536),Fe=u-E*65536,u=Pe+E+65535,E=Math.floor(u/65536),Pe=u-E*65536,u=St+E+65535,E=Math.floor(u/65536),St=u-E*65536,u=mt+E+65535,E=Math.floor(u/65536),mt=u-E*65536,u=nt+E+65535,E=Math.floor(u/65536),nt=u-E*65536,u=$e+E+65535,E=Math.floor(u/65536),$e=u-E*65536,u=Xe+E+65535,E=Math.floor(u/65536),Xe=u-E*65536,u=Ze+E+65535,E=Math.floor(u/65536),Ze=u-E*65536,u=ot+E+65535,E=Math.floor(u/65536),ot=u-E*65536,u=qe+E+65535,E=Math.floor(u/65536),qe=u-E*65536,u=Qe+E+65535,E=Math.floor(u/65536),Qe=u-E*65536,u=De+E+65535,E=Math.floor(u/65536),De=u-E*65536,ee+=E-1+37*(E-1),E=1,u=ee+E+65535,E=Math.floor(u/65536),ee=u-E*65536,u=ge+E+65535,E=Math.floor(u/65536),ge=u-E*65536,u=be+E+65535,E=Math.floor(u/65536),be=u-E*65536,u=Ne+E+65535,E=Math.floor(u/65536),Ne=u-E*65536,u=Fe+E+65535,E=Math.floor(u/65536),Fe=u-E*65536,u=Pe+E+65535,E=Math.floor(u/65536),Pe=u-E*65536,u=St+E+65535,E=Math.floor(u/65536),St=u-E*65536,u=mt+E+65535,E=Math.floor(u/65536),mt=u-E*65536,u=nt+E+65535,E=Math.floor(u/65536),nt=u-E*65536,u=$e+E+65535,E=Math.floor(u/65536),$e=u-E*65536,u=Xe+E+65535,E=Math.floor(u/65536),Xe=u-E*65536,u=Ze+E+65535,E=Math.floor(u/65536),Ze=u-E*65536,u=ot+E+65535,E=Math.floor(u/65536),ot=u-E*65536,u=qe+E+65535,E=Math.floor(u/65536),qe=u-E*65536,u=Qe+E+65535,E=Math.floor(u/65536),Qe=u-E*65536,u=De+E+65535,E=Math.floor(u/65536),De=u-E*65536,ee+=E-1+37*(E-1),D[0]=ee,D[1]=ge,D[2]=be,D[3]=Ne,D[4]=Fe,D[5]=Pe,D[6]=St,D[7]=mt,D[8]=nt,D[9]=$e,D[10]=Xe,D[11]=Ze,D[12]=ot,D[13]=qe,D[14]=Qe,D[15]=De}function W(D,N){q(D,N,N)}function ve(D,N){const C=o();let u;for(u=0;u<16;u++)C[u]=N[u];for(u=253;u>=0;u--)W(C,C),u!==2&&u!==4&&q(C,C,N);for(u=0;u<16;u++)D[u]=C[u]}function ie(D,N){const C=o();let u;for(u=0;u<16;u++)C[u]=N[u];for(u=250;u>=0;u--)W(C,C),u!==1&&q(C,C,N);for(u=0;u<16;u++)D[u]=C[u]}function ue(D,N){const C=o(),u=o(),E=o(),ee=o(),ge=o(),be=o(),Ne=o(),Fe=o(),Pe=o();L(C,D[1],D[0]),L(Pe,N[1],N[0]),q(C,C,Pe),de(u,D[0],D[1]),de(Pe,N[0],N[1]),q(u,u,Pe),q(E,D[3],N[3]),q(E,E,m),q(ee,D[2],N[2]),de(ee,ee,ee),L(ge,u,C),L(be,ee,E),de(Ne,ee,E),de(Fe,u,C),q(D[0],ge,be),q(D[1],Fe,Ne),q(D[2],Ne,be),q(D[3],ge,Fe)}function Te(D,N,C){for(let u=0;u<4;u++)K(D[u],N[u],C)}function Ue(D,N){const C=o(),u=o(),E=o();ve(E,N[2]),q(C,N[0],E),q(u,N[1],E),re(D,u),D[31]^=fe(C)<<7}function y(D,N,C){z(D[0],d),z(D[1],v),z(D[2],v),z(D[3],d);for(let u=255;u>=0;--u){const E=C[u/8|0]>>(u&7)&1;Te(D,N,E),ue(N,D),ue(D,D),Te(D,N,E)}}function I(D,N){const C=[o(),o(),o(),o()];z(C[0],S),z(C[1],O),z(C[2],v),q(C[3],S,O),y(D,C,N)}function X(D){if(D.length!==c.SEED_LENGTH)throw new Error(`ed25519: seed must be ${c.SEED_LENGTH} bytes`);const N=(0,i.hash)(D);N[0]&=248,N[31]&=127,N[31]|=64;const C=new Uint8Array(32),u=[o(),o(),o(),o()];I(u,N),Ue(C,u);const E=new Uint8Array(64);return E.set(D),E.set(C,32),{publicKey:C,secretKey:E}}c.generateKeyPairFromSeed=X;function ce(D){const N=(0,r.randomBytes)(32,D),C=X(N);return(0,n.wipe)(N),C}c.generateKeyPair=ce;function V(D){if(D.length!==c.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${c.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(D.subarray(32))}c.extractPublicKeyFromSecretKey=V;const B=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function k(D,N){let C,u,E,ee;for(u=63;u>=32;--u){for(C=0,E=u-32,ee=u-12;E>4)*B[E],C=N[E]>>8,N[E]&=255;for(E=0;E<32;E++)N[E]-=C*B[E];for(u=0;u<32;u++)N[u+1]+=N[u]>>8,D[u]=N[u]&255}function G(D){const N=new Float64Array(64);for(let C=0;C<64;C++)N[C]=D[C];for(let C=0;C<64;C++)D[C]=0;k(D,N)}function Je(D,N){const C=new Float64Array(64),u=[o(),o(),o(),o()],E=(0,i.hash)(D.subarray(0,32));E[0]&=248,E[31]&=127,E[31]|=64;const ee=new Uint8Array(64);ee.set(E.subarray(32),32);const ge=new i.SHA512;ge.update(ee.subarray(32)),ge.update(N);const be=ge.digest();ge.clean(),G(be),I(u,be),Ue(ee,u),ge.reset(),ge.update(ee.subarray(0,32)),ge.update(D.subarray(32)),ge.update(N);const Ne=ge.digest();G(Ne);for(let Fe=0;Fe<32;Fe++)C[Fe]=be[Fe];for(let Fe=0;Fe<32;Fe++)for(let Pe=0;Pe<32;Pe++)C[Fe+Pe]+=Ne[Fe]*E[Pe];return k(ee.subarray(32),C),ee}c.sign=Je;function He(D,N){const C=o(),u=o(),E=o(),ee=o(),ge=o(),be=o(),Ne=o();return z(D[2],v),pe(D[1],N),W(E,D[1]),q(ee,E,b),L(E,E,D[2]),de(ee,D[2],ee),W(ge,ee),W(be,ge),q(Ne,be,ge),q(C,Ne,E),q(C,C,ee),ie(C,C),q(C,C,E),q(C,C,ee),q(C,C,ee),q(D[0],C,ee),W(u,D[0]),q(u,u,ee),le(u,E)&&q(D[0],D[0],F),W(u,D[0]),q(u,u,ee),le(u,E)?-1:(fe(D[0])===N[31]>>7&&L(D[0],d,D[0]),q(D[3],D[0],D[1]),0)}function jr(D,N,C){const u=new Uint8Array(32),E=[o(),o(),o(),o()],ee=[o(),o(),o(),o()];if(C.length!==c.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${c.SIGNATURE_LENGTH} bytes`);if(He(ee,D))return!1;const ge=new i.SHA512;ge.update(C.subarray(0,32)),ge.update(D),ge.update(N);const be=ge.digest();return G(be),y(E,ee,be),I(ee,C.subarray(32)),ue(E,ee),Ue(u,E),!he(C,u)}c.verify=jr;function Ie(D){let N=[o(),o(),o(),o()];if(He(N,D))throw new Error("Ed25519: invalid public key");let C=o(),u=o(),E=N[1];de(C,v,E),L(u,v,E),ve(u,u),q(C,C,u);let ee=new Uint8Array(32);return re(ee,C),ee}c.convertPublicKeyToX25519=Ie;function xt(D){const N=(0,i.hash)(D.subarray(0,32));N[0]&=248,N[31]&=127,N[31]|=64;const C=new Uint8Array(N.subarray(0,32));return(0,n.wipe)(N),C}c.convertSecretKeyToX25519=xt})(mc);const U1="EdDSA",q1="JWT",Wl=".",Jl="base64url",B1="utf8",H1="utf8",k1=":",K1="did",V1="key",kh="base58btc",G1="z",W1="K36",J1=32;function uo(c){return fo(yc(Ui(c),B1),Jl)}function Yl(c){const r=yc(W1,kh),i=G1+fo(nm([r,c]),kh);return[K1,V1,i].join(k1)}function Y1(c){return fo(c,Jl)}function X1(c){return yc([uo(c.header),uo(c.payload)].join(Wl),H1)}function Z1(c){return[uo(c.header),uo(c.payload),Y1(c.signature)].join(Wl)}function Kh(c=Fl.randomBytes(J1)){return mc.generateKeyPairFromSeed(c)}async function Q1(c,r,i,n,o=ne.fromMiliseconds(Date.now())){const l={alg:U1,typ:q1},d=Yl(n.publicKey),v=o+i,b={iss:d,sub:c,aud:r,iat:o,exp:v},m=X1({header:l,payload:b}),S=mc.sign(n.secretKey,m);return Z1({header:l,payload:b,signature:S})}const ew="PARSE_ERROR",tw="INVALID_REQUEST",rw="METHOD_NOT_FOUND",iw="INVALID_PARAMS",Xl="INTERNAL_ERROR",wc="SERVER_ERROR",sw=[-32700,-32600,-32601,-32602,-32603],Hs={[ew]:{code:-32700,message:"Parse error"},[tw]:{code:-32600,message:"Invalid Request"},[rw]:{code:-32601,message:"Method not found"},[iw]:{code:-32602,message:"Invalid params"},[Xl]:{code:-32603,message:"Internal error"},[wc]:{code:-32e3,message:"Server error"}},Zl=wc;function nw(c){return sw.includes(c)}function Vh(c){return Object.keys(Hs).includes(c)?Hs[c]:Hs[Zl]}function ow(c){const r=Object.values(Hs).find(i=>i.code===c);return r||Hs[Zl]}function Ql(c,r,i){return c.message.includes("getaddrinfo ENOTFOUND")||c.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${i} RPC url at ${r}`):c}var ef={},ni={},Gh;function aw(){if(Gh)return ni;Gh=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.isBrowserCryptoAvailable=ni.getSubtleCrypto=ni.getBrowerCrypto=void 0;function c(){return(Mr===null||Mr===void 0?void 0:Mr.crypto)||(Mr===null||Mr===void 0?void 0:Mr.msCrypto)||{}}ni.getBrowerCrypto=c;function r(){const n=c();return n.subtle||n.webkitSubtle}ni.getSubtleCrypto=r;function i(){return!!c()&&!!r()}return ni.isBrowserCryptoAvailable=i,ni}var oi={},Wh;function cw(){if(Wh)return oi;Wh=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.isBrowser=oi.isNode=oi.isReactNative=void 0;function c(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}oi.isReactNative=c;function r(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}oi.isNode=r;function i(){return!c()&&!r()}return oi.isBrowser=i,oi}(function(c){Object.defineProperty(c,"__esModule",{value:!0});const r=ds;r.__exportStar(aw(),c),r.__exportStar(cw(),c)})(ef);function tf(c=3){const r=Date.now()*Math.pow(10,c),i=Math.floor(Math.random()*Math.pow(10,c));return r+i}function _c(c=6){return BigInt(tf(c))}function po(c,r,i){return{id:i||tf(),jsonrpc:"2.0",method:c,params:r}}function bc(c,r){return{id:c,jsonrpc:"2.0",result:r}}function go(c,r,i){return{id:c,jsonrpc:"2.0",error:uw(r,i)}}function uw(c,r){return typeof c>"u"?Vh(Xl):(typeof c=="string"&&(c=Object.assign(Object.assign({},Vh(wc)),{message:c})),typeof r<"u"&&(c.data=r),nw(c.code)&&(c=ow(c.code)),c)}class hw{}class lw extends hw{constructor(){super()}}class fw extends lw{constructor(r){super()}}const pw="^https?:",dw="^wss?:";function gw(c){const r=c.match(new RegExp(/^\w+:/,"gi"));if(!(!r||!r.length))return r[0]}function rf(c,r){const i=gw(c);return typeof i>"u"?!1:new RegExp(r).test(i)}function Jh(c){return rf(c,pw)}function Yh(c){return rf(c,dw)}function yw(c){return new RegExp("wss?://localhost(:d{2,5})?").test(c)}function sf(c){return typeof c=="object"&&"id"in c&&"jsonrpc"in c&&c.jsonrpc==="2.0"}function Ec(c){return sf(c)&&"method"in c}function yo(c){return sf(c)&&(ai(c)||$r(c))}function ai(c){return"result"in c}function $r(c){return"error"in c}class Ei extends fw{constructor(r){super(r),this.events=new Cr.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(r),this.connection.connected&&this.registerEventListeners()}async connect(r=this.connection){await this.open(r)}async disconnect(){await this.close()}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async request(r,i){return this.requestStrict(po(r.method,r.params||[],r.id||_c().toString()),i)}async requestStrict(r,i){return new Promise(async(n,o)=>{if(!this.connection.connected)try{await this.open()}catch(l){o(l)}this.events.on(`${r.id}`,l=>{$r(l)?o(l.error):n(l.result)});try{await this.connection.send(r,i)}catch(l){o(l)}})}setConnection(r=this.connection){return r}onPayload(r){this.events.emit("payload",r),yo(r)?this.events.emit(`${r.id}`,r):this.events.emit("message",{type:r.method,data:r.params})}onClose(r){r&&r.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${r.code} ${r.reason?`(${r.reason})`:""}`)),this.events.emit("disconnect")}async open(r=this.connection){this.connection===r&&this.connection.connected||(this.connection.connected&&this.close(),typeof r=="string"&&(await this.connection.open(r),r=this.connection),this.connection=this.setConnection(r),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",r=>this.onPayload(r)),this.connection.on("close",r=>this.onClose(r)),this.connection.on("error",r=>this.events.emit("error",r)),this.connection.on("register_error",r=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const vw=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:require("ws"),mw=()=>typeof window<"u",Xh=c=>c.split("?")[0],Zh=10,ww=vw();class _w{constructor(r){if(this.url=r,this.events=new Cr.EventEmitter,this.registering=!1,!Yh(r))throw new Error(`Provided URL is not compatible with WebSocket connection: ${r}`);this.url=r}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async open(r=this.url){await this.register(r)}async close(){return new Promise((r,i)=>{if(typeof this.socket>"u"){i(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),r()},this.socket.close()})}async send(r,i){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ui(r))}catch(n){this.onError(r.id,n)}}register(r=this.url){if(!Yh(r))throw new Error(`Provided URL is not compatible with WebSocket connection: ${r}`);if(this.registering){const i=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=i||this.events.listenerCount("open")>=i)&&this.events.setMaxListeners(i+1),new Promise((n,o)=>{this.events.once("register_error",l=>{this.resetMaxListeners(),o(l)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return o(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=r,this.registering=!0,new Promise((i,n)=>{const o=ef.isReactNative()?void 0:{rejectUnauthorized:!yw(r)},l=new ww(r,[],o);mw()?l.onerror=d=>{const v=d;n(this.emitError(v.error))}:l.on("error",d=>{n(this.emitError(d))}),l.onopen=()=>{this.onOpen(l),i(l)}})}onOpen(r){r.onmessage=i=>this.onPayload(i),r.onclose=i=>this.onClose(i),this.socket=r,this.registering=!1,this.events.emit("open")}onClose(r){this.socket=void 0,this.registering=!1,this.events.emit("close",r)}onPayload(r){if(typeof r.data>"u")return;const i=typeof r.data=="string"?Ks(r.data):r.data;this.events.emit("payload",i)}onError(r,i){const n=this.parseError(i),o=n.message||n.toString(),l=go(r,o);this.events.emit("payload",l)}parseError(r,i=this.url){return Ql(r,Xh(i),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Zh&&this.events.setMaxListeners(Zh)}emitError(r){const i=this.parseError(new Error((r==null?void 0:r.message)||`WebSocket connection failed for host: ${Xh(this.url)}`));return this.events.emit("register_error",i),i}}var ho={exports:{}};ho.exports;(function(c,r){var i=200,n="__lodash_hash_undefined__",o=1,l=2,d=9007199254740991,v="[object Arguments]",b="[object Array]",m="[object AsyncFunction]",S="[object Boolean]",O="[object Date]",F="[object Error]",z="[object Function]",R="[object GeneratorFunction]",K="[object Map]",re="[object Number]",he="[object Null]",le="[object Object]",fe="[object Promise]",pe="[object Proxy]",de="[object RegExp]",L="[object Set]",q="[object String]",W="[object Symbol]",ve="[object Undefined]",ie="[object WeakMap]",ue="[object ArrayBuffer]",Te="[object DataView]",Ue="[object Float32Array]",y="[object Float64Array]",I="[object Int8Array]",X="[object Int16Array]",ce="[object Int32Array]",V="[object Uint8Array]",B="[object Uint8ClampedArray]",k="[object Uint16Array]",G="[object Uint32Array]",Je=/[\\^$.*+?()[\]{}|]/g,He=/^\[object .+?Constructor\]$/,jr=/^(?:0|[1-9]\d*)$/,Ie={};Ie[Ue]=Ie[y]=Ie[I]=Ie[X]=Ie[ce]=Ie[V]=Ie[B]=Ie[k]=Ie[G]=!0,Ie[v]=Ie[b]=Ie[ue]=Ie[S]=Ie[Te]=Ie[O]=Ie[F]=Ie[z]=Ie[K]=Ie[re]=Ie[le]=Ie[de]=Ie[L]=Ie[q]=Ie[ie]=!1;var xt=typeof Mr=="object"&&Mr&&Mr.Object===Object&&Mr,D=typeof self=="object"&&self&&self.Object===Object&&self,N=xt||D||Function("return this")(),C=r&&!r.nodeType&&r,u=C&&!0&&c&&!c.nodeType&&c,E=u&&u.exports===C,ee=E&&xt.process,ge=function(){try{return ee&&ee.binding&&ee.binding("util")}catch{}}(),be=ge&&ge.isTypedArray;function Ne(g,x){for(var U=-1,Y=g==null?0:g.length,Ve=0,me=[];++U-1}function Po(g,x){var U=this.__data__,Y=Si(U,g);return Y<0?(++this.size,U.push([g,x])):U[Y][1]=x,this}yr.prototype.clear=Eo,yr.prototype.delete=Io,yr.prototype.get=xo,yr.prototype.has=So,yr.prototype.set=Po;function Wr(g){var x=-1,U=g==null?0:g.length;for(this.clear();++xNt))return!1;var Ge=me.get(g);if(Ge&&me.get(x))return Ge==x;var _t=-1,ir=!0,Dt=U&l?new Vi:void 0;for(me.set(g,x),me.set(x,g);++_t-1&&g%1==0&&g-1&&g%1==0&&g<=d}function ln(g){var x=typeof g;return g!=null&&(x=="object"||x=="function")}function Ci(g){return g!=null&&typeof g=="object"}var fn=be?mt(be):Zs;function zo(g){return Mo(g)?Ys(g):Qs(g)}function Ke(){return[]}function Be(){return!1}c.exports=jo})(ho,ho.exports);var bw=ho.exports;const Ew=Ll(bw);function Iw(c,r){if(c.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),n=0;n>>0,pe=new Uint8Array(fe);he!==le;){for(var de=R[he],L=0,q=fe-1;(de!==0||L>>0,pe[q]=de%v>>>0,de=de/v>>>0;if(de!==0)throw new Error("Non-zero carry");re=L,he++}for(var W=fe-re;W!==fe&&pe[W]===0;)W++;for(var ve=b.repeat(K);W>>0,fe=new Uint8Array(le);R[K];){var pe=i[R.charCodeAt(K)];if(pe===255)return;for(var de=0,L=le-1;(pe!==0||de>>0,fe[L]=pe%256>>>0,pe=pe/256>>>0;if(pe!==0)throw new Error("Non-zero carry");he=de,K++}if(R[K]!==" "){for(var q=le-he;q!==le&&fe[q]===0;)q++;for(var W=new Uint8Array(re+(le-q)),ve=re;q!==le;)W[ve++]=fe[q++];return W}}}function z(R){var K=F(R);if(K)return K;throw new Error(`Non-${r} character`)}return{encode:O,decodeUnsafe:F,decode:z}}var xw=Iw,Sw=xw;const nf=c=>{if(c instanceof Uint8Array&&c.constructor.name==="Uint8Array")return c;if(c instanceof ArrayBuffer)return new Uint8Array(c);if(ArrayBuffer.isView(c))return new Uint8Array(c.buffer,c.byteOffset,c.byteLength);throw new Error("Unknown type, must be binary type")},Pw=c=>new TextEncoder().encode(c),Aw=c=>new TextDecoder().decode(c);class Cw{constructor(r,i,n){this.name=r,this.prefix=i,this.baseEncode=n}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Ow{constructor(r,i,n){if(this.name=r,this.prefix=i,i.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i.codePointAt(0),this.baseDecode=n}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return of(this,r)}}class Rw{constructor(r){this.decoders=r}or(r){return of(this,r)}decode(r){const i=r[0],n=this.decoders[i];if(n)return n.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const of=(c,r)=>new Rw({...c.decoders||{[c.prefix]:c},...r.decoders||{[r.prefix]:r}});class Tw{constructor(r,i,n,o){this.name=r,this.prefix=i,this.baseEncode=n,this.baseDecode=o,this.encoder=new Cw(r,i,n),this.decoder=new Ow(r,i,o)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const vo=({name:c,prefix:r,encode:i,decode:n})=>new Tw(c,r,i,n),Vs=({prefix:c,name:r,alphabet:i})=>{const{encode:n,decode:o}=Sw(i,r);return vo({prefix:c,name:r,encode:n,decode:l=>nf(o(l))})},Nw=(c,r,i,n)=>{const o={};for(let S=0;S=8&&(v-=8,d[m++]=255&b>>v)}if(v>=i||255&b<<8-v)throw new SyntaxError("Unexpected end of data");return d},Dw=(c,r,i)=>{const n=r[r.length-1]==="=",o=(1<i;)d-=i,l+=r[o&v>>d];if(d&&(l+=r[o&v<vo({prefix:r,name:c,encode(o){return Dw(o,n,i)},decode(o){return Nw(o,n,i,c)}}),Fw=vo({prefix:"\0",name:"identity",encode:c=>Aw(c),decode:c=>Pw(c)});var Lw=Object.freeze({__proto__:null,identity:Fw});const $w=Kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Mw=Object.freeze({__proto__:null,base2:$w});const jw=Kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var zw=Object.freeze({__proto__:null,base8:jw});const Uw=Vs({prefix:"9",name:"base10",alphabet:"0123456789"});var qw=Object.freeze({__proto__:null,base10:Uw});const Bw=Kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Hw=Kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var kw=Object.freeze({__proto__:null,base16:Bw,base16upper:Hw});const Kw=Kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vw=Kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Gw=Kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ww=Kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jw=Kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yw=Kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xw=Kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Zw=Kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qw=Kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var e_=Object.freeze({__proto__:null,base32:Kw,base32upper:Vw,base32pad:Gw,base32padupper:Ww,base32hex:Jw,base32hexupper:Yw,base32hexpad:Xw,base32hexpadupper:Zw,base32z:Qw});const t_=Vs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),r_=Vs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var i_=Object.freeze({__proto__:null,base36:t_,base36upper:r_});const s_=Vs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),n_=Vs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var o_=Object.freeze({__proto__:null,base58btc:s_,base58flickr:n_});const a_=Kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),c_=Kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),u_=Kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),h_=Kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var l_=Object.freeze({__proto__:null,base64:a_,base64pad:c_,base64url:u_,base64urlpad:h_});const af=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),f_=af.reduce((c,r,i)=>(c[i]=r,c),[]),p_=af.reduce((c,r,i)=>(c[r.codePointAt(0)]=i,c),[]);function d_(c){return c.reduce((r,i)=>(r+=f_[i],r),"")}function g_(c){const r=[];for(const i of c){const n=p_[i.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${i}`);r.push(n)}return new Uint8Array(r)}const y_=vo({prefix:"🚀",name:"base256emoji",encode:d_,decode:g_});var v_=Object.freeze({__proto__:null,base256emoji:y_}),m_=cf,Qh=128,w_=127,__=~w_,b_=Math.pow(2,31);function cf(c,r,i){r=r||[],i=i||0;for(var n=i;c>=b_;)r[i++]=c&255|Qh,c/=128;for(;c&__;)r[i++]=c&255|Qh,c>>>=7;return r[i]=c|0,cf.bytes=i-n+1,r}var E_=uc,I_=128,el=127;function uc(c,n){var i=0,n=n||0,o=0,l=n,d,v=c.length;do{if(l>=v)throw uc.bytes=0,new RangeError("Could not decode varint");d=c[l++],i+=o<28?(d&el)<=I_);return uc.bytes=l-n,i}var x_=Math.pow(2,7),S_=Math.pow(2,14),P_=Math.pow(2,21),A_=Math.pow(2,28),C_=Math.pow(2,35),O_=Math.pow(2,42),R_=Math.pow(2,49),T_=Math.pow(2,56),N_=Math.pow(2,63),D_=function(c){return c(uf.encode(c,r,i),r),rl=c=>uf.encodingLength(c),hc=(c,r)=>{const i=r.byteLength,n=rl(c),o=n+rl(i),l=new Uint8Array(o+i);return tl(c,l,0),tl(i,l,n),l.set(r,o),new L_(c,i,r,l)};class L_{constructor(r,i,n,o){this.code=r,this.size=i,this.digest=n,this.bytes=o}}const hf=({name:c,code:r,encode:i})=>new $_(c,r,i);class $_{constructor(r,i,n){this.name=r,this.code=i,this.encode=n}digest(r){if(r instanceof Uint8Array){const i=this.encode(r);return i instanceof Uint8Array?hc(this.code,i):i.then(n=>hc(this.code,n))}else throw Error("Unknown type, must be binary type")}}const lf=c=>async r=>new Uint8Array(await crypto.subtle.digest(c,r)),M_=hf({name:"sha2-256",code:18,encode:lf("SHA-256")}),j_=hf({name:"sha2-512",code:19,encode:lf("SHA-512")});var z_=Object.freeze({__proto__:null,sha256:M_,sha512:j_});const ff=0,U_="identity",pf=nf,q_=c=>hc(ff,pf(c)),B_={code:ff,name:U_,encode:pf,digest:q_};var H_=Object.freeze({__proto__:null,identity:B_});new TextEncoder,new TextDecoder;const il={...Lw,...Mw,...zw,...qw,...kw,...e_,...i_,...o_,...l_,...v_};({...z_,...H_});function df(c){return globalThis.Buffer!=null?new Uint8Array(c.buffer,c.byteOffset,c.byteLength):c}function k_(c=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?df(globalThis.Buffer.allocUnsafe(c)):new Uint8Array(c)}function gf(c,r,i,n){return{name:c,prefix:r,encoder:{name:c,prefix:r,encode:i},decoder:{decode:n}}}const sl=gf("utf8","u",c=>"u"+new TextDecoder("utf8").decode(c),c=>new TextEncoder().encode(c.substring(1))),Xa=gf("ascii","a",c=>{let r="a";for(let i=0;i{c=c.substring(1);const r=k_(c.length);for(let i=0;i{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,o)=>{this.isInitialized(),this.keychain.set(n,o),await this.persist()},this.get=n=>{this.isInitialized();const o=this.keychain.get(n);if(typeof o>"u"){const{message:l}=Q("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(l)}return o},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=r,this.logger=Re.generateChildLogger(i,this.name)}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(r){await this.core.storage.setItem(this.storageKey,zl(r))}async getKeyChain(){const r=await this.core.storage.getItem(this.storageKey);return typeof r<"u"?Ul(r):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Eb{constructor(r,i,n){this.core=r,this.logger=i,this.name=Y_,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=o=>(this.isInitialized(),this.keychain.has(o)),this.getClientId=async()=>{this.isInitialized();const o=await this.getClientSeed(),l=Kh(o);return Yl(l.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const o=cm();return this.setPrivateKey(o.publicKey,o.privateKey)},this.signJWT=async o=>{this.isInitialized();const l=await this.getClientSeed(),d=Kh(l),v=oc();return await Q1(v,o,X_,d)},this.generateSharedKey=(o,l,d)=>{this.isInitialized();const v=this.getPrivateKey(o),b=um(v,l);return this.setSymKey(b,d)},this.setSymKey=async(o,l)=>{this.isInitialized();const d=l||hm(o);return await this.keychain.set(d,o),d},this.deleteKeyPair=async o=>{this.isInitialized(),await this.keychain.del(o)},this.deleteSymKey=async o=>{this.isInitialized(),await this.keychain.del(o)},this.encode=async(o,l,d)=>{this.isInitialized();const v=lm(d),b=Ui(l);if(Ah(v)){const F=v.senderPublicKey,z=v.receiverPublicKey;o=await this.generateSharedKey(F,z)}const m=this.getSymKey(o),{type:S,senderPublicKey:O}=v;return fm({type:S,symKey:m,message:b,senderPublicKey:O})},this.decode=async(o,l,d)=>{this.isInitialized();const v=pm(l,d);if(Ah(v)){const S=v.receiverPublicKey,O=v.senderPublicKey;o=await this.generateSharedKey(S,O)}const b=this.getSymKey(o),m=dm({symKey:b,encoded:l});return Ks(m)},this.getPayloadType=o=>{const l=Ch(o);return gm(l.type)},this.getPayloadSenderPublicKey=o=>{const l=Ch(o);return l.senderPublicKey?fo(l.senderPublicKey,ym):void 0},this.core=r,this.logger=Re.generateChildLogger(i,this.name),this.keychain=n||new bb(this.core,this.logger)}get context(){return Re.getLoggerContext(this.logger)}async setPrivateKey(r,i){return await this.keychain.set(r,i),r}getPrivateKey(r){return this.keychain.get(r)}async getClientSeed(){let r="";try{r=this.keychain.get(nl)}catch{r=oc(),await this.keychain.set(nl,r)}return V_(r,"base16")}getSymKey(r){return this.keychain.get(r)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Ib extends T1{constructor(r,i){super(r,i),this.logger=r,this.core=i,this.messages=new Map,this.name=eb,this.version=tb,this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,o)=>{this.isInitialized();const l=fs(o);let d=this.messages.get(n);return typeof d>"u"&&(d={}),typeof d[l]<"u"||(d[l]=o,this.messages.set(n,d),await this.persist()),l},this.get=n=>{this.isInitialized();let o=this.messages.get(n);return typeof o>"u"&&(o={}),o},this.has=(n,o)=>{this.isInitialized();const l=this.get(n),d=fs(o);return typeof l[d]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Re.generateChildLogger(r,this.name),this.core=i}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(r){await this.core.storage.setItem(this.storageKey,zl(r))}async getRelayerMessages(){const r=await this.core.storage.getItem(this.storageKey);return typeof r<"u"?Ul(r):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class xb extends N1{constructor(r,i){super(r,i),this.relayer=r,this.logger=i,this.events=new Cr.EventEmitter,this.name=ib,this.queue=new Map,this.publishTimeout=ne.toMiliseconds(ne.TEN_SECONDS),this.queueTimeout=ne.toMiliseconds(ne.FIVE_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,o,l)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:o,opts:l}});try{const d=(l==null?void 0:l.ttl)||rb,v=ac(l),b=(l==null?void 0:l.prompt)||!1,m=(l==null?void 0:l.tag)||0,S=(l==null?void 0:l.id)||_c().toString(),O={topic:n,message:o,opts:{ttl:d,relay:v,prompt:b,tag:m,id:S}},F=setTimeout(()=>this.queue.set(S,O),this.queueTimeout);try{await await co(this.rpcPublish(n,o,d,v,b,m,S),this.publishTimeout),clearTimeout(F),this.relayer.events.emit(vt.publish,O)}catch{this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0;return}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:o,opts:l}})}catch(d){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(d),d}},this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.relayer=r,this.logger=Re.generateChildLogger(i,this.name),this.registerEventListeners()}get context(){return Re.getLoggerContext(this.logger)}rpcPublish(r,i,n,o,l,d,v){var b,m,S,O;const F={method:io(o.protocol).publish,params:{topic:r,message:i,ttl:n,prompt:l,tag:d},id:v};return _i((b=F.params)==null?void 0:b.prompt)&&((m=F.params)==null||delete m.prompt),_i((S=F.params)==null?void 0:S.tag)&&((O=F.params)==null||delete O.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:F}),this.relayer.request(F)}onPublish(r){this.queue.delete(r)}checkQueue(){this.queue.forEach(async r=>{const{topic:i,message:n,opts:o}=r;await this.publish(i,n,o)})}registerEventListeners(){this.relayer.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(vt.connection_stalled);return}this.checkQueue()}),this.relayer.on(vt.message_ack,r=>{this.onPublish(r.id.toString())})}}class Sb{constructor(){this.map=new Map,this.set=(r,i)=>{const n=this.get(r);this.exists(r,i)||this.map.set(r,[...n,i])},this.get=r=>this.map.get(r)||[],this.exists=(r,i)=>this.get(r).includes(i),this.delete=(r,i)=>{if(typeof i>"u"){this.map.delete(r);return}if(!this.map.has(r))return;const n=this.get(r);if(!this.exists(r,i))return;const o=n.filter(l=>l!==i);if(!o.length){this.map.delete(r);return}this.map.set(r,o)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Pb=Object.defineProperty,Ab=Object.defineProperties,Cb=Object.getOwnPropertyDescriptors,cl=Object.getOwnPropertySymbols,Ob=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable,ul=(c,r,i)=>r in c?Pb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,zs=(c,r)=>{for(var i in r||(r={}))Ob.call(r,i)&&ul(c,i,r[i]);if(cl)for(var i of cl(r))Rb.call(r,i)&&ul(c,i,r[i]);return c},Qa=(c,r)=>Ab(c,Cb(r));class Tb extends L1{constructor(r,i){super(r,i),this.relayer=r,this.logger=i,this.subscriptions=new Map,this.topicMap=new Sb,this.events=new Cr.EventEmitter,this.name=fb,this.version=pb,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=bi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,o)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:o}});try{const l=ac(o),d={topic:n,relay:l};this.pending.set(n,d);const v=await this.rpcSubscribe(n,l);return this.onSubscribe(v,d),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:o}}),v}catch(l){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(l),l}},this.unsubscribe=async(n,o)=>{await this.restartToComplete(),this.isInitialized(),typeof(o==null?void 0:o.id)<"u"?await this.unsubscribeById(n,o.id,o):await this.unsubscribeByTopic(n,o)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((o,l)=>{const d=new ne.Watch;d.start(this.pendingSubscriptionWatchLabel);const v=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(v),d.stop(this.pendingSubscriptionWatchLabel),o(!0)),d.elapsed(this.pendingSubscriptionWatchLabel)>=db&&(clearInterval(v),d.stop(this.pendingSubscriptionWatchLabel),l(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=r,this.logger=Re.generateChildLogger(i,this.name),this.clientId=""}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(r,i){let n=!1;try{n=this.getSubscription(r).topic===i}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(r,i){const n=this.topicMap.get(r);await Promise.all(n.map(async o=>await this.unsubscribeById(r,o,i)))}async unsubscribeById(r,i,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:r,id:i,opts:n}});try{const o=ac(n);await this.rpcUnsubscribe(r,i,o);const l=tr("USER_DISCONNECTED",`${this.name}, ${r}`);await this.onUnsubscribe(r,i,l),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:r,id:i,opts:n}})}catch(o){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(o),o}}async rpcSubscribe(r,i){const n={method:io(i.protocol).subscribe,params:{topic:r}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await co(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(vt.connection_stalled)}return fs(r+this.clientId)}async rpcBatchSubscribe(r){if(!r.length)return;const i=r[0].relay,n={method:io(i.protocol).batchSubscribe,params:{topics:r.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await co(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(vt.connection_stalled)}}rpcUnsubscribe(r,i,n){const o={method:io(n.protocol).unsubscribe,params:{topic:r,id:i}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o}),this.relayer.request(o)}onSubscribe(r,i){this.setSubscription(r,Qa(zs({},i),{id:r})),this.pending.delete(i.topic)}onBatchSubscribe(r){r.length&&r.forEach(i=>{this.setSubscription(i.id,zs({},i)),this.pending.delete(i.topic)})}async onUnsubscribe(r,i,n){this.events.removeAllListeners(i),this.hasSubscription(i,r)&&this.deleteSubscription(i,n),await this.relayer.messages.del(r)}async setRelayerSubscriptions(r){await this.relayer.core.storage.setItem(this.storageKey,r)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(r,i){this.subscriptions.has(r)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:r,subscription:i}),this.addSubscription(r,i))}addSubscription(r,i){this.subscriptions.set(r,zs({},i)),this.topicMap.set(i.topic,r),this.events.emit(Vr.created,i)}getSubscription(r){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:r});const i=this.subscriptions.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(n)}return i}deleteSubscription(r,i){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:r,reason:i});const n=this.getSubscription(r);this.subscriptions.delete(r),this.topicMap.delete(n.topic,r),this.events.emit(Vr.deleted,Qa(zs({},n),{reason:i}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vr.sync)}async reset(){if(this.cached.length){const r=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i"u"||!r.length)return;if(this.subscriptions.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(r){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(r)}}async batchSubscribe(r){if(!r.length)return;const i=await this.rpcBatchSubscribe(r);ps(i)&&this.onBatchSubscribe(i.map((n,o)=>Qa(zs({},r[o]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(this.relayer.transportExplicitlyClosed)return;const r=[];this.pending.forEach(i=>{r.push(i)}),await this.batchSubscribe(r)}registerEventListeners(){this.relayer.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(vt.connect,async()=>{await this.onConnect()}),this.relayer.on(vt.disconnect,()=>{this.onDisconnect()}),this.events.on(Vr.created,async r=>{const i=Vr.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()}),this.events.on(Vr.deleted,async r=>{const i=Vr.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}async restartToComplete(){this.restartInProgress&&await new Promise(r=>{const i=setInterval(()=>{this.restartInProgress||(clearInterval(i),r())},this.pollingInterval)})}}var Nb=Object.defineProperty,hl=Object.getOwnPropertySymbols,Db=Object.prototype.hasOwnProperty,Fb=Object.prototype.propertyIsEnumerable,ll=(c,r,i)=>r in c?Nb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,Lb=(c,r)=>{for(var i in r||(r={}))Db.call(r,i)&&ll(c,i,r[i]);if(hl)for(var i of hl(r))Fb.call(r,i)&&ll(c,i,r[i]);return c};class $b extends D1{constructor(r){super(r),this.protocol="wc",this.version=2,this.events=new Cr.EventEmitter,this.name=nb,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.request=async i=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(i)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.core=r.core,this.logger=typeof r.logger<"u"&&typeof r.logger!="string"?Re.generateChildLogger(r.logger,this.name):Re.pino(Re.getDefaultLoggerOptions({level:r.logger||sb})),this.messages=new Ib(this.logger,r.core),this.subscriber=new Tb(this,this.logger),this.publisher=new xb(this,this.logger),this.relayUrl=(r==null?void 0:r.relayUrl)||mf,this.projectId=r.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${ol}...`),await this.restartTransport(ol)}this.registerEventListeners(),this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},ub)}get context(){return Re.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(r,i,n){this.isInitialized(),await this.publisher.publish(r,i,n),await this.recordMessageEvent({topic:r,message:i,publishedAt:Date.now()})}async subscribe(r,i){var n;this.isInitialized();let o=((n=this.subscriber.topicMap.get(r))==null?void 0:n[0])||"";return o||(await Promise.all([new Promise(l=>{this.subscriber.once(Vr.created,d=>{d.topic===r&&l()})}),new Promise(async l=>{o=await this.subscriber.subscribe(r,i),l()})]),o)}async unsubscribe(r,i){this.isInitialized(),await this.subscriber.unsubscribe(r,i)}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(vt.transport_closed))}async transportOpen(r){if(this.transportExplicitlyClosed=!1,!this.reconnecting){this.relayUrl=r||this.relayUrl,this.reconnecting=!0;try{await Promise.all([new Promise(i=>{this.initialized||i(),this.subscriber.once(Vr.resubscribed,()=>{i()})}),await Promise.race([new Promise(async(i,n)=>{await co(this.provider.connect(),5e3,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>n(o)).then(()=>i()).finally(()=>this.removeListener(vt.transport_closed,this.rejectTransportOpen))}),new Promise(i=>this.once(vt.transport_closed,this.rejectTransportOpen))])])}catch(i){this.logger.error(i);const n=i;if(!this.isConnectionStalled(n.message))throw i;this.events.emit(vt.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(r){this.transportExplicitlyClosed||this.reconnecting||(this.relayUrl=r||this.relayUrl,this.connected&&await Promise.all([new Promise(i=>{this.provider.once(Ms.disconnect,()=>{i()})}),this.transportClose()]),await this.createProvider(),await this.transportOpen())}isConnectionStalled(r){return this.staleConnectionErrors.some(i=>r.includes(i))}rejectTransportOpen(){throw new Error("Attempt to connect to relay via `transportOpen` has stalled. Retrying...")}async createProvider(){const r=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Ei(new _w(vm({sdkVersion:cb,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:r,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(r){const{topic:i,message:n}=r;await this.messages.set(i,n)}async shouldIgnoreMessageEvent(r){const{topic:i,message:n}=r;return await this.subscriber.isSubscribed(i)?this.messages.has(i,n):!0}async onProviderPayload(r){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:r}),Ec(r)){if(!r.method.endsWith(ob))return;const i=r.params,{topic:n,message:o,publishedAt:l}=i.data,d={topic:n,message:o,publishedAt:l};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Lb({type:"event",event:i.id},d)),this.events.emit(i.id,d),await this.acknowledgePayload(r),await this.onMessageEvent(d)}else yo(r)&&this.events.emit(vt.message_ack,r)}async onMessageEvent(r){await this.shouldIgnoreMessageEvent(r)||(this.events.emit(vt.message,r),await this.recordMessageEvent(r))}async acknowledgePayload(r){const i=bc(r.id,!0);await this.provider.connection.send(i)}registerProviderListeners(){this.provider.on(Ms.payload,r=>this.onProviderPayload(r)),this.provider.on(Ms.connect,()=>{this.events.emit(vt.connect)}),this.provider.on(Ms.disconnect,()=>{this.onProviderDisconnect()}),this.provider.on(Ms.error,r=>{this.logger.error(r),this.events.emit(vt.error,r)})}registerEventListeners(){this.events.on(vt.connection_stalled,async()=>{await this.restartTransport()})}onProviderDisconnect(){this.events.emit(vt.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.restartTransport()},ne.toMiliseconds(ab))}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}async toEstablishConnection(){if(!this.connected){if(this.connecting)return await new Promise(r=>{const i=setInterval(()=>{this.connected&&(clearInterval(i),r())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var Mb=Object.defineProperty,fl=Object.getOwnPropertySymbols,jb=Object.prototype.hasOwnProperty,zb=Object.prototype.propertyIsEnumerable,pl=(c,r,i)=>r in c?Mb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,dl=(c,r)=>{for(var i in r||(r={}))jb.call(r,i)&&pl(c,i,r[i]);if(fl)for(var i of fl(r))zb.call(r,i)&&pl(c,i,r[i]);return c};class mo extends F1{constructor(r,i,n,o=bi,l=void 0){super(r,i,n,o),this.core=r,this.logger=i,this.name=n,this.map=new Map,this.version=hb,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(d=>{this.getKey&&d!==null&&!_i(d)?this.map.set(this.getKey(d),d):om(d)?this.map.set(d.id,d):am(d)&&this.map.set(d.topic,d)}),this.cached=[],this.initialized=!0)},this.set=async(d,v)=>{this.isInitialized(),this.map.has(d)?await this.update(d,v):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:d,value:v}),this.map.set(d,v),await this.persist())},this.get=d=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:d}),this.getData(d)),this.getAll=d=>(this.isInitialized(),d?this.values.filter(v=>Object.keys(d).every(b=>Ew(v[b],d[b]))):this.values),this.update=async(d,v)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:d,update:v});const b=dl(dl({},this.getData(d)),v);this.map.set(d,b),await this.persist()},this.delete=async(d,v)=>{this.isInitialized(),this.map.has(d)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:d,reason:v}),this.map.delete(d),await this.persist())},this.logger=Re.generateChildLogger(i,this.name),this.storagePrefix=o,this.getKey=l}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(r){await this.core.storage.setItem(this.storageKey,r)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(r){const i=this.map.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw this.logger.error(n),new Error(n)}return i}async persist(){await this.setDataStore(this.values)}async restore(){try{const r=await this.getDataStore();if(typeof r>"u"||!r.length)return;if(this.map.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(r){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(r)}}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Ub{constructor(r,i){this.core=r,this.logger=i,this.name=gb,this.version=yb,this.events=new vc,this.initialized=!1,this.storagePrefix=bi,this.ignoredPayloadTypes=[$l],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=oc(),o=await this.core.crypto.setSymKey(n),l=Lr(ne.FIVE_MINUTES),d={protocol:vf},v={topic:o,expiry:l,relay:d,active:!1},b=mm({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:n,relay:d});return await this.pairings.set(o,v),await this.core.relayer.subscribe(o),this.core.expirer.set(o,l),{topic:o,uri:b}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:o,symKey:l,relay:d}=wm(n.uri);if(this.pairings.keys.includes(o))throw new Error(`Pairing already exists: ${o}`);if(this.core.crypto.hasKeys(o))throw new Error(`Keychain already exists: ${o}`);const v=Lr(ne.FIVE_MINUTES),b={topic:o,relay:d,expiry:v,active:!1};return await this.pairings.set(o,b),await this.core.crypto.setSymKey(l,o),await this.core.relayer.subscribe(o,{relay:d}),this.core.expirer.set(o,v),n.activatePairing&&await this.activate({topic:o}),b},this.activate=async({topic:n})=>{this.isInitialized();const o=Lr(ne.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:o}),this.core.expirer.set(n,o)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:o}=n;if(this.pairings.keys.includes(o)){const l=await this.sendRequest(o,"wc_pairingPing",{}),{done:d,resolve:v,reject:b}=hs();this.events.once(Ft("pairing_ping",l),({error:m})=>{m?b(m):v()}),await d()}},this.updateExpiry=async({topic:n,expiry:o})=>{this.isInitialized(),await this.pairings.update(n,{expiry:o})},this.updateMetadata=async({topic:n,metadata:o})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:o})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:o}=n;this.pairings.keys.includes(o)&&(await this.sendRequest(o,"wc_pairingDelete",tr("USER_DISCONNECTED")),await this.deletePairing(o))},this.sendRequest=async(n,o,l)=>{const d=po(o,l),v=await this.core.crypto.encode(n,d),b=js[o].req;return this.core.history.set(n,d),this.core.relayer.publish(n,v,b),d.id},this.sendResult=async(n,o,l)=>{const d=bc(n,l),v=await this.core.crypto.encode(o,d),b=await this.core.history.get(o,n),m=js[b.request.method].res;await this.core.relayer.publish(o,v,m),await this.core.history.resolve(d)},this.sendError=async(n,o,l)=>{const d=go(n,l),v=await this.core.crypto.encode(o,d),b=await this.core.history.get(o,n),m=js[b.request.method]?js[b.request.method].res:js.unregistered_method.res;await this.core.relayer.publish(o,v,m),await this.core.history.resolve(d)},this.deletePairing=async(n,o)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,tr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),o?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(o=>wi(o.expiry));await Promise.all(n.map(o=>this.deletePairing(o.topic)))},this.onRelayEventRequest=n=>{const{topic:o,payload:l}=n,d=l.method;if(this.pairings.keys.includes(o))switch(d){case"wc_pairingPing":return this.onPairingPingRequest(o,l);case"wc_pairingDelete":return this.onPairingDeleteRequest(o,l);default:return this.onUnknownRpcMethodRequest(o,l)}},this.onRelayEventResponse=async n=>{const{topic:o,payload:l}=n,d=(await this.core.history.get(o,l.id)).request.method;if(this.pairings.keys.includes(o))switch(d){case"wc_pairingPing":return this.onPairingPingResponse(o,l);default:return this.onUnknownRpcMethodResponse(d)}},this.onPairingPingRequest=async(n,o)=>{const{id:l}=o;try{this.isValidPing({topic:n}),await this.sendResult(l,n,!0),this.events.emit("pairing_ping",{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onPairingPingResponse=(n,o)=>{const{id:l}=o;setTimeout(()=>{ai(o)?this.events.emit(Ft("pairing_ping",l),{}):$r(o)&&this.events.emit(Ft("pairing_ping",l),{error:o.error})},500)},this.onPairingDeleteRequest=async(n,o)=>{const{id:l}=o;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit("pairing_delete",{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onUnknownRpcMethodRequest=async(n,o)=>{const{id:l,method:d}=o;try{if(this.registeredMethods.includes(d))return;const v=tr("WC_METHOD_UNSUPPORTED",d);await this.sendError(l,n,v),this.logger.error(v)}catch(v){await this.sendError(l,n,v),this.logger.error(v)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(tr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ur(n)){const{message:o}=Q("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(o)}if(!_m(n.uri)){const{message:o}=Q("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(o)}},this.isValidPing=async n=>{if(!ur(n)){const{message:l}=Q("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(l)}const{topic:o}=n;await this.isValidPairingTopic(o)},this.isValidDisconnect=async n=>{if(!ur(n)){const{message:l}=Q("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(l)}const{topic:o}=n;await this.isValidPairingTopic(o)},this.isValidPairingTopic=async n=>{if(!ls(n,!1)){const{message:o}=Q("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(o)}if(!this.pairings.keys.includes(n)){const{message:o}=Q("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(o)}if(wi(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:o}=Q("EXPIRED",`pairing topic: ${n}`);throw new Error(o)}},this.core=r,this.logger=Re.generateChildLogger(i,this.name),this.pairings=new mo(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Re.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}registerRelayerEvents(){this.core.relayer.on(vt.message,async r=>{const{topic:i,message:n}=r;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const o=await this.core.crypto.decode(i,n);Ec(o)?(this.core.history.set(i,o),this.onRelayEventRequest({topic:i,payload:o})):yo(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:i,payload:o}),this.core.history.delete(i,o.id))})}registerExpirerEvents(){this.core.expirer.on(Pr.expired,async r=>{const{topic:i}=Ml(r.target);i&&this.pairings.keys.includes(i)&&(await this.deletePairing(i,!0),this.events.emit("pairing_expire",{topic:i}))})}}class qb extends R1{constructor(r,i){super(r,i),this.core=r,this.logger=i,this.records=new Map,this.events=new Cr.EventEmitter,this.name=vb,this.version=mb,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,o,l)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:o,chainId:l}),this.records.has(o.id))return;const d={id:o.id,topic:n,request:{method:o.method,params:o.params||null},chainId:l,expiry:Lr(ne.THIRTY_DAYS)};this.records.set(d.id,d),this.events.emit(Kr.created,d)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const o=await this.getRecord(n.id);typeof o.response>"u"&&(o.response=$r(n)?{error:n.error}:{result:n.result},this.records.set(o.id,o),this.events.emit(Kr.updated,o))},this.get=async(n,o)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:o}),await this.getRecord(o)),this.delete=(n,o)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:o}),this.values.forEach(l=>{if(l.topic===n){if(typeof o<"u"&&l.id!==o)return;this.records.delete(l.id),this.events.emit(Kr.deleted,l)}})},this.exists=async(n,o)=>(this.isInitialized(),this.records.has(o)?(await this.getRecord(o)).topic===n:!1),this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.logger=Re.generateChildLogger(i,this.name)}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const r=[];return this.values.forEach(i=>{if(typeof i.response<"u")return;const n={topic:i.topic,request:po(i.request.method,i.request.params,i.id),chainId:i.chainId};return r.push(n)}),r}async setJsonRpcRecords(r){await this.core.storage.setItem(this.storageKey,r)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(r){this.isInitialized();const i=this.records.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(n)}return i}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Kr.sync)}async restore(){try{const r=await this.getJsonRpcRecords();if(typeof r>"u"||!r.length)return;if(this.records.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}}registerEventListeners(){this.events.on(Kr.created,r=>{const i=Kr.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:r}),this.persist()}),this.events.on(Kr.updated,r=>{const i=Kr.updated;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:r}),this.persist()}),this.events.on(Kr.deleted,r=>{const i=Kr.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,record:r}),this.persist()}),this.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(r=>{ne.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.delete(r.topic,r.id))})}catch(r){this.logger.warn(r)}}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Bb extends $1{constructor(r,i){super(r,i),this.core=r,this.logger=i,this.expirations=new Map,this.events=new Cr.EventEmitter,this.name=wb,this.version=_b,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const o=this.formatTarget(n);return typeof this.getExpiration(o)<"u"}catch{return!1}},this.set=(n,o)=>{this.isInitialized();const l=this.formatTarget(n),d={target:l,expiry:o};this.expirations.set(l,d),this.checkExpiry(l,d),this.events.emit(Pr.created,{target:l,expiration:d})},this.get=n=>{this.isInitialized();const o=this.formatTarget(n);return this.getExpiration(o)},this.del=n=>{if(this.isInitialized(),this.has(n)){const o=this.formatTarget(n),l=this.getExpiration(o);this.expirations.delete(o),this.events.emit(Pr.deleted,{target:o,expiration:l})}},this.on=(n,o)=>{this.events.on(n,o)},this.once=(n,o)=>{this.events.once(n,o)},this.off=(n,o)=>{this.events.off(n,o)},this.removeListener=(n,o)=>{this.events.removeListener(n,o)},this.logger=Re.generateChildLogger(i,this.name)}get context(){return Re.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(r){if(typeof r=="string")return bm(r);if(typeof r=="number")return Em(r);const{message:i}=Q("UNKNOWN_TYPE",`Target type: ${typeof r}`);throw new Error(i)}async setExpirations(r){await this.core.storage.setItem(this.storageKey,r)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Pr.sync)}async restore(){try{const r=await this.getExpirations();if(typeof r>"u"||!r.length)return;if(this.expirations.size){const{message:i}=Q("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(i),new Error(i)}this.cached=r,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(r){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(r)}}getExpiration(r){const i=this.expirations.get(r);if(!i){const{message:n}=Q("NO_MATCHING_KEY",`${this.name}: ${r}`);throw this.logger.error(n),new Error(n)}return i}checkExpiry(r,i){const{expiry:n}=i;ne.toMiliseconds(n)-Date.now()<=0&&this.expire(r,i)}expire(r,i){this.expirations.delete(r),this.events.emit(Pr.expired,{target:r,expiration:i})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((r,i)=>this.checkExpiry(i,r))}registerEventListeners(){this.core.heartbeat.on(gs.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Pr.created,r=>{const i=Pr.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),this.persist()}),this.events.on(Pr.expired,r=>{const i=Pr.expired;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),this.persist()}),this.events.on(Pr.deleted,r=>{const i=Pr.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),this.persist()})}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}}class Hb extends M1{constructor(r,i){super(r,i),this.projectId=r,this.logger=i,this.name=Za,this.initialized=!1,this.init=async n=>{Im()||!jl()||(this.verifyUrl=(n==null?void 0:n.verifyUrl)||al,await this.createIframe())},this.register=async n=>{var o;if(this.initialized||await this.init(),!!this.iframe)try{(o=this.iframe.contentWindow)==null||o.postMessage(n.attestationId,this.verifyUrl),this.logger.info(`postMessage sent: ${n.attestationId} ${this.verifyUrl}`)}catch{}},this.resolve=async n=>{var o;if(this.isDevEnv)return"";this.logger.info(`resolving attestation: ${n.attestationId}`);const l=this.startAbortTimer(ne.FIVE_SECONDS),d=await fetch(`${this.verifyUrl}/attestation/${n.attestationId}`,{signal:this.abortController.signal});return clearTimeout(l),d.status===200?(o=await d.json())==null?void 0:o.origin:""},this.createIframe=async()=>{try{await Promise.race([new Promise((n,o)=>{if(document.getElementById(Za))return n();const l=document.createElement("iframe");l.setAttribute("id",Za),l.setAttribute("src",`${this.verifyUrl}/${this.projectId}`),l.style.display="none",l.addEventListener("load",()=>{this.initialized=!0,n()}),l.addEventListener("error",d=>{o(d)}),document.body.append(l),this.iframe=l}),new Promise(n=>{setTimeout(()=>n("iframe load timeout"),ne.toMiliseconds(ne.ONE_SECOND/2))})])}catch(n){this.logger.error(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.error(n)}},this.logger=Re.generateChildLogger(i,this.name),this.verifyUrl=al,this.abortController=new AbortController,this.isDevEnv=xm()&&{}.IS_VITEST}get context(){return Re.getLoggerContext(this.logger)}startAbortTimer(r){return setTimeout(()=>this.abortController.abort(),ne.toMiliseconds(r))}}var kb=Object.defineProperty,gl=Object.getOwnPropertySymbols,Kb=Object.prototype.hasOwnProperty,Vb=Object.prototype.propertyIsEnumerable,yl=(c,r,i)=>r in c?kb(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,vl=(c,r)=>{for(var i in r||(r={}))Kb.call(r,i)&&yl(c,i,r[i]);if(gl)for(var i of gl(r))Vb.call(r,i)&&yl(c,i,r[i]);return c};class xc extends O1{constructor(r){super(r),this.protocol=yf,this.version=G_,this.name=Ic,this.events=new Cr.EventEmitter,this.initialized=!1,this.on=(n,o)=>this.events.on(n,o),this.once=(n,o)=>this.events.once(n,o),this.off=(n,o)=>this.events.off(n,o),this.removeListener=(n,o)=>this.events.removeListener(n,o),this.projectId=r==null?void 0:r.projectId,this.relayUrl=(r==null?void 0:r.relayUrl)||mf;const i=typeof(r==null?void 0:r.logger)<"u"&&typeof(r==null?void 0:r.logger)!="string"?r.logger:Re.pino(Re.getDefaultLoggerOptions({level:(r==null?void 0:r.logger)||W_.logger}));this.logger=Re.generateChildLogger(i,this.name),this.heartbeat=new gs.HeartBeat,this.crypto=new Eb(this,this.logger,r==null?void 0:r.keychain),this.history=new qb(this,this.logger),this.expirer=new Bb(this,this.logger),this.storage=r!=null&&r.storage?r.storage:new _1(vl(vl({},J_),r==null?void 0:r.storageOptions)),this.relayer=new $b({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Ub(this,this.logger),this.verify=new Hb(this.projectId||"",this.logger)}static async init(r){const i=new xc(r);await i.initialize();const n=await i.crypto.getClientId();return await i.storage.setItem(lb,n),i}get context(){return Re.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(r){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,r),this.logger.error(r.message),r}}}const Gb=xc,wf="wc",_f=2,bf="client",Sc=`${wf}@${_f}:${bf}:`,ec={name:bf,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},Wb="WALLETCONNECT_DEEPLINK_CHOICE",Jb="proposal",Ef="Proposal expired",Yb="session",eo=ne.SEVEN_DAYS,Xb="engine",Us={wc_sessionPropose:{req:{ttl:ne.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ne.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ne.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ne.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ne.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ne.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ne.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ne.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ne.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ne.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ne.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ne.THIRTY_SECONDS,prompt:!1,tag:1115}}},tc={min:ne.FIVE_MINUTES,max:ne.SEVEN_DAYS},Zb="request",Qb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var eE=Object.defineProperty,tE=Object.defineProperties,rE=Object.getOwnPropertyDescriptors,ml=Object.getOwnPropertySymbols,iE=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,wl=(c,r,i)=>r in c?eE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,Sr=(c,r)=>{for(var i in r||(r={}))iE.call(r,i)&&wl(c,i,r[i]);if(ml)for(var i of ml(r))sE.call(r,i)&&wl(c,i,r[i]);return c},rc=(c,r)=>tE(c,rE(r));class nE extends z1{constructor(r){super(r),this.name=Xb,this.events=new vc,this.initialized=!1,this.ignoredPayloadTypes=[$l],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Us)}),this.initialized=!0)},this.connect=async i=>{this.isInitialized();const n=rc(Sr({},i),{requiredNamespaces:i.requiredNamespaces||{},optionalNamespaces:i.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:o,requiredNamespaces:l,optionalNamespaces:d,sessionProperties:v,relays:b}=n;let m=o,S,O=!1;if(m&&(O=this.client.core.pairing.pairings.get(m).active),!m||!O){const{topic:fe,uri:pe}=await this.client.core.pairing.create();m=fe,S=pe}const F=await this.client.core.crypto.generateKeyPair(),z=Sr({requiredNamespaces:l,optionalNamespaces:d,relays:b??[{protocol:vf}],proposer:{publicKey:F,metadata:this.client.metadata}},v&&{sessionProperties:v}),{reject:R,resolve:K,done:re}=hs(ne.FIVE_MINUTES,Ef);if(this.events.once(Ft("session_connect"),async({error:fe,session:pe})=>{if(fe)R(fe);else if(pe){pe.self.publicKey=F;const de=rc(Sr({},pe),{requiredNamespaces:pe.requiredNamespaces,optionalNamespaces:pe.optionalNamespaces});await this.client.session.set(pe.topic,de),await this.setExpiry(pe.topic,pe.expiry),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:pe.peer.metadata}),K(de)}}),!m){const{message:fe}=Q("NO_MATCHING_KEY",`connect() pairing topic: ${m}`);throw new Error(fe)}const he=await this.sendRequest(m,"wc_sessionPropose",z),le=Lr(ne.FIVE_MINUTES);return await this.setProposal(he,Sr({id:he,expiry:le},z)),{uri:S,approval:re}},this.pair=async i=>(this.isInitialized(),await this.client.core.pairing.pair(i)),this.approve=async i=>{this.isInitialized(),await this.isValidApprove(i);const{id:n,relayProtocol:o,namespaces:l,sessionProperties:d}=i,v=this.client.proposal.get(n);let{pairingTopic:b,proposer:m,requiredNamespaces:S,optionalNamespaces:O}=v;b=b||"",so(S)||(S=Pm(l,"approve()"));const F=await this.client.core.crypto.generateKeyPair(),z=m.publicKey,R=await this.client.core.crypto.generateSharedKey(F,z);b&&n&&(await this.client.core.pairing.updateMetadata({topic:b,metadata:m.metadata}),await this.sendResult(n,b,{relay:{protocol:o??"irn"},responderPublicKey:F}),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:b}));const K=Sr({relay:{protocol:o??"irn"},namespaces:l,requiredNamespaces:S,optionalNamespaces:O,pairingTopic:b,controller:{publicKey:F,metadata:this.client.metadata},expiry:Lr(eo)},d&&{sessionProperties:d});await this.client.core.relayer.subscribe(R),await this.sendRequest(R,"wc_sessionSettle",K);const re=rc(Sr({},K),{topic:R,pairingTopic:b,acknowledged:!1,self:K.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:F});return await this.client.session.set(R,re),await this.setExpiry(R,Lr(eo)),{topic:R,acknowledged:()=>new Promise(he=>setTimeout(()=>he(this.client.session.get(R)),500))}},this.reject=async i=>{this.isInitialized(),await this.isValidReject(i);const{id:n,reason:o}=i,{pairingTopic:l}=this.client.proposal.get(n);l&&(await this.sendError(n,l,o),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")))},this.update=async i=>{this.isInitialized(),await this.isValidUpdate(i);const{topic:n,namespaces:o}=i,l=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:o}),{done:d,resolve:v,reject:b}=hs();return this.events.once(Ft("session_update",l),({error:m})=>{m?b(m):v()}),await this.client.session.update(n,{namespaces:o}),{acknowledged:d}},this.extend=async i=>{this.isInitialized(),await this.isValidExtend(i);const{topic:n}=i,o=await this.sendRequest(n,"wc_sessionExtend",{}),{done:l,resolve:d,reject:v}=hs();return this.events.once(Ft("session_extend",o),({error:b})=>{b?v(b):d()}),await this.setExpiry(n,Lr(eo)),{acknowledged:l}},this.request=async i=>{this.isInitialized(),await this.isValidRequest(i);const{chainId:n,request:o,topic:l,expiry:d}=i,v=await this.sendRequest(l,"wc_sessionRequest",{request:o,chainId:n},d),{done:b,resolve:m,reject:S}=hs(d);this.events.once(Ft("session_request",v),({error:F,result:z})=>{F?S(F):m(z)}),this.client.events.emit("session_request_sent",{topic:l,request:o,chainId:n,id:v});const O=await this.client.core.storage.getItem(Wb);return Am({id:v,topic:l,wcDeepLink:O}),await b()},this.respond=async i=>{this.isInitialized(),await this.isValidRespond(i);const{topic:n,response:o}=i,{id:l}=o;ai(o)?await this.sendResult(l,n,o.result):$r(o)&&await this.sendError(l,n,o.error),this.deletePendingSessionRequest(i.response.id,{message:"fulfilled",code:0})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.client.session.keys.includes(n)){const o=await this.sendRequest(n,"wc_sessionPing",{}),{done:l,resolve:d,reject:v}=hs();this.events.once(Ft("session_ping",o),({error:b})=>{b?v(b):d()}),await l()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async i=>{this.isInitialized(),await this.isValidEmit(i);const{topic:n,event:o,chainId:l}=i;await this.sendRequest(n,"wc_sessionEvent",{event:o,chainId:l})},this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;if(this.client.session.keys.includes(n)){const o=_c().toString();let l;const d=v=>{(v==null?void 0:v.id.toString())===o&&(this.client.core.relayer.events.removeListener(vt.message_ack,d),l())};await Promise.all([new Promise(v=>{l=v,this.client.core.relayer.on(vt.message_ack,d)}),this.sendRequest(n,"wc_sessionDelete",tr("USER_DISCONNECTED"),void 0,o)]),await this.deleteSession(n)}else await this.client.core.pairing.disconnect({topic:n})},this.find=i=>(this.isInitialized(),this.client.session.getAll().filter(n=>Cm(n,i))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async i=>{if(i.pairingTopic)try{const n=this.client.core.pairing.pairings.get(i.pairingTopic),o=this.client.core.pairing.pairings.getAll().filter(l=>{var d,v;return((d=l.peerMetadata)==null?void 0:d.url)&&((v=l.peerMetadata)==null?void 0:v.url)===i.peer.metadata.url&&l.topic&&l.topic!==n.topic});if(o.length===0)return;this.client.logger.info(`Cleaning up ${o.length} duplicate pairing(s)`),await Promise.all(o.map(l=>this.client.core.pairing.disconnect({topic:l.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(i,n)=>{const{self:o}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),this.client.session.delete(i,tr("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),n||this.client.core.expirer.del(i)},this.deleteProposal=async(i,n)=>{await Promise.all([this.client.proposal.delete(i,tr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(i)])},this.deletePendingSessionRequest=async(i,n,o=!1)=>{await Promise.all([this.client.pendingRequest.delete(i,n),o?Promise.resolve():this.client.core.expirer.del(i)])},this.setExpiry=async(i,n)=>{this.client.session.keys.includes(i)&&await this.client.session.update(i,{expiry:n}),this.client.core.expirer.set(i,n)},this.setProposal=async(i,n)=>{await this.client.proposal.set(i,n),this.client.core.expirer.set(i,n.expiry)},this.setPendingSessionRequest=async i=>{const n=Us.wc_sessionRequest.req.ttl,{id:o,topic:l,params:d}=i;await this.client.pendingRequest.set(o,{id:o,topic:l,params:d}),n&&this.client.core.expirer.set(o,Lr(n))},this.sendRequest=async(i,n,o,l,d)=>{const v=po(n,o);if(jl()&&Qb.includes(n)){const S=fs(JSON.stringify(v));await this.client.core.verify.register({attestationId:S})}const b=await this.client.core.crypto.encode(i,v),m=Us[n].req;return l&&(m.ttl=l),d&&(m.id=d),this.client.core.history.set(i,v),this.client.core.relayer.publish(i,b,m),v.id},this.sendResult=async(i,n,o)=>{const l=bc(i,o),d=await this.client.core.crypto.encode(n,l),v=await this.client.core.history.get(n,i),b=Us[v.request.method].res;this.client.core.relayer.publish(n,d,b),await this.client.core.history.resolve(l)},this.sendError=async(i,n,o)=>{const l=go(i,o),d=await this.client.core.crypto.encode(n,l),v=await this.client.core.history.get(n,i),b=Us[v.request.method].res;this.client.core.relayer.publish(n,d,b),await this.client.core.history.resolve(l)},this.cleanup=async()=>{const i=[],n=[];this.client.session.getAll().forEach(o=>{wi(o.expiry)&&i.push(o.topic)}),this.client.proposal.getAll().forEach(o=>{wi(o.expiry)&&n.push(o.id)}),await Promise.all([...i.map(o=>this.deleteSession(o)),...n.map(o=>this.deleteProposal(o))])},this.onRelayEventRequest=i=>{const{topic:n,payload:o}=i,l=o.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeRequest(n,o);case"wc_sessionSettle":return this.onSessionSettleRequest(n,o);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,o);case"wc_sessionExtend":return this.onSessionExtendRequest(n,o);case"wc_sessionPing":return this.onSessionPingRequest(n,o);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,o);case"wc_sessionRequest":return this.onSessionRequest(n,o);case"wc_sessionEvent":return this.onSessionEventRequest(n,o);default:return this.client.logger.info(`Unsupported request method ${l}`)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:o}=i,l=(await this.client.core.history.get(n,o.id)).request.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeResponse(n,o);case"wc_sessionSettle":return this.onSessionSettleResponse(n,o);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,o);case"wc_sessionExtend":return this.onSessionExtendResponse(n,o);case"wc_sessionPing":return this.onSessionPingResponse(n,o);case"wc_sessionRequest":return this.onSessionRequestResponse(n,o);default:return this.client.logger.info(`Unsupported response method ${l}`)}},this.onRelayEventUnknownPayload=i=>{const{topic:n}=i,{message:o}=Q("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(o)},this.onSessionProposeRequest=async(i,n)=>{const{params:o,id:l}=n;try{this.isValidConnect(Sr({},n.params));const d=Lr(ne.FIVE_MINUTES),v=Sr({id:l,pairingTopic:i,expiry:d},o);await this.setProposal(l,v);const b=fs(JSON.stringify(n)),m=await this.getVerifyContext(b,v.proposer.metadata);this.client.events.emit("session_proposal",{id:l,params:v,verifyContext:m})}catch(d){await this.sendError(l,i,d),this.client.logger.error(d)}},this.onSessionProposeResponse=async(i,n)=>{const{id:o}=n;if(ai(n)){const{result:l}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:l});const d=this.client.proposal.get(o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:d});const v=d.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:v});const b=l.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:b});const m=await this.client.core.crypto.generateSharedKey(v,b);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:m});const S=await this.client.core.relayer.subscribe(m);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:S}),await this.client.core.pairing.activate({topic:i})}else $r(n)&&(await this.client.proposal.delete(o,tr("USER_DISCONNECTED")),this.events.emit(Ft("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(i,n)=>{const{id:o,params:l}=n;try{this.isValidSessionSettleRequest(l);const{relay:d,controller:v,expiry:b,namespaces:m,requiredNamespaces:S,optionalNamespaces:O,sessionProperties:F,pairingTopic:z}=n.params,R=Sr({topic:i,relay:d,expiry:b,namespaces:m,acknowledged:!0,pairingTopic:z,requiredNamespaces:S,optionalNamespaces:O,controller:v.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:v.publicKey,metadata:v.metadata}},F&&{sessionProperties:F});await this.sendResult(n.id,i,!0),this.events.emit(Ft("session_connect"),{session:R}),this.cleanupDuplicatePairings(R)}catch(d){await this.sendError(o,i,d),this.client.logger.error(d)}},this.onSessionSettleResponse=async(i,n)=>{const{id:o}=n;ai(n)?(await this.client.session.update(i,{acknowledged:!0}),this.events.emit(Ft("session_approve",o),{})):$r(n)&&(await this.client.session.delete(i,tr("USER_DISCONNECTED")),this.events.emit(Ft("session_approve",o),{error:n.error}))},this.onSessionUpdateRequest=async(i,n)=>{const{params:o,id:l}=n;try{this.isValidUpdate(Sr({topic:i},o)),await this.client.session.update(i,{namespaces:o.namespaces}),await this.sendResult(l,i,!0),this.client.events.emit("session_update",{id:l,topic:i,params:o})}catch(d){await this.sendError(l,i,d),this.client.logger.error(d)}},this.onSessionUpdateResponse=(i,n)=>{const{id:o}=n;ai(n)?this.events.emit(Ft("session_update",o),{}):$r(n)&&this.events.emit(Ft("session_update",o),{error:n.error})},this.onSessionExtendRequest=async(i,n)=>{const{id:o}=n;try{this.isValidExtend({topic:i}),await this.setExpiry(i,Lr(eo)),await this.sendResult(o,i,!0),this.client.events.emit("session_extend",{id:o,topic:i})}catch(l){await this.sendError(o,i,l),this.client.logger.error(l)}},this.onSessionExtendResponse=(i,n)=>{const{id:o}=n;ai(n)?this.events.emit(Ft("session_extend",o),{}):$r(n)&&this.events.emit(Ft("session_extend",o),{error:n.error})},this.onSessionPingRequest=async(i,n)=>{const{id:o}=n;try{this.isValidPing({topic:i}),await this.sendResult(o,i,!0),this.client.events.emit("session_ping",{id:o,topic:i})}catch(l){await this.sendError(o,i,l),this.client.logger.error(l)}},this.onSessionPingResponse=(i,n)=>{const{id:o}=n;setTimeout(()=>{ai(n)?this.events.emit(Ft("session_ping",o),{}):$r(n)&&this.events.emit(Ft("session_ping",o),{error:n.error})},500)},this.onSessionDeleteRequest=async(i,n)=>{const{id:o}=n;try{this.isValidDisconnect({topic:i,reason:n.params}),await Promise.all([new Promise(l=>{this.client.core.relayer.once(vt.publish,async()=>{l(await this.deleteSession(i))})}),this.sendResult(o,i,!0)]),this.client.events.emit("session_delete",{id:o,topic:i})}catch(l){this.client.logger.error(l)}},this.onSessionRequest=async(i,n)=>{const{id:o,params:l}=n;try{this.isValidRequest(Sr({topic:i},l)),await this.setPendingSessionRequest({id:o,topic:i,params:l});const d=fs(JSON.stringify(n)),v=this.client.session.get(i),b=await this.getVerifyContext(d,v.peer.metadata);this.client.events.emit("session_request",{id:o,topic:i,params:l,verifyContext:b})}catch(d){await this.sendError(o,i,d),this.client.logger.error(d)}},this.onSessionRequestResponse=(i,n)=>{const{id:o}=n;ai(n)?this.events.emit(Ft("session_request",o),{result:n.result}):$r(n)&&this.events.emit(Ft("session_request",o),{error:n.error})},this.onSessionEventRequest=async(i,n)=>{const{id:o,params:l}=n;try{this.isValidEmit(Sr({topic:i},l)),this.client.events.emit("session_event",{id:o,topic:i,params:l})}catch(d){await this.sendError(o,i,d),this.client.logger.error(d)}},this.isValidConnect=async i=>{if(!ur(i)){const{message:b}=Q("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(i)}`);throw new Error(b)}const{pairingTopic:n,requiredNamespaces:o,optionalNamespaces:l,sessionProperties:d,relays:v}=i;if(_i(n)||await this.isValidPairingTopic(n),!Om(v,!0)){const{message:b}=Q("MISSING_OR_INVALID",`connect() relays: ${v}`);throw new Error(b)}!_i(o)&&so(o)!==0&&this.validateNamespaces(o,"requiredNamespaces"),!_i(l)&&so(l)!==0&&this.validateNamespaces(l,"optionalNamespaces"),_i(d)||this.validateSessionProps(d,"sessionProperties")},this.validateNamespaces=(i,n)=>{const o=Rm(i,"connect()",n);if(o)throw new Error(o.message)},this.isValidApprove=async i=>{if(!ur(i))throw new Error(Q("MISSING_OR_INVALID",`approve() params: ${i}`).message);const{id:n,namespaces:o,relayProtocol:l,sessionProperties:d}=i;await this.isValidProposalId(n);const v=this.client.proposal.get(n),b=Ha(o,"approve()");if(b)throw new Error(b.message);const m=Oh(v.requiredNamespaces,o,"approve()");if(m)throw new Error(m.message);if(!ls(l,!0)){const{message:S}=Q("MISSING_OR_INVALID",`approve() relayProtocol: ${l}`);throw new Error(S)}_i(d)||this.validateSessionProps(d,"sessionProperties")},this.isValidReject=async i=>{if(!ur(i)){const{message:l}=Q("MISSING_OR_INVALID",`reject() params: ${i}`);throw new Error(l)}const{id:n,reason:o}=i;if(await this.isValidProposalId(n),!Tm(o)){const{message:l}=Q("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(o)}`);throw new Error(l)}},this.isValidSessionSettleRequest=i=>{if(!ur(i)){const{message:m}=Q("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${i}`);throw new Error(m)}const{relay:n,controller:o,namespaces:l,expiry:d}=i;if(!Nm(n)){const{message:m}=Q("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(m)}const v=Dm(o,"onSessionSettleRequest()");if(v)throw new Error(v.message);const b=Ha(l,"onSessionSettleRequest()");if(b)throw new Error(b.message);if(wi(d)){const{message:m}=Q("EXPIRED","onSessionSettleRequest()");throw new Error(m)}},this.isValidUpdate=async i=>{if(!ur(i)){const{message:b}=Q("MISSING_OR_INVALID",`update() params: ${i}`);throw new Error(b)}const{topic:n,namespaces:o}=i;await this.isValidSessionTopic(n);const l=this.client.session.get(n),d=Ha(o,"update()");if(d)throw new Error(d.message);const v=Oh(l.requiredNamespaces,o,"update()");if(v)throw new Error(v.message)},this.isValidExtend=async i=>{if(!ur(i)){const{message:o}=Q("MISSING_OR_INVALID",`extend() params: ${i}`);throw new Error(o)}const{topic:n}=i;await this.isValidSessionTopic(n)},this.isValidRequest=async i=>{if(!ur(i)){const{message:b}=Q("MISSING_OR_INVALID",`request() params: ${i}`);throw new Error(b)}const{topic:n,request:o,chainId:l,expiry:d}=i;await this.isValidSessionTopic(n);const{namespaces:v}=this.client.session.get(n);if(!Rh(v,l)){const{message:b}=Q("MISSING_OR_INVALID",`request() chainId: ${l}`);throw new Error(b)}if(!Fm(o)){const{message:b}=Q("MISSING_OR_INVALID",`request() ${JSON.stringify(o)}`);throw new Error(b)}if(!Lm(v,l,o.method)){const{message:b}=Q("MISSING_OR_INVALID",`request() method: ${o.method}`);throw new Error(b)}if(d&&!$m(d,tc)){const{message:b}=Q("MISSING_OR_INVALID",`request() expiry: ${d}. Expiry must be a number (in seconds) between ${tc.min} and ${tc.max}`);throw new Error(b)}},this.isValidRespond=async i=>{if(!ur(i)){const{message:l}=Q("MISSING_OR_INVALID",`respond() params: ${i}`);throw new Error(l)}const{topic:n,response:o}=i;if(await this.isValidSessionTopic(n),!Mm(o)){const{message:l}=Q("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(l)}},this.isValidPing=async i=>{if(!ur(i)){const{message:o}=Q("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(o)}const{topic:n}=i;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async i=>{if(!ur(i)){const{message:v}=Q("MISSING_OR_INVALID",`emit() params: ${i}`);throw new Error(v)}const{topic:n,event:o,chainId:l}=i;await this.isValidSessionTopic(n);const{namespaces:d}=this.client.session.get(n);if(!Rh(d,l)){const{message:v}=Q("MISSING_OR_INVALID",`emit() chainId: ${l}`);throw new Error(v)}if(!jm(o)){const{message:v}=Q("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(v)}if(!zm(d,l,o.name)){const{message:v}=Q("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(v)}},this.isValidDisconnect=async i=>{if(!ur(i)){const{message:o}=Q("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(o)}const{topic:n}=i;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(i,n)=>{const o={verified:{verifyUrl:n.verifyUrl||"",validation:"UNKNOWN",origin:n.url||""}};try{const l=await this.client.core.verify.resolve({attestationId:i,verifyUrl:n.verifyUrl});l&&(o.verified.origin=l,o.verified.validation=l===n.url?"VALID":"INVALID")}catch(l){this.client.logger.error(l)}return this.client.logger.info(`Verify context: ${JSON.stringify(o)}`),o},this.validateSessionProps=(i,n)=>{Object.values(i).forEach(o=>{if(!ls(o,!1)){const{message:l}=Q("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(o)}`);throw new Error(l)}})}}isInitialized(){if(!this.initialized){const{message:r}=Q("NOT_INITIALIZED",this.name);throw new Error(r)}}registerRelayerEvents(){this.client.core.relayer.on(vt.message,async r=>{const{topic:i,message:n}=r;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const o=await this.client.core.crypto.decode(i,n);Ec(o)?(this.client.core.history.set(i,o),this.onRelayEventRequest({topic:i,payload:o})):yo(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:i,payload:o}),this.client.core.history.delete(i,o.id)):this.onRelayEventUnknownPayload({topic:i,payload:o})})}registerExpirerEvents(){this.client.core.expirer.on(Pr.expired,async r=>{const{topic:i,id:n}=Ml(r.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,Q("EXPIRED"),!0);i?this.client.session.keys.includes(i)&&(await this.deleteSession(i,!0),this.client.events.emit("session_expire",{topic:i})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}isValidPairingTopic(r){if(!ls(r,!1)){const{message:i}=Q("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(i)}if(!this.client.core.pairing.pairings.keys.includes(r)){const{message:i}=Q("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(i)}if(wi(this.client.core.pairing.pairings.get(r).expiry)){const{message:i}=Q("EXPIRED",`pairing topic: ${r}`);throw new Error(i)}}async isValidSessionTopic(r){if(!ls(r,!1)){const{message:i}=Q("MISSING_OR_INVALID",`session topic should be a string: ${r}`);throw new Error(i)}if(!this.client.session.keys.includes(r)){const{message:i}=Q("NO_MATCHING_KEY",`session topic doesn't exist: ${r}`);throw new Error(i)}if(wi(this.client.session.get(r).expiry)){await this.deleteSession(r);const{message:i}=Q("EXPIRED",`session topic: ${r}`);throw new Error(i)}}async isValidSessionOrPairingTopic(r){if(this.client.session.keys.includes(r))await this.isValidSessionTopic(r);else if(this.client.core.pairing.pairings.keys.includes(r))this.isValidPairingTopic(r);else if(ls(r,!1)){const{message:i}=Q("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${r}`);throw new Error(i)}else{const{message:i}=Q("MISSING_OR_INVALID",`session or pairing topic should be a string: ${r}`);throw new Error(i)}}async isValidProposalId(r){if(!Um(r)){const{message:i}=Q("MISSING_OR_INVALID",`proposal id should be a number: ${r}`);throw new Error(i)}if(!this.client.proposal.keys.includes(r)){const{message:i}=Q("NO_MATCHING_KEY",`proposal id doesn't exist: ${r}`);throw new Error(i)}if(wi(this.client.proposal.get(r).expiry)){await this.deleteProposal(r);const{message:i}=Q("EXPIRED",`proposal id: ${r}`);throw new Error(i)}}}class oE extends mo{constructor(r,i){super(r,i,Jb,Sc),this.core=r,this.logger=i}}class aE extends mo{constructor(r,i){super(r,i,Yb,Sc),this.core=r,this.logger=i}}class cE extends mo{constructor(r,i){super(r,i,Zb,Sc,n=>n.id),this.core=r,this.logger=i}}let uE=class If extends j1{constructor(r){super(r),this.protocol=wf,this.version=_f,this.name=ec.name,this.events=new Cr.EventEmitter,this.on=(n,o)=>this.events.on(n,o),this.once=(n,o)=>this.events.once(n,o),this.off=(n,o)=>this.events.off(n,o),this.removeListener=(n,o)=>this.events.removeListener(n,o),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(o){throw this.logger.error(o.message),o}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(o){throw this.logger.error(o.message),o}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(o){throw this.logger.error(o.message),o}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(o){throw this.logger.error(o.message),o}},this.update=async n=>{try{return await this.engine.update(n)}catch(o){throw this.logger.error(o.message),o}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(o){throw this.logger.error(o.message),o}},this.request=async n=>{try{return await this.engine.request(n)}catch(o){throw this.logger.error(o.message),o}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(o){throw this.logger.error(o.message),o}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(o){throw this.logger.error(o.message),o}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(o){throw this.logger.error(o.message),o}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(o){throw this.logger.error(o.message),o}},this.find=n=>{try{return this.engine.find(n)}catch(o){throw this.logger.error(o.message),o}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=(r==null?void 0:r.name)||ec.name,this.metadata=(r==null?void 0:r.metadata)||Sm();const i=typeof(r==null?void 0:r.logger)<"u"&&typeof(r==null?void 0:r.logger)!="string"?r.logger:Re.pino(Re.getDefaultLoggerOptions({level:(r==null?void 0:r.logger)||ec.logger}));this.core=(r==null?void 0:r.core)||new Gb(r),this.logger=Re.generateChildLogger(i,this.name),this.session=new aE(this.core,this.logger),this.proposal=new oE(this.core,this.logger),this.pendingRequest=new cE(this.core,this.logger),this.engine=new nE(this)}static async init(r){const i=new If(r);return await i.initialize(),i}get context(){return Re.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(r){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(r.message),r}}};var lc={exports:{}};(function(c,r){var i=typeof self<"u"?self:Mr,n=function(){function l(){this.fetch=!1,this.DOMException=i.DOMException}return l.prototype=i,new l}();(function(l){(function(d){var v={searchParams:"URLSearchParams"in l,iterable:"Symbol"in l&&"iterator"in Symbol,blob:"FileReader"in l&&"Blob"in l&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in l,arrayBuffer:"ArrayBuffer"in l};function b(y){return y&&DataView.prototype.isPrototypeOf(y)}if(v.arrayBuffer)var m=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],S=ArrayBuffer.isView||function(y){return y&&m.indexOf(Object.prototype.toString.call(y))>-1};function O(y){if(typeof y!="string"&&(y=String(y)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(y))throw new TypeError("Invalid character in header field name");return y.toLowerCase()}function F(y){return typeof y!="string"&&(y=String(y)),y}function z(y){var I={next:function(){var X=y.shift();return{done:X===void 0,value:X}}};return v.iterable&&(I[Symbol.iterator]=function(){return I}),I}function R(y){this.map={},y instanceof R?y.forEach(function(I,X){this.append(X,I)},this):Array.isArray(y)?y.forEach(function(I){this.append(I[0],I[1])},this):y&&Object.getOwnPropertyNames(y).forEach(function(I){this.append(I,y[I])},this)}R.prototype.append=function(y,I){y=O(y),I=F(I);var X=this.map[y];this.map[y]=X?X+", "+I:I},R.prototype.delete=function(y){delete this.map[O(y)]},R.prototype.get=function(y){return y=O(y),this.has(y)?this.map[y]:null},R.prototype.has=function(y){return this.map.hasOwnProperty(O(y))},R.prototype.set=function(y,I){this.map[O(y)]=F(I)},R.prototype.forEach=function(y,I){for(var X in this.map)this.map.hasOwnProperty(X)&&y.call(I,this.map[X],X,this)},R.prototype.keys=function(){var y=[];return this.forEach(function(I,X){y.push(X)}),z(y)},R.prototype.values=function(){var y=[];return this.forEach(function(I){y.push(I)}),z(y)},R.prototype.entries=function(){var y=[];return this.forEach(function(I,X){y.push([X,I])}),z(y)},v.iterable&&(R.prototype[Symbol.iterator]=R.prototype.entries);function K(y){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}function re(y){return new Promise(function(I,X){y.onload=function(){I(y.result)},y.onerror=function(){X(y.error)}})}function he(y){var I=new FileReader,X=re(I);return I.readAsArrayBuffer(y),X}function le(y){var I=new FileReader,X=re(I);return I.readAsText(y),X}function fe(y){for(var I=new Uint8Array(y),X=new Array(I.length),ce=0;ce-1?I:y}function W(y,I){I=I||{};var X=I.body;if(y instanceof W){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,I.headers||(this.headers=new R(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!X&&y._bodyInit!=null&&(X=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=I.credentials||this.credentials||"same-origin",(I.headers||!this.headers)&&(this.headers=new R(I.headers)),this.method=q(I.method||this.method||"GET"),this.mode=I.mode||this.mode||null,this.signal=I.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(X)}W.prototype.clone=function(){return new W(this,{body:this._bodyInit})};function ve(y){var I=new FormData;return y.trim().split("&").forEach(function(X){if(X){var ce=X.split("="),V=ce.shift().replace(/\+/g," "),B=ce.join("=").replace(/\+/g," ");I.append(decodeURIComponent(V),decodeURIComponent(B))}}),I}function ie(y){var I=new R,X=y.replace(/\r?\n[\t ]+/g," ");return X.split(/\r?\n/).forEach(function(ce){var V=ce.split(":"),B=V.shift().trim();if(B){var k=V.join(":").trim();I.append(B,k)}}),I}de.call(W.prototype);function ue(y,I){I||(I={}),this.type="default",this.status=I.status===void 0?200:I.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in I?I.statusText:"OK",this.headers=new R(I.headers),this.url=I.url||"",this._initBody(y)}de.call(ue.prototype),ue.prototype.clone=function(){return new ue(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new R(this.headers),url:this.url})},ue.error=function(){var y=new ue(null,{status:0,statusText:""});return y.type="error",y};var Te=[301,302,303,307,308];ue.redirect=function(y,I){if(Te.indexOf(I)===-1)throw new RangeError("Invalid status code");return new ue(null,{status:I,headers:{location:y}})},d.DOMException=l.DOMException;try{new d.DOMException}catch{d.DOMException=function(I,X){this.message=I,this.name=X;var ce=Error(I);this.stack=ce.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function Ue(y,I){return new Promise(function(X,ce){var V=new W(y,I);if(V.signal&&V.signal.aborted)return ce(new d.DOMException("Aborted","AbortError"));var B=new XMLHttpRequest;function k(){B.abort()}B.onload=function(){var G={status:B.status,statusText:B.statusText,headers:ie(B.getAllResponseHeaders()||"")};G.url="responseURL"in B?B.responseURL:G.headers.get("X-Request-URL");var Je="response"in B?B.response:B.responseText;X(new ue(Je,G))},B.onerror=function(){ce(new TypeError("Network request failed"))},B.ontimeout=function(){ce(new TypeError("Network request failed"))},B.onabort=function(){ce(new d.DOMException("Aborted","AbortError"))},B.open(V.method,V.url,!0),V.credentials==="include"?B.withCredentials=!0:V.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&v.blob&&(B.responseType="blob"),V.headers.forEach(function(G,Je){B.setRequestHeader(Je,G)}),V.signal&&(V.signal.addEventListener("abort",k),B.onreadystatechange=function(){B.readyState===4&&V.signal.removeEventListener("abort",k)}),B.send(typeof V._bodyInit>"u"?null:V._bodyInit)})}return Ue.polyfill=!0,l.fetch||(l.fetch=Ue,l.Headers=R,l.Request=W,l.Response=ue),d.Headers=R,d.Request=W,d.Response=ue,d.fetch=Ue,Object.defineProperty(d,"__esModule",{value:!0}),d})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;r=o.fetch,r.default=o.fetch,r.fetch=o.fetch,r.Headers=o.Headers,r.Request=o.Request,r.Response=o.Response,c.exports=r})(lc,lc.exports);var hE=lc.exports;const _l=Ll(hE),lE={Accept:"application/json","Content-Type":"application/json"},fE="POST",bl={headers:lE,method:fE},El=10;class Hi{constructor(r,i=!1){if(this.url=r,this.disableProviderPing=i,this.events=new Cr.EventEmitter,this.isAvailable=!1,this.registering=!1,!Jh(r))throw new Error(`Provided URL is not compatible with HTTP connection: ${r}`);this.url=r,this.disableProviderPing=i}get connected(){return this.isAvailable}get connecting(){return this.registering}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}off(r,i){this.events.off(r,i)}removeListener(r,i){this.events.removeListener(r,i)}async open(r=this.url){await this.register(r)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(r,i){this.isAvailable||await this.register();try{const n=Ui(r),l=await(await _l(this.url,Object.assign(Object.assign({},bl),{body:n}))).json();this.onPayload({data:l})}catch(n){this.onError(r.id,n)}}async register(r=this.url){if(!Jh(r))throw new Error(`Provided URL is not compatible with HTTP connection: ${r}`);if(this.registering){const i=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=i||this.events.listenerCount("open")>=i)&&this.events.setMaxListeners(i+1),new Promise((n,o)=>{this.events.once("register_error",l=>{this.resetMaxListeners(),o(l)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return o(new Error("HTTP connection is missing or invalid"));n()})})}this.url=r,this.registering=!0;try{if(!this.disableProviderPing){const i=Ui({id:1,jsonrpc:"2.0",method:"test",params:[]});await _l(r,Object.assign(Object.assign({},bl),{body:i}))}this.onOpen()}catch(i){const n=this.parseError(i);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(r){if(typeof r.data>"u")return;const i=typeof r.data=="string"?Ks(r.data):r.data;this.events.emit("payload",i)}onError(r,i){const n=this.parseError(i),o=n.message||n.toString(),l=go(r,o);this.events.emit("payload",l)}parseError(r,i=this.url){return Ql(r,i,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>El&&this.events.setMaxListeners(El)}}const Il="error",pE="wss://relay.walletconnect.com",dE="wc",gE="universal_provider",xl=`${dE}@2:${gE}:`,yE="https://rpc.walletconnect.com/v1",Ii={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},fc={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -24,4 +24,4 @@ __p += '`),Oe&&(H+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+H+`return __p -}`;var Ee=xh(function(){return Le(p,te+"return "+H).apply(i,w)});if(Ee.source=H,Na(Ee))throw Ee;return Ee}function hv(e){return Me(e).toLowerCase()}function lv(e){return Me(e).toUpperCase()}function fv(e,t,s){if(e=Me(e),e&&(s||t===i))return Dc(e);if(!e||!(t=fr(t)))return e;var a=Tr(e),h=Tr(t),p=Fc(a,h),w=Lc(a,h)+1;return vi(a,p,w).join("")}function pv(e,t,s){if(e=Me(e),e&&(s||t===i))return e.slice(0,Mc(e)+1);if(!e||!(t=fr(t)))return e;var a=Tr(e),h=Lc(a,Tr(t))+1;return vi(a,0,h).join("")}function dv(e,t,s){if(e=Me(e),e&&(s||t===i))return e.replace(dt,"");if(!e||!(t=fr(t)))return e;var a=Tr(e),h=Fc(a,Tr(t));return vi(a,h).join("")}function gv(e,t){var s=ie,a=ue;if(ct(t)){var h="separator"in t?t.separator:h;s="length"in t?_e(t.length):s,a="omission"in t?fr(t.omission):a}e=Me(e);var p=e.length;if(Zi(e)){var w=Tr(e);p=w.length}if(s>=p)return e;var _=s-Qi(a);if(_<1)return a;var A=w?vi(w,0,_).join(""):e.slice(0,_);if(h===i)return A+a;if(w&&(_+=A.length-_),Da(h)){if(e.slice(_).search(h)){var M,j=A;for(h.global||(h=Jo(h.source,Me(yr.exec(h))+"g")),h.lastIndex=0;M=h.exec(j);)var H=M.index;A=A.slice(0,H===i?_:H)}}else if(e.indexOf(fr(h),_)!=_){var J=A.lastIndexOf(h);J>-1&&(A=A.slice(0,J))}return A+a}function yv(e){return e=Me(e),e&&ht.test(e)?e.replace(ci,Kf):e}var vv=os(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),$a=Su("toUpperCase");function Ih(e,t,s){return e=Me(e),t=s?i:t,t===i?Uf(e)?Wf(e):Tf(e):e.match(t)||[]}var xh=xe(function(e,t){try{return zt(e,i,t)}catch(s){return Na(s)?s:new ye(s)}}),mv=ei(function(e,t){return mr(t,function(s){s=kr(s),Zr(e,s,Ra(e[s],e))}),e});function wv(e){var t=e==null?0:e.length,s=se();return e=t?st(e,function(a){if(typeof a[1]!="function")throw new wr(d);return[s(a[0]),a[1]]}):[],xe(function(a){for(var h=-1;++hV)return[];var s=G,a=Vt(e,G);t=se(t),e-=G;for(var h=Vo(a,t);++s0||t<0)?new Ae(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==i&&(t=_e(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},Ae.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ae.prototype.toArray=function(){return this.take(G)},Br(Ae.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),h=f[a?"take"+(t=="last"?"Right":""):t],p=a||/^find/.test(t);h&&(f.prototype[t]=function(){var w=this.__wrapped__,_=a?[1]:arguments,A=w instanceof Ae,M=_[0],j=A||we(w),H=function(Se){var Oe=h.apply(f,li([Se],_));return a&&J?Oe[0]:Oe};j&&s&&typeof M=="function"&&M.length!=1&&(A=j=!1);var J=this.__chain__,te=!!this.__actions__.length,oe=p&&!J,Ee=A&&!te;if(!p&&j){w=Ee?w:new Ae(this);var ae=e.apply(w,_);return ae.__actions__.push({func:kn,args:[H],thisArg:i}),new _r(ae,J)}return oe&&Ee?e.apply(this,_):(ae=this.thru(H),oe?a?ae.value()[0]:ae.value():ae)})}),mr(["pop","push","shift","sort","splice","unshift"],function(e){var t=yn[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",a=/^(?:pop|shift)$/.test(e);f.prototype[e]=function(){var h=arguments;if(a&&!this.__chain__){var p=this.value();return t.apply(we(p)?p:[],h)}return this[s](function(w){return t.apply(we(w)?w:[],h)})}}),Br(Ae.prototype,function(e,t){var s=f[t];if(s){var a=s.name+"";ze.call(is,a)||(is[a]=[]),is[a].push({name:t,func:s})}}),is[Mn(i,he).name]=[{name:"wrapper",func:i}],Ae.prototype.clone=yp,Ae.prototype.reverse=vp,Ae.prototype.value=mp,f.prototype.at=Gg,f.prototype.chain=Wg,f.prototype.commit=Jg,f.prototype.next=Yg,f.prototype.plant=Zg,f.prototype.reverse=Qg,f.prototype.toJSON=f.prototype.valueOf=f.prototype.value=ey,f.prototype.first=f.prototype.head,bs&&(f.prototype[bs]=Xg),f},es=Jf();_t?((_t.exports=es)._=es,Ge._=es):Ce._=es}).call(qs)})(fc,fc.exports);var vE=Object.defineProperty,mE=Object.defineProperties,wE=Object.getOwnPropertyDescriptors,Sl=Object.getOwnPropertySymbols,_E=Object.prototype.hasOwnProperty,bE=Object.prototype.propertyIsEnumerable,Pl=(c,r,i)=>r in c?vE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,to=(c,r)=>{for(var i in r||(r={}))_E.call(r,i)&&Pl(c,i,r[i]);if(Sl)for(var i of Sl(r))bE.call(r,i)&&Pl(c,i,r[i]);return c},EE=(c,r)=>mE(c,wE(r));function Ar(c,r,i){let n;const o=pc(c);return r.rpcMap&&(n=r.rpcMap[o]),n||(n=`${yE}?chainId=eip155:${o}&projectId=${i}`),n}function pc(c){return c.includes("eip155")?Number(c.split(":")[1]):Number(c)}function xf(c){return c.map(r=>`${r.split(":")[0]}:${r.split(":")[1]}`)}function IE(c,r){const i=Object.keys(r.namespaces).filter(o=>o.includes(c));if(!i.length)return[];const n=[];return i.forEach(o=>{const l=r.namespaces[o].accounts;n.push(...l)}),n}function xE(c={},r={}){const i=Al(c),n=Al(r);return fc.exports.merge(i,n)}function Al(c){var r,i,n,o;const l={};if(!so(c))return l;for(const[d,v]of Object.entries(c)){const b=ql(d)?[d]:v.chains,m=v.methods||[],S=v.events||[],O=v.rpcMap||{},F=no(d);l[F]=EE(to(to({},l[F]),v),{chains:ka(b,(r=l[F])==null?void 0:r.chains),methods:ka(m,(i=l[F])==null?void 0:i.methods),events:ka(S,(n=l[F])==null?void 0:n.events),rpcMap:to(to({},O),(o=l[F])==null?void 0:o.rpcMap)})}return l}function SE(c){return c.includes(":")?c.split(":")[2]:c}function PE(c){const r={};for(const[i,n]of Object.entries(c)){const o=n.methods||[],l=n.events||[],d=n.accounts||[],v=ql(i)?[i]:n.chains?n.chains:xf(n.accounts);r[i]={chains:v,methods:o,events:l,accounts:d}}return r}const Sf={},It=c=>Sf[c],ic=(c,r)=>{Sf[c]=r};class AE{constructor(r){this.name="polkadot",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(this.chainId=r,!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const r=this.namespace.accounts;return r?r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2])||[]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class CE{constructor(r){this.name="eip155",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(r){switch(r.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(r);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(r.request.method)?await this.client.request(r):this.getHttpProvider().request(r.request)}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}setDefaultChain(r,i){const n=pc(r);if(!this.httpProviders[n]){const o=i||Ar(`${this.name}:${n}`,this.namespace,this.client.core.projectId);if(!o)throw new Error(`No RPC url provided for chainId: ${n}`);this.setHttpProvider(n,o)}this.chainId=n,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${n}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}createHttpProvider(r,i){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;const o=pc(i);r[o]=this.createHttpProvider(o,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}getHttpProvider(){const r=this.chainId,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}async handleSwitchChain(r){var i,n;let o=r.request.params?(i=r.request.params[0])==null?void 0:i.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const l=parseInt(o,16);if(this.isChainApproved(l))this.setDefaultChain(`${l}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:r.topic,request:{method:r.request.method,params:[{chainId:o}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${l}`);else throw new Error(`Failed to switch to chain 'eip155:${l}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(r){return this.namespace.chains.includes(`${this.name}:${r}`)}}class OE{constructor(r){this.name="solana",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.chainId=r,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class RE{constructor(r){this.name="cosmos",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(this.chainId=r,!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class TE{constructor(r){this.name="cip34",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(this.chainId=r,!this.httpProviders[r]){const n=i||this.getCardanoRPCUrl(r);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{const n=this.getCardanoRPCUrl(i);r[i]=this.createHttpProvider(i,n)}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}getCardanoRPCUrl(r){const i=this.namespace.rpcMap;if(i)return i[r]}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||this.getCardanoRPCUrl(r);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class NE{constructor(r){this.name="elrond",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.chainId=r,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class DE{constructor(r){this.name="multiversx",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.chainId=r,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}var FE=Object.defineProperty,LE=Object.defineProperties,$E=Object.getOwnPropertyDescriptors,Cl=Object.getOwnPropertySymbols,ME=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,Ol=(c,r,i)=>r in c?FE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,ro=(c,r)=>{for(var i in r||(r={}))ME.call(r,i)&&Ol(c,i,r[i]);if(Cl)for(var i of Cl(r))jE.call(r,i)&&Ol(c,i,r[i]);return c},sc=(c,r)=>LE(c,$E(r));class Pc{constructor(r){this.events=new vc,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=r,this.logger=typeof(r==null?void 0:r.logger)<"u"&&typeof(r==null?void 0:r.logger)!="string"?r.logger:Re.pino(Re.getDefaultLoggerOptions({level:(r==null?void 0:r.logger)||Il})),this.disableProviderPing=(r==null?void 0:r.disableProviderPing)||!1}static async init(r){const i=new Pc(r);return await i.initialize(),i}async request(r,i){const[n,o]=this.validateChain(i);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:ro({},r),chainId:`${n}:${o}`,topic:this.session.topic})}sendAsync(r,i,n){this.request(r,n).then(o=>i(null,o)).catch(o=>i(o,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 r;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(r=this.session)==null?void 0:r.topic,reason:tr("USER_DISCONNECTED")}),await this.cleanup()}async connect(r){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(r),await this.cleanupPendingPairings(),!r.skipPairing)return await this.pair(r.pairingTopic)}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}removeListener(r,i){this.events.removeListener(r,i)}off(r,i){this.events.off(r,i)}get isWalletConnect(){return!0}async pair(r){this.shouldAbortPairingAttempt=!1;let i=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(i>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:o}=await this.client.connect({pairingTopic:r,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await o().then(l=>{this.session=l,this.namespaces||(this.namespaces=PE(l.namespaces),this.persist("namespaces",this.namespaces))}).catch(l=>{if(l.message!==Ef)throw l;i++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(r,i){try{if(!this.session)return;const[n,o]=this.validateChain(r);this.getProvider(n).setDefaultChain(o,i)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(r={}){this.logger.info("Cleaning up inactive pairings...");const i=this.client.pairing.getAll();if(ps(i)){for(const n of i)r.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${i.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 r=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[r]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await uE.init({logger:this.providerOpts.logger||Il,relayUrl:this.providerOpts.relayUrl||pE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,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 r=[...new Set(Object.keys(this.session.namespaces).map(i=>no(i)))];ic("client",this.client),ic("events",this.events),ic("disableProviderPing",this.disableProviderPing),r.forEach(i=>{if(!this.session)return;const n=IE(i,this.session),o=xf(n),l=xE(this.namespaces,this.optionalNamespaces),d=sc(ro({},l[i]),{accounts:n,chains:o});switch(i){case"eip155":this.rpcProviders[i]=new CE({namespace:d});break;case"solana":this.rpcProviders[i]=new OE({namespace:d});break;case"cosmos":this.rpcProviders[i]=new RE({namespace:d});break;case"polkadot":this.rpcProviders[i]=new AE({namespace:d});break;case"cip34":this.rpcProviders[i]=new TE({namespace:d});break;case"elrond":this.rpcProviders[i]=new NE({namespace:d});break;case"multiversx":this.rpcProviders[i]=new DE({namespace:d});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",r=>{this.events.emit("session_ping",r)}),this.client.on("session_event",r=>{const{params:i}=r,{event:n}=i;if(n.name==="accountsChanged"){const o=n.data;o&&ps(o)&&this.events.emit("accountsChanged",o.map(SE))}else n.name==="chainChanged"?this.onChainChanged(i.chainId):this.events.emit(n.name,n.data);this.events.emit("session_event",r)}),this.client.on("session_update",({topic:r,params:i})=>{var n;const{namespaces:o}=i,l=(n=this.client)==null?void 0:n.session.get(r);this.session=sc(ro({},l),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:r,params:i})}),this.client.on("session_delete",async r=>{await this.cleanup(),this.events.emit("session_delete",r),this.events.emit("disconnect",sc(ro({},tr("USER_DISCONNECTED")),{data:r.topic}))}),this.on(Ii.DEFAULT_CHAIN_CHANGED,r=>{this.onChainChanged(r,!0)})}getProvider(r){if(!this.rpcProviders[r])throw new Error(`Provider not found: ${r}`);return this.rpcProviders[r]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(r=>{var i;this.getProvider(r).updateNamespace((i=this.session)==null?void 0:i.namespaces[r])})}setNamespaces(r){const{namespaces:i,optionalNamespaces:n,sessionProperties:o}=r;i&&Object.keys(i).length&&(this.namespaces=i),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=o,this.persist("namespaces",i),this.persist("optionalNamespaces",n)}validateChain(r){const[i,n]=(r==null?void 0:r.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[i,n];if(i&&!Object.keys(this.namespaces||{}).map(d=>no(d)).includes(i))throw new Error(`Namespace '${i}' is not configured. Please call connect() first with namespace config.`);if(i&&n)return[i,n];const o=no(Object.keys(this.namespaces)[0]),l=this.rpcProviders[o].getDefaultChain();return[o,l]}async requestAccounts(){const[r]=this.validateChain();return await this.getProvider(r).requestAccounts()}onChainChanged(r,i=!1){var n;if(!this.namespaces)return;const[o,l]=this.validateChain(r);i||this.getProvider(o).setDefaultChain(l),((n=this.namespaces[o])!=null?n:this.namespaces[`${o}:${l}`]).defaultChain=l,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",l)}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(r,i){this.client.core.storage.setItem(`${xl}/${r}`,i)}async getFromStore(r){return await this.client.core.storage.getItem(`${xl}/${r}`)}}const zE=Pc,UE="wc",qE="ethereum_provider",BE=`${UE}@2:${qE}:`,HE="https://rpc.walletconnect.com/v1/",dc=["eth_sendTransaction","personal_sign"],kE=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],gc=["chainChanged","accountsChanged"],KE=["message","disconnect","connect"];var VE=Object.defineProperty,GE=Object.defineProperties,WE=Object.getOwnPropertyDescriptors,Rl=Object.getOwnPropertySymbols,JE=Object.prototype.hasOwnProperty,YE=Object.prototype.propertyIsEnumerable,Tl=(c,r,i)=>r in c?VE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,Bs=(c,r)=>{for(var i in r||(r={}))JE.call(r,i)&&Tl(c,i,r[i]);if(Rl)for(var i of Rl(r))YE.call(r,i)&&Tl(c,i,r[i]);return c},Nl=(c,r)=>GE(c,WE(r));function lo(c){return Number(c[0].split(":")[1])}function nc(c){return`0x${c.toString(16)}`}function XE(c){const{chains:r,optionalChains:i,methods:n,optionalMethods:o,events:l,optionalEvents:d,rpcMap:v}=c;if(!ps(r))throw new Error("Invalid chains");const b={chains:r,methods:n||dc,events:l||gc,rpcMap:Bs({},r.length?{[lo(r)]:v[lo(r)]}:{})},m=l==null?void 0:l.filter(z=>!gc.includes(z)),S=n==null?void 0:n.filter(z=>!dc.includes(z));if(!i&&!d&&!o&&!(m!=null&&m.length)&&!(S!=null&&S.length))return{required:r.length?b:void 0};const O=(m==null?void 0:m.length)&&(S==null?void 0:S.length)||!i,F={chains:[...new Set(O?b.chains.concat(i||[]):i)],methods:[...new Set(b.methods.concat(o!=null&&o.length?o:kE))],events:[...new Set(b.events.concat(d||KE))],rpcMap:v};return{required:r.length?b:void 0,optional:i.length?F:void 0}}class Ac{constructor(){this.events=new Cr.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=BE,this.on=(r,i)=>(this.events.on(r,i),this),this.once=(r,i)=>(this.events.once(r,i),this),this.removeListener=(r,i)=>(this.events.removeListener(r,i),this),this.off=(r,i)=>(this.events.off(r,i),this),this.parseAccount=r=>this.isCompatibleChainId(r)?this.parseAccountId(r).address:r,this.signer={},this.rpc={}}static async init(r){const i=new Ac;return await i.initialize(r),i}async request(r){return await this.signer.request(r,this.formatChainId(this.chainId))}sendAsync(r,i){this.signer.sendAsync(r,i,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(r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(r);const{required:i,optional:n}=XE(this.rpc);try{const o=await new Promise(async(d,v)=>{var b;this.rpc.showQrModal&&((b=this.modal)==null||b.subscribeModal(m=>{!m.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),v(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Nl(Bs({namespaces:Bs({},i&&{[this.namespace]:i})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:r==null?void 0:r.pairingTopic})).then(m=>{d(m)}).catch(m=>{v(new Error(m.message))})});if(!o)return;this.setChainIds(this.rpc.chains);const l=qm(o.namespaces,[this.namespace]);this.setAccounts(l),this.events.emit("connect",{chainId:nc(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}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",r=>{const{params:i}=r,{event:n}=i;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",r)}),this.signer.on("chainChanged",r=>{const i=parseInt(r);this.chainId=i,this.events.emit("chainChanged",nc(this.chainId)),this.persist()}),this.signer.on("session_update",r=>{this.events.emit("session_update",r)}),this.signer.on("session_delete",r=>{this.reset(),this.events.emit("session_delete",r),this.events.emit("disconnect",Nl(Bs({},tr("USER_DISCONNECTED")),{data:r.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",r=>{var i,n;this.rpc.showQrModal&&((i=this.modal)==null||i.closeModal(),(n=this.modal)==null||n.openModal({uri:r})),this.events.emit("display_uri",r)})}switchEthereumChain(r){this.request({method:"wallet_switchEthereumChain",params:[{chainId:r.toString(16)}]})}isCompatibleChainId(r){return typeof r=="string"?r.startsWith(`${this.namespace}:`):!1}formatChainId(r){return`${this.namespace}:${r}`}parseChainId(r){return Number(r.split(":")[1])}setChainIds(r){const i=r.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));i.length&&(this.chainId=i[0],this.events.emit("chainChanged",nc(this.chainId)),this.persist())}setChainId(r){if(this.isCompatibleChainId(r)){const i=this.parseChainId(r);this.chainId=i,this.switchEthereumChain(i)}}parseAccountId(r){const[i,n,o]=r.split(":");return{chainId:`${i}:${n}`,address:o}}setAccounts(r){this.accounts=r.filter(i=>this.parseChainId(this.parseAccountId(i).chainId)===this.chainId).map(i=>this.parseAccountId(i).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(r){var i,n;const o=(i=r==null?void 0:r.chains)!=null?i:[],l=(n=r==null?void 0:r.optionalChains)!=null?n:[],d=o.concat(l);if(!d.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const v=o.length?(r==null?void 0:r.methods)||dc:[],b=o.length?(r==null?void 0:r.events)||gc:[],m=(r==null?void 0:r.optionalMethods)||[],S=(r==null?void 0:r.optionalEvents)||[],O=(r==null?void 0:r.rpcMap)||this.buildRpcMap(d,r.projectId),F=(r==null?void 0:r.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(z=>this.formatChainId(z)),optionalChains:l.map(z=>this.formatChainId(z)),methods:v,events:b,optionalMethods:m,optionalEvents:S,rpcMap:O,showQrModal:!!(r!=null&&r.showQrModal),qrModalOptions:F,projectId:r.projectId,metadata:r.metadata}}buildRpcMap(r,i){const n={};return r.forEach(o=>{n[o]=this.getRpcUrl(o,i)}),n}async initialize(r){if(this.rpc=this.getRpcConfig(r),this.chainId=this.rpc.chains.length?lo(this.rpc.chains):lo(this.rpc.optionalChains),this.signer=await zE.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:r.disableProviderPing,relayUrl:r.relayUrl,storageOptions:r.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let i;try{const{WalletConnectModal:n}=await Bm(()=>import("./index-198de436.js").then(o=>o.a),["./index-198de436.js","./index-cfc0b18f.js","./index-f4824932.css","./index-cc134824.js"],import.meta.url);i=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(i)try{this.modal=new i(Bs({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(r){if(!r)return;const{chains:i,optionalChains:n,rpcMap:o}=r;i&&ps(i)&&(this.rpc.chains=i.map(l=>this.formatChainId(l)),i.forEach(l=>{this.rpc.rpcMap[l]=(o==null?void 0:o[l])||this.getRpcUrl(l)})),n&&ps(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(l=>this.formatChainId(l)),n.forEach(l=>{this.rpc.rpcMap[l]=(o==null?void 0:o[l])||this.getRpcUrl(l)}))}getRpcUrl(r,i){var n;return((n=this.rpc.rpcMap)==null?void 0:n[r])||`${HE}?chainId=eip155:${r}&projectId=${i||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const r=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),i=this.session.namespaces[`${this.namespace}:${r}`]?this.session.namespaces[`${this.namespace}:${r}`]:this.session.namespaces[this.namespace];this.setChainIds(r?[this.formatChainId(r)]:i==null?void 0:i.accounts),this.setAccounts(i==null?void 0:i.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(r){return typeof r=="string"||r instanceof String?[this.parseAccount(r)]:r.map(i=>this.parseAccount(i))}}const lI=Ac;export{lI as EthereumProvider,KE as OPTIONAL_EVENTS,kE as OPTIONAL_METHODS,gc as REQUIRED_EVENTS,dc as REQUIRED_METHODS,Ac as default}; +}`;var Ee=xh(function(){return Le(p,te+"return "+H).apply(i,w)});if(Ee.source=H,Na(Ee))throw Ee;return Ee}function hv(e){return Me(e).toLowerCase()}function lv(e){return Me(e).toUpperCase()}function fv(e,t,s){if(e=Me(e),e&&(s||t===i))return Dc(e);if(!e||!(t=fr(t)))return e;var a=Tr(e),h=Tr(t),p=Fc(a,h),w=Lc(a,h)+1;return vi(a,p,w).join("")}function pv(e,t,s){if(e=Me(e),e&&(s||t===i))return e.slice(0,Mc(e)+1);if(!e||!(t=fr(t)))return e;var a=Tr(e),h=Lc(a,Tr(t))+1;return vi(a,0,h).join("")}function dv(e,t,s){if(e=Me(e),e&&(s||t===i))return e.replace(dt,"");if(!e||!(t=fr(t)))return e;var a=Tr(e),h=Fc(a,Tr(t));return vi(a,h).join("")}function gv(e,t){var s=ie,a=ue;if(ct(t)){var h="separator"in t?t.separator:h;s="length"in t?_e(t.length):s,a="omission"in t?fr(t.omission):a}e=Me(e);var p=e.length;if(Zi(e)){var w=Tr(e);p=w.length}if(s>=p)return e;var _=s-Qi(a);if(_<1)return a;var A=w?vi(w,0,_).join(""):e.slice(0,_);if(h===i)return A+a;if(w&&(_+=A.length-_),Da(h)){if(e.slice(_).search(h)){var M,j=A;for(h.global||(h=Jo(h.source,Me(yr.exec(h))+"g")),h.lastIndex=0;M=h.exec(j);)var H=M.index;A=A.slice(0,H===i?_:H)}}else if(e.indexOf(fr(h),_)!=_){var J=A.lastIndexOf(h);J>-1&&(A=A.slice(0,J))}return A+a}function yv(e){return e=Me(e),e&&ht.test(e)?e.replace(ci,Kf):e}var vv=os(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),$a=Su("toUpperCase");function Ih(e,t,s){return e=Me(e),t=s?i:t,t===i?Uf(e)?Wf(e):Tf(e):e.match(t)||[]}var xh=xe(function(e,t){try{return zt(e,i,t)}catch(s){return Na(s)?s:new ye(s)}}),mv=ei(function(e,t){return mr(t,function(s){s=kr(s),Zr(e,s,Ra(e[s],e))}),e});function wv(e){var t=e==null?0:e.length,s=se();return e=t?st(e,function(a){if(typeof a[1]!="function")throw new wr(d);return[s(a[0]),a[1]]}):[],xe(function(a){for(var h=-1;++hV)return[];var s=G,a=Vt(e,G);t=se(t),e-=G;for(var h=Vo(a,t);++s0||t<0)?new Ae(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==i&&(t=_e(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},Ae.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ae.prototype.toArray=function(){return this.take(G)},Br(Ae.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),h=f[a?"take"+(t=="last"?"Right":""):t],p=a||/^find/.test(t);h&&(f.prototype[t]=function(){var w=this.__wrapped__,_=a?[1]:arguments,A=w instanceof Ae,M=_[0],j=A||we(w),H=function(Se){var Oe=h.apply(f,li([Se],_));return a&&J?Oe[0]:Oe};j&&s&&typeof M=="function"&&M.length!=1&&(A=j=!1);var J=this.__chain__,te=!!this.__actions__.length,oe=p&&!J,Ee=A&&!te;if(!p&&j){w=Ee?w:new Ae(this);var ae=e.apply(w,_);return ae.__actions__.push({func:kn,args:[H],thisArg:i}),new _r(ae,J)}return oe&&Ee?e.apply(this,_):(ae=this.thru(H),oe?a?ae.value()[0]:ae.value():ae)})}),mr(["pop","push","shift","sort","splice","unshift"],function(e){var t=yn[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",a=/^(?:pop|shift)$/.test(e);f.prototype[e]=function(){var h=arguments;if(a&&!this.__chain__){var p=this.value();return t.apply(we(p)?p:[],h)}return this[s](function(w){return t.apply(we(w)?w:[],h)})}}),Br(Ae.prototype,function(e,t){var s=f[t];if(s){var a=s.name+"";ze.call(is,a)||(is[a]=[]),is[a].push({name:t,func:s})}}),is[Mn(i,he).name]=[{name:"wrapper",func:i}],Ae.prototype.clone=yp,Ae.prototype.reverse=vp,Ae.prototype.value=mp,f.prototype.at=Gg,f.prototype.chain=Wg,f.prototype.commit=Jg,f.prototype.next=Yg,f.prototype.plant=Zg,f.prototype.reverse=Qg,f.prototype.toJSON=f.prototype.valueOf=f.prototype.value=ey,f.prototype.first=f.prototype.head,bs&&(f.prototype[bs]=Xg),f},es=Jf();_t?((_t.exports=es)._=es,Ge._=es):Ce._=es}).call(qs)})(fc,fc.exports);var vE=Object.defineProperty,mE=Object.defineProperties,wE=Object.getOwnPropertyDescriptors,Sl=Object.getOwnPropertySymbols,_E=Object.prototype.hasOwnProperty,bE=Object.prototype.propertyIsEnumerable,Pl=(c,r,i)=>r in c?vE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,to=(c,r)=>{for(var i in r||(r={}))_E.call(r,i)&&Pl(c,i,r[i]);if(Sl)for(var i of Sl(r))bE.call(r,i)&&Pl(c,i,r[i]);return c},EE=(c,r)=>mE(c,wE(r));function Ar(c,r,i){let n;const o=pc(c);return r.rpcMap&&(n=r.rpcMap[o]),n||(n=`${yE}?chainId=eip155:${o}&projectId=${i}`),n}function pc(c){return c.includes("eip155")?Number(c.split(":")[1]):Number(c)}function xf(c){return c.map(r=>`${r.split(":")[0]}:${r.split(":")[1]}`)}function IE(c,r){const i=Object.keys(r.namespaces).filter(o=>o.includes(c));if(!i.length)return[];const n=[];return i.forEach(o=>{const l=r.namespaces[o].accounts;n.push(...l)}),n}function xE(c={},r={}){const i=Al(c),n=Al(r);return fc.exports.merge(i,n)}function Al(c){var r,i,n,o;const l={};if(!so(c))return l;for(const[d,v]of Object.entries(c)){const b=ql(d)?[d]:v.chains,m=v.methods||[],S=v.events||[],O=v.rpcMap||{},F=no(d);l[F]=EE(to(to({},l[F]),v),{chains:ka(b,(r=l[F])==null?void 0:r.chains),methods:ka(m,(i=l[F])==null?void 0:i.methods),events:ka(S,(n=l[F])==null?void 0:n.events),rpcMap:to(to({},O),(o=l[F])==null?void 0:o.rpcMap)})}return l}function SE(c){return c.includes(":")?c.split(":")[2]:c}function PE(c){const r={};for(const[i,n]of Object.entries(c)){const o=n.methods||[],l=n.events||[],d=n.accounts||[],v=ql(i)?[i]:n.chains?n.chains:xf(n.accounts);r[i]={chains:v,methods:o,events:l,accounts:d}}return r}const Sf={},It=c=>Sf[c],ic=(c,r)=>{Sf[c]=r};class AE{constructor(r){this.name="polkadot",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(this.chainId=r,!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const r=this.namespace.accounts;return r?r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2])||[]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class CE{constructor(r){this.name="eip155",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(r){switch(r.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(r);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(r.request.method)?await this.client.request(r):this.getHttpProvider().request(r.request)}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}setDefaultChain(r,i){const n=pc(r);if(!this.httpProviders[n]){const o=i||Ar(`${this.name}:${n}`,this.namespace,this.client.core.projectId);if(!o)throw new Error(`No RPC url provided for chainId: ${n}`);this.setHttpProvider(n,o)}this.chainId=n,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${n}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}createHttpProvider(r,i){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;const o=pc(i);r[o]=this.createHttpProvider(o,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}getHttpProvider(){const r=this.chainId,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}async handleSwitchChain(r){var i,n;let o=r.request.params?(i=r.request.params[0])==null?void 0:i.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const l=parseInt(o,16);if(this.isChainApproved(l))this.setDefaultChain(`${l}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:r.topic,request:{method:r.request.method,params:[{chainId:o}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${l}`);else throw new Error(`Failed to switch to chain 'eip155:${l}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(r){return this.namespace.chains.includes(`${this.name}:${r}`)}}class OE{constructor(r){this.name="solana",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.chainId=r,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class RE{constructor(r){this.name="cosmos",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(this.chainId=r,!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class TE{constructor(r){this.name="cip34",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(this.chainId=r,!this.httpProviders[r]){const n=i||this.getCardanoRPCUrl(r);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{const n=this.getCardanoRPCUrl(i);r[i]=this.createHttpProvider(i,n)}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}getCardanoRPCUrl(r){const i=this.namespace.rpcMap;if(i)return i[r]}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||this.getCardanoRPCUrl(r);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class NE{constructor(r){this.name="elrond",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.chainId=r,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}class DE{constructor(r){this.name="multiversx",this.namespace=r.namespace,this.events=It("events"),this.client=It("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(r){this.namespace=Object.assign(this.namespace,r)}requestAccounts(){return this.getAccounts()}request(r){return this.namespace.methods.includes(r.request.method)?this.client.request(r):this.getHttpProvider().request(r.request)}setDefaultChain(r,i){if(!this.httpProviders[r]){const n=i||Ar(`${this.name}:${r}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${r}`);this.setHttpProvider(r,n)}this.chainId=r,this.events.emit(Ii.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const r=this.namespace.chains[0];if(!r)throw new Error("ChainId not found");return r.split(":")[1]}getAccounts(){const r=this.namespace.accounts;return r?[...new Set(r.filter(i=>i.split(":")[1]===this.chainId.toString()).map(i=>i.split(":")[2]))]:[]}createHttpProviders(){const r={};return this.namespace.chains.forEach(i=>{var n;r[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[i])}),r}getHttpProvider(){const r=`${this.name}:${this.chainId}`,i=this.httpProviders[r];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${r} not found`);return i}setHttpProvider(r,i){const n=this.createHttpProvider(r,i);n&&(this.httpProviders[r]=n)}createHttpProvider(r,i){const n=i||Ar(r,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new Ei(new Hi(n,It("disableProviderPing")))}}var FE=Object.defineProperty,LE=Object.defineProperties,$E=Object.getOwnPropertyDescriptors,Cl=Object.getOwnPropertySymbols,ME=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,Ol=(c,r,i)=>r in c?FE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,ro=(c,r)=>{for(var i in r||(r={}))ME.call(r,i)&&Ol(c,i,r[i]);if(Cl)for(var i of Cl(r))jE.call(r,i)&&Ol(c,i,r[i]);return c},sc=(c,r)=>LE(c,$E(r));class Pc{constructor(r){this.events=new vc,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=r,this.logger=typeof(r==null?void 0:r.logger)<"u"&&typeof(r==null?void 0:r.logger)!="string"?r.logger:Re.pino(Re.getDefaultLoggerOptions({level:(r==null?void 0:r.logger)||Il})),this.disableProviderPing=(r==null?void 0:r.disableProviderPing)||!1}static async init(r){const i=new Pc(r);return await i.initialize(),i}async request(r,i){const[n,o]=this.validateChain(i);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:ro({},r),chainId:`${n}:${o}`,topic:this.session.topic})}sendAsync(r,i,n){this.request(r,n).then(o=>i(null,o)).catch(o=>i(o,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 r;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(r=this.session)==null?void 0:r.topic,reason:tr("USER_DISCONNECTED")}),await this.cleanup()}async connect(r){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(r),await this.cleanupPendingPairings(),!r.skipPairing)return await this.pair(r.pairingTopic)}on(r,i){this.events.on(r,i)}once(r,i){this.events.once(r,i)}removeListener(r,i){this.events.removeListener(r,i)}off(r,i){this.events.off(r,i)}get isWalletConnect(){return!0}async pair(r){this.shouldAbortPairingAttempt=!1;let i=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(i>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:o}=await this.client.connect({pairingTopic:r,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await o().then(l=>{this.session=l,this.namespaces||(this.namespaces=PE(l.namespaces),this.persist("namespaces",this.namespaces))}).catch(l=>{if(l.message!==Ef)throw l;i++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(r,i){try{if(!this.session)return;const[n,o]=this.validateChain(r);this.getProvider(n).setDefaultChain(o,i)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(r={}){this.logger.info("Cleaning up inactive pairings...");const i=this.client.pairing.getAll();if(ps(i)){for(const n of i)r.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${i.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 r=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[r]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await uE.init({logger:this.providerOpts.logger||Il,relayUrl:this.providerOpts.relayUrl||pE,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,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 r=[...new Set(Object.keys(this.session.namespaces).map(i=>no(i)))];ic("client",this.client),ic("events",this.events),ic("disableProviderPing",this.disableProviderPing),r.forEach(i=>{if(!this.session)return;const n=IE(i,this.session),o=xf(n),l=xE(this.namespaces,this.optionalNamespaces),d=sc(ro({},l[i]),{accounts:n,chains:o});switch(i){case"eip155":this.rpcProviders[i]=new CE({namespace:d});break;case"solana":this.rpcProviders[i]=new OE({namespace:d});break;case"cosmos":this.rpcProviders[i]=new RE({namespace:d});break;case"polkadot":this.rpcProviders[i]=new AE({namespace:d});break;case"cip34":this.rpcProviders[i]=new TE({namespace:d});break;case"elrond":this.rpcProviders[i]=new NE({namespace:d});break;case"multiversx":this.rpcProviders[i]=new DE({namespace:d});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",r=>{this.events.emit("session_ping",r)}),this.client.on("session_event",r=>{const{params:i}=r,{event:n}=i;if(n.name==="accountsChanged"){const o=n.data;o&&ps(o)&&this.events.emit("accountsChanged",o.map(SE))}else n.name==="chainChanged"?this.onChainChanged(i.chainId):this.events.emit(n.name,n.data);this.events.emit("session_event",r)}),this.client.on("session_update",({topic:r,params:i})=>{var n;const{namespaces:o}=i,l=(n=this.client)==null?void 0:n.session.get(r);this.session=sc(ro({},l),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:r,params:i})}),this.client.on("session_delete",async r=>{await this.cleanup(),this.events.emit("session_delete",r),this.events.emit("disconnect",sc(ro({},tr("USER_DISCONNECTED")),{data:r.topic}))}),this.on(Ii.DEFAULT_CHAIN_CHANGED,r=>{this.onChainChanged(r,!0)})}getProvider(r){if(!this.rpcProviders[r])throw new Error(`Provider not found: ${r}`);return this.rpcProviders[r]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(r=>{var i;this.getProvider(r).updateNamespace((i=this.session)==null?void 0:i.namespaces[r])})}setNamespaces(r){const{namespaces:i,optionalNamespaces:n,sessionProperties:o}=r;i&&Object.keys(i).length&&(this.namespaces=i),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=o,this.persist("namespaces",i),this.persist("optionalNamespaces",n)}validateChain(r){const[i,n]=(r==null?void 0:r.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[i,n];if(i&&!Object.keys(this.namespaces||{}).map(d=>no(d)).includes(i))throw new Error(`Namespace '${i}' is not configured. Please call connect() first with namespace config.`);if(i&&n)return[i,n];const o=no(Object.keys(this.namespaces)[0]),l=this.rpcProviders[o].getDefaultChain();return[o,l]}async requestAccounts(){const[r]=this.validateChain();return await this.getProvider(r).requestAccounts()}onChainChanged(r,i=!1){var n;if(!this.namespaces)return;const[o,l]=this.validateChain(r);i||this.getProvider(o).setDefaultChain(l),((n=this.namespaces[o])!=null?n:this.namespaces[`${o}:${l}`]).defaultChain=l,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",l)}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(r,i){this.client.core.storage.setItem(`${xl}/${r}`,i)}async getFromStore(r){return await this.client.core.storage.getItem(`${xl}/${r}`)}}const zE=Pc,UE="wc",qE="ethereum_provider",BE=`${UE}@2:${qE}:`,HE="https://rpc.walletconnect.com/v1/",dc=["eth_sendTransaction","personal_sign"],kE=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],gc=["chainChanged","accountsChanged"],KE=["message","disconnect","connect"];var VE=Object.defineProperty,GE=Object.defineProperties,WE=Object.getOwnPropertyDescriptors,Rl=Object.getOwnPropertySymbols,JE=Object.prototype.hasOwnProperty,YE=Object.prototype.propertyIsEnumerable,Tl=(c,r,i)=>r in c?VE(c,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[r]=i,Bs=(c,r)=>{for(var i in r||(r={}))JE.call(r,i)&&Tl(c,i,r[i]);if(Rl)for(var i of Rl(r))YE.call(r,i)&&Tl(c,i,r[i]);return c},Nl=(c,r)=>GE(c,WE(r));function lo(c){return Number(c[0].split(":")[1])}function nc(c){return`0x${c.toString(16)}`}function XE(c){const{chains:r,optionalChains:i,methods:n,optionalMethods:o,events:l,optionalEvents:d,rpcMap:v}=c;if(!ps(r))throw new Error("Invalid chains");const b={chains:r,methods:n||dc,events:l||gc,rpcMap:Bs({},r.length?{[lo(r)]:v[lo(r)]}:{})},m=l==null?void 0:l.filter(z=>!gc.includes(z)),S=n==null?void 0:n.filter(z=>!dc.includes(z));if(!i&&!d&&!o&&!(m!=null&&m.length)&&!(S!=null&&S.length))return{required:r.length?b:void 0};const O=(m==null?void 0:m.length)&&(S==null?void 0:S.length)||!i,F={chains:[...new Set(O?b.chains.concat(i||[]):i)],methods:[...new Set(b.methods.concat(o!=null&&o.length?o:kE))],events:[...new Set(b.events.concat(d||KE))],rpcMap:v};return{required:r.length?b:void 0,optional:i.length?F:void 0}}class Ac{constructor(){this.events=new Cr.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=BE,this.on=(r,i)=>(this.events.on(r,i),this),this.once=(r,i)=>(this.events.once(r,i),this),this.removeListener=(r,i)=>(this.events.removeListener(r,i),this),this.off=(r,i)=>(this.events.off(r,i),this),this.parseAccount=r=>this.isCompatibleChainId(r)?this.parseAccountId(r).address:r,this.signer={},this.rpc={}}static async init(r){const i=new Ac;return await i.initialize(r),i}async request(r){return await this.signer.request(r,this.formatChainId(this.chainId))}sendAsync(r,i){this.signer.sendAsync(r,i,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(r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(r);const{required:i,optional:n}=XE(this.rpc);try{const o=await new Promise(async(d,v)=>{var b;this.rpc.showQrModal&&((b=this.modal)==null||b.subscribeModal(m=>{!m.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),v(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Nl(Bs({namespaces:Bs({},i&&{[this.namespace]:i})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:r==null?void 0:r.pairingTopic})).then(m=>{d(m)}).catch(m=>{v(new Error(m.message))})});if(!o)return;this.setChainIds(this.rpc.chains);const l=qm(o.namespaces,[this.namespace]);this.setAccounts(l),this.events.emit("connect",{chainId:nc(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}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",r=>{const{params:i}=r,{event:n}=i;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",r)}),this.signer.on("chainChanged",r=>{const i=parseInt(r);this.chainId=i,this.events.emit("chainChanged",nc(this.chainId)),this.persist()}),this.signer.on("session_update",r=>{this.events.emit("session_update",r)}),this.signer.on("session_delete",r=>{this.reset(),this.events.emit("session_delete",r),this.events.emit("disconnect",Nl(Bs({},tr("USER_DISCONNECTED")),{data:r.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",r=>{var i,n;this.rpc.showQrModal&&((i=this.modal)==null||i.closeModal(),(n=this.modal)==null||n.openModal({uri:r})),this.events.emit("display_uri",r)})}switchEthereumChain(r){this.request({method:"wallet_switchEthereumChain",params:[{chainId:r.toString(16)}]})}isCompatibleChainId(r){return typeof r=="string"?r.startsWith(`${this.namespace}:`):!1}formatChainId(r){return`${this.namespace}:${r}`}parseChainId(r){return Number(r.split(":")[1])}setChainIds(r){const i=r.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));i.length&&(this.chainId=i[0],this.events.emit("chainChanged",nc(this.chainId)),this.persist())}setChainId(r){if(this.isCompatibleChainId(r)){const i=this.parseChainId(r);this.chainId=i,this.switchEthereumChain(i)}}parseAccountId(r){const[i,n,o]=r.split(":");return{chainId:`${i}:${n}`,address:o}}setAccounts(r){this.accounts=r.filter(i=>this.parseChainId(this.parseAccountId(i).chainId)===this.chainId).map(i=>this.parseAccountId(i).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(r){var i,n;const o=(i=r==null?void 0:r.chains)!=null?i:[],l=(n=r==null?void 0:r.optionalChains)!=null?n:[],d=o.concat(l);if(!d.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const v=o.length?(r==null?void 0:r.methods)||dc:[],b=o.length?(r==null?void 0:r.events)||gc:[],m=(r==null?void 0:r.optionalMethods)||[],S=(r==null?void 0:r.optionalEvents)||[],O=(r==null?void 0:r.rpcMap)||this.buildRpcMap(d,r.projectId),F=(r==null?void 0:r.qrModalOptions)||void 0;return{chains:o==null?void 0:o.map(z=>this.formatChainId(z)),optionalChains:l.map(z=>this.formatChainId(z)),methods:v,events:b,optionalMethods:m,optionalEvents:S,rpcMap:O,showQrModal:!!(r!=null&&r.showQrModal),qrModalOptions:F,projectId:r.projectId,metadata:r.metadata}}buildRpcMap(r,i){const n={};return r.forEach(o=>{n[o]=this.getRpcUrl(o,i)}),n}async initialize(r){if(this.rpc=this.getRpcConfig(r),this.chainId=this.rpc.chains.length?lo(this.rpc.chains):lo(this.rpc.optionalChains),this.signer=await zE.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:r.disableProviderPing,relayUrl:r.relayUrl,storageOptions:r.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let i;try{const{WalletConnectModal:n}=await Bm(()=>import("./index-e5e7bd9b.js").then(o=>o.a),["./index-e5e7bd9b.js","./index-6a2af3e6.js","./index-f4824932.css","./index-cc134824.js"],import.meta.url);i=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(i)try{this.modal=new i(Bs({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(r){if(!r)return;const{chains:i,optionalChains:n,rpcMap:o}=r;i&&ps(i)&&(this.rpc.chains=i.map(l=>this.formatChainId(l)),i.forEach(l=>{this.rpc.rpcMap[l]=(o==null?void 0:o[l])||this.getRpcUrl(l)})),n&&ps(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(l=>this.formatChainId(l)),n.forEach(l=>{this.rpc.rpcMap[l]=(o==null?void 0:o[l])||this.getRpcUrl(l)}))}getRpcUrl(r,i){var n;return((n=this.rpc.rpcMap)==null?void 0:n[r])||`${HE}?chainId=eip155:${r}&projectId=${i||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const r=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),i=this.session.namespaces[`${this.namespace}:${r}`]?this.session.namespaces[`${this.namespace}:${r}`]:this.session.namespaces[this.namespace];this.setChainIds(r?[this.formatChainId(r)]:i==null?void 0:i.accounts),this.setAccounts(i==null?void 0:i.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(r){return typeof r=="string"||r instanceof String?[this.parseAccount(r)]:r.map(i=>this.parseAccount(i))}}const lI=Ac;export{lI as EthereumProvider,KE as OPTIONAL_EVENTS,kE as OPTIONAL_METHODS,gc as REQUIRED_EVENTS,dc as REQUIRED_METHODS,Ac as default}; diff --git a/index.html b/index.html index 241701ba..9c698bb8 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,7 @@ Learn how to configure a non-root public URL by running `npm run build`. --> Sequence Kit Demo - +