From 137f70e27679f41480770a3bb40f965d40a254f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B4=CF=85=CF=82?= Date: Fri, 20 Sep 2024 00:59:43 -0400 Subject: [PATCH] Deploying! --- assets/{ccip-B6ULGj8w.js => ccip-Cm4i_WNz.js} | 2 +- ...e-DHPNJ6uk.js => hooks.module-Cnm_IKFt.js} | 2 +- .../{index-CFrD00kt.js => index-BSVOad49.js} | 20 +++++++++---------- .../{index-CF82IQ3b.js => index-BfEgo1H2.js} | 2 +- .../{index-DuLR7yxj.js => index-CW3SPSK3.js} | 2 +- .../{index-CwIYrbhM.js => index-CkrjDLK5.js} | 4 ++-- .../{index-DV5_LVti.js => index-DNfjtiM6.js} | 2 +- .../{index-Dp7JVq_m.js => index-DethetlS.js} | 2 +- .../{index-CbiTlW7Y.js => index-IoMmGEzv.js} | 2 +- ...56k1-z3WGfxvh.js => secp256k1-Db0UiqTi.js} | 2 +- ...odal-BZ0C38WO.js => w3m-modal-CS4WeCLM.js} | 8 ++++---- index.html | 6 +++--- 12 files changed, 27 insertions(+), 27 deletions(-) rename assets/{ccip-B6ULGj8w.js => ccip-Cm4i_WNz.js} (97%) rename assets/{hooks.module-DHPNJ6uk.js => hooks.module-Cnm_IKFt.js} (99%) rename assets/{index-CFrD00kt.js => index-BSVOad49.js} (93%) rename assets/{index-CF82IQ3b.js => index-BfEgo1H2.js} (98%) rename assets/{index-DuLR7yxj.js => index-CW3SPSK3.js} (99%) rename assets/{index-CwIYrbhM.js => index-CkrjDLK5.js} (97%) rename assets/{index-DV5_LVti.js => index-DNfjtiM6.js} (99%) rename assets/{index-Dp7JVq_m.js => index-DethetlS.js} (99%) rename assets/{index-CbiTlW7Y.js => index-IoMmGEzv.js} (99%) rename assets/{secp256k1-z3WGfxvh.js => secp256k1-Db0UiqTi.js} (99%) rename assets/{w3m-modal-BZ0C38WO.js => w3m-modal-CS4WeCLM.js} (96%) diff --git a/assets/ccip-B6ULGj8w.js b/assets/ccip-Cm4i_WNz.js similarity index 97% rename from assets/ccip-B6ULGj8w.js rename to assets/ccip-Cm4i_WNz.js index 9ddd4ff..d86dc5e 100644 --- a/assets/ccip-B6ULGj8w.js +++ b/assets/ccip-Cm4i_WNz.js @@ -1 +1 @@ -import{aY as h,aZ as m,a_ as p,a$ as w,b0 as b,b1 as L,b2 as E,b3 as O,b4 as x,b5 as y,b6 as M}from"./index-CFrD00kt.js";function R(s,e){if(!h(s,{strict:!1}))throw new m({address:s});if(!h(e,{strict:!1}))throw new m({address:e});return s.toLowerCase()===e.toLowerCase()}class $ extends p{constructor({callbackSelector:e,cause:a,data:n,extraData:c,sender:d,urls:t}){var i;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],(i=a.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",t&&[" Gateway URL(s):",...t.map(f=>` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat(),name:"OffchainLookupError"})}}class S extends p{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(a)}`,`Response: ${b(e)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`],name:"OffchainLookupSenderMismatchError"})}}const T="0x556f1830",q={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 G(s,{blockNumber:e,blockTag:a,data:n,to:c}){const{args:d}=L({data:n,abi:[q]}),[t,i,f,r,o]=d,{ccipRead:u}=s,g=u&&typeof(u==null?void 0:u.request)=="function"?u.request:C;try{if(!R(c,t))throw new A({sender:t,to:c});const l=await g({data:f,sender:t,urls:i}),{data:k}=await E(s,{blockNumber:e,blockTag:a,data:O([r,x([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return k}catch(l){throw new $({callbackSelector:r,cause:l,data:n,extraData:o,sender:t,urls:i})}}async function C({data:s,sender:e,urls:a}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat(),name:"OffchainLookupError"})}}class S extends p{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(a)}`,`Response: ${b(e)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`],name:"OffchainLookupSenderMismatchError"})}}const T="0x556f1830",q={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 G(s,{blockNumber:e,blockTag:a,data:n,to:c}){const{args:d}=L({data:n,abi:[q]}),[t,i,f,r,o]=d,{ccipRead:u}=s,g=u&&typeof(u==null?void 0:u.request)=="function"?u.request:C;try{if(!R(c,t))throw new A({sender:t,to:c});const l=await g({data:f,sender:t,urls:i}),{data:k}=await E(s,{blockNumber:e,blockTag:a,data:O([r,x([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return k}catch(l){throw new $({callbackSelector:r,cause:l,data:n,extraData:o,sender:t,urls:i})}}async function C({data:s,sender:e,urls:a}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d0?this.tail.next=f:this.head=f,this.tail=f,++this.length}},{key:"unshift",value:function(w){var f={data:w,next:this.head};this.length===0&&(this.tail=f),this.head=f,++this.length}},{key:"shift",value:function(){if(this.length!==0){var w=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,w}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(w){if(this.length===0)return"";for(var f=this.head,p=""+f.data;f=f.next;)p+=w+f.data;return p}},{key:"concat",value:function(w){if(this.length===0)return b.alloc(0);for(var f=b.allocUnsafe(w>>>0),p=this.head,y=0;p;)v(p.data,f,y),y+=p.data.length,p=p.next;return f}},{key:"consume",value:function(w,f){var p;return wm.length?m.length:w;if(T===m.length?y+=m:y+=m.slice(0,w),w-=T,w===0){T===m.length?(++p,f.next?this.head=f.next:this.head=this.tail=null):(this.head=f,f.data=m.slice(T));break}++p}return this.length-=p,y}},{key:"_getBuffer",value:function(w){var f=b.allocUnsafe(w),p=this.head,y=1;for(p.data.copy(f),w-=p.data.length;p=p.next;){var m=p.data,T=w>m.length?m.length:w;if(m.copy(f,f.length-w,0,T),w-=T,w===0){T===m.length?(++y,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=m.slice(T));break}++y}return this.length-=y,f}},{key:S,value:function(w,f){return l(this,t(t({},f),{},{depth:0,customInspect:!1}))}}]),R}(),Yt}function Vn(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(or,this,e)):process.nextTick(or,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(qe,r):(r._writableState.errorEmitted=!0,process.nextTick(Er,r,s)):process.nextTick(Er,r,s):t?(process.nextTick(qe,r),t(s)):process.nextTick(qe,r)}),this)}function Er(e,t){or(e,t),qe(e)}function qe(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Gn(){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 or(e,t){e.emit("error",t)}function Kn(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var rn={destroy:Vn,undestroy:Gn,errorOrDestroy:Kn},be={};function Yn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var nn={};function Q(e,t,r){r||(r=Error);function n(s,_,c){return typeof t=="string"?t:t(s,_,c)}var i=function(s){Yn(_,s);function _(c,d,b){return s.call(this,n(c,d,b))||this}return _}(r);i.prototype.name=r.name,i.prototype.code=e,nn[e]=i}function Sr(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Qn(e,t,r){return e.substr(0,t.length)===t}function Xn(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function Jn(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}Q("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Q("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Qn(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Xn(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Sr(t,"type"));else{var s=Jn(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Sr(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Q("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Q("ERR_STREAM_PREMATURE_CLOSE","Premature close");Q("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Q("ERR_STREAM_WRITE_AFTER_END","write after end");Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");be.codes=nn;var Zn=be.codes.ERR_INVALID_OPT_VALUE;function ei(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function ti(e,t,r,n){var i=ei(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new Zn(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var an={getHighWaterMark:ti},ri=ni;function ni(e,t){if(Qt("noDeprecation"))return e;var r=!1;function n(){if(!r){if(Qt("throwDeprecation"))throw new Error(t);Qt("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function Qt(e){try{if(!Ee.localStorage)return!1}catch{return!1}var t=Ee.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Xt,mr;function on(){if(mr)return Xt;mr=1,Xt=D;function e(h){var u=this;this.next=null,this.entry=null,this.finish=function(){ne(u,h)}}var t;D.WritableState=k;var r={deprecate:ri},n=tn,i=Ge.Buffer,s=(typeof Ee<"u"?Ee:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _(h){return i.from(h)}function c(h){return i.isBuffer(h)||h instanceof s}var d=rn,b=an,E=b.getHighWaterMark,l=be.codes,S=l.ERR_INVALID_ARG_TYPE,v=l.ERR_METHOD_NOT_IMPLEMENTED,R=l.ERR_MULTIPLE_CALLBACK,A=l.ERR_STREAM_CANNOT_PIPE,w=l.ERR_STREAM_DESTROYED,f=l.ERR_STREAM_NULL_VALUES,p=l.ERR_STREAM_WRITE_AFTER_END,y=l.ERR_UNKNOWN_ENCODING,m=d.errorOrDestroy;X(D,n);function T(){}function k(h,u,x){t=t||Se(),h=h||{},typeof x!="boolean"&&(x=u instanceof t),this.objectMode=!!h.objectMode,x&&(this.objectMode=this.objectMode||!!h.writableObjectMode),this.highWaterMark=E(this,h,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var B=h.decodeStrings===!1;this.decodeStrings=!B,this.defaultEncoding=h.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(P){le(u,P)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=h.emitClose!==!1,this.autoDestroy=!!h.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}k.prototype.getBuffer=function(){for(var u=this.bufferedRequest,x=[];u;)x.push(u),u=u.next;return x},function(){try{Object.defineProperty(k.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var O;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(O=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(u){return O.call(this,u)?!0:this!==D?!1:u&&u._writableState instanceof k}})):O=function(u){return u instanceof this};function D(h){t=t||Se();var u=this instanceof t;if(!u&&!O.call(D,this))return new D(h);this._writableState=new k(h,this,u),this.writable=!0,h&&(typeof h.write=="function"&&(this._write=h.write),typeof h.writev=="function"&&(this._writev=h.writev),typeof h.destroy=="function"&&(this._destroy=h.destroy),typeof h.final=="function"&&(this._final=h.final)),n.call(this)}D.prototype.pipe=function(){m(this,new A)};function M(h,u){var x=new p;m(h,x),process.nextTick(u,x)}function F(h,u,x,B){var P;return x===null?P=new f:typeof x!="string"&&!u.objectMode&&(P=new S("chunk",["string","Buffer"],x)),P?(m(h,P),process.nextTick(B,P),!1):!0}D.prototype.write=function(h,u,x){var B=this._writableState,P=!1,a=!B.objectMode&&c(h);return a&&!i.isBuffer(h)&&(h=_(h)),typeof u=="function"&&(x=u,u=null),a?u="buffer":u||(u=B.defaultEncoding),typeof x!="function"&&(x=T),B.ending?M(this,x):(a||F(this,B,h,x))&&(B.pendingcb++,P=Z(this,B,a,h,u,x)),P},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){var h=this._writableState;h.corked&&(h.corked--,!h.writing&&!h.corked&&!h.bufferProcessing&&h.bufferedRequest&&Y(this,h))},D.prototype.setDefaultEncoding=function(u){if(typeof u=="string"&&(u=u.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((u+"").toLowerCase())>-1))throw new y(u);return this._writableState.defaultEncoding=u,this},Object.defineProperty(D.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function W(h,u,x){return!h.objectMode&&h.decodeStrings!==!1&&typeof u=="string"&&(u=i.from(u,x)),u}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(h,u,x,B,P,a){if(!x){var o=W(u,B,P);B!==o&&(x=!0,P="buffer",B=o)}var g=u.objectMode?1:B.length;u.length+=g;var C=u.length */(function(e,t){var r=Ge,n=r.Buffer;function i(_,c){for(var d in _)c[d]=_[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(_,c,d){return n(_,c,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(_,c,d){if(typeof _=="number")throw new TypeError("Argument must not be a number");return n(_,c,d)},s.alloc=function(_,c,d){if(typeof _!="number")throw new TypeError("Argument must be a number");var b=n(_);return c!==void 0?typeof d=="string"?b.fill(c,d):b.fill(c):b.fill(0),b},s.allocUnsafe=function(_){if(typeof _!="number")throw new TypeError("Argument must be a number");return n(_)},s.allocUnsafeSlow=function(_){if(typeof _!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(_)}})(sr,sr.exports);var ce=sr.exports,Tr;function Ar(){if(Tr)return Zt;Tr=1;var e=ce.Buffer,t=e.isEncoding||function(f){switch(f=""+f,f&&f.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(f){if(!f)return"utf8";for(var p;;)switch(f){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return f;default:if(p)return;f=(""+f).toLowerCase(),p=!0}}function n(f){var p=r(f);if(typeof p!="string"&&(e.isEncoding===t||!t(f)))throw new Error("Unknown encoding: "+f);return p||f}Zt.StringDecoder=i;function i(f){this.encoding=n(f);var p;switch(this.encoding){case"utf16le":this.text=l,this.end=S,p=4;break;case"utf8":this.fillLast=d,p=4;break;case"base64":this.text=v,this.end=R,p=3;break;default:this.write=A,this.end=w;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(p)}i.prototype.write=function(f){if(f.length===0)return"";var p,y;if(this.lastNeed){if(p=this.fillLast(f),p===void 0)return"";y=this.lastNeed,this.lastNeed=0}else y=0;return y>5===6?2:f>>4===14?3:f>>3===30?4:f>>6===2?-1:-2}function _(f,p,y){var m=p.length-1;if(m=0?(T>0&&(f.lastNeed=T-1),T):--m=0?(T>0&&(f.lastNeed=T-2),T):--m=0?(T>0&&(T===2?T=0:f.lastNeed=T-3),T):0))}function c(f,p,y){if((p[0]&192)!==128)return f.lastNeed=0,"�";if(f.lastNeed>1&&p.length>1){if((p[1]&192)!==128)return f.lastNeed=1,"�";if(f.lastNeed>2&&p.length>2&&(p[2]&192)!==128)return f.lastNeed=2,"�"}}function d(f){var p=this.lastTotal-this.lastNeed,y=c(this,f);if(y!==void 0)return y;if(this.lastNeed<=f.length)return f.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);f.copy(this.lastChar,p,0,f.length),this.lastNeed-=f.length}function b(f,p){var y=_(this,f,p);if(!this.lastNeed)return f.toString("utf8",p);this.lastTotal=y;var m=f.length-(y-this.lastNeed);return f.copy(this.lastChar,0,m),f.toString("utf8",p,m)}function E(f){var p=f&&f.length?this.write(f):"";return this.lastNeed?p+"�":p}function l(f,p){if((f.length-p)%2===0){var y=f.toString("utf16le",p);if(y){var m=y.charCodeAt(y.length-1);if(m>=55296&&m<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=f[f.length-2],this.lastChar[1]=f[f.length-1],y.slice(0,-1)}return y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=f[f.length-1],f.toString("utf16le",p,f.length-1)}function S(f){var p=f&&f.length?this.write(f):"";if(this.lastNeed){var y=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,y)}return p}function v(f,p){var y=(f.length-p)%3;return y===0?f.toString("base64",p):(this.lastNeed=3-y,this.lastTotal=3,y===1?this.lastChar[0]=f[f.length-1]:(this.lastChar[0]=f[f.length-2],this.lastChar[1]=f[f.length-1]),f.toString("base64",p,f.length-y))}function R(f){var p=f&&f.length?this.write(f):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function A(f){return f.toString(this.encoding)}function w(f){return f&&f.length?this.write(f):""}return Zt}var Cr=be.codes.ERR_STREAM_PREMATURE_CLOSE;function ii(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof o!="string"&&!N.objectMode&&Object.getPrototypeOf(o)!==n.prototype&&(o=s(o)),C)N.endEmitted?T(a,new f):W(a,N,o,!0);else if(N.ended)T(a,new A);else{if(N.destroyed)return!1;N.reading=!1,N.decoder&&!g?(o=N.decoder.write(o),N.objectMode||o.length!==0?W(a,N,o,!1):Y(a,N)):W(a,N,o,!1)}else C||(N.reading=!1,Y(a,N))}return!N.ended&&(N.length=q?a=q:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function V(a,o){return a<=0||o.length===0&&o.ended?0:o.objectMode?1:a!==a?o.flowing&&o.length?o.buffer.head.data.length:o.length:(a>o.highWaterMark&&(o.highWaterMark=z(a)),a<=o.length?a:o.ended?o.length:(o.needReadable=!0,0))}M.prototype.read=function(a){d("read",a),a=parseInt(a,10);var o=this._readableState,g=a;if(a!==0&&(o.emittedReadable=!1),a===0&&o.needReadable&&((o.highWaterMark!==0?o.length>=o.highWaterMark:o.length>0)||o.ended))return d("read: emitReadable",o.length,o.ended),o.length===0&&o.ended?x(this):K(this),null;if(a=V(a,o),a===0&&o.ended)return o.length===0&&x(this),null;var C=o.needReadable;d("need readable",C),(o.length===0||o.length-a0?U=u(a,o):U=null,U===null?(o.needReadable=o.length<=o.highWaterMark,a=0):(o.length-=a,o.awaitDrain=0),o.length===0&&(o.ended||(o.needReadable=!0),g!==a&&o.ended&&x(this)),U!==null&&this.emit("data",U),U};function le(a,o){if(d("onEofChunk"),!o.ended){if(o.decoder){var g=o.decoder.end();g&&g.length&&(o.buffer.push(g),o.length+=o.objectMode?1:g.length)}o.ended=!0,o.sync?K(a):(o.needReadable=!1,o.emittedReadable||(o.emittedReadable=!0,ee(a)))}}function K(a){var o=a._readableState;d("emitReadable",o.needReadable,o.emittedReadable),o.needReadable=!1,o.emittedReadable||(d("emitReadable",o.flowing),o.emittedReadable=!0,process.nextTick(ee,a))}function ee(a){var o=a._readableState;d("emitReadable_",o.destroyed,o.length,o.ended),!o.destroyed&&(o.length||o.ended)&&(a.emit("readable"),o.emittedReadable=!1),o.needReadable=!o.flowing&&!o.ended&&o.length<=o.highWaterMark,h(a)}function Y(a,o){o.readingMore||(o.readingMore=!0,process.nextTick(te,a,o))}function te(a,o){for(;!o.reading&&!o.ended&&(o.length1&&P(C.pipes,a)!==-1)&&!Ce&&(d("false write response, pause",C.awaitDrain),C.awaitDrain++),g.pause())}function ye(ae){d("onerror",ae),_e(),a.removeListener("error",ye),t(a,"error")===0&&T(a,ae)}O(a,"error",ye);function we(){a.removeListener("finish",xe),_e()}a.once("close",we);function xe(){d("onfinish"),a.removeListener("close",we),_e()}a.once("finish",xe);function _e(){d("unpipe"),g.unpipe(a)}return a.emit("pipe",g),C.flowing||(d("pipe resume"),g.resume()),a};function ue(a){return function(){var g=a._readableState;d("pipeOnDrain",g.awaitDrain),g.awaitDrain&&g.awaitDrain--,g.awaitDrain===0&&t(a,"data")&&(g.flowing=!0,h(a))}}M.prototype.unpipe=function(a){var o=this._readableState,g={hasUnpiped:!1};if(o.pipesCount===0)return this;if(o.pipesCount===1)return a&&a!==o.pipes?this:(a||(a=o.pipes),o.pipes=null,o.pipesCount=0,o.flowing=!1,a&&a.emit("unpipe",this,g),this);if(!a){var C=o.pipes,U=o.pipesCount;o.pipes=null,o.pipesCount=0,o.flowing=!1;for(var N=0;N0,C.flowing!==!1&&this.resume()):a==="readable"&&!C.endEmitted&&!C.readableListening&&(C.readableListening=C.needReadable=!0,C.flowing=!1,C.emittedReadable=!1,d("on readable",C.length,C.reading),C.length?K(this):C.reading||process.nextTick(G,this)),g},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(a,o){var g=r.prototype.removeListener.call(this,a,o);return a==="readable"&&process.nextTick(re,this),g},M.prototype.removeAllListeners=function(a){var o=r.prototype.removeAllListeners.apply(this,arguments);return(a==="readable"||a===void 0)&&process.nextTick(re,this),o};function re(a){var o=a._readableState;o.readableListening=a.listenerCount("readable")>0,o.resumeScheduled&&!o.paused?o.flowing=!0:a.listenerCount("data")>0&&a.resume()}function G(a){d("readable nexttick read 0"),a.read(0)}M.prototype.resume=function(){var a=this._readableState;return a.flowing||(d("resume"),a.flowing=!a.readableListening,he(this,a)),a.paused=!1,this};function he(a,o){o.resumeScheduled||(o.resumeScheduled=!0,process.nextTick(ne,a,o))}function ne(a,o){d("resume",o.reading),o.reading||a.read(0),o.resumeScheduled=!1,a.emit("resume"),h(a),o.flowing&&!o.reading&&a.read(0)}M.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function h(a){var o=a._readableState;for(d("flow",o.flowing);o.flowing&&a.read()!==null;);}M.prototype.wrap=function(a){var o=this,g=this._readableState,C=!1;a.on("end",function(){if(d("wrapped end"),g.decoder&&!g.ended){var L=g.decoder.end();L&&L.length&&o.push(L)}o.push(null)}),a.on("data",function(L){if(d("wrapped data"),g.decoder&&(L=g.decoder.write(L)),!(g.objectMode&&L==null)&&!(!g.objectMode&&(!L||!L.length))){var ie=o.push(L);ie||(C=!0,a.pause())}});for(var U in a)this[U]===void 0&&typeof a[U]=="function"&&(this[U]=function(ie){return function(){return a[ie].apply(a,arguments)}}(U));for(var N=0;N=o.length?(o.decoder?g=o.buffer.join(""):o.buffer.length===1?g=o.buffer.first():g=o.buffer.concat(o.length),o.buffer.clear()):g=o.buffer.consume(a,o.decoder),g}function x(a){var o=a._readableState;d("endReadable",o.endEmitted),o.endEmitted||(o.ended=!0,process.nextTick(B,o,a))}function B(a,o){if(d("endReadableNT",a.endEmitted,a.length),!a.endEmitted&&a.length===0&&(a.endEmitted=!0,o.readable=!1,o.emit("end"),a.autoDestroy)){var g=o._writableState;(!g||g.autoDestroy&&g.finished)&&o.destroy()}}typeof Symbol=="function"&&(M.from=function(a,o){return m===void 0&&(m=fi()),m(M,a,o)});function P(a,o){for(var g=0,C=a.length;g0;return wi(_,d,b,function(E){i||(i=E),E&&s.forEach(Pr),!d&&(s.forEach(Pr),n(i))})});return t.reduce(xi)}var mi=Si;(function(e,t){t=e.exports=fn(),t.Stream=t,t.Readable=t,t.Writable=on(),t.Duplex=Se(),t.Transform=ln,t.PassThrough=pi,t.finished=dr,t.pipeline=mi})(ar,ar.exports);var _n=ar.exports;const{Transform:Ri}=_n;var Ti=e=>class cn extends Ri{constructor(r,n,i,s,_){super(_),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=_,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(_){s=_}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 cn(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Ai}=_n;var Ci=e=>class dn extends Ai{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(_){s=_}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 dn(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const ki=Ti,Bi=Ci;var Mi=function(e){const t=ki(e),r=Bi(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(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)}}},pn={};const Lr=[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];pn.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],_=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],b=e[7]^e[17]^e[27]^e[37]^e[47],E=e[8]^e[18]^e[28]^e[38]^e[48],l=e[9]^e[19]^e[29]^e[39]^e[49];let S=E^(i<<1|s>>>31),v=l^(s<<1|i>>>31);const R=e[0]^S,A=e[1]^v,w=e[10]^S,f=e[11]^v,p=e[20]^S,y=e[21]^v,m=e[30]^S,T=e[31]^v,k=e[40]^S,O=e[41]^v;S=r^(_<<1|c>>>31),v=n^(c<<1|_>>>31);const D=e[2]^S,M=e[3]^v,F=e[12]^S,W=e[13]^v,Z=e[22]^S,q=e[23]^v,z=e[32]^S,V=e[33]^v,le=e[42]^S,K=e[43]^v;S=i^(d<<1|b>>>31),v=s^(b<<1|d>>>31);const ee=e[4]^S,Y=e[5]^v,te=e[14]^S,ue=e[15]^v,re=e[24]^S,G=e[25]^v,he=e[34]^S,ne=e[35]^v,h=e[44]^S,u=e[45]^v;S=_^(E<<1|l>>>31),v=c^(l<<1|E>>>31);const x=e[6]^S,B=e[7]^v,P=e[16]^S,a=e[17]^v,o=e[26]^S,g=e[27]^v,C=e[36]^S,U=e[37]^v,N=e[46]^S,L=e[47]^v;S=d^(r<<1|n>>>31),v=b^(n<<1|r>>>31);const ie=e[8]^S,de=e[9]^v,Ce=e[18]^S,Ue=e[19]^v,ke=e[28]^S,ye=e[29]^v,we=e[38]^S,xe=e[39]^v,_e=e[48]^S,ae=e[49]^v,J=R,et=A,tt=f<<4|w>>>28,rt=w<<4|f>>>28,nt=p<<3|y>>>29,it=y<<3|p>>>29,at=T<<9|m>>>23,ot=m<<9|T>>>23,st=k<<18|O>>>14,ft=O<<18|k>>>14,lt=D<<1|M>>>31,ut=M<<1|D>>>31,ht=W<<12|F>>>20,_t=F<<12|W>>>20,ct=Z<<10|q>>>22,dt=q<<10|Z>>>22,pt=V<<13|z>>>19,bt=z<<13|V>>>19,vt=le<<2|K>>>30,gt=K<<2|le>>>30,yt=Y<<30|ee>>>2,wt=ee<<30|Y>>>2,xt=te<<6|ue>>>26,Et=ue<<6|te>>>26,St=G<<11|re>>>21,mt=re<<11|G>>>21,Rt=he<<15|ne>>>17,Tt=ne<<15|he>>>17,At=u<<29|h>>>3,Ct=h<<29|u>>>3,kt=x<<28|B>>>4,Bt=B<<28|x>>>4,Mt=a<<23|P>>>9,Dt=P<<23|a>>>9,Nt=o<<25|g>>>7,Pt=g<<25|o>>>7,Lt=C<<21|U>>>11,Ot=U<<21|C>>>11,It=L<<24|N>>>8,$t=N<<24|L>>>8,Ft=ie<<27|de>>>5,Ut=de<<27|ie>>>5,Ht=Ce<<20|Ue>>>12,qt=Ue<<20|Ce>>>12,jt=ye<<7|ke>>>25,Wt=ke<<7|ye>>>25,zt=we<<8|xe>>>24,Vt=xe<<8|we>>>24,Gt=_e<<14|ae>>>18,Kt=ae<<14|_e>>>18;e[0]=J^~ht&St,e[1]=et^~_t&mt,e[10]=kt^~Ht&nt,e[11]=Bt^~qt&it,e[20]=lt^~xt&Nt,e[21]=ut^~Et&Pt,e[30]=Ft^~tt&ct,e[31]=Ut^~rt&dt,e[40]=yt^~Mt&jt,e[41]=wt^~Dt&Wt,e[2]=ht^~St&Lt,e[3]=_t^~mt&Ot,e[12]=Ht^~nt&pt,e[13]=qt^~it&bt,e[22]=xt^~Nt&zt,e[23]=Et^~Pt&Vt,e[32]=tt^~ct&Rt,e[33]=rt^~dt&Tt,e[42]=Mt^~jt&at,e[43]=Dt^~Wt&ot,e[4]=St^~Lt&Gt,e[5]=mt^~Ot&Kt,e[14]=nt^~pt&At,e[15]=it^~bt&Ct,e[24]=Nt^~zt&st,e[25]=Pt^~Vt&ft,e[34]=ct^~Rt&It,e[35]=dt^~Tt&$t,e[44]=jt^~at&vt,e[45]=Wt^~ot>,e[6]=Lt^~Gt&J,e[7]=Ot^~Kt&et,e[16]=pt^~At&kt,e[17]=bt^~Ct&Bt,e[26]=zt^~st<,e[27]=Vt^~ft&ut,e[36]=Rt^~It&Ft,e[37]=Tt^~$t&Ut,e[46]=at^~vt&yt,e[47]=ot^~gt&wt,e[8]=Gt^~J&ht,e[9]=Kt^~et&_t,e[18]=At^~kt&Ht,e[19]=Ct^~Bt&qt,e[28]=st^~lt&xt,e[29]=ft^~ut&Et,e[38]=It^~Ft&tt,e[39]=$t^~Ut&rt,e[48]=vt^~yt&Mt,e[49]=gt^~wt&Dt,e[0]^=Lr[t*2],e[1]^=Lr[t*2+1]}};const We=pn;function Te(){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}Te.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};Te.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(We.p1600(this.state),this.count=0);return t};Te.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Di=Te,Ka=Mi(Di),bn={exports:{}},vn=ce.Buffer;function Qe(e,t){this._block=vn.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Qe.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=vn.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,_=0;_=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 e?s.toString(e):s};Qe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Ae=Qe,Ni=X,gn=Ae,Pi=ce.Buffer,Li=[1518500249,1859775393,-1894007588,-899497514],Oi=new Array(80);function Pe(){this.init(),this._w=Oi,gn.call(this,64,56)}Ni(Pe,gn);Pe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Ii(e){return e<<5|e>>>27}function $i(e){return e<<30|e>>>2}function Fi(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Pe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,_=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var d=0;d<80;++d){var b=~~(d/20),E=Ii(r)+Fi(b,n,i,s)+_+t[d]+Li[b]|0;_=s,s=i,i=$i(n),n=r,r=E}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=_+this._e|0};Pe.prototype._hash=function(){var e=Pi.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Ui=Pe,Hi=X,yn=Ae,qi=ce.Buffer,ji=[1518500249,1859775393,-1894007588,-899497514],Wi=new Array(80);function Le(){this.init(),this._w=Wi,yn.call(this,64,56)}Hi(Le,yn);Le.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zi(e){return e<<1|e>>>31}function Vi(e){return e<<5|e>>>27}function Gi(e){return e<<30|e>>>2}function Ki(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Le.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,_=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=zi(t[c-3]^t[c-8]^t[c-14]^t[c-16]);for(var d=0;d<80;++d){var b=~~(d/20),E=Vi(r)+Ki(b,n,i,s)+_+t[d]+ji[b]|0;_=s,s=i,i=Gi(n),n=r,r=E}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=_+this._e|0};Le.prototype._hash=function(){var e=qi.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Yi=Le,Qi=X,wn=Ae,Xi=ce.Buffer,Ji=[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],Zi=new Array(64);function Oe(){this.init(),this._w=Zi,wn.call(this,64,56)}Qi(Oe,wn);Oe.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 ea(e,t,r){return r^e&(t^r)}function ta(e,t,r){return e&t|r&(e|t)}function ra(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function na(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function ia(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function aa(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Oe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,_=this._e|0,c=this._f|0,d=this._g|0,b=this._h|0,E=0;E<16;++E)t[E]=e.readInt32BE(E*4);for(;E<64;++E)t[E]=aa(t[E-2])+t[E-7]+ia(t[E-15])+t[E-16]|0;for(var l=0;l<64;++l){var S=b+na(_)+ea(_,c,d)+Ji[l]+t[l]|0,v=ra(r)+ta(r,n,i)|0;b=d,d=c,c=_,_=s+S|0,s=i,i=n,n=r,r=S+v|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=_+this._e|0,this._f=c+this._f|0,this._g=d+this._g|0,this._h=b+this._h|0};Oe.prototype._hash=function(){var e=Xi.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var xn=Oe,oa=X,sa=xn,fa=Ae,la=ce.Buffer,ua=new Array(64);function Xe(){this.init(),this._w=ua,fa.call(this,64,56)}oa(Xe,sa);Xe.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};Xe.prototype._hash=function(){var e=la.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var ha=Xe,_a=X,En=Ae,ca=ce.Buffer,Or=[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],da=new Array(160);function Ie(){this.init(),this._w=da,En.call(this,128,112)}_a(Ie,En);Ie.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 Ir(e,t,r){return r^e&(t^r)}function $r(e,t,r){return e&t|r&(e|t)}function Fr(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Ur(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function pa(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function ba(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function va(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function ga(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function j(e,t){return e>>>0>>0?1:0}Ie.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,_=this._eh|0,c=this._fh|0,d=this._gh|0,b=this._hh|0,E=this._al|0,l=this._bl|0,S=this._cl|0,v=this._dl|0,R=this._el|0,A=this._fl|0,w=this._gl|0,f=this._hl|0,p=0;p<32;p+=2)t[p]=e.readInt32BE(p*4),t[p+1]=e.readInt32BE(p*4+4);for(;p<160;p+=2){var y=t[p-30],m=t[p-15*2+1],T=pa(y,m),k=ba(m,y);y=t[p-2*2],m=t[p-2*2+1];var O=va(y,m),D=ga(m,y),M=t[p-7*2],F=t[p-7*2+1],W=t[p-16*2],Z=t[p-16*2+1],q=k+F|0,z=T+M+j(q,k)|0;q=q+D|0,z=z+O+j(q,D)|0,q=q+Z|0,z=z+W+j(q,Z)|0,t[p]=z,t[p+1]=q}for(var V=0;V<160;V+=2){z=t[V],q=t[V+1];var le=$r(r,n,i),K=$r(E,l,S),ee=Fr(r,E),Y=Fr(E,r),te=Ur(_,R),ue=Ur(R,_),re=Or[V],G=Or[V+1],he=Ir(_,c,d),ne=Ir(R,A,w),h=f+ue|0,u=b+te+j(h,f)|0;h=h+ne|0,u=u+he+j(h,ne)|0,h=h+G|0,u=u+re+j(h,G)|0,h=h+q|0,u=u+z+j(h,q)|0;var x=Y+K|0,B=ee+le+j(x,Y)|0;b=d,f=w,d=c,w=A,c=_,A=R,R=v+h|0,_=s+u+j(R,v)|0,s=i,v=S,i=n,S=l,n=r,l=E,E=h+x|0,r=u+B+j(E,h)|0}this._al=this._al+E|0,this._bl=this._bl+l|0,this._cl=this._cl+S|0,this._dl=this._dl+v|0,this._el=this._el+R|0,this._fl=this._fl+A|0,this._gl=this._gl+w|0,this._hl=this._hl+f|0,this._ah=this._ah+r+j(this._al,E)|0,this._bh=this._bh+n+j(this._bl,l)|0,this._ch=this._ch+i+j(this._cl,S)|0,this._dh=this._dh+s+j(this._dl,v)|0,this._eh=this._eh+_+j(this._el,R)|0,this._fh=this._fh+c+j(this._fl,A)|0,this._gh=this._gh+d+j(this._gl,w)|0,this._hh=this._hh+b+j(this._hl,f)|0};Ie.prototype._hash=function(){var e=ca.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Sn=Ie,ya=X,wa=Sn,xa=Ae,Ea=ce.Buffer,Sa=new Array(160);function Je(){this.init(),this._w=Sa,xa.call(this,128,112)}ya(Je,wa);Je.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};Je.prototype._hash=function(){var e=Ea.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var ma=Je,ve=bn.exports=function(t){t=t.toLowerCase();var r=ve[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};ve.sha=Ui;ve.sha1=Yi;ve.sha224=ha;ve.sha256=xn;ve.sha384=ma;ve.sha512=Sn;var Ya=bn.exports;function mn(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t2&&(_.children=arguments.length>3?$e.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)_[s]===void 0&&(_[s]=e.defaultProps[s]);return Be(e,_,n,i,null)}function Be(e,t,r,n,i){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Rn,__i:-1,__u:0};return i==null&&$.vnode!=null&&$.vnode(s),s}function Aa(){return{current:null}}function Fe(e){return e.children}function Me(e,t){this.props=e,this.context=t}function me(e,t){if(t==null)return e.__?me(e.__,e.__i+1):null;for(var r;tt&&pe.sort(fr));ze.__r=0}function Dn(e,t,r,n,i,s,_,c,d,b,E){var l,S,v,R,A,w=n&&n.__k||kn,f=t.length;for(r.__d=d,Ca(r,t,w),d=r.__d,l=0;l0?Be(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,s=null,(c=i.__i=ka(i,r,_,E))!==-1&&(E--,(s=r[c])&&(s.__u|=131072)),s==null||s.__v===null?(c==-1&&l--,typeof i.type!="function"&&(i.__u|=65536)):c!==_&&(c==_-1?l--:c==_+1?l++:(c>_?l--:l++,i.__u|=65536))):i=e.__k[n]=null;if(E)for(n=0;n(d!=null&&!(131072&d.__u)?1:0))for(;_>=0||c=0){if((d=t[_])&&!(131072&d.__u)&&i==d.key&&s===d.type)return _;_--}if(c2&&(c.children=arguments.length>3?$e.call(arguments,2):r),Be(e.type,c,n||e.key,i||e.ref,null)}function Na(e,t){var r={__c:t="__cC"+Cn++,__:e,Consumer:function(n,i){return n.children(i)},Provider:function(n){var i,s;return this.getChildContext||(i=[],(s={})[t]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(_){this.props.value!==_.value&&i.some(function(c){c.__e=!0,_r(c)})},this.sub=function(_){i.push(_);var c=_.componentWillUnmount;_.componentWillUnmount=function(){i&&i.splice(i.indexOf(_),1),c&&c.call(_)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}$e=kn.slice,$={__e:function(e,t,r,n){for(var i,s,_;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),_=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),_=i.__d),_)return i.__E=i}catch(c){e=c}throw e}},Rn=0,Tn=function(e){return e!=null&&e.constructor==null},Me.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=oe({},this.state),typeof e=="function"&&(e=e(oe({},r),this.props)),e&&oe(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),_r(this))},Me.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_r(this))},Me.prototype.render=Fe,pe=[],An=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fr=function(e,t){return e.__v.__b-t.__v.__b},ze.__r=0,pr=0,lr=Wr(!1),ur=Wr(!0),Cn=0;const Pa=Object.freeze(Object.defineProperty({__proto__:null,Component:Me,Fragment:Fe,cloneElement:Da,createContext:Na,createElement:hr,createRef:Aa,h:hr,hydrate:$n,get isValidElement(){return Tn},get options(){return $},render:In,toChildArray:Pn},Symbol.toStringTag,{value:"Module"})),Xa=Ve(Pa);var fe,I,ir,zr,Re=0,Fn=[],H=$,Vr=H.__b,Gr=H.__r,Kr=H.diffed,Yr=H.__c,Qr=H.unmount,Xr=H.__;function ge(e,t){H.__h&&H.__h(I,e,Re||t),Re=0;var r=I.__H||(I.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Un(e){return Re=1,Hn(jn,e)}function Hn(e,t,r){var n=ge(fe++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):jn(void 0,t),function(c){var d=n.__N?n.__N[0]:n.__[0],b=n.t(d,c);d!==b&&(n.__N=[b,n.__[1]],n.__c.setState({}))}],n.__c=I,!I.u)){var i=function(c,d,b){if(!n.__c.__H)return!0;var E=n.__c.__H.__.filter(function(S){return!!S.__c});if(E.every(function(S){return!S.__N}))return!s||s.call(this,c,d,b);var l=!1;return E.forEach(function(S){if(S.__N){var v=S.__[0];S.__=S.__N,S.__N=void 0,v!==S.__[0]&&(l=!0)}}),!(!l&&n.__c.props===c)&&(!s||s.call(this,c,d,b))};I.u=!0;var s=I.shouldComponentUpdate,_=I.componentWillUpdate;I.componentWillUpdate=function(c,d,b){if(this.__e){var E=s;s=void 0,i(c,d,b),s=E}_&&_.call(this,c,d,b)},I.shouldComponentUpdate=i}return n.__N||n.__}function La(e,t){var r=ge(fe++,3);!H.__s&&yr(r.__H,t)&&(r.__=e,r.i=t,I.__H.__h.push(r))}function qn(e,t){var r=ge(fe++,4);!H.__s&&yr(r.__H,t)&&(r.__=e,r.i=t,I.__h.push(r))}function Oa(e){return Re=5,gr(function(){return{current:e}},[])}function Ia(e,t,r){Re=6,qn(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function gr(e,t){var r=ge(fe++,7);return yr(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function $a(e,t){return Re=8,gr(function(){return e},t)}function Fa(e){var t=I.context[e.__c],r=ge(fe++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(I)),t.props.value):e.__}function Ua(e,t){H.useDebugValue&&H.useDebugValue(t?t(e):e)}function Ha(e){var t=ge(fe++,10),r=Un();return t.__=e,I.componentDidCatch||(I.componentDidCatch=function(n,i){t.__&&t.__(n,i),r[1](n)}),[r[0],function(){r[1](void 0)}]}function qa(){var e=ge(fe++,11);if(!e.__){for(var t=I.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function ja(){for(var e;e=Fn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(je),e.__H.__h.forEach(cr),e.__H.__h=[]}catch(t){e.__H.__h=[],H.__e(t,e.__v)}}H.__b=function(e){I=null,Vr&&Vr(e)},H.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Xr&&Xr(e,t)},H.__r=function(e){Gr&&Gr(e),fe=0;var t=(I=e.__c).__H;t&&(ir===I?(t.__h=[],I.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(t.__h.forEach(je),t.__h.forEach(cr),t.__h=[],fe=0)),ir=I},H.diffed=function(e){Kr&&Kr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fn.push(t)!==1&&zr===H.requestAnimationFrame||((zr=H.requestAnimationFrame)||Wa)(ja)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ir=I=null},H.__c=function(e,t){t.some(function(r){try{r.__h.forEach(je),r.__h=r.__h.filter(function(n){return!n.__||cr(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],H.__e(n,r.__v)}}),Yr&&Yr(e,t)},H.unmount=function(e){Qr&&Qr(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{je(n)}catch(i){t=i}}),r.__H=void 0,t&&H.__e(t,r.__v))};var Jr=typeof requestAnimationFrame=="function";function Wa(e){var t,r=function(){clearTimeout(n),Jr&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Jr&&(t=requestAnimationFrame(r))}function je(e){var t=I,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),I=t}function cr(e){var t=I;e.__c=e.__(),I=t}function yr(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function jn(e,t){return typeof t=="function"?t(e):t}const za=Object.freeze(Object.defineProperty({__proto__:null,useCallback:$a,useContext:Fa,useDebugValue:Ua,useEffect:La,useErrorBoundary:Ha,useId:qa,useImperativeHandle:Ia,useLayoutEffect:qn,useMemo:gr,useReducer:Hn,useRef:Oa,useState:Un},Symbol.toStringTag,{value:"Module"})),Ja=Ve(za);export{Xa as a,Ja as b,Ga as c,Ka as j,Qa as r,Ya as s}; +import{aT as wr,aR as Ve,aQ as Zr,aU as Ge,aV as en,aN as Ee,aW as X}from"./index-BSVOad49.js";const Wn=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:wr,default:wr},Symbol.toStringTag,{value:"Module"})),Ga=Ve(Wn);var ar={exports:{}},tn=Zr.EventEmitter,Yt,xr;function zn(){if(xr)return Yt;xr=1;function e(R,A){var w=Object.keys(R);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(R);A&&(f=f.filter(function(p){return Object.getOwnPropertyDescriptor(R,p).enumerable})),w.push.apply(w,f)}return w}function t(R){for(var A=1;A0?this.tail.next=f:this.head=f,this.tail=f,++this.length}},{key:"unshift",value:function(w){var f={data:w,next:this.head};this.length===0&&(this.tail=f),this.head=f,++this.length}},{key:"shift",value:function(){if(this.length!==0){var w=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,w}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(w){if(this.length===0)return"";for(var f=this.head,p=""+f.data;f=f.next;)p+=w+f.data;return p}},{key:"concat",value:function(w){if(this.length===0)return b.alloc(0);for(var f=b.allocUnsafe(w>>>0),p=this.head,y=0;p;)v(p.data,f,y),y+=p.data.length,p=p.next;return f}},{key:"consume",value:function(w,f){var p;return wm.length?m.length:w;if(T===m.length?y+=m:y+=m.slice(0,w),w-=T,w===0){T===m.length?(++p,f.next?this.head=f.next:this.head=this.tail=null):(this.head=f,f.data=m.slice(T));break}++p}return this.length-=p,y}},{key:"_getBuffer",value:function(w){var f=b.allocUnsafe(w),p=this.head,y=1;for(p.data.copy(f),w-=p.data.length;p=p.next;){var m=p.data,T=w>m.length?m.length:w;if(m.copy(f,f.length-w,0,T),w-=T,w===0){T===m.length?(++y,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=m.slice(T));break}++y}return this.length-=y,f}},{key:S,value:function(w,f){return l(this,t(t({},f),{},{depth:0,customInspect:!1}))}}]),R}(),Yt}function Vn(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(or,this,e)):process.nextTick(or,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(qe,r):(r._writableState.errorEmitted=!0,process.nextTick(Er,r,s)):process.nextTick(Er,r,s):t?(process.nextTick(qe,r),t(s)):process.nextTick(qe,r)}),this)}function Er(e,t){or(e,t),qe(e)}function qe(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Gn(){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 or(e,t){e.emit("error",t)}function Kn(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var rn={destroy:Vn,undestroy:Gn,errorOrDestroy:Kn},be={};function Yn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var nn={};function Q(e,t,r){r||(r=Error);function n(s,_,c){return typeof t=="string"?t:t(s,_,c)}var i=function(s){Yn(_,s);function _(c,d,b){return s.call(this,n(c,d,b))||this}return _}(r);i.prototype.name=r.name,i.prototype.code=e,nn[e]=i}function Sr(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Qn(e,t,r){return e.substr(0,t.length)===t}function Xn(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function Jn(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}Q("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Q("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Qn(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Xn(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Sr(t,"type"));else{var s=Jn(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Sr(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Q("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Q("ERR_STREAM_PREMATURE_CLOSE","Premature close");Q("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Q("ERR_STREAM_WRITE_AFTER_END","write after end");Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");be.codes=nn;var Zn=be.codes.ERR_INVALID_OPT_VALUE;function ei(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function ti(e,t,r,n){var i=ei(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new Zn(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var an={getHighWaterMark:ti},ri=ni;function ni(e,t){if(Qt("noDeprecation"))return e;var r=!1;function n(){if(!r){if(Qt("throwDeprecation"))throw new Error(t);Qt("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function Qt(e){try{if(!Ee.localStorage)return!1}catch{return!1}var t=Ee.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Xt,mr;function on(){if(mr)return Xt;mr=1,Xt=D;function e(h){var u=this;this.next=null,this.entry=null,this.finish=function(){ne(u,h)}}var t;D.WritableState=k;var r={deprecate:ri},n=tn,i=Ge.Buffer,s=(typeof Ee<"u"?Ee:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _(h){return i.from(h)}function c(h){return i.isBuffer(h)||h instanceof s}var d=rn,b=an,E=b.getHighWaterMark,l=be.codes,S=l.ERR_INVALID_ARG_TYPE,v=l.ERR_METHOD_NOT_IMPLEMENTED,R=l.ERR_MULTIPLE_CALLBACK,A=l.ERR_STREAM_CANNOT_PIPE,w=l.ERR_STREAM_DESTROYED,f=l.ERR_STREAM_NULL_VALUES,p=l.ERR_STREAM_WRITE_AFTER_END,y=l.ERR_UNKNOWN_ENCODING,m=d.errorOrDestroy;X(D,n);function T(){}function k(h,u,x){t=t||Se(),h=h||{},typeof x!="boolean"&&(x=u instanceof t),this.objectMode=!!h.objectMode,x&&(this.objectMode=this.objectMode||!!h.writableObjectMode),this.highWaterMark=E(this,h,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var B=h.decodeStrings===!1;this.decodeStrings=!B,this.defaultEncoding=h.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(P){le(u,P)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=h.emitClose!==!1,this.autoDestroy=!!h.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}k.prototype.getBuffer=function(){for(var u=this.bufferedRequest,x=[];u;)x.push(u),u=u.next;return x},function(){try{Object.defineProperty(k.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var O;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(O=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(u){return O.call(this,u)?!0:this!==D?!1:u&&u._writableState instanceof k}})):O=function(u){return u instanceof this};function D(h){t=t||Se();var u=this instanceof t;if(!u&&!O.call(D,this))return new D(h);this._writableState=new k(h,this,u),this.writable=!0,h&&(typeof h.write=="function"&&(this._write=h.write),typeof h.writev=="function"&&(this._writev=h.writev),typeof h.destroy=="function"&&(this._destroy=h.destroy),typeof h.final=="function"&&(this._final=h.final)),n.call(this)}D.prototype.pipe=function(){m(this,new A)};function M(h,u){var x=new p;m(h,x),process.nextTick(u,x)}function F(h,u,x,B){var P;return x===null?P=new f:typeof x!="string"&&!u.objectMode&&(P=new S("chunk",["string","Buffer"],x)),P?(m(h,P),process.nextTick(B,P),!1):!0}D.prototype.write=function(h,u,x){var B=this._writableState,P=!1,a=!B.objectMode&&c(h);return a&&!i.isBuffer(h)&&(h=_(h)),typeof u=="function"&&(x=u,u=null),a?u="buffer":u||(u=B.defaultEncoding),typeof x!="function"&&(x=T),B.ending?M(this,x):(a||F(this,B,h,x))&&(B.pendingcb++,P=Z(this,B,a,h,u,x)),P},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){var h=this._writableState;h.corked&&(h.corked--,!h.writing&&!h.corked&&!h.bufferProcessing&&h.bufferedRequest&&Y(this,h))},D.prototype.setDefaultEncoding=function(u){if(typeof u=="string"&&(u=u.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((u+"").toLowerCase())>-1))throw new y(u);return this._writableState.defaultEncoding=u,this},Object.defineProperty(D.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function W(h,u,x){return!h.objectMode&&h.decodeStrings!==!1&&typeof u=="string"&&(u=i.from(u,x)),u}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(h,u,x,B,P,a){if(!x){var o=W(u,B,P);B!==o&&(x=!0,P="buffer",B=o)}var g=u.objectMode?1:B.length;u.length+=g;var C=u.length */(function(e,t){var r=Ge,n=r.Buffer;function i(_,c){for(var d in _)c[d]=_[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(_,c,d){return n(_,c,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(_,c,d){if(typeof _=="number")throw new TypeError("Argument must not be a number");return n(_,c,d)},s.alloc=function(_,c,d){if(typeof _!="number")throw new TypeError("Argument must be a number");var b=n(_);return c!==void 0?typeof d=="string"?b.fill(c,d):b.fill(c):b.fill(0),b},s.allocUnsafe=function(_){if(typeof _!="number")throw new TypeError("Argument must be a number");return n(_)},s.allocUnsafeSlow=function(_){if(typeof _!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(_)}})(sr,sr.exports);var ce=sr.exports,Tr;function Ar(){if(Tr)return Zt;Tr=1;var e=ce.Buffer,t=e.isEncoding||function(f){switch(f=""+f,f&&f.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(f){if(!f)return"utf8";for(var p;;)switch(f){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return f;default:if(p)return;f=(""+f).toLowerCase(),p=!0}}function n(f){var p=r(f);if(typeof p!="string"&&(e.isEncoding===t||!t(f)))throw new Error("Unknown encoding: "+f);return p||f}Zt.StringDecoder=i;function i(f){this.encoding=n(f);var p;switch(this.encoding){case"utf16le":this.text=l,this.end=S,p=4;break;case"utf8":this.fillLast=d,p=4;break;case"base64":this.text=v,this.end=R,p=3;break;default:this.write=A,this.end=w;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(p)}i.prototype.write=function(f){if(f.length===0)return"";var p,y;if(this.lastNeed){if(p=this.fillLast(f),p===void 0)return"";y=this.lastNeed,this.lastNeed=0}else y=0;return y>5===6?2:f>>4===14?3:f>>3===30?4:f>>6===2?-1:-2}function _(f,p,y){var m=p.length-1;if(m=0?(T>0&&(f.lastNeed=T-1),T):--m=0?(T>0&&(f.lastNeed=T-2),T):--m=0?(T>0&&(T===2?T=0:f.lastNeed=T-3),T):0))}function c(f,p,y){if((p[0]&192)!==128)return f.lastNeed=0,"�";if(f.lastNeed>1&&p.length>1){if((p[1]&192)!==128)return f.lastNeed=1,"�";if(f.lastNeed>2&&p.length>2&&(p[2]&192)!==128)return f.lastNeed=2,"�"}}function d(f){var p=this.lastTotal-this.lastNeed,y=c(this,f);if(y!==void 0)return y;if(this.lastNeed<=f.length)return f.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);f.copy(this.lastChar,p,0,f.length),this.lastNeed-=f.length}function b(f,p){var y=_(this,f,p);if(!this.lastNeed)return f.toString("utf8",p);this.lastTotal=y;var m=f.length-(y-this.lastNeed);return f.copy(this.lastChar,0,m),f.toString("utf8",p,m)}function E(f){var p=f&&f.length?this.write(f):"";return this.lastNeed?p+"�":p}function l(f,p){if((f.length-p)%2===0){var y=f.toString("utf16le",p);if(y){var m=y.charCodeAt(y.length-1);if(m>=55296&&m<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=f[f.length-2],this.lastChar[1]=f[f.length-1],y.slice(0,-1)}return y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=f[f.length-1],f.toString("utf16le",p,f.length-1)}function S(f){var p=f&&f.length?this.write(f):"";if(this.lastNeed){var y=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,y)}return p}function v(f,p){var y=(f.length-p)%3;return y===0?f.toString("base64",p):(this.lastNeed=3-y,this.lastTotal=3,y===1?this.lastChar[0]=f[f.length-1]:(this.lastChar[0]=f[f.length-2],this.lastChar[1]=f[f.length-1]),f.toString("base64",p,f.length-y))}function R(f){var p=f&&f.length?this.write(f):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function A(f){return f.toString(this.encoding)}function w(f){return f&&f.length?this.write(f):""}return Zt}var Cr=be.codes.ERR_STREAM_PREMATURE_CLOSE;function ii(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof o!="string"&&!N.objectMode&&Object.getPrototypeOf(o)!==n.prototype&&(o=s(o)),C)N.endEmitted?T(a,new f):W(a,N,o,!0);else if(N.ended)T(a,new A);else{if(N.destroyed)return!1;N.reading=!1,N.decoder&&!g?(o=N.decoder.write(o),N.objectMode||o.length!==0?W(a,N,o,!1):Y(a,N)):W(a,N,o,!1)}else C||(N.reading=!1,Y(a,N))}return!N.ended&&(N.length=q?a=q:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function V(a,o){return a<=0||o.length===0&&o.ended?0:o.objectMode?1:a!==a?o.flowing&&o.length?o.buffer.head.data.length:o.length:(a>o.highWaterMark&&(o.highWaterMark=z(a)),a<=o.length?a:o.ended?o.length:(o.needReadable=!0,0))}M.prototype.read=function(a){d("read",a),a=parseInt(a,10);var o=this._readableState,g=a;if(a!==0&&(o.emittedReadable=!1),a===0&&o.needReadable&&((o.highWaterMark!==0?o.length>=o.highWaterMark:o.length>0)||o.ended))return d("read: emitReadable",o.length,o.ended),o.length===0&&o.ended?x(this):K(this),null;if(a=V(a,o),a===0&&o.ended)return o.length===0&&x(this),null;var C=o.needReadable;d("need readable",C),(o.length===0||o.length-a0?U=u(a,o):U=null,U===null?(o.needReadable=o.length<=o.highWaterMark,a=0):(o.length-=a,o.awaitDrain=0),o.length===0&&(o.ended||(o.needReadable=!0),g!==a&&o.ended&&x(this)),U!==null&&this.emit("data",U),U};function le(a,o){if(d("onEofChunk"),!o.ended){if(o.decoder){var g=o.decoder.end();g&&g.length&&(o.buffer.push(g),o.length+=o.objectMode?1:g.length)}o.ended=!0,o.sync?K(a):(o.needReadable=!1,o.emittedReadable||(o.emittedReadable=!0,ee(a)))}}function K(a){var o=a._readableState;d("emitReadable",o.needReadable,o.emittedReadable),o.needReadable=!1,o.emittedReadable||(d("emitReadable",o.flowing),o.emittedReadable=!0,process.nextTick(ee,a))}function ee(a){var o=a._readableState;d("emitReadable_",o.destroyed,o.length,o.ended),!o.destroyed&&(o.length||o.ended)&&(a.emit("readable"),o.emittedReadable=!1),o.needReadable=!o.flowing&&!o.ended&&o.length<=o.highWaterMark,h(a)}function Y(a,o){o.readingMore||(o.readingMore=!0,process.nextTick(te,a,o))}function te(a,o){for(;!o.reading&&!o.ended&&(o.length1&&P(C.pipes,a)!==-1)&&!Ce&&(d("false write response, pause",C.awaitDrain),C.awaitDrain++),g.pause())}function ye(ae){d("onerror",ae),_e(),a.removeListener("error",ye),t(a,"error")===0&&T(a,ae)}O(a,"error",ye);function we(){a.removeListener("finish",xe),_e()}a.once("close",we);function xe(){d("onfinish"),a.removeListener("close",we),_e()}a.once("finish",xe);function _e(){d("unpipe"),g.unpipe(a)}return a.emit("pipe",g),C.flowing||(d("pipe resume"),g.resume()),a};function ue(a){return function(){var g=a._readableState;d("pipeOnDrain",g.awaitDrain),g.awaitDrain&&g.awaitDrain--,g.awaitDrain===0&&t(a,"data")&&(g.flowing=!0,h(a))}}M.prototype.unpipe=function(a){var o=this._readableState,g={hasUnpiped:!1};if(o.pipesCount===0)return this;if(o.pipesCount===1)return a&&a!==o.pipes?this:(a||(a=o.pipes),o.pipes=null,o.pipesCount=0,o.flowing=!1,a&&a.emit("unpipe",this,g),this);if(!a){var C=o.pipes,U=o.pipesCount;o.pipes=null,o.pipesCount=0,o.flowing=!1;for(var N=0;N0,C.flowing!==!1&&this.resume()):a==="readable"&&!C.endEmitted&&!C.readableListening&&(C.readableListening=C.needReadable=!0,C.flowing=!1,C.emittedReadable=!1,d("on readable",C.length,C.reading),C.length?K(this):C.reading||process.nextTick(G,this)),g},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(a,o){var g=r.prototype.removeListener.call(this,a,o);return a==="readable"&&process.nextTick(re,this),g},M.prototype.removeAllListeners=function(a){var o=r.prototype.removeAllListeners.apply(this,arguments);return(a==="readable"||a===void 0)&&process.nextTick(re,this),o};function re(a){var o=a._readableState;o.readableListening=a.listenerCount("readable")>0,o.resumeScheduled&&!o.paused?o.flowing=!0:a.listenerCount("data")>0&&a.resume()}function G(a){d("readable nexttick read 0"),a.read(0)}M.prototype.resume=function(){var a=this._readableState;return a.flowing||(d("resume"),a.flowing=!a.readableListening,he(this,a)),a.paused=!1,this};function he(a,o){o.resumeScheduled||(o.resumeScheduled=!0,process.nextTick(ne,a,o))}function ne(a,o){d("resume",o.reading),o.reading||a.read(0),o.resumeScheduled=!1,a.emit("resume"),h(a),o.flowing&&!o.reading&&a.read(0)}M.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function h(a){var o=a._readableState;for(d("flow",o.flowing);o.flowing&&a.read()!==null;);}M.prototype.wrap=function(a){var o=this,g=this._readableState,C=!1;a.on("end",function(){if(d("wrapped end"),g.decoder&&!g.ended){var L=g.decoder.end();L&&L.length&&o.push(L)}o.push(null)}),a.on("data",function(L){if(d("wrapped data"),g.decoder&&(L=g.decoder.write(L)),!(g.objectMode&&L==null)&&!(!g.objectMode&&(!L||!L.length))){var ie=o.push(L);ie||(C=!0,a.pause())}});for(var U in a)this[U]===void 0&&typeof a[U]=="function"&&(this[U]=function(ie){return function(){return a[ie].apply(a,arguments)}}(U));for(var N=0;N=o.length?(o.decoder?g=o.buffer.join(""):o.buffer.length===1?g=o.buffer.first():g=o.buffer.concat(o.length),o.buffer.clear()):g=o.buffer.consume(a,o.decoder),g}function x(a){var o=a._readableState;d("endReadable",o.endEmitted),o.endEmitted||(o.ended=!0,process.nextTick(B,o,a))}function B(a,o){if(d("endReadableNT",a.endEmitted,a.length),!a.endEmitted&&a.length===0&&(a.endEmitted=!0,o.readable=!1,o.emit("end"),a.autoDestroy)){var g=o._writableState;(!g||g.autoDestroy&&g.finished)&&o.destroy()}}typeof Symbol=="function"&&(M.from=function(a,o){return m===void 0&&(m=fi()),m(M,a,o)});function P(a,o){for(var g=0,C=a.length;g0;return wi(_,d,b,function(E){i||(i=E),E&&s.forEach(Pr),!d&&(s.forEach(Pr),n(i))})});return t.reduce(xi)}var mi=Si;(function(e,t){t=e.exports=fn(),t.Stream=t,t.Readable=t,t.Writable=on(),t.Duplex=Se(),t.Transform=ln,t.PassThrough=pi,t.finished=dr,t.pipeline=mi})(ar,ar.exports);var _n=ar.exports;const{Transform:Ri}=_n;var Ti=e=>class cn extends Ri{constructor(r,n,i,s,_){super(_),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=_,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(_){s=_}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 cn(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Ai}=_n;var Ci=e=>class dn extends Ai{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(_){s=_}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 dn(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const ki=Ti,Bi=Ci;var Mi=function(e){const t=ki(e),r=Bi(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(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)}}},pn={};const Lr=[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];pn.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],_=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],b=e[7]^e[17]^e[27]^e[37]^e[47],E=e[8]^e[18]^e[28]^e[38]^e[48],l=e[9]^e[19]^e[29]^e[39]^e[49];let S=E^(i<<1|s>>>31),v=l^(s<<1|i>>>31);const R=e[0]^S,A=e[1]^v,w=e[10]^S,f=e[11]^v,p=e[20]^S,y=e[21]^v,m=e[30]^S,T=e[31]^v,k=e[40]^S,O=e[41]^v;S=r^(_<<1|c>>>31),v=n^(c<<1|_>>>31);const D=e[2]^S,M=e[3]^v,F=e[12]^S,W=e[13]^v,Z=e[22]^S,q=e[23]^v,z=e[32]^S,V=e[33]^v,le=e[42]^S,K=e[43]^v;S=i^(d<<1|b>>>31),v=s^(b<<1|d>>>31);const ee=e[4]^S,Y=e[5]^v,te=e[14]^S,ue=e[15]^v,re=e[24]^S,G=e[25]^v,he=e[34]^S,ne=e[35]^v,h=e[44]^S,u=e[45]^v;S=_^(E<<1|l>>>31),v=c^(l<<1|E>>>31);const x=e[6]^S,B=e[7]^v,P=e[16]^S,a=e[17]^v,o=e[26]^S,g=e[27]^v,C=e[36]^S,U=e[37]^v,N=e[46]^S,L=e[47]^v;S=d^(r<<1|n>>>31),v=b^(n<<1|r>>>31);const ie=e[8]^S,de=e[9]^v,Ce=e[18]^S,Ue=e[19]^v,ke=e[28]^S,ye=e[29]^v,we=e[38]^S,xe=e[39]^v,_e=e[48]^S,ae=e[49]^v,J=R,et=A,tt=f<<4|w>>>28,rt=w<<4|f>>>28,nt=p<<3|y>>>29,it=y<<3|p>>>29,at=T<<9|m>>>23,ot=m<<9|T>>>23,st=k<<18|O>>>14,ft=O<<18|k>>>14,lt=D<<1|M>>>31,ut=M<<1|D>>>31,ht=W<<12|F>>>20,_t=F<<12|W>>>20,ct=Z<<10|q>>>22,dt=q<<10|Z>>>22,pt=V<<13|z>>>19,bt=z<<13|V>>>19,vt=le<<2|K>>>30,gt=K<<2|le>>>30,yt=Y<<30|ee>>>2,wt=ee<<30|Y>>>2,xt=te<<6|ue>>>26,Et=ue<<6|te>>>26,St=G<<11|re>>>21,mt=re<<11|G>>>21,Rt=he<<15|ne>>>17,Tt=ne<<15|he>>>17,At=u<<29|h>>>3,Ct=h<<29|u>>>3,kt=x<<28|B>>>4,Bt=B<<28|x>>>4,Mt=a<<23|P>>>9,Dt=P<<23|a>>>9,Nt=o<<25|g>>>7,Pt=g<<25|o>>>7,Lt=C<<21|U>>>11,Ot=U<<21|C>>>11,It=L<<24|N>>>8,$t=N<<24|L>>>8,Ft=ie<<27|de>>>5,Ut=de<<27|ie>>>5,Ht=Ce<<20|Ue>>>12,qt=Ue<<20|Ce>>>12,jt=ye<<7|ke>>>25,Wt=ke<<7|ye>>>25,zt=we<<8|xe>>>24,Vt=xe<<8|we>>>24,Gt=_e<<14|ae>>>18,Kt=ae<<14|_e>>>18;e[0]=J^~ht&St,e[1]=et^~_t&mt,e[10]=kt^~Ht&nt,e[11]=Bt^~qt&it,e[20]=lt^~xt&Nt,e[21]=ut^~Et&Pt,e[30]=Ft^~tt&ct,e[31]=Ut^~rt&dt,e[40]=yt^~Mt&jt,e[41]=wt^~Dt&Wt,e[2]=ht^~St&Lt,e[3]=_t^~mt&Ot,e[12]=Ht^~nt&pt,e[13]=qt^~it&bt,e[22]=xt^~Nt&zt,e[23]=Et^~Pt&Vt,e[32]=tt^~ct&Rt,e[33]=rt^~dt&Tt,e[42]=Mt^~jt&at,e[43]=Dt^~Wt&ot,e[4]=St^~Lt&Gt,e[5]=mt^~Ot&Kt,e[14]=nt^~pt&At,e[15]=it^~bt&Ct,e[24]=Nt^~zt&st,e[25]=Pt^~Vt&ft,e[34]=ct^~Rt&It,e[35]=dt^~Tt&$t,e[44]=jt^~at&vt,e[45]=Wt^~ot>,e[6]=Lt^~Gt&J,e[7]=Ot^~Kt&et,e[16]=pt^~At&kt,e[17]=bt^~Ct&Bt,e[26]=zt^~st<,e[27]=Vt^~ft&ut,e[36]=Rt^~It&Ft,e[37]=Tt^~$t&Ut,e[46]=at^~vt&yt,e[47]=ot^~gt&wt,e[8]=Gt^~J&ht,e[9]=Kt^~et&_t,e[18]=At^~kt&Ht,e[19]=Ct^~Bt&qt,e[28]=st^~lt&xt,e[29]=ft^~ut&Et,e[38]=It^~Ft&tt,e[39]=$t^~Ut&rt,e[48]=vt^~yt&Mt,e[49]=gt^~wt&Dt,e[0]^=Lr[t*2],e[1]^=Lr[t*2+1]}};const We=pn;function Te(){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}Te.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};Te.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(We.p1600(this.state),this.count=0);return t};Te.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Di=Te,Ka=Mi(Di),bn={exports:{}},vn=ce.Buffer;function Qe(e,t){this._block=vn.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Qe.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=vn.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,_=0;_=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 e?s.toString(e):s};Qe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Ae=Qe,Ni=X,gn=Ae,Pi=ce.Buffer,Li=[1518500249,1859775393,-1894007588,-899497514],Oi=new Array(80);function Pe(){this.init(),this._w=Oi,gn.call(this,64,56)}Ni(Pe,gn);Pe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Ii(e){return e<<5|e>>>27}function $i(e){return e<<30|e>>>2}function Fi(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Pe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,_=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var d=0;d<80;++d){var b=~~(d/20),E=Ii(r)+Fi(b,n,i,s)+_+t[d]+Li[b]|0;_=s,s=i,i=$i(n),n=r,r=E}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=_+this._e|0};Pe.prototype._hash=function(){var e=Pi.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Ui=Pe,Hi=X,yn=Ae,qi=ce.Buffer,ji=[1518500249,1859775393,-1894007588,-899497514],Wi=new Array(80);function Le(){this.init(),this._w=Wi,yn.call(this,64,56)}Hi(Le,yn);Le.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zi(e){return e<<1|e>>>31}function Vi(e){return e<<5|e>>>27}function Gi(e){return e<<30|e>>>2}function Ki(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Le.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,_=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=zi(t[c-3]^t[c-8]^t[c-14]^t[c-16]);for(var d=0;d<80;++d){var b=~~(d/20),E=Vi(r)+Ki(b,n,i,s)+_+t[d]+ji[b]|0;_=s,s=i,i=Gi(n),n=r,r=E}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=_+this._e|0};Le.prototype._hash=function(){var e=qi.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Yi=Le,Qi=X,wn=Ae,Xi=ce.Buffer,Ji=[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],Zi=new Array(64);function Oe(){this.init(),this._w=Zi,wn.call(this,64,56)}Qi(Oe,wn);Oe.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 ea(e,t,r){return r^e&(t^r)}function ta(e,t,r){return e&t|r&(e|t)}function ra(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function na(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function ia(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function aa(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Oe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,_=this._e|0,c=this._f|0,d=this._g|0,b=this._h|0,E=0;E<16;++E)t[E]=e.readInt32BE(E*4);for(;E<64;++E)t[E]=aa(t[E-2])+t[E-7]+ia(t[E-15])+t[E-16]|0;for(var l=0;l<64;++l){var S=b+na(_)+ea(_,c,d)+Ji[l]+t[l]|0,v=ra(r)+ta(r,n,i)|0;b=d,d=c,c=_,_=s+S|0,s=i,i=n,n=r,r=S+v|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=_+this._e|0,this._f=c+this._f|0,this._g=d+this._g|0,this._h=b+this._h|0};Oe.prototype._hash=function(){var e=Xi.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var xn=Oe,oa=X,sa=xn,fa=Ae,la=ce.Buffer,ua=new Array(64);function Xe(){this.init(),this._w=ua,fa.call(this,64,56)}oa(Xe,sa);Xe.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};Xe.prototype._hash=function(){var e=la.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var ha=Xe,_a=X,En=Ae,ca=ce.Buffer,Or=[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],da=new Array(160);function Ie(){this.init(),this._w=da,En.call(this,128,112)}_a(Ie,En);Ie.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 Ir(e,t,r){return r^e&(t^r)}function $r(e,t,r){return e&t|r&(e|t)}function Fr(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Ur(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function pa(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function ba(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function va(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function ga(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function j(e,t){return e>>>0>>0?1:0}Ie.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,_=this._eh|0,c=this._fh|0,d=this._gh|0,b=this._hh|0,E=this._al|0,l=this._bl|0,S=this._cl|0,v=this._dl|0,R=this._el|0,A=this._fl|0,w=this._gl|0,f=this._hl|0,p=0;p<32;p+=2)t[p]=e.readInt32BE(p*4),t[p+1]=e.readInt32BE(p*4+4);for(;p<160;p+=2){var y=t[p-30],m=t[p-15*2+1],T=pa(y,m),k=ba(m,y);y=t[p-2*2],m=t[p-2*2+1];var O=va(y,m),D=ga(m,y),M=t[p-7*2],F=t[p-7*2+1],W=t[p-16*2],Z=t[p-16*2+1],q=k+F|0,z=T+M+j(q,k)|0;q=q+D|0,z=z+O+j(q,D)|0,q=q+Z|0,z=z+W+j(q,Z)|0,t[p]=z,t[p+1]=q}for(var V=0;V<160;V+=2){z=t[V],q=t[V+1];var le=$r(r,n,i),K=$r(E,l,S),ee=Fr(r,E),Y=Fr(E,r),te=Ur(_,R),ue=Ur(R,_),re=Or[V],G=Or[V+1],he=Ir(_,c,d),ne=Ir(R,A,w),h=f+ue|0,u=b+te+j(h,f)|0;h=h+ne|0,u=u+he+j(h,ne)|0,h=h+G|0,u=u+re+j(h,G)|0,h=h+q|0,u=u+z+j(h,q)|0;var x=Y+K|0,B=ee+le+j(x,Y)|0;b=d,f=w,d=c,w=A,c=_,A=R,R=v+h|0,_=s+u+j(R,v)|0,s=i,v=S,i=n,S=l,n=r,l=E,E=h+x|0,r=u+B+j(E,h)|0}this._al=this._al+E|0,this._bl=this._bl+l|0,this._cl=this._cl+S|0,this._dl=this._dl+v|0,this._el=this._el+R|0,this._fl=this._fl+A|0,this._gl=this._gl+w|0,this._hl=this._hl+f|0,this._ah=this._ah+r+j(this._al,E)|0,this._bh=this._bh+n+j(this._bl,l)|0,this._ch=this._ch+i+j(this._cl,S)|0,this._dh=this._dh+s+j(this._dl,v)|0,this._eh=this._eh+_+j(this._el,R)|0,this._fh=this._fh+c+j(this._fl,A)|0,this._gh=this._gh+d+j(this._gl,w)|0,this._hh=this._hh+b+j(this._hl,f)|0};Ie.prototype._hash=function(){var e=ca.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Sn=Ie,ya=X,wa=Sn,xa=Ae,Ea=ce.Buffer,Sa=new Array(160);function Je(){this.init(),this._w=Sa,xa.call(this,128,112)}ya(Je,wa);Je.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};Je.prototype._hash=function(){var e=Ea.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var ma=Je,ve=bn.exports=function(t){t=t.toLowerCase();var r=ve[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};ve.sha=Ui;ve.sha1=Yi;ve.sha224=ha;ve.sha256=xn;ve.sha384=ma;ve.sha512=Sn;var Ya=bn.exports;function mn(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t2&&(_.children=arguments.length>3?$e.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)_[s]===void 0&&(_[s]=e.defaultProps[s]);return Be(e,_,n,i,null)}function Be(e,t,r,n,i){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Rn,__i:-1,__u:0};return i==null&&$.vnode!=null&&$.vnode(s),s}function Aa(){return{current:null}}function Fe(e){return e.children}function Me(e,t){this.props=e,this.context=t}function me(e,t){if(t==null)return e.__?me(e.__,e.__i+1):null;for(var r;tt&&pe.sort(fr));ze.__r=0}function Dn(e,t,r,n,i,s,_,c,d,b,E){var l,S,v,R,A,w=n&&n.__k||kn,f=t.length;for(r.__d=d,Ca(r,t,w),d=r.__d,l=0;l0?Be(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,s=null,(c=i.__i=ka(i,r,_,E))!==-1&&(E--,(s=r[c])&&(s.__u|=131072)),s==null||s.__v===null?(c==-1&&l--,typeof i.type!="function"&&(i.__u|=65536)):c!==_&&(c==_-1?l--:c==_+1?l++:(c>_?l--:l++,i.__u|=65536))):i=e.__k[n]=null;if(E)for(n=0;n(d!=null&&!(131072&d.__u)?1:0))for(;_>=0||c=0){if((d=t[_])&&!(131072&d.__u)&&i==d.key&&s===d.type)return _;_--}if(c2&&(c.children=arguments.length>3?$e.call(arguments,2):r),Be(e.type,c,n||e.key,i||e.ref,null)}function Na(e,t){var r={__c:t="__cC"+Cn++,__:e,Consumer:function(n,i){return n.children(i)},Provider:function(n){var i,s;return this.getChildContext||(i=[],(s={})[t]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(_){this.props.value!==_.value&&i.some(function(c){c.__e=!0,_r(c)})},this.sub=function(_){i.push(_);var c=_.componentWillUnmount;_.componentWillUnmount=function(){i&&i.splice(i.indexOf(_),1),c&&c.call(_)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}$e=kn.slice,$={__e:function(e,t,r,n){for(var i,s,_;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),_=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),_=i.__d),_)return i.__E=i}catch(c){e=c}throw e}},Rn=0,Tn=function(e){return e!=null&&e.constructor==null},Me.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=oe({},this.state),typeof e=="function"&&(e=e(oe({},r),this.props)),e&&oe(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),_r(this))},Me.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_r(this))},Me.prototype.render=Fe,pe=[],An=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fr=function(e,t){return e.__v.__b-t.__v.__b},ze.__r=0,pr=0,lr=Wr(!1),ur=Wr(!0),Cn=0;const Pa=Object.freeze(Object.defineProperty({__proto__:null,Component:Me,Fragment:Fe,cloneElement:Da,createContext:Na,createElement:hr,createRef:Aa,h:hr,hydrate:$n,get isValidElement(){return Tn},get options(){return $},render:In,toChildArray:Pn},Symbol.toStringTag,{value:"Module"})),Xa=Ve(Pa);var fe,I,ir,zr,Re=0,Fn=[],H=$,Vr=H.__b,Gr=H.__r,Kr=H.diffed,Yr=H.__c,Qr=H.unmount,Xr=H.__;function ge(e,t){H.__h&&H.__h(I,e,Re||t),Re=0;var r=I.__H||(I.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Un(e){return Re=1,Hn(jn,e)}function Hn(e,t,r){var n=ge(fe++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):jn(void 0,t),function(c){var d=n.__N?n.__N[0]:n.__[0],b=n.t(d,c);d!==b&&(n.__N=[b,n.__[1]],n.__c.setState({}))}],n.__c=I,!I.u)){var i=function(c,d,b){if(!n.__c.__H)return!0;var E=n.__c.__H.__.filter(function(S){return!!S.__c});if(E.every(function(S){return!S.__N}))return!s||s.call(this,c,d,b);var l=!1;return E.forEach(function(S){if(S.__N){var v=S.__[0];S.__=S.__N,S.__N=void 0,v!==S.__[0]&&(l=!0)}}),!(!l&&n.__c.props===c)&&(!s||s.call(this,c,d,b))};I.u=!0;var s=I.shouldComponentUpdate,_=I.componentWillUpdate;I.componentWillUpdate=function(c,d,b){if(this.__e){var E=s;s=void 0,i(c,d,b),s=E}_&&_.call(this,c,d,b)},I.shouldComponentUpdate=i}return n.__N||n.__}function La(e,t){var r=ge(fe++,3);!H.__s&&yr(r.__H,t)&&(r.__=e,r.i=t,I.__H.__h.push(r))}function qn(e,t){var r=ge(fe++,4);!H.__s&&yr(r.__H,t)&&(r.__=e,r.i=t,I.__h.push(r))}function Oa(e){return Re=5,gr(function(){return{current:e}},[])}function Ia(e,t,r){Re=6,qn(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function gr(e,t){var r=ge(fe++,7);return yr(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function $a(e,t){return Re=8,gr(function(){return e},t)}function Fa(e){var t=I.context[e.__c],r=ge(fe++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(I)),t.props.value):e.__}function Ua(e,t){H.useDebugValue&&H.useDebugValue(t?t(e):e)}function Ha(e){var t=ge(fe++,10),r=Un();return t.__=e,I.componentDidCatch||(I.componentDidCatch=function(n,i){t.__&&t.__(n,i),r[1](n)}),[r[0],function(){r[1](void 0)}]}function qa(){var e=ge(fe++,11);if(!e.__){for(var t=I.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function ja(){for(var e;e=Fn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(je),e.__H.__h.forEach(cr),e.__H.__h=[]}catch(t){e.__H.__h=[],H.__e(t,e.__v)}}H.__b=function(e){I=null,Vr&&Vr(e)},H.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Xr&&Xr(e,t)},H.__r=function(e){Gr&&Gr(e),fe=0;var t=(I=e.__c).__H;t&&(ir===I?(t.__h=[],I.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(t.__h.forEach(je),t.__h.forEach(cr),t.__h=[],fe=0)),ir=I},H.diffed=function(e){Kr&&Kr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fn.push(t)!==1&&zr===H.requestAnimationFrame||((zr=H.requestAnimationFrame)||Wa)(ja)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ir=I=null},H.__c=function(e,t){t.some(function(r){try{r.__h.forEach(je),r.__h=r.__h.filter(function(n){return!n.__||cr(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],H.__e(n,r.__v)}}),Yr&&Yr(e,t)},H.unmount=function(e){Qr&&Qr(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{je(n)}catch(i){t=i}}),r.__H=void 0,t&&H.__e(t,r.__v))};var Jr=typeof requestAnimationFrame=="function";function Wa(e){var t,r=function(){clearTimeout(n),Jr&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Jr&&(t=requestAnimationFrame(r))}function je(e){var t=I,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),I=t}function cr(e){var t=I;e.__c=e.__(),I=t}function yr(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function jn(e,t){return typeof t=="function"?t(e):t}const za=Object.freeze(Object.defineProperty({__proto__:null,useCallback:$a,useContext:Fa,useDebugValue:Ua,useEffect:La,useErrorBoundary:Ha,useId:qa,useImperativeHandle:Ia,useLayoutEffect:qn,useMemo:gr,useReducer:Hn,useRef:Oa,useState:Un},Symbol.toStringTag,{value:"Module"})),Ja=Ve(za);export{Xa as a,Ja as b,Ga as c,Ka as j,Qa as r,Ya as s}; diff --git a/assets/index-CFrD00kt.js b/assets/index-BSVOad49.js similarity index 93% rename from assets/index-CFrD00kt.js rename to assets/index-BSVOad49.js index 837e129..08efba7 100644 --- a/assets/index-CFrD00kt.js +++ b/assets/index-BSVOad49.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CbiTlW7Y.js","assets/hooks.module-DHPNJ6uk.js","assets/index-Dp7JVq_m.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-IoMmGEzv.js","assets/hooks.module-Cnm_IKFt.js","assets/index-DethetlS.js"])))=>i.map(i=>d[i]); var aEe=Object.defineProperty;var aJ=t=>{throw TypeError(t)};var oEe=(t,e,r)=>e in t?aEe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ye=(t,e,r)=>oEe(t,typeof e!="symbol"?e+"":e,r),JN=(t,e,r)=>e.has(t)||aJ("Cannot "+r);var Q=(t,e,r)=>(JN(t,e,"read from private field"),r?r.call(t):e.get(t)),Ne=(t,e,r)=>e.has(t)?aJ("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),he=(t,e,r,n)=>(JN(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),it=(t,e,r)=>(JN(t,e,"access private method"),r);var nd=(t,e,r,n)=>({set _(i){he(t,e,i,r)},get _(){return Q(t,e,n)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var Mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Dh(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var wle={exports:{}},pM={},vle={exports:{}},Yr={};/** * @license React * react.production.min.js @@ -77,7 +77,7 @@ if (cid) { `),{docsPath:r,name:"InvalidAbiDecodingType"})}}class KBe extends kt{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class QBe extends kt{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` `),{name:"InvalidDefinitionTypeError"})}}function km(t){return typeof t[0]=="string"?Vh(t):ZBe(t)}function ZBe(t){let e=0;for(const i of t)e+=i.length;const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Vh(t){return`0x${t.reduce((e,r)=>e+r.replace("0x",""),"")}`}class Lo extends kt{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class VG extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}function OI(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function YBe(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Sk(t,...e){if(!YBe(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function E3t(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");OI(t.outputLen),OI(t.blockLen)}function DI(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function z2e(t,e){Sk(t);const r=e.outputLen;if(t.length>Ise&YC)}:{h:Number(t>>Ise&YC)|0,l:Number(t&YC)|0}}function XBe(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;it<>>32-r,tUe=(t,e,r)=>e<>>32-r,rUe=(t,e,r)=>e<>>64-r,nUe=(t,e,r)=>t<>>64-r,cL=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const iUe=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),uL=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),rl=(t,e)=>t<<32-e|t>>>e,Rse=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,sUe=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function Mse(t){for(let e=0;et().update(WG(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function S3t(t=32){if(cL&&typeof cL.getRandomValues=="function")return cL.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}const V2e=[],W2e=[],G2e=[],oUe=BigInt(0),Rv=BigInt(1),fUe=BigInt(2),cUe=BigInt(7),uUe=BigInt(256),lUe=BigInt(113);for(let t=0,e=Rv,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],V2e.push(2*(5*n+r)),W2e.push((t+1)*(t+2)/2%64);let i=oUe;for(let s=0;s<7;s++)e=(e<>cUe)*lUe)%uUe,e&fUe&&(i^=Rv<<(Rv<r>32?rUe(t,e,r):eUe(t,e,r),Pse=(t,e,r)=>r>32?nUe(t,e,r):tUe(t,e,r);function pUe(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)r[a]=t[a]^t[a+10]^t[a+20]^t[a+30]^t[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,f=(a+2)%10,c=r[f],d=r[f+1],p=kse(c,d,1)^r[o],g=Pse(c,d,1)^r[o+1];for(let x=0;x<50;x+=10)t[a+x]^=p,t[a+x+1]^=g}let i=t[2],s=t[3];for(let a=0;a<24;a++){const o=W2e[a],f=kse(i,s,o),c=Pse(i,s,o),d=V2e[a];i=t[d],s=t[d+1],t[d]=f,t[d+1]=c}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)r[o]=t[a+o];for(let o=0;o<10;o++)t[a+o]^=~r[(o+2)%10]&r[(o+4)%10]}t[0]^=dUe[n],t[1]^=hUe[n]}r.fill(0)}class GG extends q2e{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,OI(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=iUe(this.state)}keccak(){Rse||Mse(this.state32),pUe(this.state32,this.rounds),Rse||Mse(this.state32),this.posOut=0,this.pos=0}update(e){DI(this);const{blockLen:r,state:n}=this;e=WG(e);const i=e.length;for(let s=0;s=n&&this.keccak();const a=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+a),i),this.posOut+=a,i+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return OI(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(z2e(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:a}=this;return e||(e=new GG(r,n,i,a,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}const mUe=(t,e,r)=>H2e(()=>new GG(e,t,r)),gUe=mUe(1,136,256/8);function V6(t,e){const r=e||"hex",n=gUe(yh(t,{strict:!1})?_k(t):t);return r==="bytes"?n:Er(n)}const lL=new VG(8192);function f_(t,e){if(lL.has(`${t}.${e}`))return lL.get(`${t}.${e}`);const r=e?`${e}${t.toLowerCase()}`:t.substring(2).toLowerCase(),n=V6(fm(r),"bytes"),i=(e?r.substring(`${e}0x`.length):r).split("");for(let a=0;a<40;a+=2)n[a>>1]>>4>=8&&i[a]&&(i[a]=i[a].toUpperCase()),(n[a>>1]&15)>=8&&i[a+1]&&(i[a+1]=i[a+1].toUpperCase());const s=`0x${i.join("")}`;return lL.set(`${t}.${e}`,s),s}function $s(t,e){if(!js(t,{strict:!1}))throw new Lo({address:t});return f_(t,e)}const bUe=/^0x[a-fA-F0-9]{40}$/,dL=new VG(8192);function js(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(dL.has(n))return dL.get(n);const i=bUe.test(t)?t.toLowerCase()===t?!0:r?f_(t)===t:!0:!1;return dL.set(n,i),i}function V7(t,e,r,{strict:n}={}){return yh(t,{strict:!1})?yUe(t,e,r,{strict:n}):Z2e(t,e,r,{strict:n})}function K2e(t,e){if(typeof e=="number"&&e>0&&e>f0(t)-1)throw new B2e({offset:e,position:"start",size:f0(t)})}function Q2e(t,e,r){if(typeof e=="number"&&typeof r=="number"&&f0(t)!==r-e)throw new B2e({offset:r,position:"end",size:f0(t)})}function Z2e(t,e,r,{strict:n}={}){K2e(t,e);const i=t.slice(e,r);return n&&Q2e(i,e,r),i}function yUe(t,e,r,{strict:n}={}){K2e(t,e);const i=`0x${t.replace("0x","").slice((e??0)*2,(r??t.length)*2)}`;return n&&Q2e(i,e,r),i}function Y2e(t,e){if(t.length!==e.length)throw new zBe({expectedLength:t.length,givenLength:e.length});const r=wUe({params:t,values:e}),n=QG(r);return n.length===0?"0x":n}function wUe({params:t,values:e}){const r=[];for(let n=0;n0?km([o,a]):o}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:km(s.map(({encoded:a})=>a))}}function AUe(t,{param:e}){const[,r]=e.type.split("bytes"),n=f0(t);if(!r){let i=t;return n%32!==0&&(i=k6(i,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:km([k6(Tr(n,{size:32})),i])}}if(n!==Number.parseInt(r))throw new jBe({expectedSize:Number.parseInt(r),value:t});return{dynamic:!1,encoded:k6(t,{dir:"right"})}}function _Ue(t){if(typeof t!="boolean")throw new kt(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:k6(F2e(t))}}function EUe(t,{signed:e}){return{dynamic:!1,encoded:Tr(t,{size:32,signed:e})}}function CUe(t){const e=Ek(t),r=Math.ceil(f0(e)/32),n=[];for(let i=0;ii))}}function ZG(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const hL="/docs/contract/encodeDeployData";function YG(t){const{abi:e,args:r,bytecode:n}=t;if(!r||r.length===0)return n;const i=e.find(a=>"type"in a&&a.type==="constructor");if(!i)throw new UBe({docsPath:hL});if(!("inputs"in i))throw new Tse({docsPath:hL});if(!i.inputs||i.inputs.length===0)throw new Tse({docsPath:hL});const s=Y2e(i.inputs,r);return Vh([n,s])}function Qo(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}class c_ extends kt{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 Client."].join(` -`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class pL extends kt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function TUe(t){const e=V6(`0x${t.substring(4)}`).substring(26);return f_(`0x${e}`)}const IUe="modulepreload",RUe=function(t){return"/"+t},Nse={},Ya=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(r.map(f=>{if(f=RUe(f),f in Nse)return;Nse[f]=!0;const c=f.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${d}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":IUe,c||(p.as="script"),p.crossOrigin="",p.href=f,o&&p.setAttribute("nonce",o),document.head.appendChild(p),c)return new Promise((g,x)=>{p.addEventListener("load",g),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};async function MUe({hash:t,signature:e}){const r=yh(t)?t:Er(t),{secp256k1:n}=await Ya(async()=>{const{secp256k1:a}=await import("./secp256k1-z3WGfxvh.js");return{secp256k1:a}},[]);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:c,s:d,v:p,yParity:g}=e,x=Number(g??p),S=Ose(x);return new n.Signature(hu(c),hu(d)).addRecoveryBit(S)}const a=yh(e)?e:Er(e),o=H6(`0x${a.slice(130)}`),f=Ose(o);return n.Signature.fromCompact(a.substring(2,130)).addRecoveryBit(f)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ose(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function kUe({hash:t,signature:e}){return TUe(await MUe({hash:t,signature:e}))}class Dse extends kt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PUe extends kt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class NUe extends kt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const OUe={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new NUe({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new PUe({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Dse({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Dse({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function JG(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(OUe);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function W6(t,e="hex"){const r=J2e(t),n=JG(new Uint8Array(r.length));return r.encode(n),e==="hex"?Z0(n.bytes):n.bytes}function J2e(t){return Array.isArray(t)?DUe(t.map(e=>J2e(e))):$Ue(t)}function DUe(t){const e=t.reduce((i,s)=>i+s.length,0),r=X2e(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function $Ue(t){const e=typeof t=="string"?p1(t):t,r=X2e(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function X2e(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new kt("Length is too large.")}function BUe(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=V6(Vh(["0x05",W6([Tr(e),r,n?Tr(n):"0x"])]));return i==="bytes"?p1(s):s}async function eme(t){const{authorization:e,signature:r}=t;return kUe({hash:BUe(e),signature:r??e})}class aq extends kt{constructor({blockNumber:e,chain:r,contract:n}){super(`Chain "${r.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...e&&n.blockCreated&&n.blockCreated>e?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${n.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class UUe extends kt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class LUe extends kt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` +`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class pL extends kt{constructor({docsPath:e,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:e,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function TUe(t){const e=V6(`0x${t.substring(4)}`).substring(26);return f_(`0x${e}`)}const IUe="modulepreload",RUe=function(t){return"/dacademy-eas-test/"+t},Nse={},Ya=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(r.map(f=>{if(f=RUe(f),f in Nse)return;Nse[f]=!0;const c=f.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${d}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":IUe,c||(p.as="script"),p.crossOrigin="",p.href=f,o&&p.setAttribute("nonce",o),document.head.appendChild(p),c)return new Promise((g,x)=>{p.addEventListener("load",g),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};async function MUe({hash:t,signature:e}){const r=yh(t)?t:Er(t),{secp256k1:n}=await Ya(async()=>{const{secp256k1:a}=await import("./secp256k1-Db0UiqTi.js");return{secp256k1:a}},[]);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:c,s:d,v:p,yParity:g}=e,x=Number(g??p),S=Ose(x);return new n.Signature(hu(c),hu(d)).addRecoveryBit(S)}const a=yh(e)?e:Er(e),o=H6(`0x${a.slice(130)}`),f=Ose(o);return n.Signature.fromCompact(a.substring(2,130)).addRecoveryBit(f)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Ose(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function kUe({hash:t,signature:e}){return TUe(await MUe({hash:t,signature:e}))}class Dse extends kt{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PUe extends kt{constructor({length:e,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class NUe extends kt{constructor({count:e,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const OUe={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new NUe({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new PUe({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Dse({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Dse({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const r=e??this.position;return this.assertPosition(r+t-1),this.bytes.subarray(r,r+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const r=this.inspectBytes(t);return this.position+=e??t,r},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function JG(t,{recursiveReadLimit:e=8192}={}){const r=Object.create(OUe);return r.bytes=t,r.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=e,r}function W6(t,e="hex"){const r=J2e(t),n=JG(new Uint8Array(r.length));return r.encode(n),e==="hex"?Z0(n.bytes):n.bytes}function J2e(t){return Array.isArray(t)?DUe(t.map(e=>J2e(e))):$Ue(t)}function DUe(t){const e=t.reduce((i,s)=>i+s.length,0),r=X2e(e);return{length:e<=55?1+e:1+r+e,encode(i){e<=55?i.pushByte(192+e):(i.pushByte(247+r),r===1?i.pushUint8(e):r===2?i.pushUint16(e):r===3?i.pushUint24(e):i.pushUint32(e));for(const{encode:s}of t)s(i)}}}function $Ue(t){const e=typeof t=="string"?p1(t):t,r=X2e(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+r+e.length,encode(i){e.length===1&&e[0]<128?i.pushBytes(e):e.length<=55?(i.pushByte(128+e.length),i.pushBytes(e)):(i.pushByte(183+r),r===1?i.pushUint8(e.length):r===2?i.pushUint16(e.length):r===3?i.pushUint24(e.length):i.pushUint32(e.length),i.pushBytes(e))}}}function X2e(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new kt("Length is too large.")}function BUe(t){const{chainId:e,contractAddress:r,nonce:n,to:i}=t,s=V6(Vh(["0x05",W6([Tr(e),r,n?Tr(n):"0x"])]));return i==="bytes"?p1(s):s}async function eme(t){const{authorization:e,signature:r}=t;return kUe({hash:BUe(e),signature:r??e})}class aq extends kt{constructor({blockNumber:e,chain:r,contract:n}){super(`Chain "${r.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...e&&n.blockCreated&&n.blockCreated>e?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${n.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class UUe extends kt{constructor({chain:e,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class LUe extends kt{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` `),{name:"ChainNotFoundError"})}}class tme extends kt{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class Tk extends kt{constructor({chainId:e}){super(typeof e=="number"?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}function rme({chain:t,currentChainId:e}){if(!t)throw new LUe;if(e!==t.id)throw new UUe({chain:t,currentChainId:e})}const FUe={gwei:9,wei:18},jUe={ether:-9,wei:9},zUe={ether:-18,gwei:-9};function u_(t,e){let r=t.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(e,"0");let[i,s]=[r.slice(0,r.length-e),r.slice(r.length-e)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}function Ja(t,e="wei"){return u_(t,jUe[e])}class Jb extends kt{constructor({cause:e,message:r}={}){var i;const n=(i=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Jb,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Jb,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Pm extends kt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${Ja(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Pm,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class oq extends kt{constructor({cause:e,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${Ja(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(oq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class fq extends kt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(fq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class cq extends kt{constructor({cause:e,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(cq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class uq extends kt{constructor({cause:e,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(uq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class lq extends kt{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(lq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class dq extends kt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(dq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class hq extends kt{constructor({cause:e,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(hq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class pq extends kt{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(pq,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class W7 extends kt{constructor({cause:e,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${Ja(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${Ja(n)} gwei`:""}).`].join(` @@ -96,8 +96,8 @@ if (cid) { `).slice(0,-1)}function Fse(t){if(!(!t||t.length===0))return t.reduce((e,{slot:r,value:n})=>{if(r.length!==66)throw new Cse({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new Cse({size:n.length,targetSize:66,type:"hex"});return e[r]=n,e},{})}function lLe(t){const{balance:e,nonce:r,state:n,stateDiff:i,code:s}=t,a={};if(s!==void 0&&(a.code=s),e!==void 0&&(a.balance=Tr(e)),r!==void 0&&(a.nonce=Tr(r)),n!==void 0&&(a.state=Fse(n)),i!==void 0){if(a.state)throw new cLe;a.stateDiff=Fse(i)}return a}function ume(t){if(!t)return;const e={};for(const{address:r,...n}of t){if(!js(r,{strict:!1}))throw new Lo({address:r});if(e[r])throw new fLe({address:r});e[r]=lLe(n)}return e}async function lme(t,{address:e,blockNumber:r,blockTag:n="latest"}){const i=r?Tr(r):void 0,s=await t.request({method:"eth_getBalance",params:[e,i||n]});return BigInt(s)}async function sK(t,e){var i,s,a;const r=e.account??t.account,n=r?Qo(r):void 0;try{let l=function(w){const{block:_,request:E,rpcStateOverride:T}=w;return t.request({method:"eth_estimateGas",params:T?[E,_??"latest",T]:_?[E,_]:[E]})};const{accessList:o,authorizationList:f,blobs:c,blobVersionedHashes:d,blockNumber:p,blockTag:g,data:x,gas:S,gasPrice:I,maxFeePerBlobGas:R,maxFeePerGas:O,maxPriorityFeePerGas:M,nonce:U,value:D,stateOverride:B,...F}=await Nk(t,{...e,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),N=(p?Tr(p):void 0)||g,W=ume(B),Y=await(async()=>{if(F.to)return F.to;if(f&&f.length>0)return await eme({authorization:f[0]}).catch(()=>{throw new kt("`to` is required. Could not infer from `authorizationList`")})})();d_(e);const z=(a=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionRequest)==null?void 0:a.format,u=(z||Rk)({...rK(F,{format:z}),from:n==null?void 0:n.address,accessList:o,authorizationList:f,blobs:c,blobVersionedHashes:d,data:x,gas:S,gasPrice:I,maxFeePerBlobGas:R,maxFeePerGas:O,maxPriorityFeePerGas:M,nonce:U,to:Y,value:D});let h=BigInt(await l({block:N,request:u,rpcStateOverride:W}));if(f){const w=await lme(t,{address:u.from}),_=await Promise.all(f.map(async E=>{const{contractAddress:T}=E,v=await l({block:N,request:{authorizationList:void 0,data:x,from:n==null?void 0:n.address,to:T,value:Tr(w)},rpcStateOverride:W}).catch(()=>100000n);return 2n*BigInt(v)}));h+=_.reduce((E,T)=>E+T,0n)}return h}catch(o){throw oLe(o,{...e,account:n,chain:t.chain})}}async function dLe(t,{address:e,blockTag:r="latest",blockNumber:n}){const i=await t.request({method:"eth_getTransactionCount",params:[e,n?Tr(n):r]},{dedupe:!!n});return H6(i)}function aK(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(s=>p1(s)):t.blobs,i=[];for(const s of n)i.push(Uint8Array.from(e.blobToKzgCommitment(s)));return r==="bytes"?i:i.map(s=>Z0(s))}function oK(t){const{kzg:e}=t,r=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(a=>p1(a)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(a=>p1(a)):t.commitments,s=[];for(let a=0;aZ0(a))}function hLe(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),a=Number(r>>i&s),o=Number(r&s),f=n?4:0,c=n?0:4;t.setUint32(e+f,a,n),t.setUint32(e+c,o,n)}const pLe=(t,e,r)=>t&e^~t&r,mLe=(t,e,r)=>t&e^t&r^e&r;class gLe extends q2e{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=uL(this.buffer)}update(e){DI(this);const{view:r,buffer:n,blockLen:i}=this;e=WG(e);const s=e.length;for(let a=0;ai-a&&(this.process(n,0),a=0);for(let p=a;pd.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p>>3,I=rl(x,17)^rl(x,19)^x>>>10;mp[p]=I+mp[p-7]+S+mp[p-16]|0}let{A:n,B:i,C:s,D:a,E:o,F:f,G:c,H:d}=this;for(let p=0;p<64;p++){const g=rl(o,6)^rl(o,11)^rl(o,25),x=d+g+pLe(o,f,c)+bLe[p]+mp[p]|0,I=(rl(n,2)^rl(n,13)^rl(n,22))+mLe(n,i,s)|0;d=c,c=f,f=o,o=a+x|0,a=s,s=i,i=n,n=x+I|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,a=a+this.D|0,o=o+this.E|0,f=f+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(n,i,s,a,o,f,c,d)}roundClean(){mp.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const wLe=H2e(()=>new yLe);function vLe(t,e){return wLe(yh(t,{strict:!1})?_k(t):t)}function xLe(t){const{commitment:e,version:r=1}=t,n=t.to??(typeof e=="string"?"hex":"bytes"),i=vLe(e);return i.set([r],0),n==="bytes"?i:Z0(i)}function dme(t){const{commitments:e,version:r}=t,n=t.to??(typeof e[0]=="string"?"hex":"bytes"),i=[];for(const s of e)i.push(xLe({commitment:s,to:n,version:r}));return i}const jse=6,hme=32,fK=4096,pme=hme*fK,zse=pme*jse-1-1*fK*jse,mme=1;class ALe extends kt{constructor({maxSize:e,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}}class gme extends kt{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class _Le extends kt{constructor({hash:e,size:r}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${r}`],name:"InvalidVersionedHashSizeError"})}}class ELe extends kt{constructor({hash:e,version:r}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${mme}`,`Received: ${r}`],name:"InvalidVersionedHashVersionError"})}}function CLe(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),r=typeof t.data=="string"?p1(t.data):t.data,n=f0(r);if(!n)throw new gme;if(n>zse)throw new ALe({maxSize:zse,size:n});const i=[];let s=!0,a=0;for(;s;){const o=JG(new Uint8Array(pme));let f=0;for(;fo.bytes):i.map(o=>Z0(o.bytes))}function bme(t){const{data:e,kzg:r,to:n}=t,i=t.blobs??CLe({data:e,to:n}),s=t.commitments??aK({blobs:i,kzg:r,to:n}),a=t.proofs??oK({blobs:i,commitments:s,kzg:r,to:n}),o=[];for(let f=0;f"u"&&p)if(f){const O=await R();g.nonce=await f.consume({address:p.address,chainId:O,client:t})}else g.nonce=await Qn(t,dLe,"getTransactionCount")({address:p.address,blockTag:"pending"});if((c.includes("fees")||c.includes("type"))&&typeof d>"u")try{g.type=yme(g)}catch{const O=await S();g.type=typeof(O==null?void 0:O.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(c.includes("fees"))if(g.type!=="legacy"&&g.type!=="eip2930"){if(typeof g.maxFeePerGas>"u"||typeof g.maxPriorityFeePerGas>"u"){const O=await S(),{maxFeePerGas:M,maxPriorityFeePerGas:U}=await Use(t,{block:O,chain:i,request:g});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(g.gas=await Qn(t,sK,"estimateGas")({...g,account:p?{address:p.address,type:"json-rpc"}:void 0})),d_(g),delete g.parameters,g}async function vme(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}async function Ok(t,e){var O,M,U,D;const{account:r=t.account,chain:n=t.chain,accessList:i,authorizationList:s,blobs:a,data:o,gas:f,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:g,nonce:x,value:S,...I}=e;if(!r)throw new c_({docsPath:"/docs/actions/wallet/sendTransaction"});const R=Qo(r);try{d_(e);const B=await(async()=>{if(e.to)return e.to;if(s&&s.length>0)return await eme({authorization:s[0]}).catch(()=>{throw new kt("`to` is required. Could not infer from `authorizationList`.")})})();if(R.type==="json-rpc"){let F;n!==null&&(F=await Qn(t,kk,"getChainId")({}),rme({currentChainId:F,chain:n}));const k=(U=(M=(O=t.chain)==null?void 0:O.formatters)==null?void 0:M.transactionRequest)==null?void 0:U.format,W=(k||Rk)({...rK(I,{format:k}),accessList:i,authorizationList:s,blobs:a,chainId:F,data:o,from:R.address,gas:f,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:g,nonce:x,to:B,value:S});return await t.request({method:"eth_sendTransaction",params:[W]},{retryCount:0})}if(R.type==="local"){const F=await Qn(t,Nk,"prepareTransactionRequest")({account:R,accessList:i,authorizationList:s,blobs:a,chain:n,data:o,gas:f,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:p,maxPriorityFeePerGas:g,nonce:x,nonceManager:R.nonceManager,parameters:[...wme,"sidecars"],value:S,...I,to:B}),k=(D=n==null?void 0:n.serializers)==null?void 0:D.transaction,N=await R.signTransaction(F,{serializer:k});return await Qn(t,vme,"sendRawTransaction")({serializedTransaction:N})}throw R.type==="smart"?new pL({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new pL({docsPath:"/docs/actions/wallet/sendTransaction",type:R.type})}catch(B){throw B instanceof pL?B:YUe(B,{...e,account:R,chain:e.chain||void 0})}}function SLe(t,e){const{abi:r,args:n,bytecode:i,...s}=e,a=YG({abi:r,args:n,bytecode:i});return Ok(t,{...s,data:a})}const mq=[{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"}],xme=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],Ame=[...xme,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],TLe=[...xme,{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"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],qse=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Hse=[{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"}]}];function ILe(t,e={}){typeof e.size<"u"&&zu(t,{size:e.size});const r=Z0(t,e);return hu(r,e)}function RLe(t,e={}){let r=t;if(typeof e.size<"u"&&(zu(r,{size:e.size}),r=h1(r)),r.length>1||r[0]>1)throw new IBe(r);return!!r[0]}function oh(t,e={}){typeof e.size<"u"&&zu(t,{size:e.size});const r=Z0(t,e);return H6(r,e)}function MLe(t,e={}){let r=t;return typeof e.size<"u"&&(zu(r,{size:e.size}),r=h1(r,{dir:"right"})),new TextDecoder().decode(r)}function _me(t,e){const r=typeof e=="string"?p1(e):e,n=JG(r);if(f0(r)===0&&t.length>0)throw new Ck;if(f0(e)&&f0(e)<32)throw new LBe({data:typeof e=="string"?e:Z0(e),params:t,size:f0(e)});let i=0;const s=[];for(let a=0;a48?ILe(i,{signed:r}):oh(i,{signed:r}),32]}function $Le(t,e,{staticPosition:r}){const n=e.components.length===0||e.components.some(({name:a})=>!a),i=n?[]:{};let s=0;if(ax(e)){const a=oh(t.readBytes(gq)),o=r+a;for(let f=0;fV6(_k(t));function LLe(t){return ULe(t)}const FLe="1.0.5";let mc=class bq extends Error{constructor(e,r={}){var a;const n=r.cause instanceof bq?r.cause.details:(a=r.cause)!=null&&a.message?r.cause.message:r.details,i=r.cause instanceof bq&&r.cause.docsPath||r.docsPath,s=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${FLe}`].join(` `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=e}};function u5(t,e){const r=t.exec(e);return r==null?void 0:r.groups}const Eme=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Cme=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Sme=/^\(.+?\).*?$/,Wse=/^tuple(?(\[(\d*)\])*)$/;function yq(t){let e=t.type;if(Wse.test(t.type)&&"components"in t){e="(";const r=t.components.length;for(let i=0;i[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function zLe(t){return Tme.test(t)}function qLe(t){return u5(Tme,t)}const Ime=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function HLe(t){return Ime.test(t)}function VLe(t){return u5(Ime,t)}const Rme=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function WLe(t){return Rme.test(t)}function GLe(t){return u5(Rme,t)}const Mme=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function kme(t){return Mme.test(t)}function KLe(t){return u5(Mme,t)}const Pme=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function QLe(t){return Pme.test(t)}function ZLe(t){return u5(Pme,t)}const YLe=/^fallback\(\) external(?:\s(?payable{1}))?$/;function JLe(t){return YLe.test(t)}const XLe=/^receive\(\) external payable$/;function eFe(t){return XLe.test(t)}const tFe=new Set(["indexed"]),wq=new Set(["calldata","memory","storage"]);class rFe extends mc{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class nFe extends mc{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class iFe extends mc{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class sFe extends mc{constructor({param:e,name:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${r}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class aFe extends mc{constructor({param:e,type:r,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class oFe extends mc{constructor({param:e,type:r,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class fFe extends mc{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class x9 extends mc{constructor({signature:e,type:r}){super(`Invalid ${r} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class cFe extends mc{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class uFe extends mc{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class lFe extends mc{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class dFe extends mc{constructor({current:e,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function hFe(t,e){return e?`${e}:${t}`:t}const mL=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function pFe(t,e={}){if(WLe(t)){const r=GLe(t);if(!r)throw new x9({signature:t,type:"function"});const n=pu(r.parameters),i=[],s=n.length;for(let o=0;o[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,gFe=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,bFe=/^u?int$/;function f2(t,e){var p,g;const r=hFe(t,e==null?void 0:e.type);if(mL.has(r))return mL.get(r);const n=Sme.test(t),i=u5(n?gFe:mFe,t);if(!i)throw new iFe({param:t});if(i.name&&wFe(i.name))throw new sFe({param:t,name:i.name});const s=i.name?{name:i.name}:{},a=i.modifier==="indexed"?{indexed:!0}:{},o=(e==null?void 0:e.structs)??{};let f,c={};if(n){f="tuple";const x=pu(i.type),S=[],I=x.length;for(let R=0;R[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function Ome(t,e,r=new Set){const n=[],i=t.length;for(let s=0;s{const e=typeof t=="string"?t:jLe(t);return _Fe(e)};function $me(t){return LLe(EFe(t))}const CFe=$me,cK=t=>V7($me(t),0,4);function uK(t){const{abi:e,args:r=[],name:n}=t,i=yh(n,{strict:!1}),s=e.filter(o=>i?o.type==="function"?cK(o)===n:o.type==="event"?CFe(o)===n:!1:"name"in o&&o.name===n);if(s.length===0)return;if(s.length===1)return s[0];let a;for(const o of s){if(!("inputs"in o))continue;if(!r||r.length===0){if(!o.inputs||o.inputs.length===0)return o;continue}if(!o.inputs||o.inputs.length===0||o.inputs.length!==r.length)continue;if(r.every((c,d)=>{const p="inputs"in o&&o.inputs[d];return p?vq(c,p):!1})){if(a&&"inputs"in a&&a.inputs){const c=Bme(o.inputs,a.inputs,r);if(c)throw new HBe({abiItem:o,type:c[0]},{abiItem:a,type:c[1]})}a=o}}return a||s[0]}function vq(t,e){const r=typeof t,n=e.type;switch(n){case"address":return js(t,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in e?Object.values(e.components).every((i,s)=>vq(Object.values(t)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(t)&&t.every(i=>vq(i,{...e,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Bme(t,e,r){for(const n in t){const i=t[n],s=e[n];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Bme(i.components,s.components,r[n]);const a=[i.type,s.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")?js(r[n],{strict:!1}):a.includes("address")&&a.includes("bytes")?js(r[n],{strict:!1}):!1)return a}}const gL="/docs/contract/decodeFunctionResult";function xw(t){const{abi:e,args:r,functionName:n,data:i}=t;let s=e[0];if(n){const o=uK({abi:e,args:r,name:n});if(!o)throw new NI(n,{docsPath:gL});s=o}if(s.type!=="function")throw new NI(void 0,{docsPath:gL});if(!s.outputs)throw new qBe(s.name,{docsPath:gL});const a=_me(s.outputs,i);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}const Gse="/docs/contract/encodeFunctionData";function SFe(t){const{abi:e,args:r,functionName:n}=t;let i=e[0];if(n){const s=uK({abi:e,args:r,name:n});if(!s)throw new NI(n,{docsPath:Gse});i=s}if(i.type!=="function")throw new NI(void 0,{docsPath:Gse});return{abi:[i],functionName:cK(dy(i))}}function vg(t){const{args:e}=t,{abi:r,functionName:n}=(()=>{var o;return t.abi.length===1&&((o=t.functionName)!=null&&o.startsWith("0x"))?t:SFe(t)})(),i=r[0],s=n,a="inputs"in i&&i.inputs?Y2e(i.inputs,e??[]):void 0;return Vh([s,a??"0x"])}function h_({blockNumber:t,chain:e,contract:r}){var i;const n=(i=e==null?void 0:e.contracts)==null?void 0:i[r];if(!n)throw new aq({chain:e,contract:{name:r}});if(t&&n.blockCreated&&n.blockCreated>t)throw new aq({blockNumber:t,chain:e,contract:{name:r,blockCreated:n.blockCreated}});return n.address}const Ume={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},TFe={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},IFe={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function RFe(t){const{abi:e,data:r}=t,n=V7(r,0,4);if(n==="0x")throw new Ck;const s=[...e||[],TFe,IFe].find(a=>a.type==="error"&&n===cK(dy(a)));if(!s)throw new j2e(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?_me(s.inputs,V7(r,4)):void 0,errorName:s.name}}function Lme({abiItem:t,args:e,includeFunctionName:r=!0,includeName:n=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${r?t.name:""}(${t.inputs.map((i,s)=>`${n&&i.name?`${i.name}: `:""}${typeof e[s]=="object"?sc(e[s]):e[s]}`).join(", ")})`}class MFe extends kt{constructor(e,{account:r,docsPath:n,chain:i,data:s,gas:a,gasPrice:o,maxFeePerGas:f,maxPriorityFeePerGas:c,nonce:d,to:p,value:g,stateOverride:x}){var R;const S=r?Qo(r):void 0;let I=l_({from:S==null?void 0:S.address,to:p,value:typeof g<"u"&&`${XG(g)} ${((R=i==null?void 0:i.nativeCurrency)==null?void 0:R.symbol)||"ETH"}`,data:s,gas:a,gasPrice:typeof o<"u"&&`${Ja(o)} gwei`,maxFeePerGas:typeof f<"u"&&`${Ja(f)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Ja(c)} gwei`,nonce:d});x&&(I+=` ${uLe(x)}`),super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",I].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class lK extends kt{constructor(e,{abi:r,args:n,contractAddress:i,docsPath:s,functionName:a,sender:o}){const f=uK({abi:r,args:n,name:a}),c=f?Lme({abiItem:f,args:n,includeFunctionName:!1,includeName:!1}):void 0,d=f?dy(f,{includeName:!0}):void 0,p=l_({address:i&&KUe(i),function:d,args:c&&c!=="()"&&`${[...Array((a==null?void 0:a.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:o});super(e.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:e,docsPath:s,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=e,this.contractAddress=i,this.functionName=a,this.sender=o}}class xq extends kt{constructor({abi:e,data:r,functionName:n,message:i}){let s,a,o,f;if(r&&r!=="0x")try{a=RFe({abi:e,data:r});const{abiItem:d,errorName:p,args:g}=a;if(p==="Error")f=g[0];else if(p==="Panic"){const[x]=g;f=Ume[x]}else{const x=d?dy(d,{includeName:!0}):void 0,S=d&&g?Lme({abiItem:d,args:g,includeFunctionName:!1,includeName:!1}):void 0;o=[x?`Error: ${x}`:"",S&&S!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${S}`:""]}}catch(d){s=d}else i&&(f=i);let c;s instanceof j2e&&(c=s.signature,o=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(f&&f!=="execution reverted"||c?[`The contract function "${n}" reverted with the following ${c?"signature":"reason"}:`,f||c].join(` -`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:o,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.reason=f,this.signature=c}}class kFe extends kt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class PFe extends kt{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class dK extends kt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}function hK(t,e){var n,i,s,a,o,f;if(!(t instanceof kt))return!1;const r=t.walk(c=>c instanceof xq);return r instanceof xq?!!(((n=r.data)==null?void 0:n.errorName)==="ResolverNotFound"||((i=r.data)==null?void 0:i.errorName)==="ResolverWildcardNotSupported"||((s=r.data)==null?void 0:s.errorName)==="ResolverNotContract"||((a=r.data)==null?void 0:a.errorName)==="ResolverError"||((o=r.data)==null?void 0:o.errorName)==="HttpError"||(f=r.reason)!=null&&f.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&r.reason===Ume[50]):!1}function Fme(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return yh(e)?e:null}function dT(t){let e=new Uint8Array(32).fill(0);if(!t)return Z0(e);const r=t.split(".");for(let n=r.length-1;n>=0;n-=1){const i=Fme(r[n]),s=i?_k(i):V6(fm(r[n]),"bytes");e=V6(km([e,s]),"bytes")}return Z0(e)}function NFe(t){return`[${t.slice(2)}]`}function OFe(t){const e=new Uint8Array(32).fill(0);return t?Fme(t)||V6(fm(t)):Z0(e)}function pK(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const r=new Uint8Array(fm(e).byteLength+2);let n=0;const i=e.split(".");for(let s=0;s255&&(a=fm(NFe(OFe(i[s])))),r[n]=a.length,r.set(a,n+1),n+=a.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}const DFe=3;function ox(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:a}){const{code:o,data:f,message:c,shortMessage:d}=t instanceof dK?t:t instanceof kt?t.walk(g=>"data"in g)||t.walk():{},p=t instanceof Ck?new kFe({functionName:s}):[DFe,Nm.code].includes(o)&&(f||c||d)?new xq({abi:e,data:typeof f=="object"?f.data:f,functionName:s,message:d??c}):t;return new lK(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:a})}const $Fe="0x82ad56cb",BFe="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",UFe="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function LFe(t,{docsPath:e,...r}){const n=(()=>{const i=tK(t,r);return i instanceof Ik?t:i})();return new MFe(n,{docsPath:e,...r})}const bL=new Map;function jme({fn:t,id:e,shouldSplitBatch:r,wait:n=0,sort:i}){const s=async()=>{const d=f();a();const p=d.map(({args:g})=>g);p.length!==0&&t(p).then(g=>{var x;i&&Array.isArray(g)&&g.sort(i);for(let S=0;S{var x;for(let S=0;SbL.delete(e),o=()=>f().map(({args:d})=>d),f=()=>bL.get(e)||[],c=d=>bL.set(e,[...f(),d]);return{flush:a,async schedule(d){const p={},g=new Promise((I,R)=>{p.resolve=I,p.reject=R});return(r==null?void 0:r([...o(),d]))&&s(),f().length>0?(c({args:d,pendingPromise:p}),g):(c({args:d,pendingPromise:p}),setTimeout(s,n),g)}}}async function mK(t,e){var z,P,u,l;const{account:r=t.account,batch:n=!!((z=t.batch)!=null&&z.multicall),blockNumber:i,blockTag:s="latest",accessList:a,blobs:o,code:f,data:c,factory:d,factoryData:p,gas:g,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:I,maxPriorityFeePerGas:R,nonce:O,to:M,value:U,stateOverride:D,...B}=e,F=r?Qo(r):void 0;if(f&&(d||p))throw new kt("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(f&&M)throw new kt("Cannot provide both `code` & `to` as parameters.");const k=f&&c,N=d&&p&&M&&c,W=k||N,Y=k?zFe({code:f,data:c}):N?qFe({data:c,factory:d,factoryData:p,to:M}):c;try{d_(e);const w=(i?Tr(i):void 0)||s,_=ume(D),E=(l=(u=(P=t.chain)==null?void 0:P.formatters)==null?void 0:u.transactionRequest)==null?void 0:l.format,v=(E||Rk)({...rK(B,{format:E}),from:F==null?void 0:F.address,accessList:a,blobs:o,data:Y,gas:g,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:I,maxPriorityFeePerGas:R,nonce:O,to:W?void 0:M,value:U});if(n&&FFe({request:v})&&!_)try{return await jFe(t,{...v,blockNumber:i,blockTag:s})}catch(A){if(!(A instanceof tme)&&!(A instanceof aq))throw A}const m=await t.request({method:"eth_call",params:_?[v,w,_]:[v,w]});return m==="0x"?{data:void 0}:{data:m}}catch(h){const w=HFe(h),{offchainLookup:_,offchainLookupSignature:E}=await Ya(async()=>{const{offchainLookup:T,offchainLookupSignature:v}=await import("./ccip-B6ULGj8w.js");return{offchainLookup:T,offchainLookupSignature:v}},[]);if(t.ccipRead!==!1&&(w==null?void 0:w.slice(0,10))===E&&M)return{data:await _(t,{data:w,to:M})};throw W&&(w==null?void 0:w.slice(0,10))==="0x101bb98d"?new PFe({factory:d}):LFe(h,{...e,account:F,chain:t.chain})}}function FFe({request:t}){const{data:e,to:r,...n}=t;return!(!e||e.startsWith($Fe)||!r||Object.values(n).filter(i=>typeof i<"u").length>0)}async function jFe(t,e){var I;const{batchSize:r=1024,wait:n=0}=typeof((I=t.batch)==null?void 0:I.multicall)=="object"?t.batch.multicall:{},{blockNumber:i,blockTag:s="latest",data:a,multicallAddress:o,to:f}=e;let c=o;if(!c){if(!t.chain)throw new tme;c=h_({blockNumber:i,chain:t.chain,contract:"multicall3"})}const p=(i?Tr(i):void 0)||s,{schedule:g}=jme({id:`${t.uid}.${p}`,wait:n,shouldSplitBatch(R){return R.reduce((M,{data:U})=>M+(U.length-2),0)>r*2},fn:async R=>{const O=R.map(D=>({allowFailure:!0,callData:D.data,target:D.to})),M=vg({abi:mq,args:[O],functionName:"aggregate3"}),U=await t.request({method:"eth_call",params:[{data:M,to:c},p]});return xw({abi:mq,args:[O],functionName:"aggregate3",data:U||"0x"})}}),[{returnData:x,success:S}]=await g({data:a,to:f});if(!S)throw new dK({data:x});return x==="0x"?{data:void 0}:{data:x}}function zFe(t){const{code:e,data:r}=t;return YG({abi:Dme(["constructor(bytes, bytes)"]),bytecode:BFe,args:[e,r]})}function qFe(t){const{data:e,factory:r,factoryData:n,to:i}=t;return YG({abi:Dme(["constructor(address, bytes, address, bytes)"]),bytecode:UFe,args:[i,e,r,n]})}function HFe(t){var r;if(!(t instanceof kt))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(r=e.data)==null?void 0:r.data:e.data}async function Om(t,e){const{abi:r,address:n,args:i,functionName:s,...a}=e,o=vg({abi:r,args:i,functionName:s});try{const{data:f}=await Qn(t,mK,"call")({...a,data:o,to:n});return xw({abi:r,args:i,functionName:s,data:f||"0x"})}catch(f){throw ox(f,{abi:r,address:n,args:i,docsPath:"/docs/contract/readContract",functionName:s})}}async function VFe(t,{blockNumber:e,blockTag:r,coinType:n,name:i,gatewayUrls:s,strict:a,universalResolverAddress:o}){let f=o;if(!f){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");f=h_({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const c=vg({abi:Hse,functionName:"addr",...n!=null?{args:[dT(i),BigInt(n)]}:{args:[dT(i)]}}),d={address:f,abi:Ame,functionName:"resolve",args:[Er(pK(i)),c],blockNumber:e,blockTag:r},p=Qn(t,Om,"readContract"),g=s?await p({...d,args:[...d.args,s]}):await p(d);if(g[0]==="0x")return null;const x=xw({abi:Hse,args:n!=null?[dT(i),BigInt(n)]:void 0,functionName:"addr",data:g[0]});return x==="0x"||h1(x)==="0x00"?null:x}catch(c){if(a)throw c;if(hK(c,"resolve"))return null;throw c}}class WFe extends kt{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)}`],name:"EnsAvatarInvalidMetadataError"})}}class kv extends kt{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class gK extends kt{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.`,{name:"EnsAvatarUriResolutionError"})}}class GFe extends kt{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const KFe=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,QFe=/^(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\-.]+))?(?\/.*)?$/,ZFe=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,YFe=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function JFe(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 Kse(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function zme({uri:t,gatewayUrls:e}){const r=ZFe.test(t);if(r)return{uri:t,isOnChain:!0,isEncoded:r};const n=Kse(e==null?void 0:e.ipfs,"https://ipfs.io"),i=Kse(e==null?void 0:e.arweave,"https://arweave.net"),s=t.match(KFe),{protocol:a,subpath:o,target:f,subtarget:c=""}=(s==null?void 0:s.groups)||{},d=a==="ipns:/"||o==="ipns/",p=a==="ipfs:/"||o==="ipfs/"||QFe.test(t);if(t.startsWith("http")&&!d&&!p){let x=t;return e!=null&&e.arweave&&(x=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:x,isOnChain:!1,isEncoded:!1}}if((d||p)&&f)return{uri:`${n}/${d?"ipns":"ipfs"}/${f}${c}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&f)return{uri:`${i}/${f}${c||""}`,isOnChain:!1,isEncoded:!1};let g=t.replace(YFe,"");if(g.startsWith("i.json());return await bK({gatewayUrls:t,uri:qme(r)})}catch{throw new gK({uri:e})}}async function bK({gatewayUrls:t,uri:e}){const{uri:r,isOnChain:n}=zme({uri:e,gatewayUrls:t});if(n||await JFe(r))return r;throw new gK({uri:e})}function eje(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=e.split("/"),[s,a]=r.split(":"),[o,f]=n.split(":");if(!s||s.toLowerCase()!=="eip155")throw new kv({reason:"Only EIP-155 supported"});if(!a)throw new kv({reason:"Chain ID not found"});if(!f)throw new kv({reason:"Contract address not found"});if(!i)throw new kv({reason:"Token ID not found"});if(!o)throw new kv({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a),namespace:o.toLowerCase(),contractAddress:f,tokenID:i}}async function tje(t,{nft:e}){if(e.namespace==="erc721")return Om(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 Om(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 GFe({namespace:e.namespace})}async function rje(t,{gatewayUrls:e,record:r}){return/eip155:/i.test(r)?nje(t,{gatewayUrls:e,record:r}):bK({uri:r,gatewayUrls:e})}async function nje(t,{gatewayUrls:e,record:r}){const n=eje(r),i=await tje(t,{nft:n}),{uri:s,isOnChain:a,isEncoded:o}=zme({uri:i,gatewayUrls:e});if(a&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=o?atob(s.replace("data:application/json;base64,","")):s,d=JSON.parse(c);return bK({uri:qme(d),gatewayUrls:e})}let f=n.tokenID;return n.namespace==="erc1155"&&(f=f.replace("0x","").padStart(64,"0")),XFe({gatewayUrls:e,uri:s.replace(/(?:0x)?{id}/,f)})}async function ije(t,{blockNumber:e,blockTag:r,name:n,key:i,gatewayUrls:s,strict:a,universalResolverAddress:o}){let f=o;if(!f){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");f=h_({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const c={address:f,abi:Ame,functionName:"resolve",args:[Er(pK(n)),vg({abi:qse,functionName:"text",args:[dT(n),i]})],blockNumber:e,blockTag:r},d=Qn(t,Om,"readContract"),p=s?await d({...c,args:[...c.args,s]}):await d(c);if(p[0]==="0x")return null;const g=xw({abi:qse,functionName:"text",data:p[0]});return g===""?null:g}catch(c){if(a)throw c;if(hK(c,"resolve"))return null;throw c}}async function sje(t,{blockNumber:e,blockTag:r,assetGatewayUrls:n,name:i,gatewayUrls:s,strict:a,universalResolverAddress:o}){const f=await Qn(t,ije,"getEnsText")({blockNumber:e,blockTag:r,key:"avatar",name:i,universalResolverAddress:o,gatewayUrls:s,strict:a});if(!f)return null;try{return await rje(t,{record:f,gatewayUrls:n})}catch{return null}}async function aje(t,{address:e,blockNumber:r,blockTag:n,gatewayUrls:i,strict:s,universalResolverAddress:a}){let o=a;if(!o){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=h_({blockNumber:r,chain:t.chain,contract:"ensUniversalResolver"})}const f=`${e.toLowerCase().substring(2)}.addr.reverse`;try{const c={address:o,abi:TLe,functionName:"reverse",args:[Er(pK(f))],blockNumber:r,blockTag:n},d=Qn(t,Om,"readContract"),[p,g]=i?await d({...c,args:[...c.args,i]}):await d(c);return e.toLowerCase()!==g.toLowerCase()?null:p}catch(c){if(s)throw c;if(hK(c,"reverse"))return null;throw c}}const oje=new Map,fje=new Map;function cje(t){const e=(i,s)=>({clear:()=>s.delete(i),get:()=>s.get(i),set:a=>s.set(i,a)}),r=e(t,oje),n=e(t,fje);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function uje(t,{cacheKey:e,cacheTime:r=Number.POSITIVE_INFINITY}){const n=cje(e),i=n.response.get();if(i&&r>0&&new Date().getTime()-i.created.getTime()`blockNumber.${t}`;async function dje(t,{cacheTime:e=t.cacheTime}={}){const r=await uje(()=>t.request({method:"eth_blockNumber"}),{cacheKey:lje(t.uid),cacheTime:e});return BigInt(r)}function hje(t,{args:e,eventName:r}={}){return{...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,logIndex:t.logIndex?Number(t.logIndex):null,transactionHash:t.transactionHash?t.transactionHash:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,...r?{args:e,eventName:r}:{}}}async function Hme(t,{blockHash:e,blockNumber:r,blockTag:n,hash:i,index:s}){var d,p,g;const a=n||"latest",o=r!==void 0?Tr(r):void 0;let f=null;if(i?f=await t.request({method:"eth_getTransactionByHash",params:[i]},{dedupe:!0}):e?f=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,Tr(s)]},{dedupe:!0}):(o||a)&&(f=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||a,Tr(s)]},{dedupe:!!o})),!f)throw new nme({blockHash:e,blockNumber:r,blockTag:a,hash:i,index:s});return(((g=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.transaction)==null?void 0:g.format)||Pk)(f)}const pje={"0x0":"reverted","0x1":"success"};function Vme(t){const e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs?t.logs.map(r=>hje(r)):null,to:t.to?t.to:null,transactionIndex:t.transactionIndex?H6(t.transactionIndex):null,status:t.status?pje[t.status]:null,type:t.type?ome[t.type]||t.type:null};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),e}const mje=nK("transactionReceipt",Vme);async function Qse(t,{hash:e}){var i,s,a;const r=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!r)throw new ime({hash:e});return(((a=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionReceipt)==null?void 0:a.format)||Vme)(r)}async function gje(t,e){var R;const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:s,multicallAddress:a,stateOverride:o}=e,f=e.contracts,c=n??(typeof((R=t.batch)==null?void 0:R.multicall)=="object"&&t.batch.multicall.batchSize||1024);let d=a;if(!d){if(!t.chain)throw new Error("client chain not configured. multicallAddress is required.");d=h_({blockNumber:i,chain:t.chain,contract:"multicall3"})}const p=[[]];let g=0,x=0;for(let O=0;O0&&x>c&&p[g].length>0&&(g++,x=(F.length-2)/2,p[g]=[]),p[g]=[...p[g],{allowFailure:!0,callData:F,target:U}]}catch(F){const k=ox(F,{abi:M,address:U,args:D,docsPath:"/docs/contract/multicall",functionName:B});if(!r)throw k;p[g]=[...p[g],{allowFailure:!0,callData:"0x",target:U}]}}const S=await Promise.allSettled(p.map(O=>Qn(t,Om,"readContract")({abi:mq,address:d,args:[O],blockNumber:i,blockTag:s,functionName:"aggregate3",stateOverride:o}))),I=[];for(let O=0;OyL.get(t)||[],s=()=>{const d=i();yL.set(t,d.filter(p=>p.id!==n))},a=()=>{const d=Zse.get(t);i().length===1&&d&&d(),s()},o=i();if(yL.set(t,[...o,{id:n,fns:e}]),o&&o.length>0)return a;const f={};for(const d in e)f[d]=(...p)=>{var x,S;const g=i();if(g.length!==0)for(const I of g)(S=(x=I.fns)[d])==null||S.call(x,...p)};const c=r(f);return typeof c=="function"&&Zse.set(t,c),a}async function $I(t){return new Promise(e=>setTimeout(e,t))}function yje(t,{emitOnBegin:e,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let o;e&&(o=await t({unpoll:s}));const f=await(r==null?void 0:r(o))??n;await $I(f);const c=async()=>{i&&(await t({unpoll:s}),await $I(n),c())};c()})(),s}function wje(t,{emitOnBegin:e=!1,emitMissed:r=!1,onBlockNumber:n,onError:i,poll:s,pollingInterval:a=t.pollingInterval}){const o=typeof s<"u"?s:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket");let f;return o?(()=>{const p=sc(["watchBlockNumber",t.uid,e,r,a]);return Aq(p,{onBlockNumber:n,onError:i},g=>yje(async()=>{var x;try{const S=await Qn(t,dje,"getBlockNumber")({cacheTime:0});if(f){if(S===f)return;if(S-f>1&&r)for(let I=f+1n;If)&&(g.onBlockNumber(S,f),f=S)}catch(S){(x=g.onError)==null||x.call(g,S)}},{emitOnBegin:e,interval:a}))})():(()=>{const p=sc(["watchBlockNumber",t.uid,e,r]);return Aq(p,{onBlockNumber:n,onError:i},g=>{let x=!0,S=()=>x=!1;return(async()=>{try{const I=(()=>{if(t.transport.type==="fallback"){const O=t.transport.transports.find(M=>M.config.type==="webSocket");return O?O.value:t.transport}return t.transport})(),{unsubscribe:R}=await I.subscribe({params:["newHeads"],onData(O){var U;if(!x)return;const M=hu((U=O.result)==null?void 0:U.number);g.onBlockNumber(M,f),f=M},onError(O){var M;(M=g.onError)==null||M.call(g,O)}});S=R,x||S()}catch(I){i==null||i(I)}})(),()=>S()})})()}async function vje(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>f_(n))}async function xje(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}const JC=new VG(8192);function Aje(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(JC.get(r))return JC.get(r);const n=t().finally(()=>JC.delete(r));return JC.set(r,n),n}function BI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const a=async({count:o=0}={})=>{const f=async({error:c})=>{const d=typeof e=="function"?e({count:o,error:c}):e;d&&await $I(d),a({count:o+1})};try{const c=await t();i(c)}catch(c){if(o{const{dedupe:i=!1,retryDelay:s=150,retryCount:a=3,uid:o}={...e,...n},f=i?V6(Ek(`${o}.${sc(r)}`)):void 0;return Aje(()=>BI(async()=>{try{return await t(r)}catch(c){const d=c;switch(d.code){case G7.code:throw new G7(d);case K7.code:throw new K7(d);case Q7.code:throw new Q7(d,{method:r.method});case Z7.code:throw new Z7(d);case Nm.code:throw new Nm(d);case Y7.code:throw new Y7(d);case J7.code:throw new J7(d);case P6.code:throw new P6(d);case hy.code:throw new hy(d);case X7.code:throw new X7(d,{method:r.method});case py.code:throw new py(d);case ex.code:throw new ex(d);case ci.code:throw new ci(d);case tx.code:throw new tx(d);case rx.code:throw new rx(d);case nx.code:throw new nx(d);case ix.code:throw new ix(d);case to.code:throw new to(d);case 5e3:throw new ci(d);default:throw c instanceof kt?c:new ZUe(d)}}},{delay:({count:c,error:d})=>{var p;if(d&&d instanceof q9){const g=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(g!=null&&g.match(/\d/))return Number.parseInt(g)*1e3}return~~(1<Eje(c)}),{enabled:i,id:f})}}function Eje(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===py.code||t.code===Nm.code:t instanceof q9&&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:!0}function Wme(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}const Cje=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Sje=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Gme(t,{errorInstance:e=new Error("timed out"),timeout:r,signal:n}){return new Promise((i,s)=>{(async()=>{let a;try{const o=new AbortController;r>0&&(a=setTimeout(()=>{n?o.abort():s(e)},r)),i(await t({signal:(o==null?void 0:o.signal)||null}))}catch(o){(o==null?void 0:o.name)==="AbortError"&&s(e),s(o)}finally{clearTimeout(a)}})()})}function Tje(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Yse=Tje();function Ije(t,e={}){return{async request(r){var p;const{body:n,onRequest:i=e.onRequest,onResponse:s=e.onResponse,timeout:a=e.timeout??1e4}=r,o={...e.fetchOptions??{},...r.fetchOptions??{}},{headers:f,method:c,signal:d}=o;try{const g=await Gme(async({signal:S})=>{const I={...o,body:Array.isArray(n)?sc(n.map(M=>({jsonrpc:"2.0",id:M.id??Yse.take(),...M}))):sc({jsonrpc:"2.0",id:n.id??Yse.take(),...n}),headers:{"Content-Type":"application/json",...f},method:c||"POST",signal:d||(a>0?S:null)},R=new Request(t,I);return i&&await i(R),await fetch(t,I)},{errorInstance:new Bse({body:n,url:t}),timeout:a,signal:!0});s&&await s(g);let x;if((p=g.headers.get("Content-Type"))!=null&&p.startsWith("application/json")?x=await g.json():(x=await g.text(),x=JSON.parse(x||"{}")),!g.ok)throw new q9({body:n,details:sc(x.error)||g.statusText,headers:g.headers,status:g.status,url:t});return x}catch(g){throw g instanceof q9||g instanceof Bse?g:new q9({body:n,cause:g,url:t})}}}}function Rje(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(f,c)=>{const d={...c};for(const p of f){const{name:g,type:x}=p;x==="address"&&(d[g]=d[g].toLowerCase())}return d},a=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},o=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return sc({domain:a,message:o,primaryType:n,types:i})}function Mje(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(a,o)=>{for(const f of a){const{name:c,type:d}=f,p=o[c],g=d.match(Sje);if(g&&(typeof p=="number"||typeof p=="bigint")){const[I,R,O]=g;Tr(p,{signed:R==="int",size:Number.parseInt(O)/8})}if(d==="address"&&typeof p=="string"&&!js(p))throw new Lo({address:p});const x=d.match(Cje);if(x){const[I,R]=x;if(R&&f0(p)!==Number.parseInt(R))throw new VBe({expectedSize:Number.parseInt(R),givenSize:f0(p)})}const S=i[d];S&&s(S,p)}};i.EIP712Domain&&e&&s(i.EIP712Domain,e),n!=="EIP712Domain"&&s(i[n],r)}function kje({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)}function Pje(t){const{authorizationList:e}=t;if(e)for(const r of e){const{contractAddress:n,chainId:i}=r;if(!js(n))throw new Lo({address:n});if(i<=0)throw new Tk({chainId:i})}yK(t)}function Nje(t){const{blobVersionedHashes:e}=t;if(e){if(e.length===0)throw new gme;for(const r of e){const n=f0(r),i=H6(V7(r,0,1));if(n!==32)throw new _Le({hash:r,size:n});if(i!==mme)throw new ELe({hash:r,version:i})}}yK(t)}function yK(t){const{chainId:e,maxPriorityFeePerGas:r,maxFeePerGas:n,to:i}=t;if(e<=0)throw new Tk({chainId:e});if(i&&!js(i))throw new Lo({address:i});if(n&&n>Mk)throw new Pm({maxFeePerGas:n});if(r&&n&&r>n)throw new W7({maxFeePerGas:n,maxPriorityFeePerGas:r})}function Oje(t){const{chainId:e,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:s}=t;if(e<=0)throw new Tk({chainId:e});if(s&&!js(s))throw new Lo({address:s});if(r||i)throw new kt("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>Mk)throw new Pm({maxFeePerGas:n})}function Dje(t){const{chainId:e,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:s}=t;if(s&&!js(s))throw new Lo({address:s});if(typeof e<"u"&&e<=0)throw new Tk({chainId:e});if(r||i)throw new kt("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>Mk)throw new Pm({maxFeePerGas:n})}function $je(t){if(!t||t.length===0)return[];const e=[];for(const r of t){const{contractAddress:n,chainId:i,nonce:s,...a}=r;e.push([Er(i),n,s?Er(s):"0x",...p_({},a)])}return e}function Dk(t){if(!t||t.length===0)return[];const e=[];for(let r=0;r"u"||typeof x>"u")){const U=typeof t.blobs[0]=="string"?t.blobs:t.blobs.map(F=>Z0(F)),D=t.kzg,B=aK({blobs:U,kzg:D});if(typeof g>"u"&&(g=dme({commitments:B})),typeof x>"u"){const F=oK({blobs:U,commitments:B,kzg:D});x=bme({blobs:U,commitments:B,proofs:F})}}const S=Dk(d),I=[Er(r),i?Er(i):"0x",c?Er(c):"0x",f?Er(f):"0x",n?Er(n):"0x",s??"0x",a?Er(a):"0x",p??"0x",S,o?Er(o):"0x",g??[],...p_(t,e)],R=[],O=[],M=[];if(x)for(let U=0;U{if(e.v>=35n)return(e.v-35n)/2n>0?e.v:27n+(e.v===35n?0n:1n);if(r>0)return BigInt(r*2)+BigInt(35n+e.v-27n);const x=27n+(e.v===27n?0n:1n);if(e.v!==x)throw new HUe({v:e.v});return x})(),p=h1(e.r),g=h1(e.s);c=[...c,Er(d),p==="0x00"?"0x":p,g==="0x00"?"0x":g]}else r>0&&(c=[...c,Er(r),"0x","0x"]);return W6(c)}function p_(t,e){const r=e??t,{v:n,yParity:i}=r;if(typeof r.r>"u")return[];if(typeof r.s>"u")return[];if(typeof n>"u"&&typeof i>"u")return[];const s=h1(r.r),a=h1(r.s);return[typeof i=="number"?i?Er(1):"0x":n===0n?"0x":n===1n?Er(1):n===27n?"0x":Er(1),s==="0x00"?"0x":s,a==="0x00"?"0x":a]}class qje extends kt{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function Hje(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new qje({value:t});let[r,n="0"]=t.split(".");const i=r.startsWith("-");if(i&&(r=r.slice(1)),n=n.replace(/(0+)$/,""),e===0)Math.round(+`.${n}`)===1&&(r=`${BigInt(r)+1n}`),n="";else if(n.length>e){const[s,a,o]=[n.slice(0,e-1),n.slice(e-1,e),n.slice(e)],f=Math.round(+`${a}.${o}`);f>9?n=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):n=`${s}${f}`,n.length>e&&(n=n.slice(1),r=`${BigInt(r)+1n}`),n=n.slice(0,e)}else n=n.padEnd(e,"0");return BigInt(`${i?"-":""}${r}${n}`)}async function Vje(t,{confirmations:e=1,hash:r,onReplaced:n,pollingInterval:i=t.pollingInterval,retryCount:s=6,retryDelay:a=({count:f})=>~~(1<{o&&setTimeout(()=>I(new $se({hash:r})),o);const R=Aq(f,{onReplaced:n,resolve:S,reject:I},O=>{const M=Qn(t,wje,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(U){const D=F=>{M(),F(),R()};let B=U;if(!x){c>s&&D(()=>O.reject(new $se({hash:r})));try{if(g){if(e>1&&(!g.blockNumber||B-g.blockNumber+1nO.resolve(g));return}if(d||(x=!0,await BI(async()=>{d=await Qn(t,Hme,"getTransaction")({hash:r}),d.blockNumber&&(B=d.blockNumber)},{delay:a,retryCount:s}),x=!1),g=await Qn(t,Qse,"getTransactionReceipt")({hash:r}),e>1&&(!g.blockNumber||B-g.blockNumber+1nO.resolve(g))}catch(F){if(F instanceof nme||F instanceof ime){if(!d){x=!1;return}try{p=d,x=!0;const k=await BI(()=>Qn(t,sx,"getBlock")({blockNumber:B,includeTransactions:!0}),{delay:a,retryCount:s,shouldRetry:({error:Y})=>Y instanceof ame});x=!1;const N=k.transactions.find(({from:Y,nonce:z})=>Y===p.from&&z===p.nonce);if(!N||(g=await Qn(t,Qse,"getTransactionReceipt")({hash:N.hash}),e>1&&(!g.blockNumber||B-g.blockNumber+1n{var Y;(Y=O.onReplaced)==null||Y.call(O,{reason:W,replacedTransaction:p,transaction:N,transactionReceipt:g}),O.resolve(g)})}catch(k){D(()=>O.reject(k))}}else D(()=>O.reject(F))}finally{c++}}}})})})}async function Wje(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>$s(r))}async function Gje(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function Kje(t,e){var c,d,p,g;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new c_({docsPath:"/docs/actions/wallet/signTransaction"});const s=Qo(r);d_({account:s,...e});const a=await Qn(t,kk,"getChainId")({});n!==null&&rme({currentChainId:a,chain:n});const o=(n==null?void 0:n.formatters)||((c=t.chain)==null?void 0:c.formatters),f=((d=o==null?void 0:o.transactionRequest)==null?void 0:d.format)||Rk;return s.signTransaction?s.signTransaction({...i,chainId:a},{serializer:(g=(p=t.chain)==null?void 0:p.serializers)==null?void 0:g.transaction}):await t.request({method:"eth_signTransaction",params:[{...f(i),chainId:Tr(a),from:s.address}]},{retryCount:0})}async function Kme(t,{account:e=t.account,message:r}){if(!e)throw new c_({docsPath:"/docs/actions/wallet/signMessage"});const n=Qo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Ek(r):r.raw instanceof Uint8Array?Er(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function Qje(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new c_({docsPath:"/docs/actions/wallet/signTypedData"});const a=Qo(r),o={EIP712Domain:kje({domain:n}),...e.types};if(Mje({domain:n,message:i,primaryType:s,types:o}),a.signTypedData)return a.signTypedData({domain:n,message:i,primaryType:s,types:o});const f=Rje({domain:n,message:i,primaryType:s,types:o});return t.request({method:"eth_signTypedData_v4",params:[a.address,f]},{retryCount:0})}async function Zje(t,e){const{abi:r,address:n,args:i,dataSuffix:s,functionName:a,...o}=e,f=o.account?Qo(o.account):t.account,c=vg({abi:r,args:i,functionName:a});try{const{data:d}=await Qn(t,mK,"call")({batch:!1,data:`${c}${s?s.replace("0x",""):""}`,to:n,...o,account:f}),p=xw({abi:r,args:i,functionName:a,data:d||"0x"}),g=r.filter(x=>"name"in x&&x.name===e.functionName);return{result:p,request:{abi:g,address:n,args:i,dataSuffix:s,functionName:a,...o,account:f}}}catch(d){throw ox(d,{abi:r,address:n,args:i,docsPath:"/docs/contract/simulateContract",functionName:a,sender:f==null?void 0:f.address})}}async function Yje(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(e)}]},{retryCount:0})}async function Jje(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}async function Qme(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:a,functionName:o,...f}=e;if(!n)throw new c_({docsPath:"/docs/contract/writeContract"});const c=Qo(n),d=vg({abi:r,args:s,functionName:o});try{return await Qn(t,Ok,"sendTransaction")({data:`${d}${a?a.replace("0x",""):""}`,to:i,account:c,...f})}catch(p){throw ox(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:o,sender:c.address})}}function Bs(t,e,r){const n=t[e.name];if(typeof n=="function")return n;const i=t[r];return typeof i=="function"?i:s=>e(t,s)}const hT="2.13.5",Xje=()=>`@wagmi/core@${hT}`;var Zme=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},UI,Yme;let Wh=class _q extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Xje()}constructor(e,r={}){var s;super(),UI.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=r.cause instanceof _q?r.cause.details:(s=r.cause)!=null&&s.message?r.cause.message:r.details,i=r.cause instanceof _q&&r.cause.docsPath||r.docsPath;this.message=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(` -`),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=e}walk(e){return Zme(this,UI,"m",Yme).call(this,this,e)}};UI=new WeakSet,Yme=function t(e,r){return r!=null&&r(e)?e:e.cause?Zme(this,UI,"m",t).call(this,e.cause,r):e};class Dm extends Wh{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class eze extends Wh{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class Jme extends Wh{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class tze extends Wh{constructor({address:e,connector:r}){super(`Account "${e}" not found for connector "${r.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class rze extends Wh{constructor({connectionChainId:e,connectorChainId:r}){super(`The current chain of the connector (id: ${r}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class nze extends Wh{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function Jse(t,e){var n;let r;if(typeof e.connector=="function"?r=t._internal.connectors.setup(e.connector):r=e.connector,r.uid===t.state.current)throw new eze;try{t.setState(a=>({...a,status:"connecting"})),r.emitter.emit("message",{type:"connecting"});const i=await r.connect({chainId:e.chainId}),s=i.accounts;return r.emitter.off("connect",t._internal.events.connect),r.emitter.on("change",t._internal.events.change),r.emitter.on("disconnect",t._internal.events.disconnect),await((n=t.storage)==null?void 0:n.setItem("recentConnectorId",r.id)),t.setState(a=>({...a,connections:new Map(a.connections).set(r.uid,{accounts:s,chainId:i.chainId,connector:r}),current:r.uid,status:"connected"})),{accounts:s,chainId:i.chainId}}catch(i){throw t.setState(s=>({...s,status:s.current?"connected":"disconnected"})),i}}const Eq=256;let XC=Eq,eS;function Xme(t=11){if(!eS||XC+t>Eq*2){eS="",XC=0;for(let e=0;e{const M=O(R);for(const D in S)delete M[D];const U={...R,...M};return Object.assign(U,{extend:I(U)})}}return Object.assign(S,{extend:I(S)})}function wK({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:a},o){const f=Xme();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:a},request:_je(r,{retryCount:n,retryDelay:i,uid:f}),value:o}}function ize(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>wK({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}function sze(t,e={}){const{key:r="fallback",name:n="Fallback",rank:i=!1,retryCount:s,retryDelay:a}=e;return({chain:o,pollingInterval:f=4e3,timeout:c,...d})=>{let p=t,g=()=>{};const x=wK({key:r,name:n,async request({method:S,params:I}){const R=async(O=0)=>{const M=p[O]({...d,chain:o,retryCount:0,timeout:c});try{const U=await M.request({method:S,params:I});return g({method:S,params:I,response:U,transport:M,status:"success"}),U}catch(U){if(g({error:U,method:S,params:I,transport:M,status:"error"}),aze(U)||O===p.length-1)throw U;return R(O+1)}};return R()},retryCount:s,retryDelay:a,type:"fallback"},{onResponse:S=>g=S,transports:p.map(S=>S({chain:o,retryCount:0}))});if(i){const S=typeof i=="object"?i:{};oze({chain:o,interval:S.interval??f,onTransports:I=>p=I,sampleCount:S.sampleCount,timeout:S.timeout,transports:p,weights:S.weights})}return x}}function aze(t){return"code"in t&&typeof t.code=="number"&&(t.code===hy.code||t.code===ci.code||t.code===5e3)}function oze({chain:t,interval:e=4e3,onTransports:r,sampleCount:n=10,timeout:i=1e3,transports:s,weights:a={}}){const{stability:o=.7,latency:f=.3}=a,c=[],d=async()=>{const p=await Promise.all(s.map(async S=>{const I=S({chain:t,retryCount:0,timeout:i}),R=Date.now();let O,M;try{await I.request({method:"net_listening"}),M=1}catch{M=0}finally{O=Date.now()}return{latency:O-R,success:M}}));c.push(p),c.length>n&&c.shift();const g=Math.max(...c.map(S=>Math.max(...S.map(({latency:I})=>I)))),x=s.map((S,I)=>{const R=c.map(B=>B[I].latency),M=1-R.reduce((B,F)=>B+F,0)/R.length/g,U=c.map(B=>B[I].success),D=U.reduce((B,F)=>B+F,0)/U.length;return D===0?[0,I]:[f*M+o*D,I]}).sort((S,I)=>I[0]-S[0]);r(x.map(([,S])=>s[S])),await $I(e),d()};d()}class fze extends kt{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function wL(t,e={}){const{batch:r,fetchOptions:n,key:i="http",name:s="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:o,retryDelay:f}=e;return({chain:c,retryCount:d,timeout:p})=>{const{batchSize:g=1e3,wait:x=0}=typeof r=="object"?r:{},S=e.retryCount??d,I=p??e.timeout??1e4,R=t||(c==null?void 0:c.rpcUrls.default.http[0]);if(!R)throw new fze;const O=Ije(R,{fetchOptions:n,onRequest:a,onResponse:o,timeout:I});return wK({key:i,name:s,async request({method:M,params:U}){const D={method:M,params:U},{schedule:B}=jme({id:R,wait:x,shouldSplitBatch(W){return W.length>g},fn:W=>O.request({body:W}),sort:(W,Y)=>W.id-Y.id}),F=async W=>r?B(W):[await O.request({body:W})],[{error:k,result:N}]=await F(D);if(k)throw new sme({body:D,error:k,url:R});return N},retryCount:S,retryDelay:f,timeout:I,type:"http"},{fetchOptions:n,url:R})}}function Xse(t){return{addChain:e=>$Be(t,e),deployContract:e=>SLe(t,e),getAddresses:()=>vje(t),getChainId:()=>kk(t),getPermissions:()=>xje(t),prepareTransactionRequest:e=>Nk(t,e),requestAddresses:()=>Wje(t),requestPermissions:e=>Gje(t,e),sendRawTransaction:e=>vme(t,e),sendTransaction:e=>Ok(t,e),signMessage:e=>Kme(t,e),signTransaction:e=>Kje(t,e),signTypedData:e=>Qje(t,e),switchChain:e=>Yje(t,e),watchAsset:e=>Jje(t,e),writeContract:e=>Qme(t,e)}}async function Aw(t,e={}){let r;if(e.connector){const{connector:c}=e;if(t.state.status==="reconnecting"&&!c.getAccounts&&!c.getChainId)throw new nze({connector:c});const[d,p]=await Promise.all([c.getAccounts(),c.getChainId()]);r={accounts:d,chainId:p,connector:c}}else r=t.state.connections.get(t.state.current);if(!r)throw new Jme;const n=e.chainId??r.chainId,i=await r.connector.getChainId();if(i!==r.chainId)throw new rze({connectionChainId:r.chainId,connectorChainId:i});const s=r.connector;if(s.getClient)return s.getClient({chainId:n});const a=Qo(e.account??r.accounts[0]);if(a.address=$s(a.address),e.account&&!r.accounts.some(c=>c.toLowerCase()===a.address.toLowerCase()))throw new tze({address:a.address,connector:s});const o=t.chains.find(c=>c.id===n),f=await r.connector.getProvider({chainId:n});return ege({account:a,chain:o,name:"Connector Client",transport:c=>ize(f)({...c,retryCount:0})})}async function cze(t,e={}){var i,s;let r;if(e.connector)r=e.connector;else{const{connections:a,current:o}=t.state,f=a.get(o);r=f==null?void 0:f.connector}const n=t.state.connections;r&&(await r.disconnect(),r.emitter.off("change",t._internal.events.change),r.emitter.off("disconnect",t._internal.events.disconnect),r.emitter.on("connect",t._internal.events.connect),n.delete(r.uid)),t.setState(a=>{if(n.size===0)return{...a,connections:new Map,current:null,status:"disconnected"};const o=n.values().next().value;return{...a,connections:new Map(n),current:o.connector.uid}});{const a=t.state.current;if(!a)return;const o=(i=t.state.connections.get(a))==null?void 0:i.connector;if(!o)return;await((s=t.storage)==null?void 0:s.setItem("recentConnectorId",o.id))}}async function uze(t,e){const{chainId:r,connector:n,...i}=e;let s;e.account?s=e.account:s=(await Aw(t,{account:e.account,chainId:r,connector:n})).account;const a=t.getClient({chainId:r});return Bs(a,sK,"estimateGas")({...i,account:s})}function tge(t){return typeof t=="number"?t:t==="wei"?0:Math.abs(zUe[t])}function _w(t){const e=t.state.current,r=t.state.connections.get(e),n=r==null?void 0:r.accounts,i=n==null?void 0:n[0],s=t.chains.find(o=>o.id===(r==null?void 0:r.chainId)),a=t.state.status;switch(a){case"connected":return{address:i,addresses:n,chain:s,chainId:r==null?void 0:r.chainId,connector:r==null?void 0:r.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:a};case"reconnecting":return{address:i,addresses:n,chain:s,chainId:r==null?void 0:r.chainId,connector:r==null?void 0:r.connector,isConnected:!!i,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:a};case"connecting":return{address:i,addresses:n,chain:s,chainId:r==null?void 0:r.chainId,connector:r==null?void 0:r.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:a};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:a}}}async function lze(t,e){const{allowFailure:r=!0,chainId:n,contracts:i,...s}=e,a=t.getClient({chainId:n});return Bs(a,gje,"multicall")({allowFailure:r,contracts:i,...s})}function dze(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,Om,"readContract")(n)}async function hze(t,e){var o;const{allowFailure:r=!0,blockNumber:n,blockTag:i,...s}=e,a=e.contracts;try{const f={};for(const[g,x]of a.entries()){const S=x.chainId??t.state.chainId;f[S]||(f[S]=[]),(o=f[S])==null||o.push({contract:x,index:g})}const c=()=>Object.entries(f).map(([g,x])=>lze(t,{...s,allowFailure:r,blockNumber:n,blockTag:i,chainId:Number.parseInt(g),contracts:x.map(({contract:S})=>S)})),d=(await Promise.all(c())).flat(),p=Object.values(f).flatMap(g=>g.map(({index:x})=>x));return d.reduce((g,x,S)=>(g&&(g[p[S]]=x),g),[])}catch(f){if(f instanceof lK)throw f;const c=()=>a.map(d=>dze(t,{...d,blockNumber:n,blockTag:i}));return r?(await Promise.allSettled(c())).map(d=>d.status==="fulfilled"?{result:d.value,status:"success"}:{error:d.reason,result:void 0,status:"failure"}):await Promise.all(c())}}async function pze(t,e){const{address:r,blockNumber:n,blockTag:i,chainId:s,token:a,unit:o="ether"}=e;if(a)try{return eae(t,{balanceAddress:r,chainId:s,symbolType:"string",tokenAddress:a})}catch(g){if(g instanceof lK){const x=await eae(t,{balanceAddress:r,chainId:s,symbolType:"bytes32",tokenAddress:a}),S=L2e(h1(x.symbol,{dir:"right"}));return{...x,symbol:S}}throw g}const f=t.getClient({chainId:s}),d=await Bs(f,lme,"getBalance")(n?{address:r,blockNumber:n}:{address:r,blockTag:i}),p=t.chains.find(g=>g.id===s)??f.chain;return{decimals:p.nativeCurrency.decimals,formatted:u_(d,tge(o)),symbol:p.nativeCurrency.symbol,value:d}}async function eae(t,e){const{balanceAddress:r,chainId:n,symbolType:i,tokenAddress:s,unit:a}=e,o={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:i}]}],address:s},[f,c,d]=await hze(t,{allowFailure:!1,contracts:[{...o,functionName:"balanceOf",args:[r],chainId:n},{...o,functionName:"decimals",chainId:n},{...o,functionName:"symbol",chainId:n}]}),p=u_(f??"0",tge(a??c));return{decimals:c,formatted:p,symbol:d,value:f}}function tae(t){return t.state.chainId}function fx(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(!fx(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&&!fx(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}let tS=[];function mze(t){const e=[...t.state.connections.values()];return t.state.status==="reconnecting"||fx(tS,e)?tS:(tS=e,e)}function gze(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,VFe,"getEnsAddress")(n)}function rae(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,sje,"getEnsAvatar")(n)}function bze(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,aje,"getEnsName")(n)}async function yze(t,e={}){const r=await Aw(t,e);return r.extend(Xse),r.extend(Xse)}async function wze(t,e){const{account:r,chainId:n,...i}=e,s=r??_w(t).address,a=t.getClient({chainId:n});return Bs(a,Nk,"prepareTransactionRequest")({...i,...s?{account:s}:{}})}let vL=!1;async function rge(t,e={}){var c,d;if(vL)return[];vL=!0,t.setState(p=>({...p,status:p.current?"reconnecting":"connecting"}));const r=[];if((c=e.connectors)!=null&&c.length)for(const p of e.connectors){let g;typeof p=="function"?g=t._internal.connectors.setup(p):g=p,r.push(g)}else r.push(...t.connectors);let n;try{n=await((d=t.storage)==null?void 0:d.getItem("recentConnectorId"))}catch{}const i={};for(const[,p]of t.state.connections)i[p.connector.id]=1;n&&(i[n]=0);const s=Object.keys(i).length>0?[...r].sort((p,g)=>(i[p.id]??10)-(i[g.id]??10)):r;let a=!1;const o=[],f=[];for(const p of s){const g=await p.getProvider().catch(()=>{});if(!g||f.some(I=>I===g)||!await p.isAuthorized())continue;const S=await p.connect({isReconnecting:!0}).catch(()=>null);S&&(p.emitter.off("connect",t._internal.events.connect),p.emitter.on("change",t._internal.events.change),p.emitter.on("disconnect",t._internal.events.disconnect),t.setState(I=>{const R=new Map(a?I.connections:new Map).set(p.uid,{accounts:S.accounts,chainId:S.chainId,connector:p});return{...I,current:a?I.current:p.uid,connections:R}}),o.push({accounts:S.accounts,chainId:S.chainId,connector:p}),f.push(g),a=!0)}return(t.state.status==="reconnecting"||t.state.status==="connecting")&&(a?t.setState(p=>({...p,status:"connected"})):t.setState(p=>({...p,connections:new Map,current:null,status:"disconnected"}))),vL=!1,o}async function vze(t,e){const{account:r,chainId:n,connector:i,gas:s,...a}=e;let o;typeof r=="object"&&r.type==="local"?o=t.getClient({chainId:n}):o=await Aw(t,{account:r,chainId:n,connector:i});const{connector:f}=_w(t),c=await(async()=>{var g;if(!(!("data"in e)||!e.data)&&!((g=i??f)!=null&&g.supportsSimulation)&&s!==null)return s===void 0?Bs(o,sK,"estimateGas")({...a,account:r,chain:n?{id:n}:null}):s})();return await Bs(o,Ok,"sendTransaction")({...a,...r?{account:r}:{},gas:c,chain:n?{id:n}:null})}async function xze(t,e){const{account:r,connector:n,...i}=e;let s;return typeof r=="object"&&r.type==="local"?s=t.getClient():s=await Aw(t,{account:r,connector:n}),Bs(s,Kme,"signMessage")({...i,...r?{account:r}:{}})}async function Aze(t,e){const{abi:r,chainId:n,connector:i,...s}=e;let a;e.account?a=e.account:a=(await Aw(t,{chainId:n,connector:i})).account;const o=t.getClient({chainId:n}),f=Bs(o,Zje,"simulateContract"),{result:c,request:d}=await f({...s,abi:r,account:a});return{chainId:o.chain.id,result:c,request:{__mode:"prepared",...d,chainId:n}}}async function _ze(t,e){var i;const{connector:r}=e,n=t.state.connections.get(r.uid);if(!n)throw new Jme;return await((i=t.storage)==null?void 0:i.setItem("recentConnectorId",r.id)),t.setState(s=>({...s,current:r.uid})),{accounts:n.accounts,chainId:n.chainId}}class Cp extends Wh{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class Eze extends Wh{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Cze(t,e){var a;const{addEthereumChainParameter:r,chainId:n}=e,i=t.state.connections.get(((a=e.connector)==null?void 0:a.uid)??t.state.current);if(i){const o=i.connector;if(!o.switchChain)throw new Eze({connector:o});return await o.switchChain({addEthereumChainParameter:r,chainId:n})}const s=t.chains.find(o=>o.id===n);if(!s)throw new Dm;return t.setState(o=>({...o,chainId:n})),s}function nge(t,e){const{onChange:r}=e;return t.subscribe(()=>_w(t),r,{equalityFn(n,i){const{connector:s,...a}=n,{connector:o,...f}=i;return fx(a,f)&&(s==null?void 0:s.id)===(o==null?void 0:o.id)&&(s==null?void 0:s.uid)===(o==null?void 0:o.uid)}})}function Sze(t,e){const{onChange:r}=e;return t.subscribe(n=>n.chainId,r)}function Tze(t,e){const{onChange:r}=e;return t._internal.connectors.subscribe((n,i)=>{r(Object.values(n),i)})}async function Ize(t,e){const{chainId:r,timeout:n=0,...i}=e,s=t.getClient({chainId:r}),o=await Bs(s,Vje,"waitForTransactionReceipt")({...i,timeout:n});if(o.status==="reverted"){const c=await Bs(s,Hme,"getTransaction")({hash:o.transactionHash}),p=await Bs(s,mK,"call")({...c,gasPrice:c.type!=="eip1559"?c.gasPrice:void 0,maxFeePerGas:c.type==="eip1559"?c.maxFeePerGas:void 0,maxPriorityFeePerGas:c.type==="eip1559"?c.maxPriorityFeePerGas:void 0}),g=p!=null&&p.data?L2e(`0x${p.data.substring(138)}`):"unknown reason";throw new Error(g)}return{...o,chainId:s.chain.id}}async function Rze(t,e){const{account:r,chainId:n,connector:i,__mode:s,...a}=e;let o;typeof r=="object"&&r.type==="local"?o=t.getClient({chainId:n}):o=await Aw(t,{account:r,chainId:n,connector:i});const{connector:f}=_w(t);let c;if(s==="prepared"||f!=null&&f.supportsSimulation)c=a;else{const{request:g}=await Aze(t,{...a,account:r,chainId:n});c=g}return await Bs(o,Qme,"writeContract")({...c,...r?{account:r}:{},chain:n?{id:n}:null})}const Mze=/(rabby|trustwallet)/,kze={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t!=null&&t.coinbaseWalletExtension?t.coinbaseWalletExtension:pT(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return pT(t,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const r=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isZerion"];for(const n of r)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(t){var e,r;return(e=t==null?void 0:t.phantom)!=null&&e.ethereum?(r=t.phantom)==null?void 0:r.ethereum:pT(t,"isPhantom")}}};$k.type="injected";function $k(t={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:r}=t;function n(){const f=t.target;if(typeof f=="function"){const c=f();if(c)return c}return typeof f=="object"?f:typeof f=="string"?{...kze[f]??{id:f,name:`${f[0].toUpperCase()}${f.slice(1)}`,provider:`is${f[0].toUpperCase()}${f.slice(1)}`}}:{id:"injected",name:"Injected",provider(c){return c==null?void 0:c.ethereum}}}let i,s,a,o;return f=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},get supportsSimulation(){return Mze.test(this.id.toLowerCase())},type:$k.type,async setup(){const c=await this.getProvider();c&&t.target&&(a||(a=this.onConnect.bind(this),c.on("connect",a)),i||(i=this.onAccountsChanged.bind(this),c.on("accountsChanged",i)))},async connect({chainId:c,isReconnecting:d}={}){var x,S,I,R,O,M;const p=await this.getProvider();if(!p)throw new Cp;let g=[];if(d)g=await this.getAccounts().catch(()=>[]);else if(e)try{g=(R=(I=(S=(x=(await p.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:x.caveats)==null?void 0:S[0])==null?void 0:I.value)==null?void 0:R.map(D=>$s(D)),g.length>0&&(g=await this.getAccounts())}catch(U){const D=U;if(D.code===ci.code)throw new ci(D);if(D.code===P6.code)throw D}try{!(g!=null&&g.length)&&!d&&(g=(await p.request({method:"eth_requestAccounts"})).map(B=>$s(B))),a&&(p.removeListener("connect",a),a=void 0),i||(i=this.onAccountsChanged.bind(this),p.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),p.on("chainChanged",s)),o||(o=this.onDisconnect.bind(this),p.on("disconnect",o));let U=await this.getChainId();if(c&&U!==c){const D=await this.switchChain({chainId:c}).catch(B=>{if(B.code===ci.code)throw B;return{id:U}});U=(D==null?void 0:D.id)??U}return e&&await((O=f.storage)==null?void 0:O.removeItem(`${this.id}.disconnected`)),t.target||await((M=f.storage)==null?void 0:M.setItem("injected.connected",!0)),{accounts:g,chainId:U}}catch(U){const D=U;throw D.code===ci.code?new ci(D):D.code===P6.code?new P6(D):D}},async disconnect(){var d,p;const c=await this.getProvider();if(!c)throw new Cp;s&&(c.removeListener("chainChanged",s),s=void 0),o&&(c.removeListener("disconnect",o),o=void 0),a||(a=this.onConnect.bind(this),c.on("connect",a));try{await Gme(()=>c.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await((d=f.storage)==null?void 0:d.setItem(`${this.id}.disconnected`,!0)),t.target||await((p=f.storage)==null?void 0:p.removeItem("injected.connected"))},async getAccounts(){const c=await this.getProvider();if(!c)throw new Cp;return(await c.request({method:"eth_accounts"})).map(p=>$s(p))},async getChainId(){const c=await this.getProvider();if(!c)throw new Cp;const d=await c.request({method:"eth_chainId"});return Number(d)},async getProvider(){if(typeof window>"u")return;let c;const d=n();return typeof d.provider=="function"?c=d.provider(window):typeof d.provider=="string"?c=pT(window,d.provider):c=d.provider,c&&!c.removeListener&&("off"in c&&typeof c.off=="function"?c.removeListener=c.off:c.removeListener=()=>{}),c},async isAuthorized(){var c,d;try{if(e&&await((c=f.storage)==null?void 0:c.getItem(`${this.id}.disconnected`))||!t.target&&!await((d=f.storage)==null?void 0:d.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(r!==void 0&&r!==!1){const S=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",S),!!await this.getProvider()),I=typeof r=="number"?r:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(O=>window.addEventListener("ethereum#initialized",()=>O(S()),{once:!0}))]:[],new Promise(O=>setTimeout(()=>O(S()),I))]))return!0}throw new Cp}return!!(await BI(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:c,chainId:d}){var x,S,I,R;const p=await this.getProvider();if(!p)throw new Cp;const g=f.chains.find(O=>O.id===d);if(!g)throw new to(new Dm);try{return await Promise.all([p.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(d)}]}).then(async()=>{await this.getChainId()===d&&f.emitter.emit("change",{chainId:d})}),new Promise(O=>f.emitter.once("change",({chainId:M})=>{M===d&&O()}))]),g}catch(O){const M=O;if(M.code===4902||((S=(x=M==null?void 0:M.data)==null?void 0:x.originalError)==null?void 0:S.code)===4902)try{const{default:U,...D}=g.blockExplorers??{};let B;c!=null&&c.blockExplorerUrls?B=c.blockExplorerUrls:U&&(B=[U.url,...Object.values(D).map(W=>W.url)]);let F;(I=c==null?void 0:c.rpcUrls)!=null&&I.length?F=c.rpcUrls:F=[((R=g.rpcUrls.default)==null?void 0:R.http[0])??""];const k={blockExplorerUrls:B,chainId:Tr(d),chainName:(c==null?void 0:c.chainName)??g.name,iconUrls:c==null?void 0:c.iconUrls,nativeCurrency:(c==null?void 0:c.nativeCurrency)??g.nativeCurrency,rpcUrls:F};if(await p.request({method:"wallet_addEthereumChain",params:[k]}),await this.getChainId()!==d)throw new ci(new Error("User rejected switch after adding network."));return g}catch(U){throw new ci(U)}throw M.code===ci.code?new ci(M):new to(M)}},async onAccountsChanged(c){var d;if(c.length===0)this.onDisconnect();else if(f.emitter.listenerCount("connect")){const p=(await this.getChainId()).toString();this.onConnect({chainId:p}),e&&await((d=f.storage)==null?void 0:d.removeItem(`${this.id}.disconnected`))}else f.emitter.emit("change",{accounts:c.map(p=>$s(p))})},onChainChanged(c){const d=Number(c);f.emitter.emit("change",{chainId:d})},async onConnect(c){const d=await this.getAccounts();if(d.length===0)return;const p=Number(c.chainId);f.emitter.emit("connect",{accounts:d,chainId:p});const g=await this.getProvider();g&&(a&&(g.removeListener("connect",a),a=void 0),i||(i=this.onAccountsChanged.bind(this),g.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),g.on("chainChanged",s)),o||(o=this.onDisconnect.bind(this),g.on("disconnect",o)))},async onDisconnect(c){const d=await this.getProvider();c&&c.code===1013&&d&&(await this.getAccounts()).length||(f.emitter.emit("disconnect"),d&&(s&&(d.removeListener("chainChanged",s),s=void 0),o&&(d.removeListener("disconnect",o),o=void 0),a||(a=this.onConnect.bind(this),d.on("connect",a))))}})}function pT(t,e){function r(i){return typeof e=="function"?e(i):typeof e=="string"?i[e]:!0}const n=t.ethereum;if(n!=null&&n.providers)return n.providers.find(i=>r(i));if(n&&r(n))return n}function Pze(t){if(typeof window>"u")return;const e=r=>t(r.detail);return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}function Nze(){const t=new Set;let e=[];const r=()=>Pze(i=>{e.some(({info:s})=>s.uuid===i.info.uuid)||(e=[...e,i],t.forEach(s=>s(e,{added:[i]})))});let n=r();return{_listeners(){return t},clear(){t.forEach(i=>i([],{removed:[...e]})),e=[]},destroy(){this.clear(),t.clear(),n==null||n()},findProvider({rdns:i}){return e.find(s=>s.info.rdns===i)},getProviders(){return e},reset(){this.clear(),n==null||n(),n=r()},subscribe(i,{emitImmediately:s}={}){return t.add(i),s&&i(e,{added:e}),()=>t.delete(i)}}}const Oze={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REOWN_PROJECT_ID:"6562ee7f0e72671353204776ca7a132c"},Dze=t=>(e,r,n)=>{const i=n.subscribe;return n.subscribe=(a,o,f)=>{let c=a;if(o){const d=(f==null?void 0:f.equalityFn)||Object.is;let p=a(n.getState());c=g=>{const x=a(g);if(!d(p,x)){const S=p;o(p=x,S)}},f!=null&&f.fireImmediately&&o(p,p)}return i(c)},t(e,r,n)},$ze=Dze;function Bze(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var s;const a=f=>f===null?null:JSON.parse(f,void 0),o=(s=r.getItem(i))!=null?s:null;return o instanceof Promise?o.then(a):a(o)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>r.removeItem(i)}}const cx=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return cx(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return cx(n)(r)}}}},Uze=(t,e)=>(r,n,i)=>{let s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:R=>R,version:0,merge:(R,O)=>({...O,...R}),...e},a=!1;const o=new Set,f=new Set;let c;try{c=s.getStorage()}catch{}if(!c)return t((...R)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...R)},n,i);const d=cx(s.serialize),p=()=>{const R=s.partialize({...n()});let O;const M=d({state:R,version:s.version}).then(U=>c.setItem(s.name,U)).catch(U=>{O=U});if(O)throw O;return M},g=i.setState;i.setState=(R,O)=>{g(R,O),p()};const x=t((...R)=>{r(...R),p()},n,i);let S;const I=()=>{var R;if(!c)return;a=!1,o.forEach(M=>M(n()));const O=((R=s.onRehydrateStorage)==null?void 0:R.call(s,n()))||void 0;return cx(c.getItem.bind(c))(s.name).then(M=>{if(M)return s.deserialize(M)}).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==s.version){if(s.migrate)return s.migrate(M.state,M.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return M.state}).then(M=>{var U;return S=s.merge(M,(U=n())!=null?U:x),r(S,!0),p()}).then(()=>{O==null||O(S,void 0),a=!0,f.forEach(M=>M(S))}).catch(M=>{O==null||O(void 0,M)})};return i.persist={setOptions:R=>{s={...s,...R},R.getStorage&&(c=R.getStorage())},clearStorage:()=>{c==null||c.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>I(),hasHydrated:()=>a,onHydrate:R=>(o.add(R),()=>{o.delete(R)}),onFinishHydration:R=>(f.add(R),()=>{f.delete(R)})},I(),S||x},Lze=(t,e)=>(r,n,i)=>{let s={storage:Bze(()=>localStorage),partialize:I=>I,version:0,merge:(I,R)=>({...R,...I}),...e},a=!1;const o=new Set,f=new Set;let c=s.storage;if(!c)return t((...I)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...I)},n,i);const d=()=>{const I=s.partialize({...n()});return c.setItem(s.name,{state:I,version:s.version})},p=i.setState;i.setState=(I,R)=>{p(I,R),d()};const g=t((...I)=>{r(...I),d()},n,i);let x;const S=()=>{var I,R;if(!c)return;a=!1,o.forEach(M=>{var U;return M((U=n())!=null?U:g)});const O=((R=s.onRehydrateStorage)==null?void 0:R.call(s,(I=n())!=null?I:g))||void 0;return cx(c.getItem.bind(c))(s.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==s.version){if(s.migrate)return s.migrate(M.state,M.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return M.state}).then(M=>{var U;return x=s.merge(M,(U=n())!=null?U:g),r(x,!0),d()}).then(()=>{O==null||O(x,void 0),x=n(),a=!0,f.forEach(M=>M(x))}).catch(M=>{O==null||O(void 0,M)})};return i.persist={setOptions:I=>{s={...s,...I},I.storage&&(c=I.storage)},clearStorage:()=>{c==null||c.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>S(),hasHydrated:()=>a,onHydrate:I=>(o.add(I),()=>{o.delete(I)}),onFinishHydration:I=>(f.add(I),()=>{f.delete(I)})},s.skipHydration||S(),x||g},Fze=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((Oze?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Uze(t,e)):Lze(t,e),jze=Fze,zze={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REOWN_PROJECT_ID:"6562ee7f0e72671353204776ca7a132c"},nae=t=>{let e;const r=new Set,n=(f,c)=>{const d=typeof f=="function"?f(e):f;if(!Object.is(d,e)){const p=e;e=c??typeof d!="object"?d:Object.assign({},e,d),r.forEach(g=>g(e,p))}},i=()=>e,o={setState:n,getState:i,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(zze?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,o),o},xL=t=>t?nae(t):nae;var ige={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(f,c,d){this.fn=f,this.context=c,this.once=d||!1}function s(f,c,d,p,g){if(typeof d!="function")throw new TypeError("The listener must be a function");var x=new i(d,p||f,g),S=r?r+c:c;return f._events[S]?f._events[S].fn?f._events[S]=[f._events[S],x]:f._events[S].push(x):(f._events[S]=x,f._eventsCount++),f}function a(f,c){--f._eventsCount===0?f._events=new n:delete f._events[c]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],d,p;if(this._eventsCount===0)return c;for(p in d=this._events)e.call(d,p)&&c.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},o.prototype.listeners=function(c){var d=r?r+c:c,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,x=p.length,S=new Array(x);g{let i=n;return(i==null?void 0:i.__type)==="bigint"&&(i=BigInt(i.value)),(i==null?void 0:i.__type)==="Map"&&(i=new Map(i.value)),(e==null?void 0:e(r,i))??i})}function iae(t,e){return t.slice(0,e).join(".")||"."}function sae(t,e){const{length:r}=t;for(let n=0;n{let a=s;return typeof a=="bigint"&&(a={__type:"bigint",value:s.toString()}),a instanceof Map&&(a={__type:"Map",value:Array.from(s.entries())}),(e==null?void 0:e(i,a))??a},n),r??void 0)}function sge(t){const{deserialize:e=Gze,key:r="wagmi",serialize:n=Qze,storage:i=age}=t;function s(a){return a instanceof Promise?a.then(o=>o).catch(()=>null):a}return{...i,key:r,async getItem(a,o){const f=i.getItem(`${r}.${a}`),c=await s(f);return c?e(c)??null:o??null},async setItem(a,o){const f=`${r}.${a}`;o===null?await s(i.removeItem(f)):await s(i.setItem(f,n(o)))},async removeItem(a){await s(i.removeItem(`${r}.${a}`))}}}const age={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},Cq=256;let rS=Cq,nS;function Zze(t=11){if(!nS||rS+t>Cq*2){nS="",rS=0;for(let e=0;es.chains),f=xL(()=>[...s.connectors??[],...i?[]:(a==null?void 0:a.getProviders().map(d))??[]].map(c));function c(B){var N;const F=Wze(Zze()),k={...B({emitter:F,chains:o.getState(),storage:r,transports:s.transports}),emitter:F,uid:F.uid};return F.on("connect",U),(N=k.setup)==null||N.call(k),k}function d(B){const{info:F}=B,k=B.provider;return $k({target:{...F,id:F.rdns,provider:k}})}const p=new Map;function g(B={}){const F=B.chainId??R.getState().chainId,k=o.getState().find(W=>W.id===F);if(B.chainId&&!k)throw new Dm;{const W=p.get(R.getState().chainId);if(W&&!k)return W;if(!k)throw new Dm}{const W=p.get(F);if(W)return W}let N;if(s.client)N=s.client({chain:k});else{const W=k.id,Y=o.getState().map(u=>u.id),z={},P=Object.entries(s);for(const[u,l]of P)if(!(u==="chains"||u==="client"||u==="connectors"||u==="transports"))if(typeof l=="object")if(W in l)z[u]=l[W];else{if(Y.some(w=>w in l))continue;z[u]=l}else z[u]=l;N=ege({...z,chain:k,batch:z.batch??{multicall:!0},transport:u=>s.transports[W]({...u,connectors:f})})}return p.set(F,N),N}function x(){return{chainId:o.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let S;const I="0.0.0-canary-";hT.startsWith(I)?S=Number.parseInt(hT.replace(I,"")):S=Number.parseInt(hT.split(".")[0]??"0");const R=xL($ze(r?jze(x,{migrate(B,F){if(F===S)return B;const k=x(),N=O(B,k.chainId);return{...k,chainId:N}},name:"store",partialize(B){return{connections:{__type:"Map",value:Array.from(B.connections.entries()).map(([F,k])=>{const{id:N,name:W,type:Y,uid:z}=k.connector;return[F,{...k,connector:{id:N,name:W,type:Y,uid:z}}]})},chainId:B.chainId,current:B.current}},merge(B,F){typeof B=="object"&&B&&"status"in B&&delete B.status;const k=O(B,F.chainId);return{...F,...B,chainId:k}},skipHydration:i,storage:r,version:S}):x));function O(B,F){return B&&typeof B=="object"&&"chainId"in B&&typeof B.chainId=="number"&&o.getState().some(k=>k.id===B.chainId)?B.chainId:F}n&&R.subscribe(({connections:B,current:F})=>{var k;return F?(k=B.get(F))==null?void 0:k.chainId:void 0},B=>{if(o.getState().some(k=>k.id===B))return R.setState(k=>({...k,chainId:B??k.chainId}))}),a==null||a.subscribe(B=>{const F=new Map;for(const N of f.getState())F.set(N.id,!0);const k=[];for(const N of B){const W=c(d(N));F.has(W.id)||k.push(W)}r&&!R.persist.hasHydrated()||f.setState(N=>[...N,...k],!0)});function M(B){R.setState(F=>{const k=F.connections.get(B.uid);return k?{...F,connections:new Map(F.connections).set(B.uid,{accounts:B.accounts??k.accounts,chainId:B.chainId??k.chainId,connector:k.connector})}:F})}function U(B){R.getState().status==="connecting"||R.getState().status==="reconnecting"||R.setState(F=>{const k=f.getState().find(N=>N.uid===B.uid);return k?(k.emitter.listenerCount("connect")&&k.emitter.off("connect",M),k.emitter.listenerCount("change")||k.emitter.on("change",M),k.emitter.listenerCount("disconnect")||k.emitter.on("disconnect",D),{...F,connections:new Map(F.connections).set(B.uid,{accounts:B.accounts,chainId:B.chainId,connector:k}),current:B.uid,status:"connected"}):F})}function D(B){R.setState(F=>{const k=F.connections.get(B.uid);if(k){const W=k.connector;W.emitter.listenerCount("change")&&k.connector.emitter.off("change",M),W.emitter.listenerCount("disconnect")&&k.connector.emitter.off("disconnect",D),W.emitter.listenerCount("connect")||k.connector.emitter.on("connect",U)}if(F.connections.delete(B.uid),F.connections.size===0)return{...F,connections:new Map,current:null,status:"disconnected"};const N=F.connections.values().next().value;return{...F,connections:new Map(F.connections),current:N.connector.uid}})}return{get chains(){return o.getState()},get connectors(){return f.getState()},storage:r,getClient:g,get state(){return R.getState()},setState(B){let F;typeof B=="function"?F=B(R.getState()):F=B;const k=x();typeof F!="object"&&(F=k),Object.keys(k).some(W=>!(W in F))&&(F=k),R.setState(F,!0)},subscribe(B,F,k){return R.subscribe(B,F,k?{...k,fireImmediately:k.emitImmediately}:void 0)},_internal:{mipd:a,store:R,ssr:!!i,syncConnectedChain:n,transports:s.transports,chains:{setState(B){const F=typeof B=="function"?B(o.getState()):B;if(F.length!==0)return o.setState(F,!0)},subscribe(B){return o.subscribe(B)}},connectors:{providerDetailToConnector:d,setup:c,setState(B){return f.setState(typeof B=="function"?B(f.getState()):B,!0)},subscribe(B){return f.subscribe(B)}},events:{change:M,connect:U,disconnect:D}}}}function Jze(t,e){const{initialState:r,reconnectOnMount:n}=e;return r&&!t._internal.store.persist.hasHydrated()&&t.setState({...r,chainId:t.chains.some(i=>i.id===r.chainId)?r.chainId:t.chains[0].id,connections:n?r.connections:new Map,status:n?"reconnecting":"disconnected"}),{async onMount(){var i;if(t._internal.ssr){await t._internal.store.persist.rehydrate();const s=(i=t._internal.mipd)==null?void 0:i.getProviders().map(t._internal.connectors.providerDetailToConnector).map(t._internal.connectors.setup);t._internal.connectors.setState(a=>[...a,...s??[]])}n?rge(t):t.storage&&t.setState(s=>({...s,connections:new Map}))}}}const Xze={getItem(t){return typeof window>"u"?null:eqe(document.cookie,t)??null},setItem(t,e){typeof window>"u"||(document.cookie=`${t}=${e};path=/;samesite=Lax`)},removeItem(t){typeof window>"u"||(document.cookie=`${t}=;max-age=-1;path=/`)}};function eqe(t,e){const r=t.split("; ").find(n=>n.startsWith(`${e}=`));if(r)return r.substring(e.length+1)}function tqe(t){var s,a,o;const{chain:e}=t,r=e.rpcUrls.default.http[0];if(!t.transports)return[r];const n=(a=(s=t.transports)==null?void 0:s[e.id])==null?void 0:a.call(s,{chain:e});return(((o=n==null?void 0:n.value)==null?void 0:o.transports)||[n]).map(({value:f})=>(f==null?void 0:f.url)||r)}function rqe(t){const{children:e,config:r,initialState:n,reconnectOnMount:i=!0}=t,{onMount:s}=Jze(r,{initialState:n,reconnectOnMount:i});r._internal.ssr||s();const a=Fn.useRef(!0);return Fn.useEffect(()=>{if(a.current&&r._internal.ssr)return s(),()=>{a.current=!1}},[]),e}const oge=Fn.createContext(void 0);function nqe(t){const{children:e,config:r}=t,n={value:r};return Fn.createElement(rqe,t,Fn.createElement(oge.Provider,n,e))}const iqe="2.12.12",sqe=()=>`wagmi@${iqe}`;class aqe extends Wh{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return sqe()}}class oqe extends aqe{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function vK(t={}){const e=t.config??Fn.useContext(oge);if(!e)throw new oqe;return e}var fge={exports:{}},cge={},uge={exports:{}},lge={};/** +`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:o,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.reason=f,this.signature=c}}class kFe extends kt{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class PFe extends kt{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class dK extends kt{constructor({data:e,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}function hK(t,e){var n,i,s,a,o,f;if(!(t instanceof kt))return!1;const r=t.walk(c=>c instanceof xq);return r instanceof xq?!!(((n=r.data)==null?void 0:n.errorName)==="ResolverNotFound"||((i=r.data)==null?void 0:i.errorName)==="ResolverWildcardNotSupported"||((s=r.data)==null?void 0:s.errorName)==="ResolverNotContract"||((a=r.data)==null?void 0:a.errorName)==="ResolverError"||((o=r.data)==null?void 0:o.errorName)==="HttpError"||(f=r.reason)!=null&&f.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&r.reason===Ume[50]):!1}function Fme(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return yh(e)?e:null}function dT(t){let e=new Uint8Array(32).fill(0);if(!t)return Z0(e);const r=t.split(".");for(let n=r.length-1;n>=0;n-=1){const i=Fme(r[n]),s=i?_k(i):V6(fm(r[n]),"bytes");e=V6(km([e,s]),"bytes")}return Z0(e)}function NFe(t){return`[${t.slice(2)}]`}function OFe(t){const e=new Uint8Array(32).fill(0);return t?Fme(t)||V6(fm(t)):Z0(e)}function pK(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const r=new Uint8Array(fm(e).byteLength+2);let n=0;const i=e.split(".");for(let s=0;s255&&(a=fm(NFe(OFe(i[s])))),r[n]=a.length,r.set(a,n+1),n+=a.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}const DFe=3;function ox(t,{abi:e,address:r,args:n,docsPath:i,functionName:s,sender:a}){const{code:o,data:f,message:c,shortMessage:d}=t instanceof dK?t:t instanceof kt?t.walk(g=>"data"in g)||t.walk():{},p=t instanceof Ck?new kFe({functionName:s}):[DFe,Nm.code].includes(o)&&(f||c||d)?new xq({abi:e,data:typeof f=="object"?f.data:f,functionName:s,message:d??c}):t;return new lK(p,{abi:e,args:n,contractAddress:r,docsPath:i,functionName:s,sender:a})}const $Fe="0x82ad56cb",BFe="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",UFe="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function LFe(t,{docsPath:e,...r}){const n=(()=>{const i=tK(t,r);return i instanceof Ik?t:i})();return new MFe(n,{docsPath:e,...r})}const bL=new Map;function jme({fn:t,id:e,shouldSplitBatch:r,wait:n=0,sort:i}){const s=async()=>{const d=f();a();const p=d.map(({args:g})=>g);p.length!==0&&t(p).then(g=>{var x;i&&Array.isArray(g)&&g.sort(i);for(let S=0;S{var x;for(let S=0;SbL.delete(e),o=()=>f().map(({args:d})=>d),f=()=>bL.get(e)||[],c=d=>bL.set(e,[...f(),d]);return{flush:a,async schedule(d){const p={},g=new Promise((I,R)=>{p.resolve=I,p.reject=R});return(r==null?void 0:r([...o(),d]))&&s(),f().length>0?(c({args:d,pendingPromise:p}),g):(c({args:d,pendingPromise:p}),setTimeout(s,n),g)}}}async function mK(t,e){var z,P,u,l;const{account:r=t.account,batch:n=!!((z=t.batch)!=null&&z.multicall),blockNumber:i,blockTag:s="latest",accessList:a,blobs:o,code:f,data:c,factory:d,factoryData:p,gas:g,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:I,maxPriorityFeePerGas:R,nonce:O,to:M,value:U,stateOverride:D,...B}=e,F=r?Qo(r):void 0;if(f&&(d||p))throw new kt("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(f&&M)throw new kt("Cannot provide both `code` & `to` as parameters.");const k=f&&c,N=d&&p&&M&&c,W=k||N,Y=k?zFe({code:f,data:c}):N?qFe({data:c,factory:d,factoryData:p,to:M}):c;try{d_(e);const w=(i?Tr(i):void 0)||s,_=ume(D),E=(l=(u=(P=t.chain)==null?void 0:P.formatters)==null?void 0:u.transactionRequest)==null?void 0:l.format,v=(E||Rk)({...rK(B,{format:E}),from:F==null?void 0:F.address,accessList:a,blobs:o,data:Y,gas:g,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:I,maxPriorityFeePerGas:R,nonce:O,to:W?void 0:M,value:U});if(n&&FFe({request:v})&&!_)try{return await jFe(t,{...v,blockNumber:i,blockTag:s})}catch(A){if(!(A instanceof tme)&&!(A instanceof aq))throw A}const m=await t.request({method:"eth_call",params:_?[v,w,_]:[v,w]});return m==="0x"?{data:void 0}:{data:m}}catch(h){const w=HFe(h),{offchainLookup:_,offchainLookupSignature:E}=await Ya(async()=>{const{offchainLookup:T,offchainLookupSignature:v}=await import("./ccip-Cm4i_WNz.js");return{offchainLookup:T,offchainLookupSignature:v}},[]);if(t.ccipRead!==!1&&(w==null?void 0:w.slice(0,10))===E&&M)return{data:await _(t,{data:w,to:M})};throw W&&(w==null?void 0:w.slice(0,10))==="0x101bb98d"?new PFe({factory:d}):LFe(h,{...e,account:F,chain:t.chain})}}function FFe({request:t}){const{data:e,to:r,...n}=t;return!(!e||e.startsWith($Fe)||!r||Object.values(n).filter(i=>typeof i<"u").length>0)}async function jFe(t,e){var I;const{batchSize:r=1024,wait:n=0}=typeof((I=t.batch)==null?void 0:I.multicall)=="object"?t.batch.multicall:{},{blockNumber:i,blockTag:s="latest",data:a,multicallAddress:o,to:f}=e;let c=o;if(!c){if(!t.chain)throw new tme;c=h_({blockNumber:i,chain:t.chain,contract:"multicall3"})}const p=(i?Tr(i):void 0)||s,{schedule:g}=jme({id:`${t.uid}.${p}`,wait:n,shouldSplitBatch(R){return R.reduce((M,{data:U})=>M+(U.length-2),0)>r*2},fn:async R=>{const O=R.map(D=>({allowFailure:!0,callData:D.data,target:D.to})),M=vg({abi:mq,args:[O],functionName:"aggregate3"}),U=await t.request({method:"eth_call",params:[{data:M,to:c},p]});return xw({abi:mq,args:[O],functionName:"aggregate3",data:U||"0x"})}}),[{returnData:x,success:S}]=await g({data:a,to:f});if(!S)throw new dK({data:x});return x==="0x"?{data:void 0}:{data:x}}function zFe(t){const{code:e,data:r}=t;return YG({abi:Dme(["constructor(bytes, bytes)"]),bytecode:BFe,args:[e,r]})}function qFe(t){const{data:e,factory:r,factoryData:n,to:i}=t;return YG({abi:Dme(["constructor(address, bytes, address, bytes)"]),bytecode:UFe,args:[i,e,r,n]})}function HFe(t){var r;if(!(t instanceof kt))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(r=e.data)==null?void 0:r.data:e.data}async function Om(t,e){const{abi:r,address:n,args:i,functionName:s,...a}=e,o=vg({abi:r,args:i,functionName:s});try{const{data:f}=await Qn(t,mK,"call")({...a,data:o,to:n});return xw({abi:r,args:i,functionName:s,data:f||"0x"})}catch(f){throw ox(f,{abi:r,address:n,args:i,docsPath:"/docs/contract/readContract",functionName:s})}}async function VFe(t,{blockNumber:e,blockTag:r,coinType:n,name:i,gatewayUrls:s,strict:a,universalResolverAddress:o}){let f=o;if(!f){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");f=h_({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const c=vg({abi:Hse,functionName:"addr",...n!=null?{args:[dT(i),BigInt(n)]}:{args:[dT(i)]}}),d={address:f,abi:Ame,functionName:"resolve",args:[Er(pK(i)),c],blockNumber:e,blockTag:r},p=Qn(t,Om,"readContract"),g=s?await p({...d,args:[...d.args,s]}):await p(d);if(g[0]==="0x")return null;const x=xw({abi:Hse,args:n!=null?[dT(i),BigInt(n)]:void 0,functionName:"addr",data:g[0]});return x==="0x"||h1(x)==="0x00"?null:x}catch(c){if(a)throw c;if(hK(c,"resolve"))return null;throw c}}class WFe extends kt{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)}`],name:"EnsAvatarInvalidMetadataError"})}}class kv extends kt{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class gK extends kt{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.`,{name:"EnsAvatarUriResolutionError"})}}class GFe extends kt{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const KFe=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,QFe=/^(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\-.]+))?(?\/.*)?$/,ZFe=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,YFe=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function JFe(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 Kse(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function zme({uri:t,gatewayUrls:e}){const r=ZFe.test(t);if(r)return{uri:t,isOnChain:!0,isEncoded:r};const n=Kse(e==null?void 0:e.ipfs,"https://ipfs.io"),i=Kse(e==null?void 0:e.arweave,"https://arweave.net"),s=t.match(KFe),{protocol:a,subpath:o,target:f,subtarget:c=""}=(s==null?void 0:s.groups)||{},d=a==="ipns:/"||o==="ipns/",p=a==="ipfs:/"||o==="ipfs/"||QFe.test(t);if(t.startsWith("http")&&!d&&!p){let x=t;return e!=null&&e.arweave&&(x=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:x,isOnChain:!1,isEncoded:!1}}if((d||p)&&f)return{uri:`${n}/${d?"ipns":"ipfs"}/${f}${c}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&f)return{uri:`${i}/${f}${c||""}`,isOnChain:!1,isEncoded:!1};let g=t.replace(YFe,"");if(g.startsWith("i.json());return await bK({gatewayUrls:t,uri:qme(r)})}catch{throw new gK({uri:e})}}async function bK({gatewayUrls:t,uri:e}){const{uri:r,isOnChain:n}=zme({uri:e,gatewayUrls:t});if(n||await JFe(r))return r;throw new gK({uri:e})}function eje(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=e.split("/"),[s,a]=r.split(":"),[o,f]=n.split(":");if(!s||s.toLowerCase()!=="eip155")throw new kv({reason:"Only EIP-155 supported"});if(!a)throw new kv({reason:"Chain ID not found"});if(!f)throw new kv({reason:"Contract address not found"});if(!i)throw new kv({reason:"Token ID not found"});if(!o)throw new kv({reason:"ERC namespace not found"});return{chainID:Number.parseInt(a),namespace:o.toLowerCase(),contractAddress:f,tokenID:i}}async function tje(t,{nft:e}){if(e.namespace==="erc721")return Om(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 Om(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 GFe({namespace:e.namespace})}async function rje(t,{gatewayUrls:e,record:r}){return/eip155:/i.test(r)?nje(t,{gatewayUrls:e,record:r}):bK({uri:r,gatewayUrls:e})}async function nje(t,{gatewayUrls:e,record:r}){const n=eje(r),i=await tje(t,{nft:n}),{uri:s,isOnChain:a,isEncoded:o}=zme({uri:i,gatewayUrls:e});if(a&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=o?atob(s.replace("data:application/json;base64,","")):s,d=JSON.parse(c);return bK({uri:qme(d),gatewayUrls:e})}let f=n.tokenID;return n.namespace==="erc1155"&&(f=f.replace("0x","").padStart(64,"0")),XFe({gatewayUrls:e,uri:s.replace(/(?:0x)?{id}/,f)})}async function ije(t,{blockNumber:e,blockTag:r,name:n,key:i,gatewayUrls:s,strict:a,universalResolverAddress:o}){let f=o;if(!f){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");f=h_({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const c={address:f,abi:Ame,functionName:"resolve",args:[Er(pK(n)),vg({abi:qse,functionName:"text",args:[dT(n),i]})],blockNumber:e,blockTag:r},d=Qn(t,Om,"readContract"),p=s?await d({...c,args:[...c.args,s]}):await d(c);if(p[0]==="0x")return null;const g=xw({abi:qse,functionName:"text",data:p[0]});return g===""?null:g}catch(c){if(a)throw c;if(hK(c,"resolve"))return null;throw c}}async function sje(t,{blockNumber:e,blockTag:r,assetGatewayUrls:n,name:i,gatewayUrls:s,strict:a,universalResolverAddress:o}){const f=await Qn(t,ije,"getEnsText")({blockNumber:e,blockTag:r,key:"avatar",name:i,universalResolverAddress:o,gatewayUrls:s,strict:a});if(!f)return null;try{return await rje(t,{record:f,gatewayUrls:n})}catch{return null}}async function aje(t,{address:e,blockNumber:r,blockTag:n,gatewayUrls:i,strict:s,universalResolverAddress:a}){let o=a;if(!o){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=h_({blockNumber:r,chain:t.chain,contract:"ensUniversalResolver"})}const f=`${e.toLowerCase().substring(2)}.addr.reverse`;try{const c={address:o,abi:TLe,functionName:"reverse",args:[Er(pK(f))],blockNumber:r,blockTag:n},d=Qn(t,Om,"readContract"),[p,g]=i?await d({...c,args:[...c.args,i]}):await d(c);return e.toLowerCase()!==g.toLowerCase()?null:p}catch(c){if(s)throw c;if(hK(c,"reverse"))return null;throw c}}const oje=new Map,fje=new Map;function cje(t){const e=(i,s)=>({clear:()=>s.delete(i),get:()=>s.get(i),set:a=>s.set(i,a)}),r=e(t,oje),n=e(t,fje);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function uje(t,{cacheKey:e,cacheTime:r=Number.POSITIVE_INFINITY}){const n=cje(e),i=n.response.get();if(i&&r>0&&new Date().getTime()-i.created.getTime()`blockNumber.${t}`;async function dje(t,{cacheTime:e=t.cacheTime}={}){const r=await uje(()=>t.request({method:"eth_blockNumber"}),{cacheKey:lje(t.uid),cacheTime:e});return BigInt(r)}function hje(t,{args:e,eventName:r}={}){return{...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,logIndex:t.logIndex?Number(t.logIndex):null,transactionHash:t.transactionHash?t.transactionHash:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,...r?{args:e,eventName:r}:{}}}async function Hme(t,{blockHash:e,blockNumber:r,blockTag:n,hash:i,index:s}){var d,p,g;const a=n||"latest",o=r!==void 0?Tr(r):void 0;let f=null;if(i?f=await t.request({method:"eth_getTransactionByHash",params:[i]},{dedupe:!0}):e?f=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,Tr(s)]},{dedupe:!0}):(o||a)&&(f=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||a,Tr(s)]},{dedupe:!!o})),!f)throw new nme({blockHash:e,blockNumber:r,blockTag:a,hash:i,index:s});return(((g=(p=(d=t.chain)==null?void 0:d.formatters)==null?void 0:p.transaction)==null?void 0:g.format)||Pk)(f)}const pje={"0x0":"reverted","0x1":"success"};function Vme(t){const e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs?t.logs.map(r=>hje(r)):null,to:t.to?t.to:null,transactionIndex:t.transactionIndex?H6(t.transactionIndex):null,status:t.status?pje[t.status]:null,type:t.type?ome[t.type]||t.type:null};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),e}const mje=nK("transactionReceipt",Vme);async function Qse(t,{hash:e}){var i,s,a;const r=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!r)throw new ime({hash:e});return(((a=(s=(i=t.chain)==null?void 0:i.formatters)==null?void 0:s.transactionReceipt)==null?void 0:a.format)||Vme)(r)}async function gje(t,e){var R;const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:s,multicallAddress:a,stateOverride:o}=e,f=e.contracts,c=n??(typeof((R=t.batch)==null?void 0:R.multicall)=="object"&&t.batch.multicall.batchSize||1024);let d=a;if(!d){if(!t.chain)throw new Error("client chain not configured. multicallAddress is required.");d=h_({blockNumber:i,chain:t.chain,contract:"multicall3"})}const p=[[]];let g=0,x=0;for(let O=0;O0&&x>c&&p[g].length>0&&(g++,x=(F.length-2)/2,p[g]=[]),p[g]=[...p[g],{allowFailure:!0,callData:F,target:U}]}catch(F){const k=ox(F,{abi:M,address:U,args:D,docsPath:"/docs/contract/multicall",functionName:B});if(!r)throw k;p[g]=[...p[g],{allowFailure:!0,callData:"0x",target:U}]}}const S=await Promise.allSettled(p.map(O=>Qn(t,Om,"readContract")({abi:mq,address:d,args:[O],blockNumber:i,blockTag:s,functionName:"aggregate3",stateOverride:o}))),I=[];for(let O=0;OyL.get(t)||[],s=()=>{const d=i();yL.set(t,d.filter(p=>p.id!==n))},a=()=>{const d=Zse.get(t);i().length===1&&d&&d(),s()},o=i();if(yL.set(t,[...o,{id:n,fns:e}]),o&&o.length>0)return a;const f={};for(const d in e)f[d]=(...p)=>{var x,S;const g=i();if(g.length!==0)for(const I of g)(S=(x=I.fns)[d])==null||S.call(x,...p)};const c=r(f);return typeof c=="function"&&Zse.set(t,c),a}async function $I(t){return new Promise(e=>setTimeout(e,t))}function yje(t,{emitOnBegin:e,initialWaitTime:r,interval:n}){let i=!0;const s=()=>i=!1;return(async()=>{let o;e&&(o=await t({unpoll:s}));const f=await(r==null?void 0:r(o))??n;await $I(f);const c=async()=>{i&&(await t({unpoll:s}),await $I(n),c())};c()})(),s}function wje(t,{emitOnBegin:e=!1,emitMissed:r=!1,onBlockNumber:n,onError:i,poll:s,pollingInterval:a=t.pollingInterval}){const o=typeof s<"u"?s:!(t.transport.type==="webSocket"||t.transport.type==="fallback"&&t.transport.transports[0].config.type==="webSocket");let f;return o?(()=>{const p=sc(["watchBlockNumber",t.uid,e,r,a]);return Aq(p,{onBlockNumber:n,onError:i},g=>yje(async()=>{var x;try{const S=await Qn(t,dje,"getBlockNumber")({cacheTime:0});if(f){if(S===f)return;if(S-f>1&&r)for(let I=f+1n;If)&&(g.onBlockNumber(S,f),f=S)}catch(S){(x=g.onError)==null||x.call(g,S)}},{emitOnBegin:e,interval:a}))})():(()=>{const p=sc(["watchBlockNumber",t.uid,e,r]);return Aq(p,{onBlockNumber:n,onError:i},g=>{let x=!0,S=()=>x=!1;return(async()=>{try{const I=(()=>{if(t.transport.type==="fallback"){const O=t.transport.transports.find(M=>M.config.type==="webSocket");return O?O.value:t.transport}return t.transport})(),{unsubscribe:R}=await I.subscribe({params:["newHeads"],onData(O){var U;if(!x)return;const M=hu((U=O.result)==null?void 0:U.number);g.onBlockNumber(M,f),f=M},onError(O){var M;(M=g.onError)==null||M.call(g,O)}});S=R,x||S()}catch(I){i==null||i(I)}})(),()=>S()})})()}async function vje(t){var r;return((r=t.account)==null?void 0:r.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"},{dedupe:!0})).map(n=>f_(n))}async function xje(t){return await t.request({method:"wallet_getPermissions"},{dedupe:!0})}const JC=new VG(8192);function Aje(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(JC.get(r))return JC.get(r);const n=t().finally(()=>JC.delete(r));return JC.set(r,n),n}function BI(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((i,s)=>{const a=async({count:o=0}={})=>{const f=async({error:c})=>{const d=typeof e=="function"?e({count:o,error:c}):e;d&&await $I(d),a({count:o+1})};try{const c=await t();i(c)}catch(c){if(o{const{dedupe:i=!1,retryDelay:s=150,retryCount:a=3,uid:o}={...e,...n},f=i?V6(Ek(`${o}.${sc(r)}`)):void 0;return Aje(()=>BI(async()=>{try{return await t(r)}catch(c){const d=c;switch(d.code){case G7.code:throw new G7(d);case K7.code:throw new K7(d);case Q7.code:throw new Q7(d,{method:r.method});case Z7.code:throw new Z7(d);case Nm.code:throw new Nm(d);case Y7.code:throw new Y7(d);case J7.code:throw new J7(d);case P6.code:throw new P6(d);case hy.code:throw new hy(d);case X7.code:throw new X7(d,{method:r.method});case py.code:throw new py(d);case ex.code:throw new ex(d);case ci.code:throw new ci(d);case tx.code:throw new tx(d);case rx.code:throw new rx(d);case nx.code:throw new nx(d);case ix.code:throw new ix(d);case to.code:throw new to(d);case 5e3:throw new ci(d);default:throw c instanceof kt?c:new ZUe(d)}}},{delay:({count:c,error:d})=>{var p;if(d&&d instanceof q9){const g=(p=d==null?void 0:d.headers)==null?void 0:p.get("Retry-After");if(g!=null&&g.match(/\d/))return Number.parseInt(g)*1e3}return~~(1<Eje(c)}),{enabled:i,id:f})}}function Eje(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===py.code||t.code===Nm.code:t instanceof q9&&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:!0}function Wme(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}const Cje=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Sje=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Gme(t,{errorInstance:e=new Error("timed out"),timeout:r,signal:n}){return new Promise((i,s)=>{(async()=>{let a;try{const o=new AbortController;r>0&&(a=setTimeout(()=>{n?o.abort():s(e)},r)),i(await t({signal:(o==null?void 0:o.signal)||null}))}catch(o){(o==null?void 0:o.name)==="AbortError"&&s(e),s(o)}finally{clearTimeout(a)}})()})}function Tje(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Yse=Tje();function Ije(t,e={}){return{async request(r){var p;const{body:n,onRequest:i=e.onRequest,onResponse:s=e.onResponse,timeout:a=e.timeout??1e4}=r,o={...e.fetchOptions??{},...r.fetchOptions??{}},{headers:f,method:c,signal:d}=o;try{const g=await Gme(async({signal:S})=>{const I={...o,body:Array.isArray(n)?sc(n.map(M=>({jsonrpc:"2.0",id:M.id??Yse.take(),...M}))):sc({jsonrpc:"2.0",id:n.id??Yse.take(),...n}),headers:{"Content-Type":"application/json",...f},method:c||"POST",signal:d||(a>0?S:null)},R=new Request(t,I);return i&&await i(R),await fetch(t,I)},{errorInstance:new Bse({body:n,url:t}),timeout:a,signal:!0});s&&await s(g);let x;if((p=g.headers.get("Content-Type"))!=null&&p.startsWith("application/json")?x=await g.json():(x=await g.text(),x=JSON.parse(x||"{}")),!g.ok)throw new q9({body:n,details:sc(x.error)||g.statusText,headers:g.headers,status:g.status,url:t});return x}catch(g){throw g instanceof q9||g instanceof Bse?g:new q9({body:n,cause:g,url:t})}}}}function Rje(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(f,c)=>{const d={...c};for(const p of f){const{name:g,type:x}=p;x==="address"&&(d[g]=d[g].toLowerCase())}return d},a=i.EIP712Domain?e?s(i.EIP712Domain,e):{}:{},o=(()=>{if(n!=="EIP712Domain")return s(i[n],r)})();return sc({domain:a,message:o,primaryType:n,types:i})}function Mje(t){const{domain:e,message:r,primaryType:n,types:i}=t,s=(a,o)=>{for(const f of a){const{name:c,type:d}=f,p=o[c],g=d.match(Sje);if(g&&(typeof p=="number"||typeof p=="bigint")){const[I,R,O]=g;Tr(p,{signed:R==="int",size:Number.parseInt(O)/8})}if(d==="address"&&typeof p=="string"&&!js(p))throw new Lo({address:p});const x=d.match(Cje);if(x){const[I,R]=x;if(R&&f0(p)!==Number.parseInt(R))throw new VBe({expectedSize:Number.parseInt(R),givenSize:f0(p)})}const S=i[d];S&&s(S,p)}};i.EIP712Domain&&e&&s(i.EIP712Domain,e),n!=="EIP712Domain"&&s(i[n],r)}function kje({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)}function Pje(t){const{authorizationList:e}=t;if(e)for(const r of e){const{contractAddress:n,chainId:i}=r;if(!js(n))throw new Lo({address:n});if(i<=0)throw new Tk({chainId:i})}yK(t)}function Nje(t){const{blobVersionedHashes:e}=t;if(e){if(e.length===0)throw new gme;for(const r of e){const n=f0(r),i=H6(V7(r,0,1));if(n!==32)throw new _Le({hash:r,size:n});if(i!==mme)throw new ELe({hash:r,version:i})}}yK(t)}function yK(t){const{chainId:e,maxPriorityFeePerGas:r,maxFeePerGas:n,to:i}=t;if(e<=0)throw new Tk({chainId:e});if(i&&!js(i))throw new Lo({address:i});if(n&&n>Mk)throw new Pm({maxFeePerGas:n});if(r&&n&&r>n)throw new W7({maxFeePerGas:n,maxPriorityFeePerGas:r})}function Oje(t){const{chainId:e,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:s}=t;if(e<=0)throw new Tk({chainId:e});if(s&&!js(s))throw new Lo({address:s});if(r||i)throw new kt("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>Mk)throw new Pm({maxFeePerGas:n})}function Dje(t){const{chainId:e,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:s}=t;if(s&&!js(s))throw new Lo({address:s});if(typeof e<"u"&&e<=0)throw new Tk({chainId:e});if(r||i)throw new kt("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>Mk)throw new Pm({maxFeePerGas:n})}function $je(t){if(!t||t.length===0)return[];const e=[];for(const r of t){const{contractAddress:n,chainId:i,nonce:s,...a}=r;e.push([Er(i),n,s?Er(s):"0x",...p_({},a)])}return e}function Dk(t){if(!t||t.length===0)return[];const e=[];for(let r=0;r"u"||typeof x>"u")){const U=typeof t.blobs[0]=="string"?t.blobs:t.blobs.map(F=>Z0(F)),D=t.kzg,B=aK({blobs:U,kzg:D});if(typeof g>"u"&&(g=dme({commitments:B})),typeof x>"u"){const F=oK({blobs:U,commitments:B,kzg:D});x=bme({blobs:U,commitments:B,proofs:F})}}const S=Dk(d),I=[Er(r),i?Er(i):"0x",c?Er(c):"0x",f?Er(f):"0x",n?Er(n):"0x",s??"0x",a?Er(a):"0x",p??"0x",S,o?Er(o):"0x",g??[],...p_(t,e)],R=[],O=[],M=[];if(x)for(let U=0;U{if(e.v>=35n)return(e.v-35n)/2n>0?e.v:27n+(e.v===35n?0n:1n);if(r>0)return BigInt(r*2)+BigInt(35n+e.v-27n);const x=27n+(e.v===27n?0n:1n);if(e.v!==x)throw new HUe({v:e.v});return x})(),p=h1(e.r),g=h1(e.s);c=[...c,Er(d),p==="0x00"?"0x":p,g==="0x00"?"0x":g]}else r>0&&(c=[...c,Er(r),"0x","0x"]);return W6(c)}function p_(t,e){const r=e??t,{v:n,yParity:i}=r;if(typeof r.r>"u")return[];if(typeof r.s>"u")return[];if(typeof n>"u"&&typeof i>"u")return[];const s=h1(r.r),a=h1(r.s);return[typeof i=="number"?i?Er(1):"0x":n===0n?"0x":n===1n?Er(1):n===27n?"0x":Er(1),s==="0x00"?"0x":s,a==="0x00"?"0x":a]}class qje extends kt{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function Hje(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new qje({value:t});let[r,n="0"]=t.split(".");const i=r.startsWith("-");if(i&&(r=r.slice(1)),n=n.replace(/(0+)$/,""),e===0)Math.round(+`.${n}`)===1&&(r=`${BigInt(r)+1n}`),n="";else if(n.length>e){const[s,a,o]=[n.slice(0,e-1),n.slice(e-1,e),n.slice(e)],f=Math.round(+`${a}.${o}`);f>9?n=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):n=`${s}${f}`,n.length>e&&(n=n.slice(1),r=`${BigInt(r)+1n}`),n=n.slice(0,e)}else n=n.padEnd(e,"0");return BigInt(`${i?"-":""}${r}${n}`)}async function Vje(t,{confirmations:e=1,hash:r,onReplaced:n,pollingInterval:i=t.pollingInterval,retryCount:s=6,retryDelay:a=({count:f})=>~~(1<{o&&setTimeout(()=>I(new $se({hash:r})),o);const R=Aq(f,{onReplaced:n,resolve:S,reject:I},O=>{const M=Qn(t,wje,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(U){const D=F=>{M(),F(),R()};let B=U;if(!x){c>s&&D(()=>O.reject(new $se({hash:r})));try{if(g){if(e>1&&(!g.blockNumber||B-g.blockNumber+1nO.resolve(g));return}if(d||(x=!0,await BI(async()=>{d=await Qn(t,Hme,"getTransaction")({hash:r}),d.blockNumber&&(B=d.blockNumber)},{delay:a,retryCount:s}),x=!1),g=await Qn(t,Qse,"getTransactionReceipt")({hash:r}),e>1&&(!g.blockNumber||B-g.blockNumber+1nO.resolve(g))}catch(F){if(F instanceof nme||F instanceof ime){if(!d){x=!1;return}try{p=d,x=!0;const k=await BI(()=>Qn(t,sx,"getBlock")({blockNumber:B,includeTransactions:!0}),{delay:a,retryCount:s,shouldRetry:({error:Y})=>Y instanceof ame});x=!1;const N=k.transactions.find(({from:Y,nonce:z})=>Y===p.from&&z===p.nonce);if(!N||(g=await Qn(t,Qse,"getTransactionReceipt")({hash:N.hash}),e>1&&(!g.blockNumber||B-g.blockNumber+1n{var Y;(Y=O.onReplaced)==null||Y.call(O,{reason:W,replacedTransaction:p,transaction:N,transactionReceipt:g}),O.resolve(g)})}catch(k){D(()=>O.reject(k))}}else D(()=>O.reject(F))}finally{c++}}}})})})}async function Wje(t){return(await t.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>$s(r))}async function Gje(t,e){return t.request({method:"wallet_requestPermissions",params:[e]},{retryCount:0})}async function Kje(t,e){var c,d,p,g;const{account:r=t.account,chain:n=t.chain,...i}=e;if(!r)throw new c_({docsPath:"/docs/actions/wallet/signTransaction"});const s=Qo(r);d_({account:s,...e});const a=await Qn(t,kk,"getChainId")({});n!==null&&rme({currentChainId:a,chain:n});const o=(n==null?void 0:n.formatters)||((c=t.chain)==null?void 0:c.formatters),f=((d=o==null?void 0:o.transactionRequest)==null?void 0:d.format)||Rk;return s.signTransaction?s.signTransaction({...i,chainId:a},{serializer:(g=(p=t.chain)==null?void 0:p.serializers)==null?void 0:g.transaction}):await t.request({method:"eth_signTransaction",params:[{...f(i),chainId:Tr(a),from:s.address}]},{retryCount:0})}async function Kme(t,{account:e=t.account,message:r}){if(!e)throw new c_({docsPath:"/docs/actions/wallet/signMessage"});const n=Qo(e);if(n.signMessage)return n.signMessage({message:r});const i=typeof r=="string"?Ek(r):r.raw instanceof Uint8Array?Er(r.raw):r.raw;return t.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}async function Qje(t,e){const{account:r=t.account,domain:n,message:i,primaryType:s}=e;if(!r)throw new c_({docsPath:"/docs/actions/wallet/signTypedData"});const a=Qo(r),o={EIP712Domain:kje({domain:n}),...e.types};if(Mje({domain:n,message:i,primaryType:s,types:o}),a.signTypedData)return a.signTypedData({domain:n,message:i,primaryType:s,types:o});const f=Rje({domain:n,message:i,primaryType:s,types:o});return t.request({method:"eth_signTypedData_v4",params:[a.address,f]},{retryCount:0})}async function Zje(t,e){const{abi:r,address:n,args:i,dataSuffix:s,functionName:a,...o}=e,f=o.account?Qo(o.account):t.account,c=vg({abi:r,args:i,functionName:a});try{const{data:d}=await Qn(t,mK,"call")({batch:!1,data:`${c}${s?s.replace("0x",""):""}`,to:n,...o,account:f}),p=xw({abi:r,args:i,functionName:a,data:d||"0x"}),g=r.filter(x=>"name"in x&&x.name===e.functionName);return{result:p,request:{abi:g,address:n,args:i,dataSuffix:s,functionName:a,...o,account:f}}}catch(d){throw ox(d,{abi:r,address:n,args:i,docsPath:"/docs/contract/simulateContract",functionName:a,sender:f==null?void 0:f.address})}}async function Yje(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(e)}]},{retryCount:0})}async function Jje(t,e){return await t.request({method:"wallet_watchAsset",params:e},{retryCount:0})}async function Qme(t,e){const{abi:r,account:n=t.account,address:i,args:s,dataSuffix:a,functionName:o,...f}=e;if(!n)throw new c_({docsPath:"/docs/contract/writeContract"});const c=Qo(n),d=vg({abi:r,args:s,functionName:o});try{return await Qn(t,Ok,"sendTransaction")({data:`${d}${a?a.replace("0x",""):""}`,to:i,account:c,...f})}catch(p){throw ox(p,{abi:r,address:i,args:s,docsPath:"/docs/contract/writeContract",functionName:o,sender:c.address})}}function Bs(t,e,r){const n=t[e.name];if(typeof n=="function")return n;const i=t[r];return typeof i=="function"?i:s=>e(t,s)}const hT="2.13.5",Xje=()=>`@wagmi/core@${hT}`;var Zme=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},UI,Yme;let Wh=class _q extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Xje()}constructor(e,r={}){var s;super(),UI.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=r.cause instanceof _q?r.cause.details:(s=r.cause)!=null&&s.message?r.cause.message:r.details,i=r.cause instanceof _q&&r.cause.docsPath||r.docsPath;this.message=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(` +`),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=e}walk(e){return Zme(this,UI,"m",Yme).call(this,this,e)}};UI=new WeakSet,Yme=function t(e,r){return r!=null&&r(e)?e:e.cause?Zme(this,UI,"m",t).call(this,e.cause,r):e};class Dm extends Wh{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class eze extends Wh{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class Jme extends Wh{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class tze extends Wh{constructor({address:e,connector:r}){super(`Account "${e}" not found for connector "${r.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class rze extends Wh{constructor({connectionChainId:e,connectorChainId:r}){super(`The current chain of the connector (id: ${r}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class nze extends Wh{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function Jse(t,e){var n;let r;if(typeof e.connector=="function"?r=t._internal.connectors.setup(e.connector):r=e.connector,r.uid===t.state.current)throw new eze;try{t.setState(a=>({...a,status:"connecting"})),r.emitter.emit("message",{type:"connecting"});const i=await r.connect({chainId:e.chainId}),s=i.accounts;return r.emitter.off("connect",t._internal.events.connect),r.emitter.on("change",t._internal.events.change),r.emitter.on("disconnect",t._internal.events.disconnect),await((n=t.storage)==null?void 0:n.setItem("recentConnectorId",r.id)),t.setState(a=>({...a,connections:new Map(a.connections).set(r.uid,{accounts:s,chainId:i.chainId,connector:r}),current:r.uid,status:"connected"})),{accounts:s,chainId:i.chainId}}catch(i){throw t.setState(s=>({...s,status:s.current?"connected":"disconnected"})),i}}const Eq=256;let XC=Eq,eS;function Xme(t=11){if(!eS||XC+t>Eq*2){eS="",XC=0;for(let e=0;e{const M=O(R);for(const D in S)delete M[D];const U={...R,...M};return Object.assign(U,{extend:I(U)})}}return Object.assign(S,{extend:I(S)})}function wK({key:t,name:e,request:r,retryCount:n=3,retryDelay:i=150,timeout:s,type:a},o){const f=Xme();return{config:{key:t,name:e,request:r,retryCount:n,retryDelay:i,timeout:s,type:a},request:_je(r,{retryCount:n,retryDelay:i,uid:f}),value:o}}function ize(t,e={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=e;return({retryCount:s})=>wK({key:r,name:n,request:t.request.bind(t),retryCount:e.retryCount??s,retryDelay:i,type:"custom"})}function sze(t,e={}){const{key:r="fallback",name:n="Fallback",rank:i=!1,retryCount:s,retryDelay:a}=e;return({chain:o,pollingInterval:f=4e3,timeout:c,...d})=>{let p=t,g=()=>{};const x=wK({key:r,name:n,async request({method:S,params:I}){const R=async(O=0)=>{const M=p[O]({...d,chain:o,retryCount:0,timeout:c});try{const U=await M.request({method:S,params:I});return g({method:S,params:I,response:U,transport:M,status:"success"}),U}catch(U){if(g({error:U,method:S,params:I,transport:M,status:"error"}),aze(U)||O===p.length-1)throw U;return R(O+1)}};return R()},retryCount:s,retryDelay:a,type:"fallback"},{onResponse:S=>g=S,transports:p.map(S=>S({chain:o,retryCount:0}))});if(i){const S=typeof i=="object"?i:{};oze({chain:o,interval:S.interval??f,onTransports:I=>p=I,sampleCount:S.sampleCount,timeout:S.timeout,transports:p,weights:S.weights})}return x}}function aze(t){return"code"in t&&typeof t.code=="number"&&(t.code===hy.code||t.code===ci.code||t.code===5e3)}function oze({chain:t,interval:e=4e3,onTransports:r,sampleCount:n=10,timeout:i=1e3,transports:s,weights:a={}}){const{stability:o=.7,latency:f=.3}=a,c=[],d=async()=>{const p=await Promise.all(s.map(async S=>{const I=S({chain:t,retryCount:0,timeout:i}),R=Date.now();let O,M;try{await I.request({method:"net_listening"}),M=1}catch{M=0}finally{O=Date.now()}return{latency:O-R,success:M}}));c.push(p),c.length>n&&c.shift();const g=Math.max(...c.map(S=>Math.max(...S.map(({latency:I})=>I)))),x=s.map((S,I)=>{const R=c.map(B=>B[I].latency),M=1-R.reduce((B,F)=>B+F,0)/R.length/g,U=c.map(B=>B[I].success),D=U.reduce((B,F)=>B+F,0)/U.length;return D===0?[0,I]:[f*M+o*D,I]}).sort((S,I)=>I[0]-S[0]);r(x.map(([,S])=>s[S])),await $I(e),d()};d()}class fze extends kt{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function wL(t,e={}){const{batch:r,fetchOptions:n,key:i="http",name:s="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:o,retryDelay:f}=e;return({chain:c,retryCount:d,timeout:p})=>{const{batchSize:g=1e3,wait:x=0}=typeof r=="object"?r:{},S=e.retryCount??d,I=p??e.timeout??1e4,R=t||(c==null?void 0:c.rpcUrls.default.http[0]);if(!R)throw new fze;const O=Ije(R,{fetchOptions:n,onRequest:a,onResponse:o,timeout:I});return wK({key:i,name:s,async request({method:M,params:U}){const D={method:M,params:U},{schedule:B}=jme({id:R,wait:x,shouldSplitBatch(W){return W.length>g},fn:W=>O.request({body:W}),sort:(W,Y)=>W.id-Y.id}),F=async W=>r?B(W):[await O.request({body:W})],[{error:k,result:N}]=await F(D);if(k)throw new sme({body:D,error:k,url:R});return N},retryCount:S,retryDelay:f,timeout:I,type:"http"},{fetchOptions:n,url:R})}}function Xse(t){return{addChain:e=>$Be(t,e),deployContract:e=>SLe(t,e),getAddresses:()=>vje(t),getChainId:()=>kk(t),getPermissions:()=>xje(t),prepareTransactionRequest:e=>Nk(t,e),requestAddresses:()=>Wje(t),requestPermissions:e=>Gje(t,e),sendRawTransaction:e=>vme(t,e),sendTransaction:e=>Ok(t,e),signMessage:e=>Kme(t,e),signTransaction:e=>Kje(t,e),signTypedData:e=>Qje(t,e),switchChain:e=>Yje(t,e),watchAsset:e=>Jje(t,e),writeContract:e=>Qme(t,e)}}async function Aw(t,e={}){let r;if(e.connector){const{connector:c}=e;if(t.state.status==="reconnecting"&&!c.getAccounts&&!c.getChainId)throw new nze({connector:c});const[d,p]=await Promise.all([c.getAccounts(),c.getChainId()]);r={accounts:d,chainId:p,connector:c}}else r=t.state.connections.get(t.state.current);if(!r)throw new Jme;const n=e.chainId??r.chainId,i=await r.connector.getChainId();if(i!==r.chainId)throw new rze({connectionChainId:r.chainId,connectorChainId:i});const s=r.connector;if(s.getClient)return s.getClient({chainId:n});const a=Qo(e.account??r.accounts[0]);if(a.address=$s(a.address),e.account&&!r.accounts.some(c=>c.toLowerCase()===a.address.toLowerCase()))throw new tze({address:a.address,connector:s});const o=t.chains.find(c=>c.id===n),f=await r.connector.getProvider({chainId:n});return ege({account:a,chain:o,name:"Connector Client",transport:c=>ize(f)({...c,retryCount:0})})}async function cze(t,e={}){var i,s;let r;if(e.connector)r=e.connector;else{const{connections:a,current:o}=t.state,f=a.get(o);r=f==null?void 0:f.connector}const n=t.state.connections;r&&(await r.disconnect(),r.emitter.off("change",t._internal.events.change),r.emitter.off("disconnect",t._internal.events.disconnect),r.emitter.on("connect",t._internal.events.connect),n.delete(r.uid)),t.setState(a=>{if(n.size===0)return{...a,connections:new Map,current:null,status:"disconnected"};const o=n.values().next().value;return{...a,connections:new Map(n),current:o.connector.uid}});{const a=t.state.current;if(!a)return;const o=(i=t.state.connections.get(a))==null?void 0:i.connector;if(!o)return;await((s=t.storage)==null?void 0:s.setItem("recentConnectorId",o.id))}}async function uze(t,e){const{chainId:r,connector:n,...i}=e;let s;e.account?s=e.account:s=(await Aw(t,{account:e.account,chainId:r,connector:n})).account;const a=t.getClient({chainId:r});return Bs(a,sK,"estimateGas")({...i,account:s})}function tge(t){return typeof t=="number"?t:t==="wei"?0:Math.abs(zUe[t])}function _w(t){const e=t.state.current,r=t.state.connections.get(e),n=r==null?void 0:r.accounts,i=n==null?void 0:n[0],s=t.chains.find(o=>o.id===(r==null?void 0:r.chainId)),a=t.state.status;switch(a){case"connected":return{address:i,addresses:n,chain:s,chainId:r==null?void 0:r.chainId,connector:r==null?void 0:r.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:a};case"reconnecting":return{address:i,addresses:n,chain:s,chainId:r==null?void 0:r.chainId,connector:r==null?void 0:r.connector,isConnected:!!i,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:a};case"connecting":return{address:i,addresses:n,chain:s,chainId:r==null?void 0:r.chainId,connector:r==null?void 0:r.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:a};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:a}}}async function lze(t,e){const{allowFailure:r=!0,chainId:n,contracts:i,...s}=e,a=t.getClient({chainId:n});return Bs(a,gje,"multicall")({allowFailure:r,contracts:i,...s})}function dze(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,Om,"readContract")(n)}async function hze(t,e){var o;const{allowFailure:r=!0,blockNumber:n,blockTag:i,...s}=e,a=e.contracts;try{const f={};for(const[g,x]of a.entries()){const S=x.chainId??t.state.chainId;f[S]||(f[S]=[]),(o=f[S])==null||o.push({contract:x,index:g})}const c=()=>Object.entries(f).map(([g,x])=>lze(t,{...s,allowFailure:r,blockNumber:n,blockTag:i,chainId:Number.parseInt(g),contracts:x.map(({contract:S})=>S)})),d=(await Promise.all(c())).flat(),p=Object.values(f).flatMap(g=>g.map(({index:x})=>x));return d.reduce((g,x,S)=>(g&&(g[p[S]]=x),g),[])}catch(f){if(f instanceof lK)throw f;const c=()=>a.map(d=>dze(t,{...d,blockNumber:n,blockTag:i}));return r?(await Promise.allSettled(c())).map(d=>d.status==="fulfilled"?{result:d.value,status:"success"}:{error:d.reason,result:void 0,status:"failure"}):await Promise.all(c())}}async function pze(t,e){const{address:r,blockNumber:n,blockTag:i,chainId:s,token:a,unit:o="ether"}=e;if(a)try{return eae(t,{balanceAddress:r,chainId:s,symbolType:"string",tokenAddress:a})}catch(g){if(g instanceof lK){const x=await eae(t,{balanceAddress:r,chainId:s,symbolType:"bytes32",tokenAddress:a}),S=L2e(h1(x.symbol,{dir:"right"}));return{...x,symbol:S}}throw g}const f=t.getClient({chainId:s}),d=await Bs(f,lme,"getBalance")(n?{address:r,blockNumber:n}:{address:r,blockTag:i}),p=t.chains.find(g=>g.id===s)??f.chain;return{decimals:p.nativeCurrency.decimals,formatted:u_(d,tge(o)),symbol:p.nativeCurrency.symbol,value:d}}async function eae(t,e){const{balanceAddress:r,chainId:n,symbolType:i,tokenAddress:s,unit:a}=e,o={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:i}]}],address:s},[f,c,d]=await hze(t,{allowFailure:!1,contracts:[{...o,functionName:"balanceOf",args:[r],chainId:n},{...o,functionName:"decimals",chainId:n},{...o,functionName:"symbol",chainId:n}]}),p=u_(f??"0",tge(a??c));return{decimals:c,formatted:p,symbol:d,value:f}}function tae(t){return t.state.chainId}function fx(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(!fx(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&&!fx(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}let tS=[];function mze(t){const e=[...t.state.connections.values()];return t.state.status==="reconnecting"||fx(tS,e)?tS:(tS=e,e)}function gze(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,VFe,"getEnsAddress")(n)}function rae(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,sje,"getEnsAvatar")(n)}function bze(t,e){const{chainId:r,...n}=e,i=t.getClient({chainId:r});return Bs(i,aje,"getEnsName")(n)}async function yze(t,e={}){const r=await Aw(t,e);return r.extend(Xse),r.extend(Xse)}async function wze(t,e){const{account:r,chainId:n,...i}=e,s=r??_w(t).address,a=t.getClient({chainId:n});return Bs(a,Nk,"prepareTransactionRequest")({...i,...s?{account:s}:{}})}let vL=!1;async function rge(t,e={}){var c,d;if(vL)return[];vL=!0,t.setState(p=>({...p,status:p.current?"reconnecting":"connecting"}));const r=[];if((c=e.connectors)!=null&&c.length)for(const p of e.connectors){let g;typeof p=="function"?g=t._internal.connectors.setup(p):g=p,r.push(g)}else r.push(...t.connectors);let n;try{n=await((d=t.storage)==null?void 0:d.getItem("recentConnectorId"))}catch{}const i={};for(const[,p]of t.state.connections)i[p.connector.id]=1;n&&(i[n]=0);const s=Object.keys(i).length>0?[...r].sort((p,g)=>(i[p.id]??10)-(i[g.id]??10)):r;let a=!1;const o=[],f=[];for(const p of s){const g=await p.getProvider().catch(()=>{});if(!g||f.some(I=>I===g)||!await p.isAuthorized())continue;const S=await p.connect({isReconnecting:!0}).catch(()=>null);S&&(p.emitter.off("connect",t._internal.events.connect),p.emitter.on("change",t._internal.events.change),p.emitter.on("disconnect",t._internal.events.disconnect),t.setState(I=>{const R=new Map(a?I.connections:new Map).set(p.uid,{accounts:S.accounts,chainId:S.chainId,connector:p});return{...I,current:a?I.current:p.uid,connections:R}}),o.push({accounts:S.accounts,chainId:S.chainId,connector:p}),f.push(g),a=!0)}return(t.state.status==="reconnecting"||t.state.status==="connecting")&&(a?t.setState(p=>({...p,status:"connected"})):t.setState(p=>({...p,connections:new Map,current:null,status:"disconnected"}))),vL=!1,o}async function vze(t,e){const{account:r,chainId:n,connector:i,gas:s,...a}=e;let o;typeof r=="object"&&r.type==="local"?o=t.getClient({chainId:n}):o=await Aw(t,{account:r,chainId:n,connector:i});const{connector:f}=_w(t),c=await(async()=>{var g;if(!(!("data"in e)||!e.data)&&!((g=i??f)!=null&&g.supportsSimulation)&&s!==null)return s===void 0?Bs(o,sK,"estimateGas")({...a,account:r,chain:n?{id:n}:null}):s})();return await Bs(o,Ok,"sendTransaction")({...a,...r?{account:r}:{},gas:c,chain:n?{id:n}:null})}async function xze(t,e){const{account:r,connector:n,...i}=e;let s;return typeof r=="object"&&r.type==="local"?s=t.getClient():s=await Aw(t,{account:r,connector:n}),Bs(s,Kme,"signMessage")({...i,...r?{account:r}:{}})}async function Aze(t,e){const{abi:r,chainId:n,connector:i,...s}=e;let a;e.account?a=e.account:a=(await Aw(t,{chainId:n,connector:i})).account;const o=t.getClient({chainId:n}),f=Bs(o,Zje,"simulateContract"),{result:c,request:d}=await f({...s,abi:r,account:a});return{chainId:o.chain.id,result:c,request:{__mode:"prepared",...d,chainId:n}}}async function _ze(t,e){var i;const{connector:r}=e,n=t.state.connections.get(r.uid);if(!n)throw new Jme;return await((i=t.storage)==null?void 0:i.setItem("recentConnectorId",r.id)),t.setState(s=>({...s,current:r.uid})),{accounts:n.accounts,chainId:n.chainId}}class Cp extends Wh{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class Eze extends Wh{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Cze(t,e){var a;const{addEthereumChainParameter:r,chainId:n}=e,i=t.state.connections.get(((a=e.connector)==null?void 0:a.uid)??t.state.current);if(i){const o=i.connector;if(!o.switchChain)throw new Eze({connector:o});return await o.switchChain({addEthereumChainParameter:r,chainId:n})}const s=t.chains.find(o=>o.id===n);if(!s)throw new Dm;return t.setState(o=>({...o,chainId:n})),s}function nge(t,e){const{onChange:r}=e;return t.subscribe(()=>_w(t),r,{equalityFn(n,i){const{connector:s,...a}=n,{connector:o,...f}=i;return fx(a,f)&&(s==null?void 0:s.id)===(o==null?void 0:o.id)&&(s==null?void 0:s.uid)===(o==null?void 0:o.uid)}})}function Sze(t,e){const{onChange:r}=e;return t.subscribe(n=>n.chainId,r)}function Tze(t,e){const{onChange:r}=e;return t._internal.connectors.subscribe((n,i)=>{r(Object.values(n),i)})}async function Ize(t,e){const{chainId:r,timeout:n=0,...i}=e,s=t.getClient({chainId:r}),o=await Bs(s,Vje,"waitForTransactionReceipt")({...i,timeout:n});if(o.status==="reverted"){const c=await Bs(s,Hme,"getTransaction")({hash:o.transactionHash}),p=await Bs(s,mK,"call")({...c,gasPrice:c.type!=="eip1559"?c.gasPrice:void 0,maxFeePerGas:c.type==="eip1559"?c.maxFeePerGas:void 0,maxPriorityFeePerGas:c.type==="eip1559"?c.maxPriorityFeePerGas:void 0}),g=p!=null&&p.data?L2e(`0x${p.data.substring(138)}`):"unknown reason";throw new Error(g)}return{...o,chainId:s.chain.id}}async function Rze(t,e){const{account:r,chainId:n,connector:i,__mode:s,...a}=e;let o;typeof r=="object"&&r.type==="local"?o=t.getClient({chainId:n}):o=await Aw(t,{account:r,chainId:n,connector:i});const{connector:f}=_w(t);let c;if(s==="prepared"||f!=null&&f.supportsSimulation)c=a;else{const{request:g}=await Aze(t,{...a,account:r,chainId:n});c=g}return await Bs(o,Qme,"writeContract")({...c,...r?{account:r}:{},chain:n?{id:n}:null})}const Mze=/(rabby|trustwallet)/,kze={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t!=null&&t.coinbaseWalletExtension?t.coinbaseWalletExtension:pT(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return pT(t,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const r=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isZerion"];for(const n of r)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(t){var e,r;return(e=t==null?void 0:t.phantom)!=null&&e.ethereum?(r=t.phantom)==null?void 0:r.ethereum:pT(t,"isPhantom")}}};$k.type="injected";function $k(t={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:r}=t;function n(){const f=t.target;if(typeof f=="function"){const c=f();if(c)return c}return typeof f=="object"?f:typeof f=="string"?{...kze[f]??{id:f,name:`${f[0].toUpperCase()}${f.slice(1)}`,provider:`is${f[0].toUpperCase()}${f.slice(1)}`}}:{id:"injected",name:"Injected",provider(c){return c==null?void 0:c.ethereum}}}let i,s,a,o;return f=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},get supportsSimulation(){return Mze.test(this.id.toLowerCase())},type:$k.type,async setup(){const c=await this.getProvider();c&&t.target&&(a||(a=this.onConnect.bind(this),c.on("connect",a)),i||(i=this.onAccountsChanged.bind(this),c.on("accountsChanged",i)))},async connect({chainId:c,isReconnecting:d}={}){var x,S,I,R,O,M;const p=await this.getProvider();if(!p)throw new Cp;let g=[];if(d)g=await this.getAccounts().catch(()=>[]);else if(e)try{g=(R=(I=(S=(x=(await p.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:x.caveats)==null?void 0:S[0])==null?void 0:I.value)==null?void 0:R.map(D=>$s(D)),g.length>0&&(g=await this.getAccounts())}catch(U){const D=U;if(D.code===ci.code)throw new ci(D);if(D.code===P6.code)throw D}try{!(g!=null&&g.length)&&!d&&(g=(await p.request({method:"eth_requestAccounts"})).map(B=>$s(B))),a&&(p.removeListener("connect",a),a=void 0),i||(i=this.onAccountsChanged.bind(this),p.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),p.on("chainChanged",s)),o||(o=this.onDisconnect.bind(this),p.on("disconnect",o));let U=await this.getChainId();if(c&&U!==c){const D=await this.switchChain({chainId:c}).catch(B=>{if(B.code===ci.code)throw B;return{id:U}});U=(D==null?void 0:D.id)??U}return e&&await((O=f.storage)==null?void 0:O.removeItem(`${this.id}.disconnected`)),t.target||await((M=f.storage)==null?void 0:M.setItem("injected.connected",!0)),{accounts:g,chainId:U}}catch(U){const D=U;throw D.code===ci.code?new ci(D):D.code===P6.code?new P6(D):D}},async disconnect(){var d,p;const c=await this.getProvider();if(!c)throw new Cp;s&&(c.removeListener("chainChanged",s),s=void 0),o&&(c.removeListener("disconnect",o),o=void 0),a||(a=this.onConnect.bind(this),c.on("connect",a));try{await Gme(()=>c.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await((d=f.storage)==null?void 0:d.setItem(`${this.id}.disconnected`,!0)),t.target||await((p=f.storage)==null?void 0:p.removeItem("injected.connected"))},async getAccounts(){const c=await this.getProvider();if(!c)throw new Cp;return(await c.request({method:"eth_accounts"})).map(p=>$s(p))},async getChainId(){const c=await this.getProvider();if(!c)throw new Cp;const d=await c.request({method:"eth_chainId"});return Number(d)},async getProvider(){if(typeof window>"u")return;let c;const d=n();return typeof d.provider=="function"?c=d.provider(window):typeof d.provider=="string"?c=pT(window,d.provider):c=d.provider,c&&!c.removeListener&&("off"in c&&typeof c.off=="function"?c.removeListener=c.off:c.removeListener=()=>{}),c},async isAuthorized(){var c,d;try{if(e&&await((c=f.storage)==null?void 0:c.getItem(`${this.id}.disconnected`))||!t.target&&!await((d=f.storage)==null?void 0:d.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(r!==void 0&&r!==!1){const S=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",S),!!await this.getProvider()),I=typeof r=="number"?r:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(O=>window.addEventListener("ethereum#initialized",()=>O(S()),{once:!0}))]:[],new Promise(O=>setTimeout(()=>O(S()),I))]))return!0}throw new Cp}return!!(await BI(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:c,chainId:d}){var x,S,I,R;const p=await this.getProvider();if(!p)throw new Cp;const g=f.chains.find(O=>O.id===d);if(!g)throw new to(new Dm);try{return await Promise.all([p.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(d)}]}).then(async()=>{await this.getChainId()===d&&f.emitter.emit("change",{chainId:d})}),new Promise(O=>f.emitter.once("change",({chainId:M})=>{M===d&&O()}))]),g}catch(O){const M=O;if(M.code===4902||((S=(x=M==null?void 0:M.data)==null?void 0:x.originalError)==null?void 0:S.code)===4902)try{const{default:U,...D}=g.blockExplorers??{};let B;c!=null&&c.blockExplorerUrls?B=c.blockExplorerUrls:U&&(B=[U.url,...Object.values(D).map(W=>W.url)]);let F;(I=c==null?void 0:c.rpcUrls)!=null&&I.length?F=c.rpcUrls:F=[((R=g.rpcUrls.default)==null?void 0:R.http[0])??""];const k={blockExplorerUrls:B,chainId:Tr(d),chainName:(c==null?void 0:c.chainName)??g.name,iconUrls:c==null?void 0:c.iconUrls,nativeCurrency:(c==null?void 0:c.nativeCurrency)??g.nativeCurrency,rpcUrls:F};if(await p.request({method:"wallet_addEthereumChain",params:[k]}),await this.getChainId()!==d)throw new ci(new Error("User rejected switch after adding network."));return g}catch(U){throw new ci(U)}throw M.code===ci.code?new ci(M):new to(M)}},async onAccountsChanged(c){var d;if(c.length===0)this.onDisconnect();else if(f.emitter.listenerCount("connect")){const p=(await this.getChainId()).toString();this.onConnect({chainId:p}),e&&await((d=f.storage)==null?void 0:d.removeItem(`${this.id}.disconnected`))}else f.emitter.emit("change",{accounts:c.map(p=>$s(p))})},onChainChanged(c){const d=Number(c);f.emitter.emit("change",{chainId:d})},async onConnect(c){const d=await this.getAccounts();if(d.length===0)return;const p=Number(c.chainId);f.emitter.emit("connect",{accounts:d,chainId:p});const g=await this.getProvider();g&&(a&&(g.removeListener("connect",a),a=void 0),i||(i=this.onAccountsChanged.bind(this),g.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),g.on("chainChanged",s)),o||(o=this.onDisconnect.bind(this),g.on("disconnect",o)))},async onDisconnect(c){const d=await this.getProvider();c&&c.code===1013&&d&&(await this.getAccounts()).length||(f.emitter.emit("disconnect"),d&&(s&&(d.removeListener("chainChanged",s),s=void 0),o&&(d.removeListener("disconnect",o),o=void 0),a||(a=this.onConnect.bind(this),d.on("connect",a))))}})}function pT(t,e){function r(i){return typeof e=="function"?e(i):typeof e=="string"?i[e]:!0}const n=t.ethereum;if(n!=null&&n.providers)return n.providers.find(i=>r(i));if(n&&r(n))return n}function Pze(t){if(typeof window>"u")return;const e=r=>t(r.detail);return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}function Nze(){const t=new Set;let e=[];const r=()=>Pze(i=>{e.some(({info:s})=>s.uuid===i.info.uuid)||(e=[...e,i],t.forEach(s=>s(e,{added:[i]})))});let n=r();return{_listeners(){return t},clear(){t.forEach(i=>i([],{removed:[...e]})),e=[]},destroy(){this.clear(),t.clear(),n==null||n()},findProvider({rdns:i}){return e.find(s=>s.info.rdns===i)},getProviders(){return e},reset(){this.clear(),n==null||n(),n=r()},subscribe(i,{emitImmediately:s}={}){return t.add(i),s&&i(e,{added:e}),()=>t.delete(i)}}}const Oze={BASE_URL:"/dacademy-eas-test/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REOWN_PROJECT_ID:"6562ee7f0e72671353204776ca7a132c"},Dze=t=>(e,r,n)=>{const i=n.subscribe;return n.subscribe=(a,o,f)=>{let c=a;if(o){const d=(f==null?void 0:f.equalityFn)||Object.is;let p=a(n.getState());c=g=>{const x=a(g);if(!d(p,x)){const S=p;o(p=x,S)}},f!=null&&f.fireImmediately&&o(p,p)}return i(c)},t(e,r,n)},$ze=Dze;function Bze(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var s;const a=f=>f===null?null:JSON.parse(f,void 0),o=(s=r.getItem(i))!=null?s:null;return o instanceof Promise?o.then(a):a(o)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>r.removeItem(i)}}const cx=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return cx(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return cx(n)(r)}}}},Uze=(t,e)=>(r,n,i)=>{let s={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:R=>R,version:0,merge:(R,O)=>({...O,...R}),...e},a=!1;const o=new Set,f=new Set;let c;try{c=s.getStorage()}catch{}if(!c)return t((...R)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...R)},n,i);const d=cx(s.serialize),p=()=>{const R=s.partialize({...n()});let O;const M=d({state:R,version:s.version}).then(U=>c.setItem(s.name,U)).catch(U=>{O=U});if(O)throw O;return M},g=i.setState;i.setState=(R,O)=>{g(R,O),p()};const x=t((...R)=>{r(...R),p()},n,i);let S;const I=()=>{var R;if(!c)return;a=!1,o.forEach(M=>M(n()));const O=((R=s.onRehydrateStorage)==null?void 0:R.call(s,n()))||void 0;return cx(c.getItem.bind(c))(s.name).then(M=>{if(M)return s.deserialize(M)}).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==s.version){if(s.migrate)return s.migrate(M.state,M.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return M.state}).then(M=>{var U;return S=s.merge(M,(U=n())!=null?U:x),r(S,!0),p()}).then(()=>{O==null||O(S,void 0),a=!0,f.forEach(M=>M(S))}).catch(M=>{O==null||O(void 0,M)})};return i.persist={setOptions:R=>{s={...s,...R},R.getStorage&&(c=R.getStorage())},clearStorage:()=>{c==null||c.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>I(),hasHydrated:()=>a,onHydrate:R=>(o.add(R),()=>{o.delete(R)}),onFinishHydration:R=>(f.add(R),()=>{f.delete(R)})},I(),S||x},Lze=(t,e)=>(r,n,i)=>{let s={storage:Bze(()=>localStorage),partialize:I=>I,version:0,merge:(I,R)=>({...R,...I}),...e},a=!1;const o=new Set,f=new Set;let c=s.storage;if(!c)return t((...I)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...I)},n,i);const d=()=>{const I=s.partialize({...n()});return c.setItem(s.name,{state:I,version:s.version})},p=i.setState;i.setState=(I,R)=>{p(I,R),d()};const g=t((...I)=>{r(...I),d()},n,i);let x;const S=()=>{var I,R;if(!c)return;a=!1,o.forEach(M=>{var U;return M((U=n())!=null?U:g)});const O=((R=s.onRehydrateStorage)==null?void 0:R.call(s,(I=n())!=null?I:g))||void 0;return cx(c.getItem.bind(c))(s.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==s.version){if(s.migrate)return s.migrate(M.state,M.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return M.state}).then(M=>{var U;return x=s.merge(M,(U=n())!=null?U:g),r(x,!0),d()}).then(()=>{O==null||O(x,void 0),x=n(),a=!0,f.forEach(M=>M(x))}).catch(M=>{O==null||O(void 0,M)})};return i.persist={setOptions:I=>{s={...s,...I},I.storage&&(c=I.storage)},clearStorage:()=>{c==null||c.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>S(),hasHydrated:()=>a,onHydrate:I=>(o.add(I),()=>{o.delete(I)}),onFinishHydration:I=>(f.add(I),()=>{f.delete(I)})},s.skipHydration||S(),x||g},Fze=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((Oze?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Uze(t,e)):Lze(t,e),jze=Fze,zze={BASE_URL:"/dacademy-eas-test/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REOWN_PROJECT_ID:"6562ee7f0e72671353204776ca7a132c"},nae=t=>{let e;const r=new Set,n=(f,c)=>{const d=typeof f=="function"?f(e):f;if(!Object.is(d,e)){const p=e;e=c??typeof d!="object"?d:Object.assign({},e,d),r.forEach(g=>g(e,p))}},i=()=>e,o={setState:n,getState:i,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(zze?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,o),o},xL=t=>t?nae(t):nae;var ige={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(f,c,d){this.fn=f,this.context=c,this.once=d||!1}function s(f,c,d,p,g){if(typeof d!="function")throw new TypeError("The listener must be a function");var x=new i(d,p||f,g),S=r?r+c:c;return f._events[S]?f._events[S].fn?f._events[S]=[f._events[S],x]:f._events[S].push(x):(f._events[S]=x,f._eventsCount++),f}function a(f,c){--f._eventsCount===0?f._events=new n:delete f._events[c]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],d,p;if(this._eventsCount===0)return c;for(p in d=this._events)e.call(d,p)&&c.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},o.prototype.listeners=function(c){var d=r?r+c:c,p=this._events[d];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,x=p.length,S=new Array(x);g{let i=n;return(i==null?void 0:i.__type)==="bigint"&&(i=BigInt(i.value)),(i==null?void 0:i.__type)==="Map"&&(i=new Map(i.value)),(e==null?void 0:e(r,i))??i})}function iae(t,e){return t.slice(0,e).join(".")||"."}function sae(t,e){const{length:r}=t;for(let n=0;n{let a=s;return typeof a=="bigint"&&(a={__type:"bigint",value:s.toString()}),a instanceof Map&&(a={__type:"Map",value:Array.from(s.entries())}),(e==null?void 0:e(i,a))??a},n),r??void 0)}function sge(t){const{deserialize:e=Gze,key:r="wagmi",serialize:n=Qze,storage:i=age}=t;function s(a){return a instanceof Promise?a.then(o=>o).catch(()=>null):a}return{...i,key:r,async getItem(a,o){const f=i.getItem(`${r}.${a}`),c=await s(f);return c?e(c)??null:o??null},async setItem(a,o){const f=`${r}.${a}`;o===null?await s(i.removeItem(f)):await s(i.setItem(f,n(o)))},async removeItem(a){await s(i.removeItem(`${r}.${a}`))}}}const age={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},Cq=256;let rS=Cq,nS;function Zze(t=11){if(!nS||rS+t>Cq*2){nS="",rS=0;for(let e=0;es.chains),f=xL(()=>[...s.connectors??[],...i?[]:(a==null?void 0:a.getProviders().map(d))??[]].map(c));function c(B){var N;const F=Wze(Zze()),k={...B({emitter:F,chains:o.getState(),storage:r,transports:s.transports}),emitter:F,uid:F.uid};return F.on("connect",U),(N=k.setup)==null||N.call(k),k}function d(B){const{info:F}=B,k=B.provider;return $k({target:{...F,id:F.rdns,provider:k}})}const p=new Map;function g(B={}){const F=B.chainId??R.getState().chainId,k=o.getState().find(W=>W.id===F);if(B.chainId&&!k)throw new Dm;{const W=p.get(R.getState().chainId);if(W&&!k)return W;if(!k)throw new Dm}{const W=p.get(F);if(W)return W}let N;if(s.client)N=s.client({chain:k});else{const W=k.id,Y=o.getState().map(u=>u.id),z={},P=Object.entries(s);for(const[u,l]of P)if(!(u==="chains"||u==="client"||u==="connectors"||u==="transports"))if(typeof l=="object")if(W in l)z[u]=l[W];else{if(Y.some(w=>w in l))continue;z[u]=l}else z[u]=l;N=ege({...z,chain:k,batch:z.batch??{multicall:!0},transport:u=>s.transports[W]({...u,connectors:f})})}return p.set(F,N),N}function x(){return{chainId:o.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let S;const I="0.0.0-canary-";hT.startsWith(I)?S=Number.parseInt(hT.replace(I,"")):S=Number.parseInt(hT.split(".")[0]??"0");const R=xL($ze(r?jze(x,{migrate(B,F){if(F===S)return B;const k=x(),N=O(B,k.chainId);return{...k,chainId:N}},name:"store",partialize(B){return{connections:{__type:"Map",value:Array.from(B.connections.entries()).map(([F,k])=>{const{id:N,name:W,type:Y,uid:z}=k.connector;return[F,{...k,connector:{id:N,name:W,type:Y,uid:z}}]})},chainId:B.chainId,current:B.current}},merge(B,F){typeof B=="object"&&B&&"status"in B&&delete B.status;const k=O(B,F.chainId);return{...F,...B,chainId:k}},skipHydration:i,storage:r,version:S}):x));function O(B,F){return B&&typeof B=="object"&&"chainId"in B&&typeof B.chainId=="number"&&o.getState().some(k=>k.id===B.chainId)?B.chainId:F}n&&R.subscribe(({connections:B,current:F})=>{var k;return F?(k=B.get(F))==null?void 0:k.chainId:void 0},B=>{if(o.getState().some(k=>k.id===B))return R.setState(k=>({...k,chainId:B??k.chainId}))}),a==null||a.subscribe(B=>{const F=new Map;for(const N of f.getState())F.set(N.id,!0);const k=[];for(const N of B){const W=c(d(N));F.has(W.id)||k.push(W)}r&&!R.persist.hasHydrated()||f.setState(N=>[...N,...k],!0)});function M(B){R.setState(F=>{const k=F.connections.get(B.uid);return k?{...F,connections:new Map(F.connections).set(B.uid,{accounts:B.accounts??k.accounts,chainId:B.chainId??k.chainId,connector:k.connector})}:F})}function U(B){R.getState().status==="connecting"||R.getState().status==="reconnecting"||R.setState(F=>{const k=f.getState().find(N=>N.uid===B.uid);return k?(k.emitter.listenerCount("connect")&&k.emitter.off("connect",M),k.emitter.listenerCount("change")||k.emitter.on("change",M),k.emitter.listenerCount("disconnect")||k.emitter.on("disconnect",D),{...F,connections:new Map(F.connections).set(B.uid,{accounts:B.accounts,chainId:B.chainId,connector:k}),current:B.uid,status:"connected"}):F})}function D(B){R.setState(F=>{const k=F.connections.get(B.uid);if(k){const W=k.connector;W.emitter.listenerCount("change")&&k.connector.emitter.off("change",M),W.emitter.listenerCount("disconnect")&&k.connector.emitter.off("disconnect",D),W.emitter.listenerCount("connect")||k.connector.emitter.on("connect",U)}if(F.connections.delete(B.uid),F.connections.size===0)return{...F,connections:new Map,current:null,status:"disconnected"};const N=F.connections.values().next().value;return{...F,connections:new Map(F.connections),current:N.connector.uid}})}return{get chains(){return o.getState()},get connectors(){return f.getState()},storage:r,getClient:g,get state(){return R.getState()},setState(B){let F;typeof B=="function"?F=B(R.getState()):F=B;const k=x();typeof F!="object"&&(F=k),Object.keys(k).some(W=>!(W in F))&&(F=k),R.setState(F,!0)},subscribe(B,F,k){return R.subscribe(B,F,k?{...k,fireImmediately:k.emitImmediately}:void 0)},_internal:{mipd:a,store:R,ssr:!!i,syncConnectedChain:n,transports:s.transports,chains:{setState(B){const F=typeof B=="function"?B(o.getState()):B;if(F.length!==0)return o.setState(F,!0)},subscribe(B){return o.subscribe(B)}},connectors:{providerDetailToConnector:d,setup:c,setState(B){return f.setState(typeof B=="function"?B(f.getState()):B,!0)},subscribe(B){return f.subscribe(B)}},events:{change:M,connect:U,disconnect:D}}}}function Jze(t,e){const{initialState:r,reconnectOnMount:n}=e;return r&&!t._internal.store.persist.hasHydrated()&&t.setState({...r,chainId:t.chains.some(i=>i.id===r.chainId)?r.chainId:t.chains[0].id,connections:n?r.connections:new Map,status:n?"reconnecting":"disconnected"}),{async onMount(){var i;if(t._internal.ssr){await t._internal.store.persist.rehydrate();const s=(i=t._internal.mipd)==null?void 0:i.getProviders().map(t._internal.connectors.providerDetailToConnector).map(t._internal.connectors.setup);t._internal.connectors.setState(a=>[...a,...s??[]])}n?rge(t):t.storage&&t.setState(s=>({...s,connections:new Map}))}}}const Xze={getItem(t){return typeof window>"u"?null:eqe(document.cookie,t)??null},setItem(t,e){typeof window>"u"||(document.cookie=`${t}=${e};path=/;samesite=Lax`)},removeItem(t){typeof window>"u"||(document.cookie=`${t}=;max-age=-1;path=/`)}};function eqe(t,e){const r=t.split("; ").find(n=>n.startsWith(`${e}=`));if(r)return r.substring(e.length+1)}function tqe(t){var s,a,o;const{chain:e}=t,r=e.rpcUrls.default.http[0];if(!t.transports)return[r];const n=(a=(s=t.transports)==null?void 0:s[e.id])==null?void 0:a.call(s,{chain:e});return(((o=n==null?void 0:n.value)==null?void 0:o.transports)||[n]).map(({value:f})=>(f==null?void 0:f.url)||r)}function rqe(t){const{children:e,config:r,initialState:n,reconnectOnMount:i=!0}=t,{onMount:s}=Jze(r,{initialState:n,reconnectOnMount:i});r._internal.ssr||s();const a=Fn.useRef(!0);return Fn.useEffect(()=>{if(a.current&&r._internal.ssr)return s(),()=>{a.current=!1}},[]),e}const oge=Fn.createContext(void 0);function nqe(t){const{children:e,config:r}=t,n={value:r};return Fn.createElement(rqe,t,Fn.createElement(oge.Provider,n,e))}const iqe="2.12.12",sqe=()=>`wagmi@${iqe}`;class aqe extends Wh{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return sqe()}}class oqe extends aqe{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function vK(t={}){const e=t.config??Fn.useContext(oge);if(!e)throw new oqe;return e}var fge={exports:{}},cge={},uge={exports:{}},lge={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -193,14 +193,14 @@ __p += '`),un&&(Et+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Et+`return __p -}`;var qr=nJ(function(){return Sn(me,fr+"return "+Et).apply(r,Me)});if(qr.source=Et,jN(qr))throw qr;return qr}function h_e(b){return Rn(b).toLowerCase()}function p_e(b){return Rn(b).toUpperCase()}function m_e(b,C,L){if(b=Rn(b),b&&(L||C===r))return dZ(b);if(!b||!(C=bo(C)))return b;var J=vc(b),ae=vc(C),me=hZ(J,ae),Me=pZ(J,ae)+1;return op(J,me,Me).join("")}function g_e(b,C,L){if(b=Rn(b),b&&(L||C===r))return b.slice(0,gZ(b)+1);if(!b||!(C=bo(C)))return b;var J=vc(b),ae=pZ(J,vc(C))+1;return op(J,0,ae).join("")}function b_e(b,C,L){if(b=Rn(b),b&&(L||C===r))return b.replace(De,"");if(!b||!(C=bo(C)))return b;var J=vc(b),ae=hZ(J,vc(C));return op(J,ae).join("")}function y_e(b,C){var L=Y,J=z;if(_i(C)){var ae="separator"in C?C.separator:ae;L="length"in C?zr(C.length):L,J="omission"in C?bo(C.omission):J}b=Rn(b);var me=b.length;if(Qg(b)){var Me=vc(b);me=Me.length}if(L>=me)return b;var $e=L-Zg(J);if($e<1)return J;var Ge=Me?op(Me,0,$e).join(""):b.slice(0,$e);if(ae===r)return Ge+J;if(Me&&($e+=Ge.length-$e),zN(ae)){if(b.slice($e).search(ae)){var vt,xt=Ge;for(ae.global||(ae=iN(ae.source,Rn(pt.exec(ae))+"g")),ae.lastIndex=0;vt=ae.exec(xt);)var Et=vt.index;Ge=Ge.slice(0,Et===r?$e:Et)}}else if(b.indexOf(bo(ae),$e)!=$e){var qt=Ge.lastIndexOf(ae);qt>-1&&(Ge=Ge.slice(0,qt))}return Ge+J}function w_e(b){return b=Rn(b),b&&Xe.test(b)?b.replace(rt,K4e):b}var v_e=nb(function(b,C,L){return b+(L?" ":"")+C.toUpperCase()}),VN=iY("toUpperCase");function rJ(b,C,L){return b=Rn(b),C=L?r:C,C===r?q4e(b)?Y4e(b):O4e(b):b.match(C)||[]}var nJ=Wr(function(b,C){try{return R0(b,r,C)}catch(L){return jN(L)?L:new Sr(L)}}),x_e=J1(function(b,C){return af(C,function(L){L=Xu(L),Z1(b,L,LN(b[L],b))}),b});function A_e(b){var C=b==null?0:b.length,L=pr();return b=C?pi(b,function(J){if(typeof J[1]!="function")throw new of(a);return[L(J[0]),J[1]]}):[],Wr(function(J){for(var ae=-1;++aeE)return[];var L=m,J=vs(b,m);C=pr(C),b-=m;for(var ae=tN(J,C);++L0||C<0)?new Jr(L):(b<0?L=L.takeRight(-b):b&&(L=L.drop(b)),C!==r&&(C=zr(C),L=C<0?L.dropRight(-C):L.take(C-b)),L)},Jr.prototype.takeRightWhile=function(b){return this.reverse().takeWhile(b).reverse()},Jr.prototype.toArray=function(){return this.take(m)},Yu(Jr.prototype,function(b,C){var L=/^(?:filter|find|map|reject)|While$/.test(C),J=/^(?:head|last)$/.test(C),ae=pe[J?"take"+(C=="last"?"Right":""):C],me=J||/^find/.test(C);ae&&(pe.prototype[C]=function(){var Me=this.__wrapped__,$e=J?[1]:arguments,Ge=Me instanceof Jr,vt=$e[0],xt=Ge||Or(Me),Et=function(Qr){var un=ae.apply(pe,tp([Qr],$e));return J&&qt?un[0]:un};xt&&L&&typeof vt=="function"&&vt.length!=1&&(Ge=xt=!1);var qt=this.__chain__,fr=!!this.__actions__.length,br=me&&!qt,qr=Ge&&!fr;if(!me&&xt){Me=qr?Me:new Jr(this);var yr=b.apply(Me,$e);return yr.__actions__.push({func:YE,args:[Et],thisArg:r}),new ff(yr,qt)}return br&&qr?b.apply(this,$e):(yr=this.thru(Et),br?J?yr.value()[0]:yr.value():yr)})}),af(["pop","push","shift","sort","splice","unshift"],function(b){var C=_E[b],L=/^(?:push|sort|unshift)$/.test(b)?"tap":"thru",J=/^(?:pop|shift)$/.test(b);pe.prototype[b]=function(){var ae=arguments;if(J&&!this.__chain__){var me=this.value();return C.apply(Or(me)?me:[],ae)}return this[L](function(Me){return C.apply(Or(Me)?Me:[],ae)})}}),Yu(Jr.prototype,function(b,C){var L=pe[C];if(L){var J=L.name+"";Nn.call(eb,J)||(eb[J]=[]),eb[J].push({name:C,func:L})}}),eb[HE(r,O).name]=[{name:"wrapper",func:r}],Jr.prototype.clone=wve,Jr.prototype.reverse=vve,Jr.prototype.value=xve,pe.prototype.at=Z7e,pe.prototype.chain=Y7e,pe.prototype.commit=J7e,pe.prototype.next=X7e,pe.prototype.plant=txe,pe.prototype.reverse=rxe,pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=nxe,pe.prototype.first=pe.prototype.head,n4&&(pe.prototype[n4]=exe),pe},Yg=J4e();qi?((qi.exports=Yg)._=Yg,Wn._=Yg):cn._=Yg}).call(Gv)})(xH,xH.exports);var Vat=Object.defineProperty,Wat=Object.defineProperties,Gat=Object.getOwnPropertyDescriptors,ice=Object.getOwnPropertySymbols,Kat=Object.prototype.hasOwnProperty,Qat=Object.prototype.propertyIsEnumerable,sce=(t,e,r)=>e in t?Vat(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vS=(t,e)=>{for(var r in e||(e={}))Kat.call(e,r)&&sce(t,r,e[r]);if(ice)for(var r of ice(e))Qat.call(e,r)&&sce(t,r,e[r]);return t},Zat=(t,e)=>Wat(t,Gat(e));function Ru(t,e,r){var n;const i=W9(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${Hat}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Mg(t){return t.includes(":")?t.split(":")[1]:t}function H8e(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Yat(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function AF(t={},e={}){const r=ace(t),n=ace(e);return xH.exports.merge(r,n)}function ace(t){var e,r,n,i;const s={};if(!xx(t))return s;for(const[a,o]of Object.entries(t)){const f=YK(a)?[a]:o.chains,c=o.methods||[],d=o.events||[],p=o.rpcMap||{},g=C9(a);s[g]=Zat(vS(vS({},s[g]),o),{chains:_T(f,(e=s[g])==null?void 0:e.chains),methods:_T(c,(r=s[g])==null?void 0:r.methods),events:_T(d,(n=s[g])==null?void 0:n.events),rpcMap:vS(vS({},p),(i=s[g])==null?void 0:i.rpcMap)})}return s}function Jat(t){return t.includes(":")?t.split(":")[2]:t}function oce(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],a=n.accounts||[],o=YK(r)?[r]:n.chains?n.chains:H8e(n.accounts);e[r]={chains:o,methods:i,events:s,accounts:a}}return e}function _F(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const V8e={},Pn=t=>V8e[t],EF=(t,e)=>{V8e[t]=e};class Xat{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}var eot=Object.defineProperty,tot=Object.defineProperties,rot=Object.getOwnPropertyDescriptors,fce=Object.getOwnPropertySymbols,not=Object.prototype.hasOwnProperty,iot=Object.prototype.propertyIsEnumerable,cce=(t,e,r)=>e in t?eot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uce=(t,e)=>{for(var r in e||(e={}))not.call(e,r)&&cce(t,r,e[r]);if(fce)for(var r of fce(e))iot.call(e,r)&&cce(t,r,e[r]);return t},lce=(t,e)=>tot(t,rot(e));class sot{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Ru(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Mg(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const a=this.client.session.get(e.topic),o=((i=a==null?void 0:a.sessionProperties)==null?void 0:i.capabilities)||{};if(o!=null&&o[s])return o==null?void 0:o[s];const f=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:lce(uce({},a.sessionProperties||{}),{capabilities:lce(uce({},o||{}),{[s]:f})})})}catch(c){console.warn("Failed to update session with capabilities",c)}return f}}class aot{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class oot{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class fot{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Ru(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new qu(new B1(n,Pn("disableProviderPing")))}}class cot{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Mg(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class uot{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class lot{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class dot{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Ru(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace);return typeof n>"u"?void 0:new qu(new B1(n,Pn("disableProviderPing")))}}class hot{constructor(e){this.name=Rb,this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=W9(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}var pot=Object.defineProperty,mot=Object.defineProperties,got=Object.getOwnPropertyDescriptors,dce=Object.getOwnPropertySymbols,bot=Object.prototype.hasOwnProperty,yot=Object.prototype.propertyIsEnumerable,hce=(t,e,r)=>e in t?pot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xS=(t,e)=>{for(var r in e||(e={}))bot.call(e,r)&&hce(t,r,e[r]);if(dce)for(var r of dce(e))yot.call(e,r)&&hce(t,r,e[r]);return t},CF=(t,e)=>mot(t,got(e));class nQ{constructor(e){this.events=new SK,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:x_(__({level:(e==null?void 0:e.logger)||rce})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new nQ(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:xS({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(a=>r(null,oP(s,a))).catch(a=>r(a,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 e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Bn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const a=oce(this.session.namespaces);this.namespaces=AF(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const a=oce(s.namespaces);this.namespaces=AF(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==z8e)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Rb?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(Fm(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Pat.init({core:this.providerOpts.core,logger:this.providerOpts.logger||rce,relayUrl:this.providerOpts.relayUrl||jat,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.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 e=[...new Set(Object.keys(this.session.namespaces).map(r=>C9(r)))];EF("client",this.client),EF("events",this.events),EF("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Yat(r,this.session),i=H8e(n),s=AF(this.namespaces,this.optionalNamespaces),a=CF(xS({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new sot({namespace:a});break;case"algorand":this.rpcProviders[r]=new fot({namespace:a});break;case"solana":this.rpcProviders[r]=new aot({namespace:a});break;case"cosmos":this.rpcProviders[r]=new oot({namespace:a});break;case"polkadot":this.rpcProviders[r]=new Xat({namespace:a});break;case"cip34":this.rpcProviders[r]=new cot({namespace:a});break;case"elrond":this.rpcProviders[r]=new uot({namespace:a});break;case"multiversx":this.rpcProviders[r]=new lot({namespace:a});break;case"near":this.rpcProviders[r]=new dot({namespace:a});break;default:this.rpcProviders[Rb]?this.rpcProviders[Rb].updateNamespace(a):this.rpcProviders[Rb]=new hot({namespace:a})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&Fm(i)&&this.events.emit("accountsChanged",i.map(Jat))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,a=C9(i),o=_F(i)!==_F(s)?`${a}:${_F(s)}`:i;this.onChainChanged(o)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=CF(xS({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",CF(xS({},Bn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Hu.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Rb]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(a=>C9(a)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=C9(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}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(e,r){this.client.core.storage.setItem(`${nce}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${nce}/${e}`)}}const wot=nQ,vot="wc",xot="ethereum_provider",Aot=`${vot}@2:${xot}:`,_ot="https://rpc.walletconnect.com/v1/",sR=["eth_sendTransaction","personal_sign"],iQ=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],aR=["chainChanged","accountsChanged"],W8e=["chainChanged","accountsChanged","message","disconnect","connect"];var Eot=Object.defineProperty,Cot=Object.defineProperties,Sot=Object.getOwnPropertyDescriptors,pce=Object.getOwnPropertySymbols,Tot=Object.prototype.hasOwnProperty,Iot=Object.prototype.propertyIsEnumerable,mce=(t,e,r)=>e in t?Eot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mb=(t,e)=>{for(var r in e||(e={}))Tot.call(e,r)&&mce(t,r,e[r]);if(pce)for(var r of pce(e))Iot.call(e,r)&&mce(t,r,e[r]);return t},SF=(t,e)=>Cot(t,Sot(e));function oR(t){return Number(t[0].split(":")[1])}function AS(t){return`0x${t.toString(16)}`}function Rot(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:a,rpcMap:o}=t;if(!nH(e))throw new Error("Invalid chains");const f={chains:e,methods:n||sR,events:s||aR,rpcMap:Mb({},e.length?{[oR(e)]:o[oR(e)]}:{})},c=s==null?void 0:s.filter(x=>!aR.includes(x)),d=n==null?void 0:n.filter(x=>!sR.includes(x));if(!r&&!a&&!i&&!(c!=null&&c.length)&&!(d!=null&&d.length))return{required:e.length?f:void 0};const p=(c==null?void 0:c.length)&&(d==null?void 0:d.length)||!r,g={chains:[...new Set(p?f.chains.concat(r||[]):r)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:iQ))],events:[...new Set(f.events.concat(a!=null&&a.length?a:W8e))],rpcMap:o};return{required:e.length?f:void 0,optional:r.length?g:void 0}}class dP{constructor(){this.events=new Zo.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=Aot,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new dP;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}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(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=Rot(this.rpc);try{const i=await new Promise(async(a,o)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(SF(Mb({namespaces:Mb({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(c=>{a(c)}).catch(c=>{o(new Error(c.message))})});if(!i)return;const s=Gae(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:AS(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,a)=>{var o;this.rpc.showQrModal&&((o=this.modal)==null||o.subscribeModal(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(SF(Mb({},e),{chains:this.rpc.chains}),r).then(f=>{s(f)}).catch(f=>{a(new Error(f.message))})}),i=n.session;if(i){const s=Gae(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:AS(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}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",e=>{const{params:r}=e,{event:n}=r;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",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",AS(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",SF(Mb({},QZe("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",AS(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],a=i.concat(s);if(!a.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const o=i.length?(e==null?void 0:e.methods)||sR:[],f=i.length?(e==null?void 0:e.events)||aR:[],c=(e==null?void 0:e.optionalMethods)||[],d=(e==null?void 0:e.optionalEvents)||[],p=(e==null?void 0:e.rpcMap)||this.buildRpcMap(a,e.projectId),g=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(x=>this.formatChainId(x)),optionalChains:s.map(x=>this.formatChainId(x)),methods:o,events:f,optionalMethods:c,optionalEvents:d,rpcMap:p,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:g,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?oR(this.rpc.chains):oR(this.rpc.optionalChains),this.signer=await wot.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await Ya(()=>import("./index-CwIYrbhM.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Mb({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&nH(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&nH(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${_ot}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}}const Mot=dP,kot=Object.freeze(Object.defineProperty({__proto__:null,EthereumProvider:Mot,OPTIONAL_EVENTS:W8e,OPTIONAL_METHODS:iQ,REQUIRED_EVENTS:aR,REQUIRED_METHODS:sR,default:dP},Symbol.toStringTag,{value:"Module"})),Pot={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},Not={block:iLe({format(t){var r;return{transactions:(r=t.transactions)==null?void 0:r.map(n=>{if(typeof n=="string")return n;const i=Pk(n);return i.typeHex==="0x7e"&&(i.isSystemTx=n.isSystemTx,i.mint=n.mint?hu(n.mint):void 0,i.sourceHash=n.sourceHash,i.type="deposit"),i}),stateRoot:t.stateRoot}}}),transaction:rLe({format(t){const e={};return t.type==="0x7e"&&(e.isSystemTx=t.isSystemTx,e.mint=t.mint?hu(t.mint):void 0,e.sourceHash=t.sourceHash,e.type="deposit"),e}}),transactionReceipt:mje({format(t){return{l1GasPrice:t.l1GasPrice?hu(t.l1GasPrice):null,l1GasUsed:t.l1GasUsed?hu(t.l1GasUsed):null,l1Fee:t.l1Fee?hu(t.l1Fee):null,l1FeeScalar:t.l1FeeScalar?Number(t.l1FeeScalar):null}}})};function Oot(t,e){return Bot(t)?$ot(t):Bje(t,e)}const Dot={transaction:Oot};function $ot(t){Uot(t);const{sourceHash:e,data:r,from:n,gas:i,isSystemTx:s,mint:a,to:o,value:f}=t,c=[e,n,o??"0x",a?Er(a):"0x",f?Er(f):"0x",i?Er(i):"0x",s?"0x1":"0x",r??"0x"];return Vh(["0x7e",W6(c)])}function Bot(t){return t.type==="deposit"||typeof t.sourceHash<"u"}function Uot(t){const{from:e,to:r}=t;if(e&&!js(e))throw new Lo({address:e});if(r&&!js(r))throw new Lo({address:r})}const gce={contracts:Pot,formatters:Not,serializers:Dot},TF=Wme({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),Kv=11155111,Lot=Wme({...gce,id:11155420,name:"OP Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com",apiUrl:"https://optimism-sepolia.blockscout.com/api"}},contracts:{...gce.contracts,disputeGameFactory:{[Kv]:{address:"0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"}},l2OutputOracle:{[Kv]:{address:"0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204},portal:{[Kv]:{address:"0x16Fc5058F25648194471939df75CF27A2fdC48BC"}},l1StandardBridge:{[Kv]:{address:"0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"}}},testnet:!0,sourceId:Kv}),_r={WALLET_CONNECT_CONNECTOR_ID:"walletConnect",INJECTED_CONNECTOR_ID:"injected",WALLET_STANDARD_CONNECTOR_ID:"announced",COINBASE_CONNECTOR_ID:"coinbaseWallet",COINBASE_SDK_CONNECTOR_ID:"coinbaseWalletSDK",SAFE_CONNECTOR_ID:"safe",LEDGER_CONNECTOR_ID:"ledger",EIP6963_CONNECTOR_ID:"eip6963",AUTH_CONNECTOR_ID:"w3mAuth",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},VERSION:"5.1.9"},Rd={ConnectorExplorerIds:{[_r.COINBASE_CONNECTOR_ID]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[_r.COINBASE_SDK_CONNECTOR_ID]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[_r.SAFE_CONNECTOR_ID]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[_r.LEDGER_CONNECTOR_ID]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927"},EIP155NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700"},ConnectorImageIds:{[_r.COINBASE_CONNECTOR_ID]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[_r.COINBASE_SDK_CONNECTOR_ID]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[_r.SAFE_CONNECTOR_ID]:"461db637-8616-43ce-035a-d89b8a1d5800",[_r.LEDGER_CONNECTOR_ID]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[_r.WALLET_CONNECT_CONNECTOR_ID]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[_r.INJECTED_CONNECTOR_ID]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[_r.INJECTED_CONNECTOR_ID]:"Browser Wallet",[_r.WALLET_CONNECT_CONNECTOR_ID]:"WalletConnect",[_r.COINBASE_CONNECTOR_ID]:"Coinbase",[_r.COINBASE_SDK_CONNECTOR_ID]:"Coinbase",[_r.LEDGER_CONNECTOR_ID]:"Ledger",[_r.SAFE_CONNECTOR_ID]:"Safe"},ConnectorTypesMap:{[_r.INJECTED_CONNECTOR_ID]:"INJECTED",[_r.WALLET_CONNECT_CONNECTOR_ID]:"WALLET_CONNECT",[_r.EIP6963_CONNECTOR_ID]:"ANNOUNCED",[_r.AUTH_CONNECTOR_ID]:"AUTH"},WalletConnectRpcChainIds:[1,5,11155111,10,420,42161,421613,137,80001,42220,1313161554,1313161555,56,97,43114,43113,100,8453,84531,7777777,999,324,280]},bce={getCaipTokens(t){if(!t)return;const e={};return Object.entries(t).forEach(([r,n])=>{e[`${_r.EIP155}:${r}`]=n}),e}};var fR;(function(t){t.Google="google",t.Github="github",t.Apple="apple",t.Facebook="facebook",t.X="x",t.Discord="discord",t.Farcaster="farcaster"})(fR||(fR={}));var G8e={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(Mt,function(){var r=1e3,n=6e4,i=36e5,s="millisecond",a="second",o="minute",f="hour",c="day",d="week",p="month",g="quarter",x="year",S="date",I="Invalid Date",R=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(l){var h=["th","st","nd","rd"],w=l%100;return"["+l+(h[(w-20)%10]||h[w]||h[0])+"]"}},U=function(l,h,w){var _=String(l);return!_||_.length>=h?l:""+Array(h+1-_.length).join(w)+l},D={s:U,z:function(l){var h=-l.utcOffset(),w=Math.abs(h),_=Math.floor(w/60),E=w%60;return(h<=0?"+":"-")+U(_,2,"0")+":"+U(E,2,"0")},m:function l(h,w){if(h.date()1)return l(v[0])}else{var m=h.name;F[m]=h,E=m}return!_&&E&&(B=E),E||!_&&B},Y=function(l,h){if(N(l))return l.clone();var w=typeof h=="object"?h:{};return w.date=l,w.args=arguments,new P(w)},z=D;z.l=W,z.i=N,z.w=function(l,h){return Y(l,{locale:h.$L,utc:h.$u,x:h.$x,$offset:h.$offset})};var P=function(){function l(w){this.$L=W(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[k]=!0}var h=l.prototype;return h.parse=function(w){this.$d=function(_){var E=_.date,T=_.utc;if(E===null)return new Date(NaN);if(z.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var v=E.match(R);if(v){var m=v[2]-1||0,A=(v[7]||"0").substring(0,3);return T?new Date(Date.UTC(v[1],m,v[3]||1,v[4]||0,v[5]||0,v[6]||0,A)):new Date(v[1],m,v[3]||1,v[4]||0,v[5]||0,v[6]||0,A)}}return new Date(E)}(w),this.init()},h.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},h.$utils=function(){return z},h.isValid=function(){return this.$d.toString()!==I},h.isSame=function(w,_){var E=Y(w);return this.startOf(_)<=E&&E<=this.endOf(_)},h.isAfter=function(w,_){return Y(w)0,F<=B.r||!B.r){F<=1&&D>0&&(B=M[D-1]);var k=O[B.l];x&&(F=x(""+F)),I=typeof k=="string"?k.replace("%d",F):k(F,d,B.l,R);break}}if(d)return I;var N=R?O.future:O.past;return typeof N=="function"?N(I):N.replace("%s",I)},s.to=function(c,d){return o(c,d,this,!0)},s.from=function(c,d){return o(c,d,this)};var f=function(c){return c.$u?i.utc():i()};s.toNow=function(c){return this.to(f(this),c)},s.fromNow=function(c){return this.from(f(this),c)}}})})(Q8e);var qot=Q8e.exports;const Hot=$u(qot);var Z8e={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(Mt,function(){return function(r,n,i){i.updateLocale=function(s,a){var o=i.Ls[s];if(o)return(a?Object.keys(a):[]).forEach(function(f){o[f]=a[f]}),o}}})})(Z8e);var Vot=Z8e.exports;const Wot=$u(Vot);T3.extend(Hot);T3.extend(Wot);const Got={...zot,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}};T3.locale("en-web3-modal",Got);const sQ={getYear(t=new Date().toISOString()){return T3(t).year()},getRelativeDateFromNow(t){return T3(t).locale("en-web3-modal").fromNow(!0)},formatDate(t,e="DD MMM"){return T3(t).format(e)}},vl={caipNetworkIdToNumber(t){return t?Number(t.split(":")[1]):void 0},parseEvmChainId(t){return typeof t=="string"?this.caipNetworkIdToNumber(t):t}};var Kot=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,IF=Math.ceil,kf=Math.floor,Na="[BigNumber Error] ",yce=Na+"Number primitive has more than 15 significant digits: ",Oc=1e14,Dr=14,RF=9007199254740991,MF=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],wp=1e7,O0=1e9;function Y8e(t){var e,r,n,i=M.prototype={constructor:M,toString:null,valueOf:null},s=new M(1),a=20,o=4,f=-7,c=21,d=-1e7,p=1e7,g=!1,x=1,S=0,I={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function M(N,W){var Y,z,P,u,l,h,w,_,E=this;if(!(E instanceof M))return new M(N,W);if(W==null){if(N&&N._isBigNumber===!0){E.s=N.s,!N.c||N.e>p?E.c=E.e=null:N.e=10;l/=10,u++);u>p?E.c=E.e=null:(E.e=u,E.c=[N]);return}_=String(N)}else{if(!Kot.test(_=String(N)))return n(E,_,h);E.s=_.charCodeAt(0)==45?(_=_.slice(1),-1):1}(u=_.indexOf("."))>-1&&(_=_.replace(".","")),(l=_.search(/e/i))>0?(u<0&&(u=l),u+=+_.slice(l+1),_=_.substring(0,l)):u<0&&(u=_.length)}else{if(Ci(W,2,R.length,"Base"),W==10&&O)return E=new M(N),F(E,a+E.e+1,o);if(_=String(N),h=typeof N=="number"){if(N*0!=0)return n(E,_,h,W);if(E.s=1/N<0?(_=_.slice(1),-1):1,M.DEBUG&&_.replace(/^0\.0*|\./,"").length>15)throw Error(yce+N)}else E.s=_.charCodeAt(0)===45?(_=_.slice(1),-1):1;for(Y=R.slice(0,W),u=l=0,w=_.length;lu){u=w;continue}}else if(!P&&(_==_.toUpperCase()&&(_=_.toLowerCase())||_==_.toLowerCase()&&(_=_.toUpperCase()))){P=!0,l=-1,u=0;continue}return n(E,String(N),h,W)}h=!1,_=r(_,W,10,E.s),(u=_.indexOf("."))>-1?_=_.replace(".",""):u=_.length}for(l=0;_.charCodeAt(l)===48;l++);for(w=_.length;_.charCodeAt(--w)===48;);if(_=_.slice(l,++w)){if(w-=l,h&&M.DEBUG&&w>15&&(N>RF||N!==kf(N)))throw Error(yce+E.s*N);if((u=u-l-1)>p)E.c=E.e=null;else if(u=-O0&&P<=O0&&P===kf(P)){if(z[0]===0){if(P===0&&z.length===1)return!0;break e}if(W=(P+1)%Dr,W<1&&(W+=Dr),String(z[0]).length==W){for(W=0;W=Oc||Y!==kf(Y))break e;if(Y!==0)return!0}}}else if(z===null&&P===null&&(u===null||u===1||u===-1))return!0;throw Error(Na+"Invalid BigNumber: "+N)},M.maximum=M.max=function(){return D(arguments,-1)},M.minimum=M.min=function(){return D(arguments,1)},M.random=function(){var N=9007199254740992,W=Math.random()*N&2097151?function(){return kf(Math.random()*N)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Y){var z,P,u,l,h,w=0,_=[],E=new M(s);if(Y==null?Y=a:Ci(Y,0,O0),l=IF(Y/Dr),g)if(crypto.getRandomValues){for(z=crypto.getRandomValues(new Uint32Array(l*=2));w>>11),h>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),z[w]=P[0],z[w+1]=P[1]):(_.push(h%1e14),w+=2);w=l/2}else if(crypto.randomBytes){for(z=crypto.randomBytes(l*=7);w=9e15?crypto.randomBytes(7).copy(z,w):(_.push(h%1e14),w+=7);w=l/7}else throw g=!1,Error(Na+"crypto unavailable");if(!g)for(;w=10;h/=10,w++);wP-1&&(h[l+1]==null&&(h[l+1]=0),h[l+1]+=h[l]/P|0,h[l]%=P)}return h.reverse()}return function(Y,z,P,u,l){var h,w,_,E,T,v,m,A,Z=Y.indexOf("."),ie=a,y=o;for(Z>=0&&(E=S,S=0,Y=Y.replace(".",""),A=new M(z),v=A.pow(Y.length-Z),S=E,A.c=W(cd(_f(v.c),v.e,"0"),10,P,N),A.e=A.c.length),m=W(Y,z,P,l?(h=R,N):(h=N,R)),_=E=m.length;m[--E]==0;m.pop());if(!m[0])return h.charAt(0);if(Z<0?--_:(v.c=m,v.e=_,v.s=u,v=e(v,A,ie,y,P),m=v.c,T=v.r,_=v.e),w=_+ie+1,Z=m[w],E=P/2,T=T||w<0||m[w+1]!=null,T=y<4?(Z!=null||T)&&(y==0||y==(v.s<0?3:2)):Z>E||Z==E&&(y==4||T||y==6&&m[w-1]&1||y==(v.s<0?8:7)),w<1||!m[0])Y=T?cd(h.charAt(1),-ie,h.charAt(0)):h.charAt(0);else{if(m.length=w,T)for(--P;++m[--w]>P;)m[w]=0,w||(++_,m=[1].concat(m));for(E=m.length;!m[--E];);for(Z=0,Y="";Z<=E;Y+=h.charAt(m[Z++]));Y=cd(Y,_,h.charAt(0))}return Y}}(),e=function(){function N(z,P,u){var l,h,w,_,E=0,T=z.length,v=P%wp,m=P/wp|0;for(z=z.slice();T--;)w=z[T]%wp,_=z[T]/wp|0,l=m*w+_*v,h=v*w+l%wp*wp+E,E=(h/u|0)+(l/wp|0)+m*_,z[T]=h%u;return E&&(z=[E].concat(z)),z}function W(z,P,u,l){var h,w;if(u!=l)w=u>l?1:-1;else for(h=w=0;hP[h]?1:-1;break}return w}function Y(z,P,u,l){for(var h=0;u--;)z[u]-=h,h=z[u]1;z.splice(0,1));}return function(z,P,u,l,h){var w,_,E,T,v,m,A,Z,ie,y,G,H,K,ee,j,X,oe,be=z.s==P.s?1:-1,ue=z.c,Te=P.c;if(!ue||!ue[0]||!Te||!Te[0])return new M(!z.s||!P.s||(ue?Te&&ue[0]==Te[0]:!Te)?NaN:ue&&ue[0]==0||!Te?be*0:be/0);for(Z=new M(be),ie=Z.c=[],_=z.e-P.e,be=u+_+1,h||(h=Oc,_=Pf(z.e/Dr)-Pf(P.e/Dr),be=be/Dr|0),E=0;Te[E]==(ue[E]||0);E++);if(Te[E]>(ue[E]||0)&&_--,be<0)ie.push(1),T=!0;else{for(ee=ue.length,X=Te.length,E=0,be+=2,v=kf(h/(Te[0]+1)),v>1&&(Te=N(Te,v,h),ue=N(ue,v,h),X=Te.length,ee=ue.length),K=X,y=ue.slice(0,X),G=y.length;G=h/2&&j++;do{if(v=0,w=W(Te,y,X,G),w<0){if(H=y[0],X!=G&&(H=H*h+(y[1]||0)),v=kf(H/j),v>1)for(v>=h&&(v=h-1),m=N(Te,v,h),A=m.length,G=y.length;W(m,y,A,G)==1;)v--,Y(m,X=10;be/=10,E++);F(Z,u+(Z.e=E+_*Dr-1)+1,l,T)}else Z.e=_,Z.r=+T;return Z}}();function U(N,W,Y,z){var P,u,l,h,w;if(Y==null?Y=o:Ci(Y,0,8),!N.c)return N.toString();if(P=N.c[0],l=N.e,W==null)w=_f(N.c),w=z==1||z==2&&(l<=f||l>=c)?ES(w,l):cd(w,l,"0");else if(N=F(new M(N),W,Y),u=N.e,w=_f(N.c),h=w.length,z==1||z==2&&(W<=u||u<=f)){for(;hh){if(--W>0)for(w+=".";W--;w+="0");}else if(W+=u-h,W>0)for(u+1==h&&(w+=".");W--;w+="0");return N.s<0&&P?"-"+w:w}function D(N,W){for(var Y,z,P=1,u=new M(N[0]);P=10;P/=10,z++);return(Y=z+Y*Dr-1)>p?N.c=N.e=null:Y=10;h/=10,P++);if(u=W-P,u<0)u+=Dr,l=W,w=T[_=0],E=kf(w/v[P-l-1]%10);else if(_=IF((u+1)/Dr),_>=T.length)if(z){for(;T.length<=_;T.push(0));w=E=0,P=1,u%=Dr,l=u-Dr+1}else break e;else{for(w=h=T[_],P=1;h>=10;h/=10,P++);u%=Dr,l=u-Dr+P,E=l<0?0:kf(w/v[P-l-1]%10)}if(z=z||W<0||T[_+1]!=null||(l<0?w:w%v[P-l-1]),z=Y<4?(E||z)&&(Y==0||Y==(N.s<0?3:2)):E>5||E==5&&(Y==4||z||Y==6&&(u>0?l>0?w/v[P-l]:0:T[_-1])%10&1||Y==(N.s<0?8:7)),W<1||!T[0])return T.length=0,z?(W-=N.e+1,T[0]=v[(Dr-W%Dr)%Dr],N.e=-W||0):T[0]=N.e=0,N;if(u==0?(T.length=_,h=1,_--):(T.length=_+1,h=v[Dr-u],T[_]=l>0?kf(w/v[P-l]%v[l])*h:0),z)for(;;)if(_==0){for(u=1,l=T[0];l>=10;l/=10,u++);for(l=T[0]+=h,h=1;l>=10;l/=10,h++);u!=h&&(N.e++,T[0]==Oc&&(T[0]=1));break}else{if(T[_]+=h,T[_]!=Oc)break;T[_--]=0,h=1}for(u=T.length;T[--u]===0;T.pop());}N.e>p?N.c=N.e=null:N.e=c?ES(W,Y):cd(W,Y,"0"),N.s<0?"-"+W:W)}return i.absoluteValue=i.abs=function(){var N=new M(this);return N.s<0&&(N.s=1),N},i.comparedTo=function(N,W){return Y5(this,new M(N,W))},i.decimalPlaces=i.dp=function(N,W){var Y,z,P,u=this;if(N!=null)return Ci(N,0,O0),W==null?W=o:Ci(W,0,8),F(new M(u),N+u.e+1,W);if(!(Y=u.c))return null;if(z=((P=Y.length-1)-Pf(this.e/Dr))*Dr,P=Y[P])for(;P%10==0;P/=10,z--);return z<0&&(z=0),z},i.dividedBy=i.div=function(N,W){return e(this,new M(N,W),a,o)},i.dividedToIntegerBy=i.idiv=function(N,W){return e(this,new M(N,W),0,1)},i.exponentiatedBy=i.pow=function(N,W){var Y,z,P,u,l,h,w,_,E,T=this;if(N=new M(N),N.c&&!N.isInteger())throw Error(Na+"Exponent not an integer: "+k(N));if(W!=null&&(W=new M(W)),h=N.e>14,!T.c||!T.c[0]||T.c[0]==1&&!T.e&&T.c.length==1||!N.c||!N.c[0])return E=new M(Math.pow(+k(T),h?N.s*(2-_S(N)):+k(N))),W?E.mod(W):E;if(w=N.s<0,W){if(W.c?!W.c[0]:!W.s)return new M(NaN);z=!w&&T.isInteger()&&W.isInteger(),z&&(T=T.mod(W))}else{if(N.e>9&&(T.e>0||T.e<-1||(T.e==0?T.c[0]>1||h&&T.c[1]>=24e7:T.c[0]<8e13||h&&T.c[0]<=9999975e7)))return u=T.s<0&&_S(N)?-0:0,T.e>-1&&(u=1/u),new M(w?1/u:u);S&&(u=IF(S/Dr+2))}for(h?(Y=new M(.5),w&&(N.s=1),_=_S(N)):(P=Math.abs(+k(N)),_=P%2),E=new M(s);;){if(_){if(E=E.times(T),!E.c)break;u?E.c.length>u&&(E.c.length=u):z&&(E=E.mod(W))}if(P){if(P=kf(P/2),P===0)break;_=P%2}else if(N=N.times(Y),F(N,N.e+1,1),N.e>14)_=_S(N);else{if(P=+k(N),P===0)break;_=P%2}T=T.times(T),u?T.c&&T.c.length>u&&(T.c.length=u):z&&(T=T.mod(W))}return z?E:(w&&(E=s.div(E)),W?E.mod(W):u?F(E,S,o,l):E)},i.integerValue=function(N){var W=new M(this);return N==null?N=o:Ci(N,0,8),F(W,W.e+1,N)},i.isEqualTo=i.eq=function(N,W){return Y5(this,new M(N,W))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(N,W){return Y5(this,new M(N,W))>0},i.isGreaterThanOrEqualTo=i.gte=function(N,W){return(W=Y5(this,new M(N,W)))===1||W===0},i.isInteger=function(){return!!this.c&&Pf(this.e/Dr)>this.c.length-2},i.isLessThan=i.lt=function(N,W){return Y5(this,new M(N,W))<0},i.isLessThanOrEqualTo=i.lte=function(N,W){return(W=Y5(this,new M(N,W)))===-1||W===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(N,W){var Y,z,P,u,l=this,h=l.s;if(N=new M(N,W),W=N.s,!h||!W)return new M(NaN);if(h!=W)return N.s=-W,l.plus(N);var w=l.e/Dr,_=N.e/Dr,E=l.c,T=N.c;if(!w||!_){if(!E||!T)return E?(N.s=-W,N):new M(T?l:NaN);if(!E[0]||!T[0])return T[0]?(N.s=-W,N):new M(E[0]?l:o==3?-0:0)}if(w=Pf(w),_=Pf(_),E=E.slice(),h=w-_){for((u=h<0)?(h=-h,P=E):(_=w,P=T),P.reverse(),W=h;W--;P.push(0));P.reverse()}else for(z=(u=(h=E.length)<(W=T.length))?h:W,h=W=0;W0)for(;W--;E[Y++]=0);for(W=Oc-1;z>h;){if(E[--z]=0;){for(Y=0,v=H[P]%ie,m=H[P]/ie|0,l=w,u=P+l;u>P;)_=G[--l]%ie,E=G[l]/ie|0,h=m*_+E*v,_=v*_+h%ie*ie+A[u]+Y,Y=(_/Z|0)+(h/ie|0)+m*E,A[u--]=_%Z;A[u]=Y}return Y?++z:A.splice(0,1),B(N,A,z)},i.negated=function(){var N=new M(this);return N.s=-N.s||null,N},i.plus=function(N,W){var Y,z=this,P=z.s;if(N=new M(N,W),W=N.s,!P||!W)return new M(NaN);if(P!=W)return N.s=-W,z.minus(N);var u=z.e/Dr,l=N.e/Dr,h=z.c,w=N.c;if(!u||!l){if(!h||!w)return new M(P/0);if(!h[0]||!w[0])return w[0]?N:new M(h[0]?z:P*0)}if(u=Pf(u),l=Pf(l),h=h.slice(),P=u-l){for(P>0?(l=u,Y=w):(P=-P,Y=h),Y.reverse();P--;Y.push(0));Y.reverse()}for(P=h.length,W=w.length,P-W<0&&(Y=w,w=h,h=Y,W=P),P=0;W;)P=(h[--W]=h[W]+w[W]+P)/Oc|0,h[W]=Oc===h[W]?0:h[W]%Oc;return P&&(h=[P].concat(h),++l),B(N,h,l)},i.precision=i.sd=function(N,W){var Y,z,P,u=this;if(N!=null&&N!==!!N)return Ci(N,1,O0),W==null?W=o:Ci(W,0,8),F(new M(u),N,W);if(!(Y=u.c))return null;if(P=Y.length-1,z=P*Dr+1,P=Y[P]){for(;P%10==0;P/=10,z--);for(P=Y[0];P>=10;P/=10,z++);}return N&&u.e+1>z&&(z=u.e+1),z},i.shiftedBy=function(N){return Ci(N,-RF,RF),this.times("1e"+N)},i.squareRoot=i.sqrt=function(){var N,W,Y,z,P,u=this,l=u.c,h=u.s,w=u.e,_=a+4,E=new M("0.5");if(h!==1||!l||!l[0])return new M(!h||h<0&&(!l||l[0])?NaN:l?u:1/0);if(h=Math.sqrt(+k(u)),h==0||h==1/0?(W=_f(l),(W.length+w)%2==0&&(W+="0"),h=Math.sqrt(+W),w=Pf((w+1)/2)-(w<0||w%2),h==1/0?W="5e"+w:(W=h.toExponential(),W=W.slice(0,W.indexOf("e")+1)+w),Y=new M(W)):Y=new M(h+""),Y.c[0]){for(w=Y.e,h=w+_,h<3&&(h=0);;)if(P=Y,Y=E.times(P.plus(e(u,P,_,1))),_f(P.c).slice(0,h)===(W=_f(Y.c)).slice(0,h))if(Y.e0&&A>0){for(u=A%h||h,E=m.substr(0,u);u0&&(E+=_+m.slice(u)),v&&(E="-"+E)}z=T?E+(Y.decimalSeparator||"")+((w=+Y.fractionGroupSize)?T.replace(new RegExp("\\d{"+w+"}\\B","g"),"$&"+(Y.fractionGroupSeparator||"")):T):E}return(Y.prefix||"")+z+(Y.suffix||"")},i.toFraction=function(N){var W,Y,z,P,u,l,h,w,_,E,T,v,m=this,A=m.c;if(N!=null&&(h=new M(N),!h.isInteger()&&(h.c||h.s!==1)||h.lt(s)))throw Error(Na+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+k(h));if(!A)return new M(m);for(W=new M(s),_=Y=new M(s),z=w=new M(s),v=_f(A),u=W.e=v.length-m.e-1,W.c[0]=MF[(l=u%Dr)<0?Dr+l:l],N=!N||h.comparedTo(W)>0?u>0?W:_:h,l=p,p=1/0,h=new M(v),w.c[0]=0;E=e(h,W,0,1),P=Y.plus(E.times(z)),P.comparedTo(N)!=1;)Y=z,z=P,_=w.plus(E.times(P=_)),w=P,W=h.minus(E.times(P=W)),h=P;return P=e(N.minus(Y),z,0,1),w=w.plus(P.times(_)),Y=Y.plus(P.times(z)),w.s=_.s=m.s,u=u*2,T=e(_,z,u,o).minus(m).abs().comparedTo(e(w,Y,u,o).minus(m).abs())<1?[_,z]:[w,Y],p=l,T},i.toNumber=function(){return+k(this)},i.toPrecision=function(N,W){return N!=null&&Ci(N,1,O0),U(this,N,W,2)},i.toString=function(N){var W,Y=this,z=Y.s,P=Y.e;return P===null?z?(W="Infinity",z<0&&(W="-"+W)):W="NaN":(N==null?W=P<=f||P>=c?ES(_f(Y.c),P):cd(_f(Y.c),P,"0"):N===10&&O?(Y=F(new M(Y),a+P+1,o),W=cd(_f(Y.c),Y.e,"0")):(Ci(N,2,R.length,"Base"),W=r(cd(_f(Y.c),P,"0"),10,N,z,!0)),z<0&&Y.c[0]&&(W="-"+W)),W},i.valueOf=i.toJSON=function(){return k(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&M.set(t),M}function Pf(t){var e=t|0;return t>0||t===e?e:e-1}function _f(t){for(var e,r,n=1,i=t.length,s=t[0]+"";nc^r?1:-1;for(o=(f=i.length)<(c=s.length)?f:c,a=0;as[a]^r?1:-1;return f==c?0:f>c^r?1:-1}function Ci(t,e,r,n){if(tr||t!==kf(t))throw Error(Na+(n||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _S(t){var e=t.c.length-1;return Pf(t.e/Dr)==e&&t.c[e]%2!=0}function ES(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function cd(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e="0"&&s<="9";!i&&(o||f||c||d)&&t.preventDefault(),e==="0"&&!p&&!g&&s==="0"&&t.preventDefault(),e==="0"&&x&&(r(s),t.preventDefault()),(p||g)&&(e||(r("0."),t.preventDefault()),(e!=null&&e.includes(".")||e!=null&&e.includes(","))&&t.preventDefault()),!x&&!n.includes(s)&&!g&&!p&&t.preventDefault()}},Zot=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],aQ={URLS:{FAQ:"https://walletconnect.com/faq"}},zn={WC_NAME_SUFFIX:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CHAIN:{EVM:"evm",SOLANA:"solana"},CHAIN_NAME_MAP:{evm:"Ethereum",solana:"Solana"}};function w6(t,e){return e==="light"?{"--w3m-accent":(t==null?void 0:t["--w3m-accent"])||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":(t==null?void 0:t["--w3m-accent"])||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}const J8e=":";function Yot(t){const{namespace:e,reference:r}=t;return[e,r].join(J8e)}function Jot(t){const[e,r,n]=t.split(J8e);return{namespace:e,reference:r,address:n}}function Xot(t,e){const r=[];return t.forEach(n=>{const i=e(n);r.includes(i)||r.push(i)}),r}function eft(t){const{namespace:e,reference:r}=Jot(t);return Yot({namespace:e,reference:r})}function tft(t){return Xot(t,eft)}var X8e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rft(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var nft={exports:{}};/** +}`;var qr=nJ(function(){return Sn(me,fr+"return "+Et).apply(r,Me)});if(qr.source=Et,jN(qr))throw qr;return qr}function h_e(b){return Rn(b).toLowerCase()}function p_e(b){return Rn(b).toUpperCase()}function m_e(b,C,L){if(b=Rn(b),b&&(L||C===r))return dZ(b);if(!b||!(C=bo(C)))return b;var J=vc(b),ae=vc(C),me=hZ(J,ae),Me=pZ(J,ae)+1;return op(J,me,Me).join("")}function g_e(b,C,L){if(b=Rn(b),b&&(L||C===r))return b.slice(0,gZ(b)+1);if(!b||!(C=bo(C)))return b;var J=vc(b),ae=pZ(J,vc(C))+1;return op(J,0,ae).join("")}function b_e(b,C,L){if(b=Rn(b),b&&(L||C===r))return b.replace(De,"");if(!b||!(C=bo(C)))return b;var J=vc(b),ae=hZ(J,vc(C));return op(J,ae).join("")}function y_e(b,C){var L=Y,J=z;if(_i(C)){var ae="separator"in C?C.separator:ae;L="length"in C?zr(C.length):L,J="omission"in C?bo(C.omission):J}b=Rn(b);var me=b.length;if(Qg(b)){var Me=vc(b);me=Me.length}if(L>=me)return b;var $e=L-Zg(J);if($e<1)return J;var Ge=Me?op(Me,0,$e).join(""):b.slice(0,$e);if(ae===r)return Ge+J;if(Me&&($e+=Ge.length-$e),zN(ae)){if(b.slice($e).search(ae)){var vt,xt=Ge;for(ae.global||(ae=iN(ae.source,Rn(pt.exec(ae))+"g")),ae.lastIndex=0;vt=ae.exec(xt);)var Et=vt.index;Ge=Ge.slice(0,Et===r?$e:Et)}}else if(b.indexOf(bo(ae),$e)!=$e){var qt=Ge.lastIndexOf(ae);qt>-1&&(Ge=Ge.slice(0,qt))}return Ge+J}function w_e(b){return b=Rn(b),b&&Xe.test(b)?b.replace(rt,K4e):b}var v_e=nb(function(b,C,L){return b+(L?" ":"")+C.toUpperCase()}),VN=iY("toUpperCase");function rJ(b,C,L){return b=Rn(b),C=L?r:C,C===r?q4e(b)?Y4e(b):O4e(b):b.match(C)||[]}var nJ=Wr(function(b,C){try{return R0(b,r,C)}catch(L){return jN(L)?L:new Sr(L)}}),x_e=J1(function(b,C){return af(C,function(L){L=Xu(L),Z1(b,L,LN(b[L],b))}),b});function A_e(b){var C=b==null?0:b.length,L=pr();return b=C?pi(b,function(J){if(typeof J[1]!="function")throw new of(a);return[L(J[0]),J[1]]}):[],Wr(function(J){for(var ae=-1;++aeE)return[];var L=m,J=vs(b,m);C=pr(C),b-=m;for(var ae=tN(J,C);++L0||C<0)?new Jr(L):(b<0?L=L.takeRight(-b):b&&(L=L.drop(b)),C!==r&&(C=zr(C),L=C<0?L.dropRight(-C):L.take(C-b)),L)},Jr.prototype.takeRightWhile=function(b){return this.reverse().takeWhile(b).reverse()},Jr.prototype.toArray=function(){return this.take(m)},Yu(Jr.prototype,function(b,C){var L=/^(?:filter|find|map|reject)|While$/.test(C),J=/^(?:head|last)$/.test(C),ae=pe[J?"take"+(C=="last"?"Right":""):C],me=J||/^find/.test(C);ae&&(pe.prototype[C]=function(){var Me=this.__wrapped__,$e=J?[1]:arguments,Ge=Me instanceof Jr,vt=$e[0],xt=Ge||Or(Me),Et=function(Qr){var un=ae.apply(pe,tp([Qr],$e));return J&&qt?un[0]:un};xt&&L&&typeof vt=="function"&&vt.length!=1&&(Ge=xt=!1);var qt=this.__chain__,fr=!!this.__actions__.length,br=me&&!qt,qr=Ge&&!fr;if(!me&&xt){Me=qr?Me:new Jr(this);var yr=b.apply(Me,$e);return yr.__actions__.push({func:YE,args:[Et],thisArg:r}),new ff(yr,qt)}return br&&qr?b.apply(this,$e):(yr=this.thru(Et),br?J?yr.value()[0]:yr.value():yr)})}),af(["pop","push","shift","sort","splice","unshift"],function(b){var C=_E[b],L=/^(?:push|sort|unshift)$/.test(b)?"tap":"thru",J=/^(?:pop|shift)$/.test(b);pe.prototype[b]=function(){var ae=arguments;if(J&&!this.__chain__){var me=this.value();return C.apply(Or(me)?me:[],ae)}return this[L](function(Me){return C.apply(Or(Me)?Me:[],ae)})}}),Yu(Jr.prototype,function(b,C){var L=pe[C];if(L){var J=L.name+"";Nn.call(eb,J)||(eb[J]=[]),eb[J].push({name:C,func:L})}}),eb[HE(r,O).name]=[{name:"wrapper",func:r}],Jr.prototype.clone=wve,Jr.prototype.reverse=vve,Jr.prototype.value=xve,pe.prototype.at=Z7e,pe.prototype.chain=Y7e,pe.prototype.commit=J7e,pe.prototype.next=X7e,pe.prototype.plant=txe,pe.prototype.reverse=rxe,pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=nxe,pe.prototype.first=pe.prototype.head,n4&&(pe.prototype[n4]=exe),pe},Yg=J4e();qi?((qi.exports=Yg)._=Yg,Wn._=Yg):cn._=Yg}).call(Gv)})(xH,xH.exports);var Vat=Object.defineProperty,Wat=Object.defineProperties,Gat=Object.getOwnPropertyDescriptors,ice=Object.getOwnPropertySymbols,Kat=Object.prototype.hasOwnProperty,Qat=Object.prototype.propertyIsEnumerable,sce=(t,e,r)=>e in t?Vat(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vS=(t,e)=>{for(var r in e||(e={}))Kat.call(e,r)&&sce(t,r,e[r]);if(ice)for(var r of ice(e))Qat.call(e,r)&&sce(t,r,e[r]);return t},Zat=(t,e)=>Wat(t,Gat(e));function Ru(t,e,r){var n;const i=W9(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${Hat}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Mg(t){return t.includes(":")?t.split(":")[1]:t}function H8e(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Yat(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function AF(t={},e={}){const r=ace(t),n=ace(e);return xH.exports.merge(r,n)}function ace(t){var e,r,n,i;const s={};if(!xx(t))return s;for(const[a,o]of Object.entries(t)){const f=YK(a)?[a]:o.chains,c=o.methods||[],d=o.events||[],p=o.rpcMap||{},g=C9(a);s[g]=Zat(vS(vS({},s[g]),o),{chains:_T(f,(e=s[g])==null?void 0:e.chains),methods:_T(c,(r=s[g])==null?void 0:r.methods),events:_T(d,(n=s[g])==null?void 0:n.events),rpcMap:vS(vS({},p),(i=s[g])==null?void 0:i.rpcMap)})}return s}function Jat(t){return t.includes(":")?t.split(":")[2]:t}function oce(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],a=n.accounts||[],o=YK(r)?[r]:n.chains?n.chains:H8e(n.accounts);e[r]={chains:o,methods:i,events:s,accounts:a}}return e}function _F(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const V8e={},Pn=t=>V8e[t],EF=(t,e)=>{V8e[t]=e};class Xat{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}var eot=Object.defineProperty,tot=Object.defineProperties,rot=Object.getOwnPropertyDescriptors,fce=Object.getOwnPropertySymbols,not=Object.prototype.hasOwnProperty,iot=Object.prototype.propertyIsEnumerable,cce=(t,e,r)=>e in t?eot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uce=(t,e)=>{for(var r in e||(e={}))not.call(e,r)&&cce(t,r,e[r]);if(fce)for(var r of fce(e))iot.call(e,r)&&cce(t,r,e[r]);return t},lce=(t,e)=>tot(t,rot(e));class sot{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||Ru(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(Mg(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const a=this.client.session.get(e.topic),o=((i=a==null?void 0:a.sessionProperties)==null?void 0:i.capabilities)||{};if(o!=null&&o[s])return o==null?void 0:o[s];const f=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:lce(uce({},a.sessionProperties||{}),{capabilities:lce(uce({},o||{}),{[s]:f})})})}catch(c){console.warn("Failed to update session with capabilities",c)}return f}}class aot{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class oot{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class fot{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||Ru(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new qu(new B1(n,Pn("disableProviderPing")))}}class cot{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=Mg(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class uot{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class lot{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=Mg(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}class dot{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||Ru(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace);return typeof n>"u"?void 0:new qu(new B1(n,Pn("disableProviderPing")))}}class hot{constructor(e){this.name=Rb,this.namespace=e.namespace,this.events=Pn("events"),this.client=Pn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(Hu.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=W9(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||Ru(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new qu(new B1(n,Pn("disableProviderPing")))}}var pot=Object.defineProperty,mot=Object.defineProperties,got=Object.getOwnPropertyDescriptors,dce=Object.getOwnPropertySymbols,bot=Object.prototype.hasOwnProperty,yot=Object.prototype.propertyIsEnumerable,hce=(t,e,r)=>e in t?pot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xS=(t,e)=>{for(var r in e||(e={}))bot.call(e,r)&&hce(t,r,e[r]);if(dce)for(var r of dce(e))yot.call(e,r)&&hce(t,r,e[r]);return t},CF=(t,e)=>mot(t,got(e));class nQ{constructor(e){this.events=new SK,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:x_(__({level:(e==null?void 0:e.logger)||rce})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new nQ(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:xS({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(a=>r(null,oP(s,a))).catch(a=>r(a,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 e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Bn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const a=oce(this.session.namespaces);this.namespaces=AF(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const a=oce(s.namespaces);this.namespaces=AF(this.namespaces,a),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==z8e)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===Rb?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(Fm(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Pat.init({core:this.providerOpts.core,logger:this.providerOpts.logger||rce,relayUrl:this.providerOpts.relayUrl||jat,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.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 e=[...new Set(Object.keys(this.session.namespaces).map(r=>C9(r)))];EF("client",this.client),EF("events",this.events),EF("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=Yat(r,this.session),i=H8e(n),s=AF(this.namespaces,this.optionalNamespaces),a=CF(xS({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new sot({namespace:a});break;case"algorand":this.rpcProviders[r]=new fot({namespace:a});break;case"solana":this.rpcProviders[r]=new aot({namespace:a});break;case"cosmos":this.rpcProviders[r]=new oot({namespace:a});break;case"polkadot":this.rpcProviders[r]=new Xat({namespace:a});break;case"cip34":this.rpcProviders[r]=new cot({namespace:a});break;case"elrond":this.rpcProviders[r]=new uot({namespace:a});break;case"multiversx":this.rpcProviders[r]=new lot({namespace:a});break;case"near":this.rpcProviders[r]=new dot({namespace:a});break;default:this.rpcProviders[Rb]?this.rpcProviders[Rb].updateNamespace(a):this.rpcProviders[Rb]=new hot({namespace:a})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&Fm(i)&&this.events.emit("accountsChanged",i.map(Jat))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,a=C9(i),o=_F(i)!==_F(s)?`${a}:${_F(s)}`:i;this.onChainChanged(o)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=CF(xS({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",CF(xS({},Bn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Hu.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Rb]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(a=>C9(a)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=C9(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}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(e,r){this.client.core.storage.setItem(`${nce}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${nce}/${e}`)}}const wot=nQ,vot="wc",xot="ethereum_provider",Aot=`${vot}@2:${xot}:`,_ot="https://rpc.walletconnect.com/v1/",sR=["eth_sendTransaction","personal_sign"],iQ=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],aR=["chainChanged","accountsChanged"],W8e=["chainChanged","accountsChanged","message","disconnect","connect"];var Eot=Object.defineProperty,Cot=Object.defineProperties,Sot=Object.getOwnPropertyDescriptors,pce=Object.getOwnPropertySymbols,Tot=Object.prototype.hasOwnProperty,Iot=Object.prototype.propertyIsEnumerable,mce=(t,e,r)=>e in t?Eot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mb=(t,e)=>{for(var r in e||(e={}))Tot.call(e,r)&&mce(t,r,e[r]);if(pce)for(var r of pce(e))Iot.call(e,r)&&mce(t,r,e[r]);return t},SF=(t,e)=>Cot(t,Sot(e));function oR(t){return Number(t[0].split(":")[1])}function AS(t){return`0x${t.toString(16)}`}function Rot(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:a,rpcMap:o}=t;if(!nH(e))throw new Error("Invalid chains");const f={chains:e,methods:n||sR,events:s||aR,rpcMap:Mb({},e.length?{[oR(e)]:o[oR(e)]}:{})},c=s==null?void 0:s.filter(x=>!aR.includes(x)),d=n==null?void 0:n.filter(x=>!sR.includes(x));if(!r&&!a&&!i&&!(c!=null&&c.length)&&!(d!=null&&d.length))return{required:e.length?f:void 0};const p=(c==null?void 0:c.length)&&(d==null?void 0:d.length)||!r,g={chains:[...new Set(p?f.chains.concat(r||[]):r)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:iQ))],events:[...new Set(f.events.concat(a!=null&&a.length?a:W8e))],rpcMap:o};return{required:e.length?f:void 0,optional:r.length?g:void 0}}class dP{constructor(){this.events=new Zo.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=Aot,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new dP;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}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(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=Rot(this.rpc);try{const i=await new Promise(async(a,o)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(SF(Mb({namespaces:Mb({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(c=>{a(c)}).catch(c=>{o(new Error(c.message))})});if(!i)return;const s=Gae(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:AS(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,a)=>{var o;this.rpc.showQrModal&&((o=this.modal)==null||o.subscribeModal(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(SF(Mb({},e),{chains:this.rpc.chains}),r).then(f=>{s(f)}).catch(f=>{a(new Error(f.message))})}),i=n.session;if(i){const s=Gae(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:AS(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}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",e=>{const{params:r}=e,{event:n}=r;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",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",AS(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",SF(Mb({},QZe("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",AS(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],a=i.concat(s);if(!a.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const o=i.length?(e==null?void 0:e.methods)||sR:[],f=i.length?(e==null?void 0:e.events)||aR:[],c=(e==null?void 0:e.optionalMethods)||[],d=(e==null?void 0:e.optionalEvents)||[],p=(e==null?void 0:e.rpcMap)||this.buildRpcMap(a,e.projectId),g=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(x=>this.formatChainId(x)),optionalChains:s.map(x=>this.formatChainId(x)),methods:o,events:f,optionalMethods:c,optionalEvents:d,rpcMap:p,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:g,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?oR(this.rpc.chains):oR(this.rpc.optionalChains),this.signer=await wot.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await Ya(()=>import("./index-CkrjDLK5.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Mb({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&nH(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&nH(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${_ot}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}}const Mot=dP,kot=Object.freeze(Object.defineProperty({__proto__:null,EthereumProvider:Mot,OPTIONAL_EVENTS:W8e,OPTIONAL_METHODS:iQ,REQUIRED_EVENTS:aR,REQUIRED_METHODS:sR,default:dP},Symbol.toStringTag,{value:"Module"})),Pot={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},Not={block:iLe({format(t){var r;return{transactions:(r=t.transactions)==null?void 0:r.map(n=>{if(typeof n=="string")return n;const i=Pk(n);return i.typeHex==="0x7e"&&(i.isSystemTx=n.isSystemTx,i.mint=n.mint?hu(n.mint):void 0,i.sourceHash=n.sourceHash,i.type="deposit"),i}),stateRoot:t.stateRoot}}}),transaction:rLe({format(t){const e={};return t.type==="0x7e"&&(e.isSystemTx=t.isSystemTx,e.mint=t.mint?hu(t.mint):void 0,e.sourceHash=t.sourceHash,e.type="deposit"),e}}),transactionReceipt:mje({format(t){return{l1GasPrice:t.l1GasPrice?hu(t.l1GasPrice):null,l1GasUsed:t.l1GasUsed?hu(t.l1GasUsed):null,l1Fee:t.l1Fee?hu(t.l1Fee):null,l1FeeScalar:t.l1FeeScalar?Number(t.l1FeeScalar):null}}})};function Oot(t,e){return Bot(t)?$ot(t):Bje(t,e)}const Dot={transaction:Oot};function $ot(t){Uot(t);const{sourceHash:e,data:r,from:n,gas:i,isSystemTx:s,mint:a,to:o,value:f}=t,c=[e,n,o??"0x",a?Er(a):"0x",f?Er(f):"0x",i?Er(i):"0x",s?"0x1":"0x",r??"0x"];return Vh(["0x7e",W6(c)])}function Bot(t){return t.type==="deposit"||typeof t.sourceHash<"u"}function Uot(t){const{from:e,to:r}=t;if(e&&!js(e))throw new Lo({address:e});if(r&&!js(r))throw new Lo({address:r})}const gce={contracts:Pot,formatters:Not,serializers:Dot},TF=Wme({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),Kv=11155111,Lot=Wme({...gce,id:11155420,name:"OP Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com",apiUrl:"https://optimism-sepolia.blockscout.com/api"}},contracts:{...gce.contracts,disputeGameFactory:{[Kv]:{address:"0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"}},l2OutputOracle:{[Kv]:{address:"0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204},portal:{[Kv]:{address:"0x16Fc5058F25648194471939df75CF27A2fdC48BC"}},l1StandardBridge:{[Kv]:{address:"0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"}}},testnet:!0,sourceId:Kv}),_r={WALLET_CONNECT_CONNECTOR_ID:"walletConnect",INJECTED_CONNECTOR_ID:"injected",WALLET_STANDARD_CONNECTOR_ID:"announced",COINBASE_CONNECTOR_ID:"coinbaseWallet",COINBASE_SDK_CONNECTOR_ID:"coinbaseWalletSDK",SAFE_CONNECTOR_ID:"safe",LEDGER_CONNECTOR_ID:"ledger",EIP6963_CONNECTOR_ID:"eip6963",AUTH_CONNECTOR_ID:"w3mAuth",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},VERSION:"5.1.9"},Rd={ConnectorExplorerIds:{[_r.COINBASE_CONNECTOR_ID]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[_r.COINBASE_SDK_CONNECTOR_ID]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[_r.SAFE_CONNECTOR_ID]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[_r.LEDGER_CONNECTOR_ID]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927"},EIP155NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700"},ConnectorImageIds:{[_r.COINBASE_CONNECTOR_ID]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[_r.COINBASE_SDK_CONNECTOR_ID]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[_r.SAFE_CONNECTOR_ID]:"461db637-8616-43ce-035a-d89b8a1d5800",[_r.LEDGER_CONNECTOR_ID]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[_r.WALLET_CONNECT_CONNECTOR_ID]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[_r.INJECTED_CONNECTOR_ID]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[_r.INJECTED_CONNECTOR_ID]:"Browser Wallet",[_r.WALLET_CONNECT_CONNECTOR_ID]:"WalletConnect",[_r.COINBASE_CONNECTOR_ID]:"Coinbase",[_r.COINBASE_SDK_CONNECTOR_ID]:"Coinbase",[_r.LEDGER_CONNECTOR_ID]:"Ledger",[_r.SAFE_CONNECTOR_ID]:"Safe"},ConnectorTypesMap:{[_r.INJECTED_CONNECTOR_ID]:"INJECTED",[_r.WALLET_CONNECT_CONNECTOR_ID]:"WALLET_CONNECT",[_r.EIP6963_CONNECTOR_ID]:"ANNOUNCED",[_r.AUTH_CONNECTOR_ID]:"AUTH"},WalletConnectRpcChainIds:[1,5,11155111,10,420,42161,421613,137,80001,42220,1313161554,1313161555,56,97,43114,43113,100,8453,84531,7777777,999,324,280]},bce={getCaipTokens(t){if(!t)return;const e={};return Object.entries(t).forEach(([r,n])=>{e[`${_r.EIP155}:${r}`]=n}),e}};var fR;(function(t){t.Google="google",t.Github="github",t.Apple="apple",t.Facebook="facebook",t.X="x",t.Discord="discord",t.Farcaster="farcaster"})(fR||(fR={}));var G8e={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(Mt,function(){var r=1e3,n=6e4,i=36e5,s="millisecond",a="second",o="minute",f="hour",c="day",d="week",p="month",g="quarter",x="year",S="date",I="Invalid Date",R=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(l){var h=["th","st","nd","rd"],w=l%100;return"["+l+(h[(w-20)%10]||h[w]||h[0])+"]"}},U=function(l,h,w){var _=String(l);return!_||_.length>=h?l:""+Array(h+1-_.length).join(w)+l},D={s:U,z:function(l){var h=-l.utcOffset(),w=Math.abs(h),_=Math.floor(w/60),E=w%60;return(h<=0?"+":"-")+U(_,2,"0")+":"+U(E,2,"0")},m:function l(h,w){if(h.date()1)return l(v[0])}else{var m=h.name;F[m]=h,E=m}return!_&&E&&(B=E),E||!_&&B},Y=function(l,h){if(N(l))return l.clone();var w=typeof h=="object"?h:{};return w.date=l,w.args=arguments,new P(w)},z=D;z.l=W,z.i=N,z.w=function(l,h){return Y(l,{locale:h.$L,utc:h.$u,x:h.$x,$offset:h.$offset})};var P=function(){function l(w){this.$L=W(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[k]=!0}var h=l.prototype;return h.parse=function(w){this.$d=function(_){var E=_.date,T=_.utc;if(E===null)return new Date(NaN);if(z.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var v=E.match(R);if(v){var m=v[2]-1||0,A=(v[7]||"0").substring(0,3);return T?new Date(Date.UTC(v[1],m,v[3]||1,v[4]||0,v[5]||0,v[6]||0,A)):new Date(v[1],m,v[3]||1,v[4]||0,v[5]||0,v[6]||0,A)}}return new Date(E)}(w),this.init()},h.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},h.$utils=function(){return z},h.isValid=function(){return this.$d.toString()!==I},h.isSame=function(w,_){var E=Y(w);return this.startOf(_)<=E&&E<=this.endOf(_)},h.isAfter=function(w,_){return Y(w)0,F<=B.r||!B.r){F<=1&&D>0&&(B=M[D-1]);var k=O[B.l];x&&(F=x(""+F)),I=typeof k=="string"?k.replace("%d",F):k(F,d,B.l,R);break}}if(d)return I;var N=R?O.future:O.past;return typeof N=="function"?N(I):N.replace("%s",I)},s.to=function(c,d){return o(c,d,this,!0)},s.from=function(c,d){return o(c,d,this)};var f=function(c){return c.$u?i.utc():i()};s.toNow=function(c){return this.to(f(this),c)},s.fromNow=function(c){return this.from(f(this),c)}}})})(Q8e);var qot=Q8e.exports;const Hot=$u(qot);var Z8e={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(Mt,function(){return function(r,n,i){i.updateLocale=function(s,a){var o=i.Ls[s];if(o)return(a?Object.keys(a):[]).forEach(function(f){o[f]=a[f]}),o}}})})(Z8e);var Vot=Z8e.exports;const Wot=$u(Vot);T3.extend(Hot);T3.extend(Wot);const Got={...zot,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}};T3.locale("en-web3-modal",Got);const sQ={getYear(t=new Date().toISOString()){return T3(t).year()},getRelativeDateFromNow(t){return T3(t).locale("en-web3-modal").fromNow(!0)},formatDate(t,e="DD MMM"){return T3(t).format(e)}},vl={caipNetworkIdToNumber(t){return t?Number(t.split(":")[1]):void 0},parseEvmChainId(t){return typeof t=="string"?this.caipNetworkIdToNumber(t):t}};var Kot=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,IF=Math.ceil,kf=Math.floor,Na="[BigNumber Error] ",yce=Na+"Number primitive has more than 15 significant digits: ",Oc=1e14,Dr=14,RF=9007199254740991,MF=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],wp=1e7,O0=1e9;function Y8e(t){var e,r,n,i=M.prototype={constructor:M,toString:null,valueOf:null},s=new M(1),a=20,o=4,f=-7,c=21,d=-1e7,p=1e7,g=!1,x=1,S=0,I={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function M(N,W){var Y,z,P,u,l,h,w,_,E=this;if(!(E instanceof M))return new M(N,W);if(W==null){if(N&&N._isBigNumber===!0){E.s=N.s,!N.c||N.e>p?E.c=E.e=null:N.e=10;l/=10,u++);u>p?E.c=E.e=null:(E.e=u,E.c=[N]);return}_=String(N)}else{if(!Kot.test(_=String(N)))return n(E,_,h);E.s=_.charCodeAt(0)==45?(_=_.slice(1),-1):1}(u=_.indexOf("."))>-1&&(_=_.replace(".","")),(l=_.search(/e/i))>0?(u<0&&(u=l),u+=+_.slice(l+1),_=_.substring(0,l)):u<0&&(u=_.length)}else{if(Ci(W,2,R.length,"Base"),W==10&&O)return E=new M(N),F(E,a+E.e+1,o);if(_=String(N),h=typeof N=="number"){if(N*0!=0)return n(E,_,h,W);if(E.s=1/N<0?(_=_.slice(1),-1):1,M.DEBUG&&_.replace(/^0\.0*|\./,"").length>15)throw Error(yce+N)}else E.s=_.charCodeAt(0)===45?(_=_.slice(1),-1):1;for(Y=R.slice(0,W),u=l=0,w=_.length;lu){u=w;continue}}else if(!P&&(_==_.toUpperCase()&&(_=_.toLowerCase())||_==_.toLowerCase()&&(_=_.toUpperCase()))){P=!0,l=-1,u=0;continue}return n(E,String(N),h,W)}h=!1,_=r(_,W,10,E.s),(u=_.indexOf("."))>-1?_=_.replace(".",""):u=_.length}for(l=0;_.charCodeAt(l)===48;l++);for(w=_.length;_.charCodeAt(--w)===48;);if(_=_.slice(l,++w)){if(w-=l,h&&M.DEBUG&&w>15&&(N>RF||N!==kf(N)))throw Error(yce+E.s*N);if((u=u-l-1)>p)E.c=E.e=null;else if(u=-O0&&P<=O0&&P===kf(P)){if(z[0]===0){if(P===0&&z.length===1)return!0;break e}if(W=(P+1)%Dr,W<1&&(W+=Dr),String(z[0]).length==W){for(W=0;W=Oc||Y!==kf(Y))break e;if(Y!==0)return!0}}}else if(z===null&&P===null&&(u===null||u===1||u===-1))return!0;throw Error(Na+"Invalid BigNumber: "+N)},M.maximum=M.max=function(){return D(arguments,-1)},M.minimum=M.min=function(){return D(arguments,1)},M.random=function(){var N=9007199254740992,W=Math.random()*N&2097151?function(){return kf(Math.random()*N)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Y){var z,P,u,l,h,w=0,_=[],E=new M(s);if(Y==null?Y=a:Ci(Y,0,O0),l=IF(Y/Dr),g)if(crypto.getRandomValues){for(z=crypto.getRandomValues(new Uint32Array(l*=2));w>>11),h>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),z[w]=P[0],z[w+1]=P[1]):(_.push(h%1e14),w+=2);w=l/2}else if(crypto.randomBytes){for(z=crypto.randomBytes(l*=7);w=9e15?crypto.randomBytes(7).copy(z,w):(_.push(h%1e14),w+=7);w=l/7}else throw g=!1,Error(Na+"crypto unavailable");if(!g)for(;w=10;h/=10,w++);wP-1&&(h[l+1]==null&&(h[l+1]=0),h[l+1]+=h[l]/P|0,h[l]%=P)}return h.reverse()}return function(Y,z,P,u,l){var h,w,_,E,T,v,m,A,Z=Y.indexOf("."),ie=a,y=o;for(Z>=0&&(E=S,S=0,Y=Y.replace(".",""),A=new M(z),v=A.pow(Y.length-Z),S=E,A.c=W(cd(_f(v.c),v.e,"0"),10,P,N),A.e=A.c.length),m=W(Y,z,P,l?(h=R,N):(h=N,R)),_=E=m.length;m[--E]==0;m.pop());if(!m[0])return h.charAt(0);if(Z<0?--_:(v.c=m,v.e=_,v.s=u,v=e(v,A,ie,y,P),m=v.c,T=v.r,_=v.e),w=_+ie+1,Z=m[w],E=P/2,T=T||w<0||m[w+1]!=null,T=y<4?(Z!=null||T)&&(y==0||y==(v.s<0?3:2)):Z>E||Z==E&&(y==4||T||y==6&&m[w-1]&1||y==(v.s<0?8:7)),w<1||!m[0])Y=T?cd(h.charAt(1),-ie,h.charAt(0)):h.charAt(0);else{if(m.length=w,T)for(--P;++m[--w]>P;)m[w]=0,w||(++_,m=[1].concat(m));for(E=m.length;!m[--E];);for(Z=0,Y="";Z<=E;Y+=h.charAt(m[Z++]));Y=cd(Y,_,h.charAt(0))}return Y}}(),e=function(){function N(z,P,u){var l,h,w,_,E=0,T=z.length,v=P%wp,m=P/wp|0;for(z=z.slice();T--;)w=z[T]%wp,_=z[T]/wp|0,l=m*w+_*v,h=v*w+l%wp*wp+E,E=(h/u|0)+(l/wp|0)+m*_,z[T]=h%u;return E&&(z=[E].concat(z)),z}function W(z,P,u,l){var h,w;if(u!=l)w=u>l?1:-1;else for(h=w=0;hP[h]?1:-1;break}return w}function Y(z,P,u,l){for(var h=0;u--;)z[u]-=h,h=z[u]1;z.splice(0,1));}return function(z,P,u,l,h){var w,_,E,T,v,m,A,Z,ie,y,G,H,K,ee,j,X,oe,be=z.s==P.s?1:-1,ue=z.c,Te=P.c;if(!ue||!ue[0]||!Te||!Te[0])return new M(!z.s||!P.s||(ue?Te&&ue[0]==Te[0]:!Te)?NaN:ue&&ue[0]==0||!Te?be*0:be/0);for(Z=new M(be),ie=Z.c=[],_=z.e-P.e,be=u+_+1,h||(h=Oc,_=Pf(z.e/Dr)-Pf(P.e/Dr),be=be/Dr|0),E=0;Te[E]==(ue[E]||0);E++);if(Te[E]>(ue[E]||0)&&_--,be<0)ie.push(1),T=!0;else{for(ee=ue.length,X=Te.length,E=0,be+=2,v=kf(h/(Te[0]+1)),v>1&&(Te=N(Te,v,h),ue=N(ue,v,h),X=Te.length,ee=ue.length),K=X,y=ue.slice(0,X),G=y.length;G=h/2&&j++;do{if(v=0,w=W(Te,y,X,G),w<0){if(H=y[0],X!=G&&(H=H*h+(y[1]||0)),v=kf(H/j),v>1)for(v>=h&&(v=h-1),m=N(Te,v,h),A=m.length,G=y.length;W(m,y,A,G)==1;)v--,Y(m,X=10;be/=10,E++);F(Z,u+(Z.e=E+_*Dr-1)+1,l,T)}else Z.e=_,Z.r=+T;return Z}}();function U(N,W,Y,z){var P,u,l,h,w;if(Y==null?Y=o:Ci(Y,0,8),!N.c)return N.toString();if(P=N.c[0],l=N.e,W==null)w=_f(N.c),w=z==1||z==2&&(l<=f||l>=c)?ES(w,l):cd(w,l,"0");else if(N=F(new M(N),W,Y),u=N.e,w=_f(N.c),h=w.length,z==1||z==2&&(W<=u||u<=f)){for(;hh){if(--W>0)for(w+=".";W--;w+="0");}else if(W+=u-h,W>0)for(u+1==h&&(w+=".");W--;w+="0");return N.s<0&&P?"-"+w:w}function D(N,W){for(var Y,z,P=1,u=new M(N[0]);P=10;P/=10,z++);return(Y=z+Y*Dr-1)>p?N.c=N.e=null:Y=10;h/=10,P++);if(u=W-P,u<0)u+=Dr,l=W,w=T[_=0],E=kf(w/v[P-l-1]%10);else if(_=IF((u+1)/Dr),_>=T.length)if(z){for(;T.length<=_;T.push(0));w=E=0,P=1,u%=Dr,l=u-Dr+1}else break e;else{for(w=h=T[_],P=1;h>=10;h/=10,P++);u%=Dr,l=u-Dr+P,E=l<0?0:kf(w/v[P-l-1]%10)}if(z=z||W<0||T[_+1]!=null||(l<0?w:w%v[P-l-1]),z=Y<4?(E||z)&&(Y==0||Y==(N.s<0?3:2)):E>5||E==5&&(Y==4||z||Y==6&&(u>0?l>0?w/v[P-l]:0:T[_-1])%10&1||Y==(N.s<0?8:7)),W<1||!T[0])return T.length=0,z?(W-=N.e+1,T[0]=v[(Dr-W%Dr)%Dr],N.e=-W||0):T[0]=N.e=0,N;if(u==0?(T.length=_,h=1,_--):(T.length=_+1,h=v[Dr-u],T[_]=l>0?kf(w/v[P-l]%v[l])*h:0),z)for(;;)if(_==0){for(u=1,l=T[0];l>=10;l/=10,u++);for(l=T[0]+=h,h=1;l>=10;l/=10,h++);u!=h&&(N.e++,T[0]==Oc&&(T[0]=1));break}else{if(T[_]+=h,T[_]!=Oc)break;T[_--]=0,h=1}for(u=T.length;T[--u]===0;T.pop());}N.e>p?N.c=N.e=null:N.e=c?ES(W,Y):cd(W,Y,"0"),N.s<0?"-"+W:W)}return i.absoluteValue=i.abs=function(){var N=new M(this);return N.s<0&&(N.s=1),N},i.comparedTo=function(N,W){return Y5(this,new M(N,W))},i.decimalPlaces=i.dp=function(N,W){var Y,z,P,u=this;if(N!=null)return Ci(N,0,O0),W==null?W=o:Ci(W,0,8),F(new M(u),N+u.e+1,W);if(!(Y=u.c))return null;if(z=((P=Y.length-1)-Pf(this.e/Dr))*Dr,P=Y[P])for(;P%10==0;P/=10,z--);return z<0&&(z=0),z},i.dividedBy=i.div=function(N,W){return e(this,new M(N,W),a,o)},i.dividedToIntegerBy=i.idiv=function(N,W){return e(this,new M(N,W),0,1)},i.exponentiatedBy=i.pow=function(N,W){var Y,z,P,u,l,h,w,_,E,T=this;if(N=new M(N),N.c&&!N.isInteger())throw Error(Na+"Exponent not an integer: "+k(N));if(W!=null&&(W=new M(W)),h=N.e>14,!T.c||!T.c[0]||T.c[0]==1&&!T.e&&T.c.length==1||!N.c||!N.c[0])return E=new M(Math.pow(+k(T),h?N.s*(2-_S(N)):+k(N))),W?E.mod(W):E;if(w=N.s<0,W){if(W.c?!W.c[0]:!W.s)return new M(NaN);z=!w&&T.isInteger()&&W.isInteger(),z&&(T=T.mod(W))}else{if(N.e>9&&(T.e>0||T.e<-1||(T.e==0?T.c[0]>1||h&&T.c[1]>=24e7:T.c[0]<8e13||h&&T.c[0]<=9999975e7)))return u=T.s<0&&_S(N)?-0:0,T.e>-1&&(u=1/u),new M(w?1/u:u);S&&(u=IF(S/Dr+2))}for(h?(Y=new M(.5),w&&(N.s=1),_=_S(N)):(P=Math.abs(+k(N)),_=P%2),E=new M(s);;){if(_){if(E=E.times(T),!E.c)break;u?E.c.length>u&&(E.c.length=u):z&&(E=E.mod(W))}if(P){if(P=kf(P/2),P===0)break;_=P%2}else if(N=N.times(Y),F(N,N.e+1,1),N.e>14)_=_S(N);else{if(P=+k(N),P===0)break;_=P%2}T=T.times(T),u?T.c&&T.c.length>u&&(T.c.length=u):z&&(T=T.mod(W))}return z?E:(w&&(E=s.div(E)),W?E.mod(W):u?F(E,S,o,l):E)},i.integerValue=function(N){var W=new M(this);return N==null?N=o:Ci(N,0,8),F(W,W.e+1,N)},i.isEqualTo=i.eq=function(N,W){return Y5(this,new M(N,W))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(N,W){return Y5(this,new M(N,W))>0},i.isGreaterThanOrEqualTo=i.gte=function(N,W){return(W=Y5(this,new M(N,W)))===1||W===0},i.isInteger=function(){return!!this.c&&Pf(this.e/Dr)>this.c.length-2},i.isLessThan=i.lt=function(N,W){return Y5(this,new M(N,W))<0},i.isLessThanOrEqualTo=i.lte=function(N,W){return(W=Y5(this,new M(N,W)))===-1||W===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(N,W){var Y,z,P,u,l=this,h=l.s;if(N=new M(N,W),W=N.s,!h||!W)return new M(NaN);if(h!=W)return N.s=-W,l.plus(N);var w=l.e/Dr,_=N.e/Dr,E=l.c,T=N.c;if(!w||!_){if(!E||!T)return E?(N.s=-W,N):new M(T?l:NaN);if(!E[0]||!T[0])return T[0]?(N.s=-W,N):new M(E[0]?l:o==3?-0:0)}if(w=Pf(w),_=Pf(_),E=E.slice(),h=w-_){for((u=h<0)?(h=-h,P=E):(_=w,P=T),P.reverse(),W=h;W--;P.push(0));P.reverse()}else for(z=(u=(h=E.length)<(W=T.length))?h:W,h=W=0;W0)for(;W--;E[Y++]=0);for(W=Oc-1;z>h;){if(E[--z]=0;){for(Y=0,v=H[P]%ie,m=H[P]/ie|0,l=w,u=P+l;u>P;)_=G[--l]%ie,E=G[l]/ie|0,h=m*_+E*v,_=v*_+h%ie*ie+A[u]+Y,Y=(_/Z|0)+(h/ie|0)+m*E,A[u--]=_%Z;A[u]=Y}return Y?++z:A.splice(0,1),B(N,A,z)},i.negated=function(){var N=new M(this);return N.s=-N.s||null,N},i.plus=function(N,W){var Y,z=this,P=z.s;if(N=new M(N,W),W=N.s,!P||!W)return new M(NaN);if(P!=W)return N.s=-W,z.minus(N);var u=z.e/Dr,l=N.e/Dr,h=z.c,w=N.c;if(!u||!l){if(!h||!w)return new M(P/0);if(!h[0]||!w[0])return w[0]?N:new M(h[0]?z:P*0)}if(u=Pf(u),l=Pf(l),h=h.slice(),P=u-l){for(P>0?(l=u,Y=w):(P=-P,Y=h),Y.reverse();P--;Y.push(0));Y.reverse()}for(P=h.length,W=w.length,P-W<0&&(Y=w,w=h,h=Y,W=P),P=0;W;)P=(h[--W]=h[W]+w[W]+P)/Oc|0,h[W]=Oc===h[W]?0:h[W]%Oc;return P&&(h=[P].concat(h),++l),B(N,h,l)},i.precision=i.sd=function(N,W){var Y,z,P,u=this;if(N!=null&&N!==!!N)return Ci(N,1,O0),W==null?W=o:Ci(W,0,8),F(new M(u),N,W);if(!(Y=u.c))return null;if(P=Y.length-1,z=P*Dr+1,P=Y[P]){for(;P%10==0;P/=10,z--);for(P=Y[0];P>=10;P/=10,z++);}return N&&u.e+1>z&&(z=u.e+1),z},i.shiftedBy=function(N){return Ci(N,-RF,RF),this.times("1e"+N)},i.squareRoot=i.sqrt=function(){var N,W,Y,z,P,u=this,l=u.c,h=u.s,w=u.e,_=a+4,E=new M("0.5");if(h!==1||!l||!l[0])return new M(!h||h<0&&(!l||l[0])?NaN:l?u:1/0);if(h=Math.sqrt(+k(u)),h==0||h==1/0?(W=_f(l),(W.length+w)%2==0&&(W+="0"),h=Math.sqrt(+W),w=Pf((w+1)/2)-(w<0||w%2),h==1/0?W="5e"+w:(W=h.toExponential(),W=W.slice(0,W.indexOf("e")+1)+w),Y=new M(W)):Y=new M(h+""),Y.c[0]){for(w=Y.e,h=w+_,h<3&&(h=0);;)if(P=Y,Y=E.times(P.plus(e(u,P,_,1))),_f(P.c).slice(0,h)===(W=_f(Y.c)).slice(0,h))if(Y.e0&&A>0){for(u=A%h||h,E=m.substr(0,u);u0&&(E+=_+m.slice(u)),v&&(E="-"+E)}z=T?E+(Y.decimalSeparator||"")+((w=+Y.fractionGroupSize)?T.replace(new RegExp("\\d{"+w+"}\\B","g"),"$&"+(Y.fractionGroupSeparator||"")):T):E}return(Y.prefix||"")+z+(Y.suffix||"")},i.toFraction=function(N){var W,Y,z,P,u,l,h,w,_,E,T,v,m=this,A=m.c;if(N!=null&&(h=new M(N),!h.isInteger()&&(h.c||h.s!==1)||h.lt(s)))throw Error(Na+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+k(h));if(!A)return new M(m);for(W=new M(s),_=Y=new M(s),z=w=new M(s),v=_f(A),u=W.e=v.length-m.e-1,W.c[0]=MF[(l=u%Dr)<0?Dr+l:l],N=!N||h.comparedTo(W)>0?u>0?W:_:h,l=p,p=1/0,h=new M(v),w.c[0]=0;E=e(h,W,0,1),P=Y.plus(E.times(z)),P.comparedTo(N)!=1;)Y=z,z=P,_=w.plus(E.times(P=_)),w=P,W=h.minus(E.times(P=W)),h=P;return P=e(N.minus(Y),z,0,1),w=w.plus(P.times(_)),Y=Y.plus(P.times(z)),w.s=_.s=m.s,u=u*2,T=e(_,z,u,o).minus(m).abs().comparedTo(e(w,Y,u,o).minus(m).abs())<1?[_,z]:[w,Y],p=l,T},i.toNumber=function(){return+k(this)},i.toPrecision=function(N,W){return N!=null&&Ci(N,1,O0),U(this,N,W,2)},i.toString=function(N){var W,Y=this,z=Y.s,P=Y.e;return P===null?z?(W="Infinity",z<0&&(W="-"+W)):W="NaN":(N==null?W=P<=f||P>=c?ES(_f(Y.c),P):cd(_f(Y.c),P,"0"):N===10&&O?(Y=F(new M(Y),a+P+1,o),W=cd(_f(Y.c),Y.e,"0")):(Ci(N,2,R.length,"Base"),W=r(cd(_f(Y.c),P,"0"),10,N,z,!0)),z<0&&Y.c[0]&&(W="-"+W)),W},i.valueOf=i.toJSON=function(){return k(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,t!=null&&M.set(t),M}function Pf(t){var e=t|0;return t>0||t===e?e:e-1}function _f(t){for(var e,r,n=1,i=t.length,s=t[0]+"";nc^r?1:-1;for(o=(f=i.length)<(c=s.length)?f:c,a=0;as[a]^r?1:-1;return f==c?0:f>c^r?1:-1}function Ci(t,e,r,n){if(tr||t!==kf(t))throw Error(Na+(n||"Argument")+(typeof t=="number"?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function _S(t){var e=t.c.length-1;return Pf(t.e/Dr)==e&&t.c[e]%2!=0}function ES(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function cd(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(n=t.length,++e>n){for(i=r,e-=n;--e;i+=r);t+=i}else e="0"&&s<="9";!i&&(o||f||c||d)&&t.preventDefault(),e==="0"&&!p&&!g&&s==="0"&&t.preventDefault(),e==="0"&&x&&(r(s),t.preventDefault()),(p||g)&&(e||(r("0."),t.preventDefault()),(e!=null&&e.includes(".")||e!=null&&e.includes(","))&&t.preventDefault()),!x&&!n.includes(s)&&!g&&!p&&t.preventDefault()}},Zot=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],aQ={URLS:{FAQ:"https://walletconnect.com/faq"}},zn={WC_NAME_SUFFIX:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CHAIN:{EVM:"evm",SOLANA:"solana"},CHAIN_NAME_MAP:{evm:"Ethereum",solana:"Solana"}};function w6(t,e){return e==="light"?{"--w3m-accent":(t==null?void 0:t["--w3m-accent"])||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":(t==null?void 0:t["--w3m-accent"])||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}const J8e=":";function Yot(t){const{namespace:e,reference:r}=t;return[e,r].join(J8e)}function Jot(t){const[e,r,n]=t.split(J8e);return{namespace:e,reference:r,address:n}}function Xot(t,e){const r=[];return t.forEach(n=>{const i=e(n);r.includes(i)||r.push(i)}),r}function eft(t){const{namespace:e,reference:r}=Jot(t);return Yot({namespace:e,reference:r})}function tft(t){return Xot(t,eft)}var X8e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rft(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var nft={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT -*/(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",a=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?i=X8e:s&&(i=self);var o=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,f=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],g=[1,256,65536,16777216],x=[6,1536,393216,100663296],S=[0,8,16,24],I=[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],R=[224,256,384,512],O=[128,256],M=["hex","buffer","arrayBuffer","array","digest"],U={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var D=function(y,G,H){return function(K){return new A(y,G,y).update(K)[H]()}},B=function(y,G,H){return function(K,ee){return new A(y,G,ee).update(K)[H]()}},F=function(y,G,H){return function(K,ee,j,X){return l["cshake"+y].update(K,ee,j,X)[H]()}},k=function(y,G,H){return function(K,ee,j,X){return l["kmac"+y].update(K,ee,j,X)[H]()}},N=function(y,G,H,K){for(var ee=0;ee>5,this.byteCount=this.blockCount<<2,this.outputBlocks=H>>5,this.extraBytes=(H&31)>>3;for(var K=0;K<50;++K)this.s[K]=0}A.prototype.update=function(y){if(this.finalized)throw new Error(r);var G,H=typeof y;if(H!=="string"){if(H==="object"){if(y===null)throw new Error(e);if(f&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!f||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);G=!0}for(var K=this.blocks,ee=this.byteCount,j=y.length,X=this.blockCount,oe=0,be=this.s,ue,Te;oe>2]|=y[oe]<>2]|=Te<>2]|=(192|Te>>6)<>2]|=(128|Te&63)<=57344?(K[ue>>2]|=(224|Te>>12)<>2]|=(128|Te>>6&63)<>2]|=(128|Te&63)<>2]|=(240|Te>>18)<>2]|=(128|Te>>12&63)<>2]|=(128|Te>>6&63)<>2]|=(128|Te&63)<=ee){for(this.start=ue-ee,this.block=K[X],ue=0;ue>8,H=y&255;H>0;)ee.unshift(H),y=y>>8,H=y&255,++K;return G?ee.push(K):ee.unshift(K),this.update(ee),ee.length},A.prototype.encodeString=function(y){var G,H=typeof y;if(H!=="string"){if(H==="object"){if(y===null)throw new Error(e);if(f&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!f||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);G=!0}var K=0,ee=y.length;if(G)K=ee;else for(var j=0;j=57344?K+=3:(X=65536+((X&1023)<<10|y.charCodeAt(++j)&1023),K+=4)}return K+=this.encode(K*8),this.update(y),K},A.prototype.bytepad=function(y,G){for(var H=this.encode(G),K=0;K>2]|=this.padding[G&3],this.lastByteIndex===this.byteCount)for(y[0]=y[H],G=1;G>4&15]+c[oe&15]+c[oe>>12&15]+c[oe>>8&15]+c[oe>>20&15]+c[oe>>16&15]+c[oe>>28&15]+c[oe>>24&15];j%y===0&&(ie(G),ee=0)}return K&&(oe=G[ee],X+=c[oe>>4&15]+c[oe&15],K>1&&(X+=c[oe>>12&15]+c[oe>>8&15]),K>2&&(X+=c[oe>>20&15]+c[oe>>16&15])),X},A.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,G=this.s,H=this.outputBlocks,K=this.extraBytes,ee=0,j=0,X=this.outputBits>>3,oe;K?oe=new ArrayBuffer(H+1<<2):oe=new ArrayBuffer(X);for(var be=new Uint32Array(oe);j>8&255,X[oe+2]=be>>16&255,X[oe+3]=be>>24&255;j%y===0&&ie(G)}return K&&(oe=j<<2,be=G[ee],X[oe]=be&255,K>1&&(X[oe+1]=be>>8&255),K>2&&(X[oe+2]=be>>16&255)),X};function Z(y,G,H){A.call(this,y,G,H)}Z.prototype=new A,Z.prototype.finalize=function(){return this.encode(this.outputBits,!0),A.prototype.finalize.call(this)};var ie=function(y){var G,H,K,ee,j,X,oe,be,ue,Te,Ye,Fe,At,tt,Qe,ht,ze,je,lt,Be,Ze,ne,V,$,re,se,le,ve,Re,de,Pe,te,ke,mt,Ue,rt,st,Xe,Ie,Oe,dt,et,q,_e,fe,Ce,we,De,ft,Le,ot,gt,at,bt,Pt,yt,pt,sr,Rr,Mr,kr,Pr,vr;for(K=0;K<48;K+=2)ee=y[0]^y[10]^y[20]^y[30]^y[40],j=y[1]^y[11]^y[21]^y[31]^y[41],X=y[2]^y[12]^y[22]^y[32]^y[42],oe=y[3]^y[13]^y[23]^y[33]^y[43],be=y[4]^y[14]^y[24]^y[34]^y[44],ue=y[5]^y[15]^y[25]^y[35]^y[45],Te=y[6]^y[16]^y[26]^y[36]^y[46],Ye=y[7]^y[17]^y[27]^y[37]^y[47],Fe=y[8]^y[18]^y[28]^y[38]^y[48],At=y[9]^y[19]^y[29]^y[39]^y[49],G=Fe^(X<<1|oe>>>31),H=At^(oe<<1|X>>>31),y[0]^=G,y[1]^=H,y[10]^=G,y[11]^=H,y[20]^=G,y[21]^=H,y[30]^=G,y[31]^=H,y[40]^=G,y[41]^=H,G=ee^(be<<1|ue>>>31),H=j^(ue<<1|be>>>31),y[2]^=G,y[3]^=H,y[12]^=G,y[13]^=H,y[22]^=G,y[23]^=H,y[32]^=G,y[33]^=H,y[42]^=G,y[43]^=H,G=X^(Te<<1|Ye>>>31),H=oe^(Ye<<1|Te>>>31),y[4]^=G,y[5]^=H,y[14]^=G,y[15]^=H,y[24]^=G,y[25]^=H,y[34]^=G,y[35]^=H,y[44]^=G,y[45]^=H,G=be^(Fe<<1|At>>>31),H=ue^(At<<1|Fe>>>31),y[6]^=G,y[7]^=H,y[16]^=G,y[17]^=H,y[26]^=G,y[27]^=H,y[36]^=G,y[37]^=H,y[46]^=G,y[47]^=H,G=Te^(ee<<1|j>>>31),H=Ye^(j<<1|ee>>>31),y[8]^=G,y[9]^=H,y[18]^=G,y[19]^=H,y[28]^=G,y[29]^=H,y[38]^=G,y[39]^=H,y[48]^=G,y[49]^=H,tt=y[0],Qe=y[1],Ce=y[11]<<4|y[10]>>>28,we=y[10]<<4|y[11]>>>28,ve=y[20]<<3|y[21]>>>29,Re=y[21]<<3|y[20]>>>29,Mr=y[31]<<9|y[30]>>>23,kr=y[30]<<9|y[31]>>>23,et=y[40]<<18|y[41]>>>14,q=y[41]<<18|y[40]>>>14,mt=y[2]<<1|y[3]>>>31,Ue=y[3]<<1|y[2]>>>31,ht=y[13]<<12|y[12]>>>20,ze=y[12]<<12|y[13]>>>20,De=y[22]<<10|y[23]>>>22,ft=y[23]<<10|y[22]>>>22,de=y[33]<<13|y[32]>>>19,Pe=y[32]<<13|y[33]>>>19,Pr=y[42]<<2|y[43]>>>30,vr=y[43]<<2|y[42]>>>30,bt=y[5]<<30|y[4]>>>2,Pt=y[4]<<30|y[5]>>>2,rt=y[14]<<6|y[15]>>>26,st=y[15]<<6|y[14]>>>26,je=y[25]<<11|y[24]>>>21,lt=y[24]<<11|y[25]>>>21,Le=y[34]<<15|y[35]>>>17,ot=y[35]<<15|y[34]>>>17,te=y[45]<<29|y[44]>>>3,ke=y[44]<<29|y[45]>>>3,$=y[6]<<28|y[7]>>>4,re=y[7]<<28|y[6]>>>4,yt=y[17]<<23|y[16]>>>9,pt=y[16]<<23|y[17]>>>9,Xe=y[26]<<25|y[27]>>>7,Ie=y[27]<<25|y[26]>>>7,Be=y[36]<<21|y[37]>>>11,Ze=y[37]<<21|y[36]>>>11,gt=y[47]<<24|y[46]>>>8,at=y[46]<<24|y[47]>>>8,_e=y[8]<<27|y[9]>>>5,fe=y[9]<<27|y[8]>>>5,se=y[18]<<20|y[19]>>>12,le=y[19]<<20|y[18]>>>12,sr=y[29]<<7|y[28]>>>25,Rr=y[28]<<7|y[29]>>>25,Oe=y[38]<<8|y[39]>>>24,dt=y[39]<<8|y[38]>>>24,ne=y[48]<<14|y[49]>>>18,V=y[49]<<14|y[48]>>>18,y[0]=tt^~ht&je,y[1]=Qe^~ze<,y[10]=$^~se&ve,y[11]=re^~le&Re,y[20]=mt^~rt&Xe,y[21]=Ue^~st&Ie,y[30]=_e^~Ce&De,y[31]=fe^~we&ft,y[40]=bt^~yt&sr,y[41]=Pt^~pt&Rr,y[2]=ht^~je&Be,y[3]=ze^~lt&Ze,y[12]=se^~ve&de,y[13]=le^~Re&Pe,y[22]=rt^~Xe&Oe,y[23]=st^~Ie&dt,y[32]=Ce^~De&Le,y[33]=we^~ft&ot,y[42]=yt^~sr&Mr,y[43]=pt^~Rr&kr,y[4]=je^~Be&ne,y[5]=lt^~Ze&V,y[14]=ve^~de&te,y[15]=Re^~Pe&ke,y[24]=Xe^~Oe&et,y[25]=Ie^~dt&q,y[34]=De^~Le>,y[35]=ft^~ot&at,y[44]=sr^~Mr&Pr,y[45]=Rr^~kr&vr,y[6]=Be^~ne&tt,y[7]=Ze^~V&Qe,y[16]=de^~te&$,y[17]=Pe^~ke&re,y[26]=Oe^~et&mt,y[27]=dt^~q&Ue,y[36]=Le^~gt&_e,y[37]=ot^~at&fe,y[46]=Mr^~Pr&bt,y[47]=kr^~vr&Pt,y[8]=ne^~tt&ht,y[9]=V^~Qe&ze,y[18]=te^~$&se,y[19]=ke^~re&le,y[28]=et^~mt&rt,y[29]=q^~Ue&st,y[38]=gt^~_e&Ce,y[39]=at^~fe&we,y[48]=Pr^~bt&yt,y[49]=vr^~Pt&pt,y[0]^=I[K],y[1]^=I[K+1]};if(o)t.exports=l;else for(w=0;w{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Ace=sft();var AH;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(AH||(AH={}));var Kc;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Kc||(Kc={}));const _ce="0123456789abcdef";let Ga=class g0{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();MT[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(xce>MT[n])&&console.log.apply(console,r)}debug(...e){this._log(g0.levels.DEBUG,e)}info(...e){this._log(g0.levels.INFO,e)}warn(...e){this._log(g0.levels.WARNING,e)}makeError(e,r,n){if(vce)return this.makeError("censored error",r,{});r||(r=g0.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(f=>{const c=n[f];try{if(c instanceof Uint8Array){let d="";for(let p=0;p>4],d+=_ce[c[p]&15];i.push(f+"=Uint8Array(0x"+d+")")}else i.push(f+"="+JSON.stringify(c))}catch{i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let a="";switch(r){case Kc.NUMERIC_FAULT:{a="NUMERIC_FAULT";const f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":a+="-"+f;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case Kc.CALL_EXCEPTION:case Kc.INSUFFICIENT_FUNDS:case Kc.MISSING_NEW:case Kc.NONCE_EXPIRED:case Kc.REPLACEMENT_UNDERPRICED:case Kc.TRANSACTION_REPLACED:case Kc.UNPREDICTABLE_GAS_LIMIT:a=r;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const o=new Error(e);return o.reason=s,o.code=r,Object.keys(n).forEach(function(f){o[f]=n[f]}),o}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,g0.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Ace&&this.throwError("platform missing String.prototype.normalize",g0.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ace})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,g0.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,g0.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,g0.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",g0.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",g0.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",g0.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return kF||(kF=new g0(ift)),kF}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",g0.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),wce){if(!e)return;this.globalLogger().throwError("error censorship permanent",g0.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}vce=!!e,wce=!!r}static setLogLevel(e){const r=MT[e.toLowerCase()];if(r==null){g0.globalLogger().warn("invalid log level - "+e);return}xce=r}static from(e){return new g0(e)}};Ga.errors=Kc,Ga.levels=AH;const aft="bytes/5.7.0",O6=new Ga(aft);function eye(t){return!!t.toHexString}function kT(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return kT(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ece(t){return typeof t=="number"&&t==t&&t%1===0}function P_(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Ece(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function tye(t,e){if(e||(e={}),typeof t=="number"){O6.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),kT(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),eye(t)&&(t=t.toHexString()),Sy(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":O6.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;i>4]+PF[i&15]}return r}return O6.throwArgumentError("invalid hexlify value","value",t)}function cR(t,e){for(typeof t!="string"?t=rye(t):Sy(t)||O6.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&O6.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var nye={exports:{}},oft={},fft=Object.freeze({__proto__:null,default:oft}),cft=rft(fft);(function(t){(function(e,r){function n(u,l){if(!u)throw new Error(l||"Assertion failed")}function i(u,l){u.super_=l;var h=function(){};h.prototype=l.prototype,u.prototype=new h,u.prototype.constructor=u}function s(u,l,h){if(s.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((l==="le"||l==="be")&&(h=l,l=10),this._init(u||0,l||10,h||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=cft.Buffer}catch{}s.isBN=function(u){return u instanceof s?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===s.wordSize&&Array.isArray(u.words)},s.max=function(u,l){return u.cmp(l)>0?u:l},s.min=function(u,l){return u.cmp(l)<0?u:l},s.prototype._init=function(u,l,h){if(typeof u=="number")return this._initNumber(u,l,h);if(typeof u=="object")return this._initArray(u,l,h);l==="hex"&&(l=16),n(l===(l|0)&&l>=2&&l<=36),u=u.toString().replace(/\s+/g,"");var w=0;u[0]==="-"&&(w++,this.negative=1),w=0;w-=3)E=u[w]|u[w-1]<<8|u[w-2]<<16,this.words[_]|=E<>>26-T&67108863,T+=24,T>=26&&(T-=26,_++);else if(h==="le")for(w=0,_=0;w>>26-T&67108863,T+=24,T>=26&&(T-=26,_++);return this._strip()};function o(u,l){var h=u.charCodeAt(l);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+u)}function f(u,l,h){var w=o(u,h);return h-1>=l&&(w|=o(u,h-1)<<4),w}s.prototype._parseHex=function(u,l,h){this.length=Math.ceil((u.length-l)/6),this.words=new Array(this.length);for(var w=0;w=l;w-=2)T=f(u,l,w)<<_,this.words[E]|=T&67108863,_>=18?(_-=18,E+=1,this.words[E]|=T>>>26):_+=8;else{var v=u.length-l;for(w=v%2===0?l+1:l;w=18?(_-=18,E+=1,this.words[E]|=T>>>26):_+=8}this._strip()};function c(u,l,h,w){for(var _=0,E=0,T=Math.min(u.length,h),v=l;v=49?E=m-49+10:m>=17?E=m-17+10:E=m,n(m>=0&&E1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var g=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],x=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],S=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(u,l){u=u||10,l=l|0||1;var h;if(u===16||u==="hex"){h="";for(var w=0,_=0,E=0;E>>24-w&16777215,w+=2,w>=26&&(w-=26,E--),_!==0||E!==this.length-1?h=g[6-v.length]+v+h:h=v+h}for(_!==0&&(h=_.toString(16)+h);h.length%l!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(u===(u|0)&&u>=2&&u<=36){var m=x[u],A=S[u];h="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ie=Z.modrn(A).toString(u);Z=Z.idivn(A),Z.isZero()?h=ie+h:h=g[m-ie.length]+ie+h}for(this.isZero()&&(h="0"+h);h.length%l!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(u,l){return this.toArrayLike(a,u,l)}),s.prototype.toArray=function(u,l){return this.toArrayLike(Array,u,l)};var I=function(u,l){return u.allocUnsafe?u.allocUnsafe(l):new u(l)};s.prototype.toArrayLike=function(u,l,h){this._strip();var w=this.byteLength(),_=h||Math.max(1,w);n(w<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var E=I(u,_),T=l==="le"?"LE":"BE";return this["_toArrayLike"+T](E,w),E},s.prototype._toArrayLikeLE=function(u,l){for(var h=0,w=0,_=0,E=0;_>8&255),h>16&255),E===6?(h>24&255),w=0,E=0):(w=T>>>24,E+=2)}if(h=0&&(u[h--]=T>>8&255),h>=0&&(u[h--]=T>>16&255),E===6?(h>=0&&(u[h--]=T>>24&255),w=0,E=0):(w=T>>>24,E+=2)}if(h>=0)for(u[h--]=w;h>=0;)u[h--]=0},Math.clz32?s.prototype._countBits=function(u){return 32-Math.clz32(u)}:s.prototype._countBits=function(u){var l=u,h=0;return l>=4096&&(h+=13,l>>>=13),l>=64&&(h+=7,l>>>=7),l>=8&&(h+=4,l>>>=4),l>=2&&(h+=2,l>>>=2),h+l},s.prototype._zeroBits=function(u){if(u===0)return 26;var l=u,h=0;return l&8191||(h+=13,l>>>=13),l&127||(h+=7,l>>>=7),l&15||(h+=4,l>>>=4),l&3||(h+=2,l>>>=2),l&1||h++,h},s.prototype.bitLength=function(){var u=this.words[this.length-1],l=this._countBits(u);return(this.length-1)*26+l};function R(u){for(var l=new Array(u.bitLength()),h=0;h>>_&1}return l}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,l=0;lu.length?this.clone().ior(u):u.clone().ior(this)},s.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},s.prototype.iuand=function(u){var l;this.length>u.length?l=u:l=this;for(var h=0;hu.length?this.clone().iand(u):u.clone().iand(this)},s.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},s.prototype.iuxor=function(u){var l,h;this.length>u.length?(l=this,h=u):(l=u,h=this);for(var w=0;wu.length?this.clone().ixor(u):u.clone().ixor(this)},s.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},s.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var l=Math.ceil(u/26)|0,h=u%26;this._expand(l),h>0&&l--;for(var w=0;w0&&(this.words[w]=~this.words[w]&67108863>>26-h),this._strip()},s.prototype.notn=function(u){return this.clone().inotn(u)},s.prototype.setn=function(u,l){n(typeof u=="number"&&u>=0);var h=u/26|0,w=u%26;return this._expand(h+1),l?this.words[h]=this.words[h]|1<u.length?(h=this,w=u):(h=u,w=this);for(var _=0,E=0;E>>26;for(;_!==0&&E>>26;if(this.length=h.length,_!==0)this.words[this.length]=_,this.length++;else if(h!==this)for(;Eu.length?this.clone().iadd(u):u.clone().iadd(this)},s.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var l=this.iadd(u);return u.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var h=this.cmp(u);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,_;h>0?(w=this,_=u):(w=u,_=this);for(var E=0,T=0;T<_.length;T++)l=(w.words[T]|0)-(_.words[T]|0)+E,E=l>>26,this.words[T]=l&67108863;for(;E!==0&&T>26,this.words[T]=l&67108863;if(E===0&&T>>26,ie=m&67108863,y=Math.min(A,l.length-1),G=Math.max(0,A-u.length+1);G<=y;G++){var H=A-G|0;_=u.words[H]|0,E=l.words[G]|0,T=_*E+ie,Z+=T/67108864|0,ie=T&67108863}h.words[A]=ie|0,m=Z|0}return m!==0?h.words[A]=m|0:h.length--,h._strip()}var M=function(u,l,h){var w=u.words,_=l.words,E=h.words,T=0,v,m,A,Z=w[0]|0,ie=Z&8191,y=Z>>>13,G=w[1]|0,H=G&8191,K=G>>>13,ee=w[2]|0,j=ee&8191,X=ee>>>13,oe=w[3]|0,be=oe&8191,ue=oe>>>13,Te=w[4]|0,Ye=Te&8191,Fe=Te>>>13,At=w[5]|0,tt=At&8191,Qe=At>>>13,ht=w[6]|0,ze=ht&8191,je=ht>>>13,lt=w[7]|0,Be=lt&8191,Ze=lt>>>13,ne=w[8]|0,V=ne&8191,$=ne>>>13,re=w[9]|0,se=re&8191,le=re>>>13,ve=_[0]|0,Re=ve&8191,de=ve>>>13,Pe=_[1]|0,te=Pe&8191,ke=Pe>>>13,mt=_[2]|0,Ue=mt&8191,rt=mt>>>13,st=_[3]|0,Xe=st&8191,Ie=st>>>13,Oe=_[4]|0,dt=Oe&8191,et=Oe>>>13,q=_[5]|0,_e=q&8191,fe=q>>>13,Ce=_[6]|0,we=Ce&8191,De=Ce>>>13,ft=_[7]|0,Le=ft&8191,ot=ft>>>13,gt=_[8]|0,at=gt&8191,bt=gt>>>13,Pt=_[9]|0,yt=Pt&8191,pt=Pt>>>13;h.negative=u.negative^l.negative,h.length=19,v=Math.imul(ie,Re),m=Math.imul(ie,de),m=m+Math.imul(y,Re)|0,A=Math.imul(y,de);var sr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(sr>>>26)|0,sr&=67108863,v=Math.imul(H,Re),m=Math.imul(H,de),m=m+Math.imul(K,Re)|0,A=Math.imul(K,de),v=v+Math.imul(ie,te)|0,m=m+Math.imul(ie,ke)|0,m=m+Math.imul(y,te)|0,A=A+Math.imul(y,ke)|0;var Rr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,v=Math.imul(j,Re),m=Math.imul(j,de),m=m+Math.imul(X,Re)|0,A=Math.imul(X,de),v=v+Math.imul(H,te)|0,m=m+Math.imul(H,ke)|0,m=m+Math.imul(K,te)|0,A=A+Math.imul(K,ke)|0,v=v+Math.imul(ie,Ue)|0,m=m+Math.imul(ie,rt)|0,m=m+Math.imul(y,Ue)|0,A=A+Math.imul(y,rt)|0;var Mr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,v=Math.imul(be,Re),m=Math.imul(be,de),m=m+Math.imul(ue,Re)|0,A=Math.imul(ue,de),v=v+Math.imul(j,te)|0,m=m+Math.imul(j,ke)|0,m=m+Math.imul(X,te)|0,A=A+Math.imul(X,ke)|0,v=v+Math.imul(H,Ue)|0,m=m+Math.imul(H,rt)|0,m=m+Math.imul(K,Ue)|0,A=A+Math.imul(K,rt)|0,v=v+Math.imul(ie,Xe)|0,m=m+Math.imul(ie,Ie)|0,m=m+Math.imul(y,Xe)|0,A=A+Math.imul(y,Ie)|0;var kr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(kr>>>26)|0,kr&=67108863,v=Math.imul(Ye,Re),m=Math.imul(Ye,de),m=m+Math.imul(Fe,Re)|0,A=Math.imul(Fe,de),v=v+Math.imul(be,te)|0,m=m+Math.imul(be,ke)|0,m=m+Math.imul(ue,te)|0,A=A+Math.imul(ue,ke)|0,v=v+Math.imul(j,Ue)|0,m=m+Math.imul(j,rt)|0,m=m+Math.imul(X,Ue)|0,A=A+Math.imul(X,rt)|0,v=v+Math.imul(H,Xe)|0,m=m+Math.imul(H,Ie)|0,m=m+Math.imul(K,Xe)|0,A=A+Math.imul(K,Ie)|0,v=v+Math.imul(ie,dt)|0,m=m+Math.imul(ie,et)|0,m=m+Math.imul(y,dt)|0,A=A+Math.imul(y,et)|0;var Pr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Pr>>>26)|0,Pr&=67108863,v=Math.imul(tt,Re),m=Math.imul(tt,de),m=m+Math.imul(Qe,Re)|0,A=Math.imul(Qe,de),v=v+Math.imul(Ye,te)|0,m=m+Math.imul(Ye,ke)|0,m=m+Math.imul(Fe,te)|0,A=A+Math.imul(Fe,ke)|0,v=v+Math.imul(be,Ue)|0,m=m+Math.imul(be,rt)|0,m=m+Math.imul(ue,Ue)|0,A=A+Math.imul(ue,rt)|0,v=v+Math.imul(j,Xe)|0,m=m+Math.imul(j,Ie)|0,m=m+Math.imul(X,Xe)|0,A=A+Math.imul(X,Ie)|0,v=v+Math.imul(H,dt)|0,m=m+Math.imul(H,et)|0,m=m+Math.imul(K,dt)|0,A=A+Math.imul(K,et)|0,v=v+Math.imul(ie,_e)|0,m=m+Math.imul(ie,fe)|0,m=m+Math.imul(y,_e)|0,A=A+Math.imul(y,fe)|0;var vr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(vr>>>26)|0,vr&=67108863,v=Math.imul(ze,Re),m=Math.imul(ze,de),m=m+Math.imul(je,Re)|0,A=Math.imul(je,de),v=v+Math.imul(tt,te)|0,m=m+Math.imul(tt,ke)|0,m=m+Math.imul(Qe,te)|0,A=A+Math.imul(Qe,ke)|0,v=v+Math.imul(Ye,Ue)|0,m=m+Math.imul(Ye,rt)|0,m=m+Math.imul(Fe,Ue)|0,A=A+Math.imul(Fe,rt)|0,v=v+Math.imul(be,Xe)|0,m=m+Math.imul(be,Ie)|0,m=m+Math.imul(ue,Xe)|0,A=A+Math.imul(ue,Ie)|0,v=v+Math.imul(j,dt)|0,m=m+Math.imul(j,et)|0,m=m+Math.imul(X,dt)|0,A=A+Math.imul(X,et)|0,v=v+Math.imul(H,_e)|0,m=m+Math.imul(H,fe)|0,m=m+Math.imul(K,_e)|0,A=A+Math.imul(K,fe)|0,v=v+Math.imul(ie,we)|0,m=m+Math.imul(ie,De)|0,m=m+Math.imul(y,we)|0,A=A+Math.imul(y,De)|0;var Zn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,v=Math.imul(Be,Re),m=Math.imul(Be,de),m=m+Math.imul(Ze,Re)|0,A=Math.imul(Ze,de),v=v+Math.imul(ze,te)|0,m=m+Math.imul(ze,ke)|0,m=m+Math.imul(je,te)|0,A=A+Math.imul(je,ke)|0,v=v+Math.imul(tt,Ue)|0,m=m+Math.imul(tt,rt)|0,m=m+Math.imul(Qe,Ue)|0,A=A+Math.imul(Qe,rt)|0,v=v+Math.imul(Ye,Xe)|0,m=m+Math.imul(Ye,Ie)|0,m=m+Math.imul(Fe,Xe)|0,A=A+Math.imul(Fe,Ie)|0,v=v+Math.imul(be,dt)|0,m=m+Math.imul(be,et)|0,m=m+Math.imul(ue,dt)|0,A=A+Math.imul(ue,et)|0,v=v+Math.imul(j,_e)|0,m=m+Math.imul(j,fe)|0,m=m+Math.imul(X,_e)|0,A=A+Math.imul(X,fe)|0,v=v+Math.imul(H,we)|0,m=m+Math.imul(H,De)|0,m=m+Math.imul(K,we)|0,A=A+Math.imul(K,De)|0,v=v+Math.imul(ie,Le)|0,m=m+Math.imul(ie,ot)|0,m=m+Math.imul(y,Le)|0,A=A+Math.imul(y,ot)|0;var bi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(bi>>>26)|0,bi&=67108863,v=Math.imul(V,Re),m=Math.imul(V,de),m=m+Math.imul($,Re)|0,A=Math.imul($,de),v=v+Math.imul(Be,te)|0,m=m+Math.imul(Be,ke)|0,m=m+Math.imul(Ze,te)|0,A=A+Math.imul(Ze,ke)|0,v=v+Math.imul(ze,Ue)|0,m=m+Math.imul(ze,rt)|0,m=m+Math.imul(je,Ue)|0,A=A+Math.imul(je,rt)|0,v=v+Math.imul(tt,Xe)|0,m=m+Math.imul(tt,Ie)|0,m=m+Math.imul(Qe,Xe)|0,A=A+Math.imul(Qe,Ie)|0,v=v+Math.imul(Ye,dt)|0,m=m+Math.imul(Ye,et)|0,m=m+Math.imul(Fe,dt)|0,A=A+Math.imul(Fe,et)|0,v=v+Math.imul(be,_e)|0,m=m+Math.imul(be,fe)|0,m=m+Math.imul(ue,_e)|0,A=A+Math.imul(ue,fe)|0,v=v+Math.imul(j,we)|0,m=m+Math.imul(j,De)|0,m=m+Math.imul(X,we)|0,A=A+Math.imul(X,De)|0,v=v+Math.imul(H,Le)|0,m=m+Math.imul(H,ot)|0,m=m+Math.imul(K,Le)|0,A=A+Math.imul(K,ot)|0,v=v+Math.imul(ie,at)|0,m=m+Math.imul(ie,bt)|0,m=m+Math.imul(y,at)|0,A=A+Math.imul(y,bt)|0;var Yn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,v=Math.imul(se,Re),m=Math.imul(se,de),m=m+Math.imul(le,Re)|0,A=Math.imul(le,de),v=v+Math.imul(V,te)|0,m=m+Math.imul(V,ke)|0,m=m+Math.imul($,te)|0,A=A+Math.imul($,ke)|0,v=v+Math.imul(Be,Ue)|0,m=m+Math.imul(Be,rt)|0,m=m+Math.imul(Ze,Ue)|0,A=A+Math.imul(Ze,rt)|0,v=v+Math.imul(ze,Xe)|0,m=m+Math.imul(ze,Ie)|0,m=m+Math.imul(je,Xe)|0,A=A+Math.imul(je,Ie)|0,v=v+Math.imul(tt,dt)|0,m=m+Math.imul(tt,et)|0,m=m+Math.imul(Qe,dt)|0,A=A+Math.imul(Qe,et)|0,v=v+Math.imul(Ye,_e)|0,m=m+Math.imul(Ye,fe)|0,m=m+Math.imul(Fe,_e)|0,A=A+Math.imul(Fe,fe)|0,v=v+Math.imul(be,we)|0,m=m+Math.imul(be,De)|0,m=m+Math.imul(ue,we)|0,A=A+Math.imul(ue,De)|0,v=v+Math.imul(j,Le)|0,m=m+Math.imul(j,ot)|0,m=m+Math.imul(X,Le)|0,A=A+Math.imul(X,ot)|0,v=v+Math.imul(H,at)|0,m=m+Math.imul(H,bt)|0,m=m+Math.imul(K,at)|0,A=A+Math.imul(K,bt)|0,v=v+Math.imul(ie,yt)|0,m=m+Math.imul(ie,pt)|0,m=m+Math.imul(y,yt)|0,A=A+Math.imul(y,pt)|0;var yi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(yi>>>26)|0,yi&=67108863,v=Math.imul(se,te),m=Math.imul(se,ke),m=m+Math.imul(le,te)|0,A=Math.imul(le,ke),v=v+Math.imul(V,Ue)|0,m=m+Math.imul(V,rt)|0,m=m+Math.imul($,Ue)|0,A=A+Math.imul($,rt)|0,v=v+Math.imul(Be,Xe)|0,m=m+Math.imul(Be,Ie)|0,m=m+Math.imul(Ze,Xe)|0,A=A+Math.imul(Ze,Ie)|0,v=v+Math.imul(ze,dt)|0,m=m+Math.imul(ze,et)|0,m=m+Math.imul(je,dt)|0,A=A+Math.imul(je,et)|0,v=v+Math.imul(tt,_e)|0,m=m+Math.imul(tt,fe)|0,m=m+Math.imul(Qe,_e)|0,A=A+Math.imul(Qe,fe)|0,v=v+Math.imul(Ye,we)|0,m=m+Math.imul(Ye,De)|0,m=m+Math.imul(Fe,we)|0,A=A+Math.imul(Fe,De)|0,v=v+Math.imul(be,Le)|0,m=m+Math.imul(be,ot)|0,m=m+Math.imul(ue,Le)|0,A=A+Math.imul(ue,ot)|0,v=v+Math.imul(j,at)|0,m=m+Math.imul(j,bt)|0,m=m+Math.imul(X,at)|0,A=A+Math.imul(X,bt)|0,v=v+Math.imul(H,yt)|0,m=m+Math.imul(H,pt)|0,m=m+Math.imul(K,yt)|0,A=A+Math.imul(K,pt)|0;var wi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(wi>>>26)|0,wi&=67108863,v=Math.imul(se,Ue),m=Math.imul(se,rt),m=m+Math.imul(le,Ue)|0,A=Math.imul(le,rt),v=v+Math.imul(V,Xe)|0,m=m+Math.imul(V,Ie)|0,m=m+Math.imul($,Xe)|0,A=A+Math.imul($,Ie)|0,v=v+Math.imul(Be,dt)|0,m=m+Math.imul(Be,et)|0,m=m+Math.imul(Ze,dt)|0,A=A+Math.imul(Ze,et)|0,v=v+Math.imul(ze,_e)|0,m=m+Math.imul(ze,fe)|0,m=m+Math.imul(je,_e)|0,A=A+Math.imul(je,fe)|0,v=v+Math.imul(tt,we)|0,m=m+Math.imul(tt,De)|0,m=m+Math.imul(Qe,we)|0,A=A+Math.imul(Qe,De)|0,v=v+Math.imul(Ye,Le)|0,m=m+Math.imul(Ye,ot)|0,m=m+Math.imul(Fe,Le)|0,A=A+Math.imul(Fe,ot)|0,v=v+Math.imul(be,at)|0,m=m+Math.imul(be,bt)|0,m=m+Math.imul(ue,at)|0,A=A+Math.imul(ue,bt)|0,v=v+Math.imul(j,yt)|0,m=m+Math.imul(j,pt)|0,m=m+Math.imul(X,yt)|0,A=A+Math.imul(X,pt)|0;var Jn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,v=Math.imul(se,Xe),m=Math.imul(se,Ie),m=m+Math.imul(le,Xe)|0,A=Math.imul(le,Ie),v=v+Math.imul(V,dt)|0,m=m+Math.imul(V,et)|0,m=m+Math.imul($,dt)|0,A=A+Math.imul($,et)|0,v=v+Math.imul(Be,_e)|0,m=m+Math.imul(Be,fe)|0,m=m+Math.imul(Ze,_e)|0,A=A+Math.imul(Ze,fe)|0,v=v+Math.imul(ze,we)|0,m=m+Math.imul(ze,De)|0,m=m+Math.imul(je,we)|0,A=A+Math.imul(je,De)|0,v=v+Math.imul(tt,Le)|0,m=m+Math.imul(tt,ot)|0,m=m+Math.imul(Qe,Le)|0,A=A+Math.imul(Qe,ot)|0,v=v+Math.imul(Ye,at)|0,m=m+Math.imul(Ye,bt)|0,m=m+Math.imul(Fe,at)|0,A=A+Math.imul(Fe,bt)|0,v=v+Math.imul(be,yt)|0,m=m+Math.imul(be,pt)|0,m=m+Math.imul(ue,yt)|0,A=A+Math.imul(ue,pt)|0;var di=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(di>>>26)|0,di&=67108863,v=Math.imul(se,dt),m=Math.imul(se,et),m=m+Math.imul(le,dt)|0,A=Math.imul(le,et),v=v+Math.imul(V,_e)|0,m=m+Math.imul(V,fe)|0,m=m+Math.imul($,_e)|0,A=A+Math.imul($,fe)|0,v=v+Math.imul(Be,we)|0,m=m+Math.imul(Be,De)|0,m=m+Math.imul(Ze,we)|0,A=A+Math.imul(Ze,De)|0,v=v+Math.imul(ze,Le)|0,m=m+Math.imul(ze,ot)|0,m=m+Math.imul(je,Le)|0,A=A+Math.imul(je,ot)|0,v=v+Math.imul(tt,at)|0,m=m+Math.imul(tt,bt)|0,m=m+Math.imul(Qe,at)|0,A=A+Math.imul(Qe,bt)|0,v=v+Math.imul(Ye,yt)|0,m=m+Math.imul(Ye,pt)|0,m=m+Math.imul(Fe,yt)|0,A=A+Math.imul(Fe,pt)|0;var hi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(hi>>>26)|0,hi&=67108863,v=Math.imul(se,_e),m=Math.imul(se,fe),m=m+Math.imul(le,_e)|0,A=Math.imul(le,fe),v=v+Math.imul(V,we)|0,m=m+Math.imul(V,De)|0,m=m+Math.imul($,we)|0,A=A+Math.imul($,De)|0,v=v+Math.imul(Be,Le)|0,m=m+Math.imul(Be,ot)|0,m=m+Math.imul(Ze,Le)|0,A=A+Math.imul(Ze,ot)|0,v=v+Math.imul(ze,at)|0,m=m+Math.imul(ze,bt)|0,m=m+Math.imul(je,at)|0,A=A+Math.imul(je,bt)|0,v=v+Math.imul(tt,yt)|0,m=m+Math.imul(tt,pt)|0,m=m+Math.imul(Qe,yt)|0,A=A+Math.imul(Qe,pt)|0;var Cn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,v=Math.imul(se,we),m=Math.imul(se,De),m=m+Math.imul(le,we)|0,A=Math.imul(le,De),v=v+Math.imul(V,Le)|0,m=m+Math.imul(V,ot)|0,m=m+Math.imul($,Le)|0,A=A+Math.imul($,ot)|0,v=v+Math.imul(Be,at)|0,m=m+Math.imul(Be,bt)|0,m=m+Math.imul(Ze,at)|0,A=A+Math.imul(Ze,bt)|0,v=v+Math.imul(ze,yt)|0,m=m+Math.imul(ze,pt)|0,m=m+Math.imul(je,yt)|0,A=A+Math.imul(je,pt)|0;var vi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(vi>>>26)|0,vi&=67108863,v=Math.imul(se,Le),m=Math.imul(se,ot),m=m+Math.imul(le,Le)|0,A=Math.imul(le,ot),v=v+Math.imul(V,at)|0,m=m+Math.imul(V,bt)|0,m=m+Math.imul($,at)|0,A=A+Math.imul($,bt)|0,v=v+Math.imul(Be,yt)|0,m=m+Math.imul(Be,pt)|0,m=m+Math.imul(Ze,yt)|0,A=A+Math.imul(Ze,pt)|0;var xi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(xi>>>26)|0,xi&=67108863,v=Math.imul(se,at),m=Math.imul(se,bt),m=m+Math.imul(le,at)|0,A=Math.imul(le,bt),v=v+Math.imul(V,yt)|0,m=m+Math.imul(V,pt)|0,m=m+Math.imul($,yt)|0,A=A+Math.imul($,pt)|0;var Ai=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,v=Math.imul(se,yt),m=Math.imul(se,pt),m=m+Math.imul(le,yt)|0,A=Math.imul(le,pt);var l0=(T+v|0)+((m&8191)<<13)|0;return T=(A+(m>>>13)|0)+(l0>>>26)|0,l0&=67108863,E[0]=sr,E[1]=Rr,E[2]=Mr,E[3]=kr,E[4]=Pr,E[5]=vr,E[6]=Zn,E[7]=bi,E[8]=Yn,E[9]=yi,E[10]=wi,E[11]=Jn,E[12]=di,E[13]=hi,E[14]=Cn,E[15]=vi,E[16]=xi,E[17]=Ai,E[18]=l0,T!==0&&(E[19]=T,h.length++),h};Math.imul||(M=O);function U(u,l,h){h.negative=l.negative^u.negative,h.length=u.length+l.length;for(var w=0,_=0,E=0;E>>26)|0,_+=T>>>26,T&=67108863}h.words[E]=v,w=T,T=_}return w!==0?h.words[E]=w:h.length--,h._strip()}function D(u,l,h){return U(u,l,h)}s.prototype.mulTo=function(u,l){var h,w=this.length+u.length;return this.length===10&&u.length===10?h=M(this,u,l):w<63?h=O(this,u,l):w<1024?h=U(this,u,l):h=D(this,u,l),h},s.prototype.mul=function(u){var l=new s(null);return l.words=new Array(this.length+u.length),this.mulTo(u,l)},s.prototype.mulf=function(u){var l=new s(null);return l.words=new Array(this.length+u.length),D(this,u,l)},s.prototype.imul=function(u){return this.clone().mulTo(u,this)},s.prototype.imuln=function(u){var l=u<0;l&&(u=-u),n(typeof u=="number"),n(u<67108864);for(var h=0,w=0;w>=26,h+=_/67108864|0,h+=E>>>26,this.words[w]=E&67108863}return h!==0&&(this.words[w]=h,this.length++),l?this.ineg():this},s.prototype.muln=function(u){return this.clone().imuln(u)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(u){var l=R(u);if(l.length===0)return new s(1);for(var h=this,w=0;w=0);var l=u%26,h=(u-l)/26,w=67108863>>>26-l<<26-l,_;if(l!==0){var E=0;for(_=0;_>>26-l}E&&(this.words[_]=E,this.length++)}if(h!==0){for(_=this.length-1;_>=0;_--)this.words[_+h]=this.words[_];for(_=0;_=0);var w;l?w=(l-l%26)/26:w=0;var _=u%26,E=Math.min((u-_)/26,this.length),T=67108863^67108863>>>_<<_,v=h;if(w-=E,w=Math.max(0,w),v){for(var m=0;mE)for(this.length-=E,m=0;m=0&&(A!==0||m>=w);m--){var Z=this.words[m]|0;this.words[m]=A<<26-_|Z>>>_,A=Z&T}return v&&A!==0&&(v.words[v.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(u,l,h){return n(this.negative===0),this.iushrn(u,l,h)},s.prototype.shln=function(u){return this.clone().ishln(u)},s.prototype.ushln=function(u){return this.clone().iushln(u)},s.prototype.shrn=function(u){return this.clone().ishrn(u)},s.prototype.ushrn=function(u){return this.clone().iushrn(u)},s.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var l=u%26,h=(u-l)/26,w=1<=0);var l=u%26,h=(u-l)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(l!==0&&h++,this.length=Math.min(h,this.length),l!==0){var w=67108863^67108863>>>l<=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},s.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l>26)-(v/67108864|0),this.words[_+h]=E&67108863}for(;_>26,this.words[_+h]=E&67108863;if(T===0)return this._strip();for(n(T===-1),T=0,_=0;_>26,this.words[_]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(u,l){var h=this.length-u.length,w=this.clone(),_=u,E=_.words[_.length-1]|0,T=this._countBits(E);h=26-T,h!==0&&(_=_.ushln(h),w.iushln(h),E=_.words[_.length-1]|0);var v=w.length-_.length,m;if(l!=="mod"){m=new s(null),m.length=v+1,m.words=new Array(m.length);for(var A=0;A=0;ie--){var y=(w.words[_.length+ie]|0)*67108864+(w.words[_.length+ie-1]|0);for(y=Math.min(y/E|0,67108863),w._ishlnsubmul(_,y,ie);w.negative!==0;)y--,w.negative=0,w._ishlnsubmul(_,1,ie),w.isZero()||(w.negative^=1);m&&(m.words[ie]=y)}return m&&m._strip(),w._strip(),l!=="div"&&h!==0&&w.iushrn(h),{div:m||null,mod:w}},s.prototype.divmod=function(u,l,h){if(n(!u.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var w,_,E;return this.negative!==0&&u.negative===0?(E=this.neg().divmod(u,l),l!=="mod"&&(w=E.div.neg()),l!=="div"&&(_=E.mod.neg(),h&&_.negative!==0&&_.iadd(u)),{div:w,mod:_}):this.negative===0&&u.negative!==0?(E=this.divmod(u.neg(),l),l!=="mod"&&(w=E.div.neg()),{div:w,mod:E.mod}):this.negative&u.negative?(E=this.neg().divmod(u.neg(),l),l!=="div"&&(_=E.mod.neg(),h&&_.negative!==0&&_.isub(u)),{div:E.div,mod:_}):u.length>this.length||this.cmp(u)<0?{div:new s(0),mod:this}:u.length===1?l==="div"?{div:this.divn(u.words[0]),mod:null}:l==="mod"?{div:null,mod:new s(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new s(this.modrn(u.words[0]))}:this._wordDiv(u,l)},s.prototype.div=function(u){return this.divmod(u,"div",!1).div},s.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},s.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},s.prototype.divRound=function(u){var l=this.divmod(u);if(l.mod.isZero())return l.div;var h=l.div.negative!==0?l.mod.isub(u):l.mod,w=u.ushrn(1),_=u.andln(1),E=h.cmp(w);return E<0||_===1&&E===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},s.prototype.modrn=function(u){var l=u<0;l&&(u=-u),n(u<=67108863);for(var h=(1<<26)%u,w=0,_=this.length-1;_>=0;_--)w=(h*w+(this.words[_]|0))%u;return l?-w:w},s.prototype.modn=function(u){return this.modrn(u)},s.prototype.idivn=function(u){var l=u<0;l&&(u=-u),n(u<=67108863);for(var h=0,w=this.length-1;w>=0;w--){var _=(this.words[w]|0)+h*67108864;this.words[w]=_/u|0,h=_%u}return this._strip(),l?this.ineg():this},s.prototype.divn=function(u){return this.clone().idivn(u)},s.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var l=this,h=u.clone();l.negative!==0?l=l.umod(u):l=l.clone();for(var w=new s(1),_=new s(0),E=new s(0),T=new s(1),v=0;l.isEven()&&h.isEven();)l.iushrn(1),h.iushrn(1),++v;for(var m=h.clone(),A=l.clone();!l.isZero();){for(var Z=0,ie=1;!(l.words[0]&ie)&&Z<26;++Z,ie<<=1);if(Z>0)for(l.iushrn(Z);Z-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(m),_.isub(A)),w.iushrn(1),_.iushrn(1);for(var y=0,G=1;!(h.words[0]&G)&&y<26;++y,G<<=1);if(y>0)for(h.iushrn(y);y-- >0;)(E.isOdd()||T.isOdd())&&(E.iadd(m),T.isub(A)),E.iushrn(1),T.iushrn(1);l.cmp(h)>=0?(l.isub(h),w.isub(E),_.isub(T)):(h.isub(l),E.isub(w),T.isub(_))}return{a:E,b:T,gcd:h.iushln(v)}},s.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var l=this,h=u.clone();l.negative!==0?l=l.umod(u):l=l.clone();for(var w=new s(1),_=new s(0),E=h.clone();l.cmpn(1)>0&&h.cmpn(1)>0;){for(var T=0,v=1;!(l.words[0]&v)&&T<26;++T,v<<=1);if(T>0)for(l.iushrn(T);T-- >0;)w.isOdd()&&w.iadd(E),w.iushrn(1);for(var m=0,A=1;!(h.words[0]&A)&&m<26;++m,A<<=1);if(m>0)for(h.iushrn(m);m-- >0;)_.isOdd()&&_.iadd(E),_.iushrn(1);l.cmp(h)>=0?(l.isub(h),w.isub(_)):(h.isub(l),_.isub(w))}var Z;return l.cmpn(1)===0?Z=w:Z=_,Z.cmpn(0)<0&&Z.iadd(u),Z},s.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var l=this.clone(),h=u.clone();l.negative=0,h.negative=0;for(var w=0;l.isEven()&&h.isEven();w++)l.iushrn(1),h.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;h.isEven();)h.iushrn(1);var _=l.cmp(h);if(_<0){var E=l;l=h,h=E}else if(_===0||h.cmpn(1)===0)break;l.isub(h)}while(!0);return h.iushln(w)},s.prototype.invm=function(u){return this.egcd(u).a.umod(u)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(u){return this.words[0]&u},s.prototype.bincn=function(u){n(typeof u=="number");var l=u%26,h=(u-l)/26,w=1<>>26,T&=67108863,this.words[E]=T}return _!==0&&(this.words[E]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(u){var l=u<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this._strip();var h;if(this.length>1)h=1;else{l&&(u=-u),n(u<=67108863,"Number is too big");var w=this.words[0]|0;h=w===u?0:wu.length)return 1;if(this.length=0;h--){var w=this.words[h]|0,_=u.words[h]|0;if(w!==_){w<_?l=-1:w>_&&(l=1);break}}return l},s.prototype.gtn=function(u){return this.cmpn(u)===1},s.prototype.gt=function(u){return this.cmp(u)===1},s.prototype.gten=function(u){return this.cmpn(u)>=0},s.prototype.gte=function(u){return this.cmp(u)>=0},s.prototype.ltn=function(u){return this.cmpn(u)===-1},s.prototype.lt=function(u){return this.cmp(u)===-1},s.prototype.lten=function(u){return this.cmpn(u)<=0},s.prototype.lte=function(u){return this.cmp(u)<=0},s.prototype.eqn=function(u){return this.cmpn(u)===0},s.prototype.eq=function(u){return this.cmp(u)===0},s.red=function(u){return new z(u)},s.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(u){return this.red=u,this},s.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},s.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},s.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},s.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},s.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},s.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},s.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},s.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var B={k256:null,p224:null,p192:null,p25519:null};function F(u,l){this.name=u,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var u=new s(null);return u.words=new Array(Math.ceil(this.n/13)),u},F.prototype.ireduce=function(u){var l=u,h;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),h=l.bitLength();while(h>this.n);var w=h0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},F.prototype.split=function(u,l){u.iushrn(this.n,0,l)},F.prototype.imulK=function(u){return u.imul(this.k)};function k(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(k,F),k.prototype.split=function(u,l){for(var h=4194303,w=Math.min(u.length,9),_=0;_>>22,E=T}E>>>=22,u.words[_-10]=E,E===0&&u.length>10?u.length-=10:u.length-=9},k.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var l=0,h=0;h>>=26,u.words[h]=_,l=w}return l!==0&&(u.words[u.length++]=l),u},s._prime=function(u){if(B[u])return B[u];var l;if(u==="k256")l=new k;else if(u==="p224")l=new N;else if(u==="p192")l=new W;else if(u==="p25519")l=new Y;else throw new Error("Unknown prime "+u);return B[u]=l,l};function z(u){if(typeof u=="string"){var l=s._prime(u);this.m=l.p,this.prime=l}else n(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}z.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},z.prototype._verify2=function(u,l){n((u.negative|l.negative)===0,"red works only with positives"),n(u.red&&u.red===l.red,"red works only with red numbers")},z.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(d(u,u.umod(this.m)._forceRed(this)),u)},z.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},z.prototype.add=function(u,l){this._verify2(u,l);var h=u.add(l);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},z.prototype.iadd=function(u,l){this._verify2(u,l);var h=u.iadd(l);return h.cmp(this.m)>=0&&h.isub(this.m),h},z.prototype.sub=function(u,l){this._verify2(u,l);var h=u.sub(l);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},z.prototype.isub=function(u,l){this._verify2(u,l);var h=u.isub(l);return h.cmpn(0)<0&&h.iadd(this.m),h},z.prototype.shl=function(u,l){return this._verify1(u),this.imod(u.ushln(l))},z.prototype.imul=function(u,l){return this._verify2(u,l),this.imod(u.imul(l))},z.prototype.mul=function(u,l){return this._verify2(u,l),this.imod(u.mul(l))},z.prototype.isqr=function(u){return this.imul(u,u.clone())},z.prototype.sqr=function(u){return this.mul(u,u)},z.prototype.sqrt=function(u){if(u.isZero())return u.clone();var l=this.m.andln(3);if(n(l%2===1),l===3){var h=this.m.add(new s(1)).iushrn(2);return this.pow(u,h)}for(var w=this.m.subn(1),_=0;!w.isZero()&&w.andln(1)===0;)_++,w.iushrn(1);n(!w.isZero());var E=new s(1).toRed(this),T=E.redNeg(),v=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new s(2*m*m).toRed(this);this.pow(m,v).cmp(T)!==0;)m.redIAdd(T);for(var A=this.pow(m,w),Z=this.pow(u,w.addn(1).iushrn(1)),ie=this.pow(u,w),y=_;ie.cmp(E)!==0;){for(var G=ie,H=0;G.cmp(E)!==0;H++)G=G.redSqr();n(H=0;_--){for(var A=l.words[_],Z=m-1;Z>=0;Z--){var ie=A>>Z&1;if(E!==w[0]&&(E=this.sqr(E)),ie===0&&T===0){v=0;continue}T<<=1,T|=ie,v++,!(v!==h&&(_!==0||Z!==0))&&(E=this.mul(E,w[T]),v=0,T=0)}m=26}return E},z.prototype.convertTo=function(u){var l=u.umod(this.m);return l===u?l.clone():l},z.prototype.convertFrom=function(u){var l=u.clone();return l.red=null,l},s.mont=function(u){return new P(u)};function P(u){z.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(P,z),P.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},P.prototype.convertFrom=function(u){var l=this.imod(u.mul(this.rinv));return l.red=null,l},P.prototype.imul=function(u,l){if(u.isZero()||l.isZero())return u.words[0]=0,u.length=1,u;var h=u.imul(l),w=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=h.isub(w).iushrn(this.shift),E=_;return _.cmp(this.m)>=0?E=_.isub(this.m):_.cmpn(0)<0&&(E=_.iadd(this.m)),E._forceRed(this)},P.prototype.mul=function(u,l){if(u.isZero()||l.isZero())return new s(0)._forceRed(this);var h=u.mul(l),w=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=h.isub(w).iushrn(this.shift),E=_;return _.cmp(this.m)>=0?E=_.isub(this.m):_.cmpn(0)<0&&(E=_.iadd(this.m)),E._forceRed(this)},P.prototype.invm=function(u){var l=this.imod(u._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(t,X8e)})(nye);var Ur=nye.exports;const iye="bignumber/5.7.0";var _H=Ur.BN;const _d=new Ga(iye),NF={},Cce=9007199254740991;function uft(t){return t!=null&&(da.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Sy(t)||typeof t=="bigint"||P_(t))}let Sce=!1,da=class Fc{constructor(e,r){e!==NF&&_d.throwError("cannot call constructor directly; use BigNumber.from",Ga.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Ra(rn(this).fromTwos(e))}toTwos(e){return Ra(rn(this).toTwos(e))}abs(){return this._hex[0]==="-"?Fc.from(this._hex.substring(1)):this}add(e){return Ra(rn(this).add(rn(e)))}sub(e){return Ra(rn(this).sub(rn(e)))}div(e){return Fc.from(e).isZero()&&Ef("division-by-zero","div"),Ra(rn(this).div(rn(e)))}mul(e){return Ra(rn(this).mul(rn(e)))}mod(e){const r=rn(e);return r.isNeg()&&Ef("division-by-zero","mod"),Ra(rn(this).umod(r))}pow(e){const r=rn(e);return r.isNeg()&&Ef("negative-power","pow"),Ra(rn(this).pow(r))}and(e){const r=rn(e);return(this.isNegative()||r.isNeg())&&Ef("unbound-bitwise-result","and"),Ra(rn(this).and(r))}or(e){const r=rn(e);return(this.isNegative()||r.isNeg())&&Ef("unbound-bitwise-result","or"),Ra(rn(this).or(r))}xor(e){const r=rn(e);return(this.isNegative()||r.isNeg())&&Ef("unbound-bitwise-result","xor"),Ra(rn(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Ef("negative-width","mask"),Ra(rn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ef("negative-width","shl"),Ra(rn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ef("negative-width","shr"),Ra(rn(this).shrn(e))}eq(e){return rn(this).eq(rn(e))}lt(e){return rn(this).lt(rn(e))}lte(e){return rn(this).lte(rn(e))}gt(e){return rn(this).gt(rn(e))}gte(e){return rn(this).gte(rn(e))}isNegative(){return this._hex[0]==="-"}isZero(){return rn(this).isZero()}toNumber(){try{return rn(this).toNumber()}catch{Ef("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return _d.throwError("this platform does not support BigInt",Ga.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Sce||(Sce=!0,_d.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?_d.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ga.errors.UNEXPECTED_ARGUMENT,{}):_d.throwError("BigNumber.toString does not accept parameters",Ga.errors.UNEXPECTED_ARGUMENT,{})),rn(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Fc)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Fc(NF,_x(e)):e.match(/^-?[0-9]+$/)?new Fc(NF,_x(new _H(e))):_d.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ef("underflow","BigNumber.from",e),(e>=Cce||e<=-Cce)&&Ef("overflow","BigNumber.from",e),Fc.from(String(e));const r=e;if(typeof r=="bigint")return Fc.from(r.toString());if(P_(r))return Fc.from(rye(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Fc.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(Sy(n)||n[0]==="-"&&Sy(n.substring(1))))return Fc.from(n)}return _d.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function _x(t){if(typeof t!="string")return _x(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&_d.throwArgumentError("invalid hex","value",t),t=_x(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Ra(t){return da.from(_x(t))}function rn(t){const e=da.from(t).toHexString();return e[0]==="-"?new _H("-"+e.substring(3),16):new _H(e.substring(2),16)}function Ef(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),_d.throwError(t,Ga.errors.NUMERIC_FAULT,n)}const sa=new Ga(iye),J9={},sye=da.from(0),aye=da.from(-1);function oye(t,e,r,n){const i={fault:e,operation:r};return n!==void 0&&(i.value=n),sa.throwError(t,Ga.errors.NUMERIC_FAULT,i)}let X9="0";for(;X9.length<256;)X9+=X9;function oQ(t){if(typeof t!="number")try{t=da.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+X9.substring(0,t):sa.throwArgumentError("invalid decimal size","decimals",t)}function OF(t,e){e==null&&(e=0);const r=oQ(e);t=da.from(t);const n=t.lt(sye);n&&(t=t.mul(aye));let i=t.mod(r).toString();for(;i.length2&&sa.throwArgumentError("too many decimal points","value",t);let s=i[0],a=i[1];for(s||(s="0"),a||(a="0");a[a.length-1]==="0";)a=a.substring(0,a.length-1);for(a.length>r.length-1&&oye("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.lengthe[a]==null?f:(typeof e[a]!==o&&sa.throwArgumentError("invalid fixed format ("+a+" not "+o+")","format."+a,e[a]),e[a]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&sa.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&sa.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new I3(J9,r,n,i)}}class as{constructor(e,r,n,i){e!==J9&&sa.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ga.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&sa.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=as.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Tce.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=as.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Tce.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&sa.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const n=as.from("1"+X9.substring(0,e),this.format),i=lft.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&sa.throwArgumentError("invalid byte width","width",e);const r=da.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return cR(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return as.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!uft(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),as.fromString(OF(e,r),I3.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=I3.from(r),i=ud(e,n.decimals);!n.signed&&i.lt(sye)&&oye("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=cR(s,n.width/8));const a=OF(i,n.decimals);return new as(J9,s,a,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=I3.from(r);if(tye(e).length>n.width/8)throw new Error("overflow");let i=da.from(e);n.signed&&(i=i.fromTwos(n.width));const s=i.toTwos((n.signed?0:1)+n.width).toHexString(),a=OF(i,n.decimals);return new as(J9,s,a,n)}static from(e,r){if(typeof e=="string")return as.fromString(e,r);if(P_(e))return as.fromBytes(e,r);try{return as.fromValue(e,0,r)}catch(n){if(n.code!==Ga.errors.INVALID_ARGUMENT)throw n}return sa.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Tce=as.from(1),lft=as.from("0.5");var Ice;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Ice||(Ice={}));var Rce;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Rce||(Rce={}));function dft(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function Mce(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}Mce("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),DF("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),DF("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),DF("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",dft),Mce("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function hft(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(o)?i(o,a-1):r.push(o)})};return i(t,e),r}function pft(t){const e={};for(let r=0;r>--f&1}const p=31,g=Math.pow(2,p),x=g>>>1,S=x>>1,I=g-1;let R=0;for(let B=0;B1;){let Y=F+k>>>1;B>>1|d(),N=N<<1^x,W=(W^x)<<1|x|1;M=N,U=1+W-N}let D=n-4;return O.map(B=>{switch(B-D){case 3:return D+65792+(t[o++]<<16|t[o++]<<8|t[o++]);case 2:return D+256+(t[o++]<<8|t[o++]);case 1:return D+t[o++];default:return B-1}})}function gft(t){let e=0;return()=>t[e++]}function bft(t){return gft(mft(t))}function yft(t){return t&1?~t>>1:t>>1}function wft(t,e){let r=Array(t);for(let n=0;ne[a]):r}function xft(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(_ft(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Eft(r,t))}return pft(fye(e))}function Aft(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function cye(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[a].push(s));return n}function _ft(t,e){let r=1+e(),n=e(),i=Aft(e),s=cye(i.length,1+t,e);return fye(s.map((a,o)=>{const f=a[0],c=a.slice(1);return Array(i[o]).fill(void 0).map((d,p)=>{let g=p*n;return[f+p*r,c.map(x=>x+g)]})}))}function Eft(t,e){let r=1+e();return cye(r,1+t,e).map(n=>[n[0],n.slice(1)])}function Cft(t){let e=uR(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let c=uR(t,e);if(c.length==0)break;n.push({set:new Set(c),node:r()})}n.sort((c,d)=>d.set.size-c.set.size);let i=t(),s=i%3;i=i/3|0;let a=!!(i&1);i>>=1;let o=i==1,f=i==2;return{branches:n,valid:s,fe0f:a,save:o,check:f}}}function Sft(){return bft(hft("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"))}const SS=Sft();new Set(uR(SS)),new Set(uR(SS)),xft(SS),Cft(SS);const Tft=new Uint8Array(32);Tft.fill(0);const Ift=new Uint8Array(32);Ift.fill(0),da.from(-1);const Rft=da.from(0),Mft=da.from(1);da.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),cR(Mft.toHexString(),32),cR(Rft.toHexString(),32);var gl={},fn={},N_=uye;function uye(t,e){if(!t)throw new Error(e||"Assertion failed")}uye.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var EH={exports:{}};typeof Object.create=="function"?EH.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:EH.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var kft=N_,Pft=EH.exports;fn.inherits=Pft;function Nft(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function Oft(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):Nft(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}fn.htonl=lye;function $ft(t,e){for(var r="",n=0;n>>0}return s}fn.join32=Bft;function Uft(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}fn.split32=Uft;function Lft(t,e){return t>>>e|t<<32-e}fn.rotr32=Lft;function Fft(t,e){return t<>>32-e}fn.rotl32=Fft;function jft(t,e){return t+e>>>0}fn.sum32=jft;function zft(t,e,r){return t+e+r>>>0}fn.sum32_3=zft;function qft(t,e,r,n){return t+e+r+n>>>0}fn.sum32_4=qft;function Hft(t,e,r,n,i){return t+e+r+n+i>>>0}fn.sum32_5=Hft;function Vft(t,e,r,n){var i=t[e],s=t[e+1],a=n+s>>>0,o=(a>>0,t[e+1]=a}fn.sum64=Vft;function Wft(t,e,r,n){var i=e+n>>>0,s=(i>>0}fn.sum64_hi=Wft;function Gft(t,e,r,n){var i=e+n;return i>>>0}fn.sum64_lo=Gft;function Kft(t,e,r,n,i,s,a,o){var f=0,c=e;c=c+n>>>0,f+=c>>0,f+=c>>0,f+=c>>0}fn.sum64_4_hi=Kft;function Qft(t,e,r,n,i,s,a,o){var f=e+n+s+o;return f>>>0}fn.sum64_4_lo=Qft;function Zft(t,e,r,n,i,s,a,o,f,c){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}fn.sum64_5_hi=Zft;function Yft(t,e,r,n,i,s,a,o,f,c){var d=e+n+s+o+c;return d>>>0}fn.sum64_5_lo=Yft;function Jft(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}fn.rotr64_hi=Jft;function Xft(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}fn.rotr64_lo=Xft;function ect(t,e,r){return t>>>r}fn.shr64_hi=ect;function tct(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}fn.shr64_lo=tct;var zw={},Pce=fn,rct=N_;function TS(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}zw.BlockHash=TS,TS.prototype.update=function(t,e){if(t=Pce.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=Pce.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s>>3}U1.g0_256=oct;function fct(t){return a1(t,17)^a1(t,19)^t>>>10}U1.g1_256=fct;var Ty=fn,cct=zw,uct=U1,$F=Ty.rotl32,Qv=Ty.sum32,lct=Ty.sum32_5,dct=uct.ft_1,bye=cct.BlockHash,hct=[1518500249,1859775393,2400959708,3395469782];function Ul(){if(!(this instanceof Ul))return new Ul;bye.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ty.inherits(Ul,bye);var pct=Ul;Ul.blockSize=512,Ul.outSize=160,Ul.hmacStrength=80,Ul.padLength=64,Ul.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=new this.Hash().update(t).digest()),tut(t.length<=this.blockSize);for(var e=t.length;e>8,g=d&255;p?f.push(p,g):f.push(g)}return f}r.toArray=n;function i(a){return a.length===1?"0"+a:a}r.zero2=i;function s(a){for(var o="",f=0;f(g>>1)-1?I=(g>>1)-R:I=R,x.isubn(I)):I=0,p[S]=I,x.iushrn(1)}return p}r.getNAF=n;function i(f,c){var d=[[],[]];f=f.clone(),c=c.clone();for(var p=0,g=0,x;f.cmpn(-p)>0||c.cmpn(-g)>0;){var S=f.andln(3)+p&3,I=c.andln(3)+g&3;S===3&&(S=-1),I===3&&(I=-1);var R;S&1?(x=f.andln(7)+p&7,(x===3||x===5)&&I===2?R=-S:R=S):R=0,d[0].push(R);var O;I&1?(x=c.andln(7)+g&7,(x===3||x===5)&&S===2?O=-I:O=I):O=0,d[1].push(O),2*p===R+1&&(p=1-p),2*g===O+1&&(g=1-g),f.iushrn(1),c.iushrn(1)}return d}r.getJSF=i;function s(f,c,d){var p="_"+c;f.prototype[c]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function a(f){return typeof f=="string"?r.toArray(f,"hex"):f}r.parseBytes=a;function o(f){return new Ur(f,"hex","le")}r.intFromLE=o}),RS=zo.getNAF,iut=zo.getJSF,lR=zo.assert;function Bp(t,e){this.type=t,this.p=new Ur(e.p,16),this.red=e.prime?Ur.red(e.prime):Ur.mont(this.p),this.zero=new Ur(0).toRed(this.red),this.one=new Ur(1).toRed(this.red),this.two=new Ur(2).toRed(this.red),this.n=e.n&&new Ur(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var kg=Bp;Bp.prototype.point=function(){throw new Error("Not implemented")},Bp.prototype.validate=function(){throw new Error("Not implemented")},Bp.prototype._fixedNafMul=function(t,e){lR(t.precomputed);var r=t._getDoubles(),n=RS(e,1,this._bitLength),i=(1<=a;f--)o=(o<<1)+n[f];s.push(o)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=i;p>0;p--){for(a=0;a=0;o--){for(var f=0;o>=0&&s[o]===0;o--)f++;if(o>=0&&f++,a=a.dblp(f),o<0)break;var c=s[o];lR(c!==0),t.type==="affine"?c>0?a=a.mixedAdd(i[c-1>>1]):a=a.mixedAdd(i[-c-1>>1].neg()):c>0?a=a.add(i[c-1>>1]):a=a.add(i[-c-1>>1].neg())}return t.type==="affine"?a.toP():a},Bp.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,a=this._wnafT2,o=this._wnafT3,f=0,c,d,p;for(c=0;c=1;c-=2){var x=c-1,S=c;if(s[x]!==1||s[S]!==1){o[x]=RS(r[x],s[x],this._bitLength),o[S]=RS(r[S],s[S],this._bitLength),f=Math.max(o[x].length,f),f=Math.max(o[S].length,f);continue}var I=[e[x],null,null,e[S]];e[x].y.cmp(e[S].y)===0?(I[1]=e[x].add(e[S]),I[2]=e[x].toJ().mixedAdd(e[S].neg())):e[x].y.cmp(e[S].y.redNeg())===0?(I[1]=e[x].toJ().mixedAdd(e[S]),I[2]=e[x].add(e[S].neg())):(I[1]=e[x].toJ().mixedAdd(e[S]),I[2]=e[x].toJ().mixedAdd(e[S].neg()));var R=[-3,-1,-5,-7,0,7,5,1,3],O=iut(r[x],r[S]);for(f=Math.max(O[0].length,f),o[x]=new Array(f),o[S]=new Array(f),d=0;d=0;c--){for(var F=0;c>=0;){var k=!0;for(d=0;d=0&&F++,D=D.dblp(F),c<0)break;for(d=0;d0?p=a[d][N-1>>1]:N<0&&(p=a[d][-N-1>>1].neg()),p.type==="affine"?D=D.mixedAdd(p):D=D.add(p))}}for(c=0;c=Math.ceil((t.bitLength()+1)/e.step):!1},Cf.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(g=f,x=c),d.negative&&(d=d.neg(),p=p.neg()),g.negative&&(g=g.neg(),x=x.neg()),[{a:d,b:p},{a:g,b:x}]},Zf.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),o=s.mul(n.a),f=i.mul(r.b),c=s.mul(n.b),d=t.sub(a).sub(o),p=f.add(c).neg();return{k1:d,k2:p}},Zf.prototype.pointFromX=function(t,e){t=new Ur(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Zf.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Zf.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},D0.prototype.isInfinity=function(){return this.inf},D0.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},D0.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},D0.prototype.getX=function(){return this.x.fromRed()},D0.prototype.getY=function(){return this.y.fromRed()},D0.prototype.mul=function(t){return t=new Ur(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},D0.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},D0.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},D0.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},D0.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},D0.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function is(t,e,r,n){kg.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ur(0)):(this.x=new Ur(e,16),this.y=new Ur(r,16),this.z=new Ur(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}cQ(is,kg.BasePoint),Zf.prototype.jpoint=function(t,e,r){return new is(this,t,e,r)},is.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},is.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},is.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),o=n.redSub(i),f=s.redSub(a);if(o.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),d=c.redMul(o),p=n.redMul(c),g=f.redSqr().redIAdd(d).redISub(p).redISub(p),x=f.redMul(p.redISub(g)).redISub(s.redMul(d)),S=this.z.redMul(t.z).redMul(o);return this.curve.jpoint(g,x,S)},is.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),a=r.redSub(n),o=i.redSub(s);if(a.cmpn(0)===0)return o.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),c=f.redMul(a),d=r.redMul(f),p=o.redSqr().redIAdd(c).redISub(d).redISub(d),g=o.redMul(d.redISub(p)).redISub(i.redMul(c)),x=this.z.redMul(a);return this.curve.jpoint(p,g,x)},is.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},is.prototype.inspect=function(){return this.isInfinity()?"":""},is.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var PT=Hw(function(t,e){var r=e;r.base=kg,r.short=aut,r.mont=null,r.edwards=null}),NT=Hw(function(t,e){var r=e,n=zo.assert;function i(o){o.type==="short"?this.curve=new PT.short(o):o.type==="edwards"?this.curve=new PT.edwards(o):this.curve=new PT.mont(o),this.g=this.curve.g,this.n=this.curve.n,this.hash=o.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(o,f){Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get:function(){var c=new i(f);return Object.defineProperty(r,o,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:gl.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:gl.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:gl.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:gl.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:gl.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:gl.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:gl.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch{a=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:gl.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function Up(t){if(!(this instanceof Up))return new Up(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=bu.toArray(t.entropy,t.entropyEnc||"hex"),r=bu.toArray(t.nonce,t.nonceEnc||"hex"),n=bu.toArray(t.pers,t.persEnc||"hex");fQ(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var $ce=Up;Up.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Up.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=bu.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var out=zo.assert;function hP(t,e){if(t instanceof hP)return t;this._importDER(t,e)||(out(t.r&&t.s,"Signature without r or s"),this.r=new Ur(t.r,16),this.s=new Ur(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var MS=hP;function fut(){this.place=0}function jF(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s>>=0;return i<=127?!1:(e.place=a,i)}function Bce(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}hP.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=Bce(e),r=Bce(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];zF(n,e.length),n=n.concat(e),n.push(2),zF(n,r.length);var i=n.concat(r),s=[48];return zF(s,i.length),s=s.concat(i),zo.encode(s,t)};var cut=function(){throw new Error("unsupported")},Rye=zo.assert;function Lf(t){if(!(this instanceof Lf))return new Lf(t);typeof t=="string"&&(Rye(Object.prototype.hasOwnProperty.call(NT,t),"Unknown curve "+t),t=NT[t]),t instanceof NT.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var uut=Lf;Lf.prototype.keyPair=function(t){return new FF(this,t)},Lf.prototype.keyFromPrivate=function(t,e){return FF.fromPrivate(this,t,e)},Lf.prototype.keyFromPublic=function(t,e){return FF.fromPublic(this,t,e)},Lf.prototype.genKeyPair=function(t){t||(t={});for(var e=new $ce({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||cut(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Ur(2));;){var i=new Ur(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Lf.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Lf.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new Ur(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),a=t.toArray("be",i),o=new $ce({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new Ur(1)),c=0;;c++){var d=n.k?n.k(c):new Ur(o.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(f)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var g=p.getX(),x=g.umod(this.n);if(x.cmpn(0)!==0){var S=d.invm(this.n).mul(x.mul(e.getPrivate()).iadd(t));if(S=S.umod(this.n),S.cmpn(0)!==0){var I=(p.getY().isOdd()?1:0)|(g.cmp(x)!==0?2:0);return n.canonical&&S.cmp(this.nh)>0&&(S=this.n.sub(S),I^=1),new MS({r:x,s:S,recoveryParam:I})}}}}}},Lf.prototype.verify=function(t,e,r,n){t=this._truncateToN(new Ur(t,16)),r=this.keyFromPublic(r,n),e=new MS(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),o=a.mul(t).umod(this.n),f=a.mul(i).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(o,r.getPublic(),f),c.isInfinity()?!1:c.eqXToP(i)):(c=this.g.mulAdd(o,r.getPublic(),f),c.isInfinity()?!1:c.getX().umod(this.n).cmp(i)===0)},Lf.prototype.recoverPubKey=function(t,e,r,n){Rye((3&r)===r,"The recovery param is more than two bits"),e=new MS(e,n);var i=this.n,s=new Ur(t),a=e.r,o=e.s,f=r&1,c=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?a=this.curve.pointFromX(a.add(this.curve.n),f):a=this.curve.pointFromX(a,f);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),g=o.mul(d).umod(i);return this.g.mulAdd(p,a,g)},Lf.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new MS(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var lut=Hw(function(t,e){var r=e;r.version="6.5.4",r.utils=zo,r.rand=function(){throw new Error("unsupported")},r.curve=PT,r.curves=NT,r.ec=uut,r.eddsa=null});lut.ec;var Uce;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Uce||(Uce={}));const dut=Symbol(),Lce=Object.getPrototypeOf,TH=new WeakMap,hut=t=>t&&(TH.has(t)?TH.get(t):Lce(t)===Object.prototype||Lce(t)===Array.prototype),put=t=>hut(t)&&t[dut]||null,Fce=(t,e=!0)=>{TH.set(t,e)},dR={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REOWN_PROJECT_ID:"6562ee7f0e72671353204776ca7a132c"},qF=t=>typeof t=="object"&&t!==null,Rp=new WeakMap,S9=new WeakSet,mut=(t=Object.is,e=(c,d)=>new Proxy(c,d),r=c=>qF(c)&&!S9.has(c)&&(Array.isArray(c)||!(Symbol.iterator in c))&&!(c instanceof WeakMap)&&!(c instanceof WeakSet)&&!(c instanceof Error)&&!(c instanceof Number)&&!(c instanceof Date)&&!(c instanceof String)&&!(c instanceof RegExp)&&!(c instanceof ArrayBuffer),n=c=>{switch(c.status){case"fulfilled":return c.value;case"rejected":throw c.reason;default:throw c}},i=new WeakMap,s=(c,d,p=n)=>{const g=i.get(c);if((g==null?void 0:g[0])===d)return g[1];const x=Array.isArray(c)?[]:Object.create(Object.getPrototypeOf(c));return Fce(x,!0),i.set(c,[d,x]),Reflect.ownKeys(c).forEach(S=>{if(Object.getOwnPropertyDescriptor(x,S))return;const I=Reflect.get(c,S),R={value:I,enumerable:!0,configurable:!0};if(S9.has(I))Fce(I,!1);else if(I instanceof Promise)delete R.value,R.get=()=>p(I);else if(Rp.has(I)){const[O,M]=Rp.get(I);R.value=s(O,M(),p)}Object.defineProperty(x,S,R)}),Object.preventExtensions(x)},a=new WeakMap,o=[1,1],f=c=>{if(!qF(c))throw new Error("object required");const d=a.get(c);if(d)return d;let p=o[0];const g=new Set,x=(W,Y=++o[0])=>{p!==Y&&(p=Y,g.forEach(z=>z(W,Y)))};let S=o[1];const I=(W=++o[1])=>(S!==W&&!g.size&&(S=W,O.forEach(([Y])=>{const z=Y[1](W);z>p&&(p=z)})),p),R=W=>(Y,z)=>{const P=[...Y];P[1]=[W,...P[1]],x(P,z)},O=new Map,M=(W,Y)=>{if((dR?"production":void 0)!=="production"&&O.has(W))throw new Error("prop listener already exists");if(g.size){const z=Y[3](R(W));O.set(W,[Y,z])}else O.set(W,[Y])},U=W=>{var Y;const z=O.get(W);z&&(O.delete(W),(Y=z[1])==null||Y.call(z))},D=W=>(g.add(W),g.size===1&&O.forEach(([z,P],u)=>{if((dR?"production":void 0)!=="production"&&P)throw new Error("remove already exists");const l=z[3](R(u));O.set(u,[z,l])}),()=>{g.delete(W),g.size===0&&O.forEach(([z,P],u)=>{P&&(P(),O.set(u,[z]))})}),B=Array.isArray(c)?[]:Object.create(Object.getPrototypeOf(c)),k=e(B,{deleteProperty(W,Y){const z=Reflect.get(W,Y);U(Y);const P=Reflect.deleteProperty(W,Y);return P&&x(["delete",[Y],z]),P},set(W,Y,z,P){const u=Reflect.has(W,Y),l=Reflect.get(W,Y,P);if(u&&(t(l,z)||a.has(z)&&t(l,a.get(z))))return!0;U(Y),qF(z)&&(z=put(z)||z);let h=z;if(z instanceof Promise)z.then(w=>{z.status="fulfilled",z.value=w,x(["resolve",[Y],w])}).catch(w=>{z.status="rejected",z.reason=w,x(["reject",[Y],w])});else{!Rp.has(z)&&r(z)&&(h=f(z));const w=!S9.has(h)&&Rp.get(h);w&&M(Y,w)}return Reflect.set(W,Y,h,P),x(["set",[Y],z,l]),!0}});a.set(c,k);const N=[B,I,s,D];return Rp.set(k,N),Reflect.ownKeys(c).forEach(W=>{const Y=Object.getOwnPropertyDescriptor(c,W);"value"in Y&&(k[W]=c[W],delete Y.value,delete Y.writable),Object.defineProperty(B,W,Y)}),k})=>[f,Rp,S9,t,e,r,n,i,s,a,o],[gut]=mut();function zi(t={}){return gut(t)}function ha(t,e,r){const n=Rp.get(t);(dR?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let i;const s=[],a=n[3];let o=!1;const c=a(d=>{s.push(d),i||(i=Promise.resolve().then(()=>{i=void 0,o&&e(s.splice(0))}))});return o=!0,()=>{o=!1,c()}}function Mye(t,e){const r=Rp.get(t);(dR?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");const[n,i,s]=r;return s(n,i(),e)}function Yf(t){return S9.add(t),t}function ho(t,e,r,n){let i=t[e];return ha(t,()=>{const s=t[e];Object.is(i,s)||r(i=s)})}function but(t){const e=zi({data:Array.from([]),has(r){return this.data.some(n=>n[0]===r)},set(r,n){const i=this.data.find(s=>s[0]===r);return i?i[1]=n:this.data.push([r,n]),this},get(r){var n;return(n=this.data.find(i=>i[0]===r))==null?void 0:n[1]},delete(r){const n=this.data.findIndex(i=>i[0]===r);return n===-1?!1:(this.data.splice(n,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(r){this.data.forEach(n=>{r(n[1],n[0],this)})},keys(){return this.data.map(r=>r[0]).values()},values(){return this.data.map(r=>r[1]).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(e,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(e),e}const HF="https://secure.walletconnect.org",kye=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["evm"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["evm","solana"]}],yut="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",S0={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,ONE_SEC_MS:1e3,SECURE_SITE:HF,SECURE_SITE_DASHBOARD:`${HF}/dashboard`,SECURE_SITE_FAVICON:`${HF}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NATIVE_TOKEN_ADDRESS:{evm:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111"},CONVERT_SLIPPAGE_TOLERANCE:1},Ot={isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(t,e=""){return t==null?void 0:t.id.toLocaleLowerCase().includes(e.toLowerCase())},isAndroid(){const t=window.navigator.userAgent.toLowerCase();return Ot.isMobile()&&t.includes("android")},isIos(){const t=window.navigator.userAgent.toLowerCase();return Ot.isMobile()&&(t.includes("iphone")||t.includes("ipad"))},isClient(){return typeof window<"u"},isPairingExpired(t){return t?t-Date.now()<=S0.TEN_SEC_MS:!0},isAllowedRetry(t){return Date.now()-t>=S0.ONE_SEC_MS},copyToClopboard(t){navigator.clipboard.writeText(t)},getPairingExpiry(){return Date.now()+S0.FOUR_MINUTES_MS},getNetworkId(t){return t==null?void 0:t.split(":")[1]},getPlainAddress(t){return t==null?void 0:t.split(":")[2]},async wait(t){return new Promise(e=>{setTimeout(e,t)})},debounce(t,e=500){let r;return(...n)=>{function i(){t(...n)}r&&clearTimeout(r),r=setTimeout(i,e)}},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},formatNativeUrl(t,e){if(Ot.isHttpUrl(t))return this.formatUniversalUrl(t,e);let r=t;r.includes("://")||(r=t.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,href:r}},formatUniversalUrl(t,e){if(!Ot.isHttpUrl(t))return this.formatNativeUrl(t,e);let r=t;r.endsWith("/")||(r=`${r}/`);const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,href:r}},openHref(t,e,r){window.open(t,e,r||"noreferrer noopener")},returnOpenHref(t,e,r){return window.open(t,e,r||"noreferrer noopener")},async preloadImage(t){const e=new Promise((r,n)=>{const i=new Image;i.onload=r,i.onerror=n,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,Ot.wait(2e3)])},formatBalance(t,e){let r="0.000";if(typeof t=="string"){const n=Number(t);if(n){const i=Math.floor(n*1e3)/1e3;i&&(r=i.toString())}}return`${r}${e?` ${e}`:""}`},formatBalance2(t,e){var n;let r;if(t==="0")r="0";else if(typeof t=="string"){const i=Number(t);i&&(r=(n=i.toString().match(/^-?\d+(?:\.\d{0,3})?/u))==null?void 0:n[0])}return{value:r??"0",rest:r==="0"?"000":"",symbol:e}},getApiUrl(){return zn.W3M_API_URL},getBlockchainApiUrl(){return zn.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return zn.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})},parseError(t){var e,r;return typeof t=="string"?t:typeof((r=(e=t==null?void 0:t.issues)==null?void 0:e[0])==null?void 0:r.message)=="string"?t.issues[0].message:t instanceof Error?t.message:"Unknown error"},sortRequestedNetworks(t,e=[]){const r={};return e&&t&&(t.forEach((n,i)=>{r[n]=i}),e.sort((n,i)=>{const s=r[n.id],a=r[i.id];return s!==void 0&&a!==void 0?s-a:s!==void 0?-1:a!==void 0?1:0})),e},calculateBalance(t){let e=0;for(const r of t)e+=r.value??0;return e},formatTokenBalance(t){const e=t.toFixed(2),[r,n]=e.split(".");return{dollars:r,pennies:n}},isAddress(t,e="evm"){switch(e){case"evm":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)||/^(?:0x)?[0-9A-F]{40}$/iu.test(t))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(t);default:return!1}},uniqueBy(t,e){const r=new Set;return t.filter(n=>{const i=n[e];return r.has(i)?!1:(r.add(i),!0)})}};async function Yv(...t){const e=await fetch(...t);if(!e.ok)throw new Error(`HTTP status code: ${e.status}`,{cause:e});return e}class pP{constructor({baseUrl:e,clientId:r}){this.baseUrl=e,this.clientId=r}async get({headers:e,signal:r,cache:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"GET",headers:e,signal:r,cache:n})).json()}async getBlob({headers:e,signal:r,...n}){const i=this.createUrl(n);return(await Yv(i,{method:"GET",headers:e,signal:r})).blob()}async post({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"POST",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async put({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"PUT",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async delete({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"DELETE",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}createUrl({path:e,params:r}){const n=new URL(e,this.baseUrl);return r&&Object.entries(r).forEach(([i,s])=>{s&&n.searchParams.append(i,s)}),this.clientId&&n.searchParams.append("clientId",this.clientId),n}}const VF="WALLETCONNECT_DEEPLINK_CHOICE",jce="@w3m/recent",zce="@w3m/connected_connector",qce="@w3m/connected_social",wut="@w3m-storage/SOCIAL_USERNAME",En={setWalletConnectDeepLink({href:t,name:e}){try{localStorage.setItem(VF,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const t=localStorage.getItem(VF);if(t)return JSON.parse(t)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{localStorage.removeItem(VF)}catch{console.info("Unable to delete WalletConnect deep link")}},setWeb3ModalRecent(t){try{const e=En.getRecentWallets();e.find(n=>n.id===t.id)||(e.unshift(t),e.length>2&&e.pop(),localStorage.setItem(jce,JSON.stringify(e)))}catch{console.info("Unable to set Web3Modal recent")}},getRecentWallets(){try{const t=localStorage.getItem(jce);return t?JSON.parse(t):[]}catch{console.info("Unable to get Web3Modal recent")}return[]},setConnectedConnector(t){try{localStorage.setItem(zce,t)}catch{console.info("Unable to set Connected Connector")}},getConnectedConnector(){try{return localStorage.getItem(zce)}catch{console.info("Unable to get Connected Connector")}},setConnectedSocialProvider(t){try{localStorage.setItem(qce,t)}catch{console.info("Unable to set Connected Social Provider")}},getConnectedSocialProvider(){try{return localStorage.getItem(qce)}catch{console.info("Unable to get Connected Social Provider")}},getConnectedSocialUsername(){try{return localStorage.getItem(wut)}catch{console.info("Unable to get Connected Social Username")}}},Sf=zi({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),Ri={state:Sf,subscribeNetworkImages(t){return ha(Sf.networkImages,()=>t(Sf.networkImages))},subscribeKey(t,e){return ho(Sf,t,e)},subscribe(t){return ha(Sf,()=>t(Sf))},setWalletImage(t,e){Sf.walletImages[t]=e},setNetworkImage(t,e){Sf.networkImages[t]=e},setChainImage(t,e){Sf.chainImages[t]=e},setConnectorImage(t,e){Sf.connectorImages[t]=e},setTokenImage(t,e){Sf.tokenImages[t]=e},setCurrencyImage(t,e){Sf.currencyImages[t]=e}},ld=zi({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),Ui={state:ld,subscribe(t){return ha(ld,()=>t(ld))},setThemeMode(t){ld.themeMode=t;try{const e=Zt.getAuthConnector();if(e){const r=Ui.getSnapshot().themeVariables;e.provider.syncTheme({themeMode:t,themeVariables:r,w3mThemeVariables:w6(r,t)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(t){ld.themeVariables={...ld.themeVariables,...t};try{const e=Zt.getAuthConnector();if(e){const r=Ui.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:r,w3mThemeVariables:w6(ld.themeVariables,ld.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return Mye(ld)}},sl=zi({unMergedConnectors:[],connectors:[]}),Zt={state:sl,subscribeKey(t,e){return ho(sl,t,e)},setConnectors(t){t.forEach(this.syncIfAuthConnector),sl.unMergedConnectors=[...sl.unMergedConnectors,...t],sl.connectors=this.mergeMultiChainConnectors(sl.unMergedConnectors)},mergeMultiChainConnectors(t){const e=this.generateConnectorMapByName(t);return Array.from(e.values()).map(n=>{var i,s,a;return n.length>1?{name:(i=n[0])==null?void 0:i.name,imageUrl:(s=n[0])==null?void 0:s.imageUrl,imageId:(a=n[0])==null?void 0:a.imageId,providers:this.getUniqueConnectorsByName(n),type:"MULTI_CHAIN"}:n[0]})},generateConnectorMapByName(t){const e=new Map;return t.forEach(r=>{const{name:n}=r;if(!n)return;const i=e.get(n)||[];i.find(a=>a.chain===r.chain)||i.push(r),e.set(n,i)}),e},getUniqueConnectorsByName(t){const e=[];return t.forEach(r=>{e.find(n=>n.chain===r.chain)||e.push({...r,name:zn.CHAIN_NAME_MAP[r.chain]})}),e},addConnector(t){this.setConnectors([t])},getAuthConnector(){return sl.connectors.find(t=>t.type==="AUTH")},getAnnouncedConnectorRdns(){return sl.connectors.filter(t=>t.type==="ANNOUNCED").map(t=>{var e;return(e=t.info)==null?void 0:e.rdns})},getConnectors(){return sl.connectors},getConnector(t,e){return sl.connectors.find(r=>{var n;return r.explorerId===t||((n=r.info)==null?void 0:n.rdns)===e})},syncIfAuthConnector(t){var s,a;if(t.id!=="w3mAuth")return;const e=t,r=Mye(zt.state),n=Ui.getSnapshot().themeMode,i=Ui.getSnapshot().themeVariables;(a=(s=e==null?void 0:e.provider)==null?void 0:s.syncDappData)==null||a.call(s,{metadata:r.metadata,sdkVersion:r.sdkVersion,projectId:r.projectId}),e.provider.syncTheme({themeMode:n,themeVariables:i,w3mThemeVariables:w6(i,n)})}},vut=Ot.getAnalyticsUrl(),xut=new pP({baseUrl:vut,clientId:null}),Aut=["MODAL_CREATED"],wb=zi({timestamp:Date.now(),data:{type:"track",event:"MODAL_CREATED"}}),Ht={state:wb,subscribe(t){return ha(wb,()=>t(wb))},_getApiHeaders(){const{projectId:t,sdkType:e,sdkVersion:r}=zt.state;return{"x-project-id":t,"x-sdk-type":e,"x-sdk-version":r}},async _sendAnalyticsEvent(t){try{if(Aut.includes(t.data.event)||typeof window>"u")return;await xut.post({path:"/e",headers:Ht._getApiHeaders(),body:{eventId:Ot.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:t.timestamp,props:t.data}})}catch{}},sendEvent(t){wb.timestamp=Date.now(),wb.data=t,zt.state.enableAnalytics&&Ht._sendAnalyticsEvent(wb)}},Jv=zi({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0}),c1={state:Jv,subscribe(t){return ha(Jv,()=>t(Jv))},set(t){Object.assign(Jv,{...Jv,...t})}},_ut={isConnected:!1,currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]},Eut={supportsAllNetworks:!0,isDefaultCaipNetwork:!1,smartAccountEnabledNetworks:[]},pn=zi({chains:but(),activeChain:void 0,activeCaipNetwork:void 0}),It={state:pn,subscribeKey(t,e){return ho(pn,t,e)},subscribeChain(t){let e;return ha(pn.chains,()=>{const r=pn.activeChain;if(r){const n=pn.chains.get(r);(!e||e!==n)&&(e=n,t(n))}})},subscribeChainProp(t,e){let r;return ha(pn.chains,()=>{var i;const n=pn.activeChain;if(n){const s=(i=pn.chains.get(n))==null?void 0:i[t];r!==s&&(r=s,e(s))}})},initialize(t){const e=t==null?void 0:t[0];if(!e)throw new Error("Adapter is required to initialize ChainController");pn.activeChain=e.chain,c1.set({activeChain:e.chain}),this.setActiveCaipNetwork(e.defaultChain),t.forEach(r=>{pn.chains.set(r.chain,{chain:r.chain,connectionControllerClient:r.connectionControllerClient,networkControllerClient:r.networkControllerClient,accountState:_ut,networkState:Eut})})},setChainNetworkData(t,e,r=!1){if(!t)throw new Error("Chain is required to update chain network data");const n=pn.chains.get(t);n&&(n.networkState=Yf({...n.networkState,...e}),pn.chains.set(t,Yf(n)),(r||pn.chains.size===1||pn.activeChain===t)&&Ct.replaceState(n.networkState))},setChainAccountData(t,e,r=!0){if(!t)throw new Error("Chain is required to update chain account data");const n=pn.chains.get(t);n&&(n.accountState=Yf({...n.accountState,...e}),pn.chains.set(t,n),(r||pn.chains.size===1||pn.activeChain===t)&&Je.replaceState(n.accountState))},setAccountProp(t,e,r){this.setChainAccountData(r,{[t]:e})},setActiveChain(t){var r,n,i,s,a;const e=t?pn.chains.get(t):void 0;e&&e.chain!==pn.activeChain&&(pn.activeChain=e.chain,pn.activeCaipNetwork=(r=e.networkState)!=null&&r.caipNetwork?Yf((n=e.networkState)==null?void 0:n.caipNetwork):void 0,Je.replaceState(e.accountState),Ct.replaceState(e.networkState),this.setCaipNetwork(e.chain,(i=e.networkState)==null?void 0:i.caipNetwork),c1.set({activeChain:t,selectedNetworkId:(a=(s=e.networkState)==null?void 0:s.caipNetwork)==null?void 0:a.id}))},setActiveCaipNetwork(t){t&&(t.chain!==pn.activeChain&&this.setActiveChain(t.chain),pn.activeCaipNetwork=Yf(t),pn.activeChain=t.chain,this.setCaipNetwork(t.chain,t,!0),c1.set({activeChain:t.chain,selectedNetworkId:t==null?void 0:t.id}))},setCaipNetwork(t,e,r=!1){this.setChainNetworkData(t,{caipNetwork:e},r)},setActiveConnector(t){t&&(pn.activeConnector=Yf(t))},getNetworkControllerClient(){const t=pn.activeChain;if(!t)throw new Error("Chain is required to get network controller client");const e=pn.chains.get(t);if(!e)throw new Error("Chain adapter not found");if(!e.networkControllerClient)throw new Error("NetworkController client not set");return e.networkControllerClient},getConnectionControllerClient(t){const e=t||pn.activeChain;if(!e)throw new Error("Chain is required to get connection controller client");const r=pn.chains.get(e);if(!r)throw new Error("Chain adapter not found");if(!r.connectionControllerClient)throw new Error("ConnectionController client not set");return r.connectionControllerClient},getAccountProp(t,e){var i;let r=pn.activeChain;if(e&&(r=e),!r)return;const n=(i=pn.chains.get(r))==null?void 0:i.accountState;if(n)return n[t]},getNetworkProp(t){var n;const e=pn.activeChain;if(!e)return;const r=(n=pn.chains.get(e))==null?void 0:n.networkState;if(r)return r[t]},resetAccount(t){const e=t;if(!e)throw new Error("Chain is required to set account prop");this.setChainAccountData(e,Yf({isConnected:!1,smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0}))}},WF=zi({supportsAllNetworks:!0,isDefaultCaipNetwork:!1,smartAccountEnabledNetworks:[]}),Ct={state:WF,replaceState(t){t&&Object.assign(WF,Yf(t))},subscribeKey(t,e){let r;return It.subscribeChainProp("networkState",n=>{if(n){const i=n[t];r!==i&&(r=i,e(i))}})},_getClient(){return It.getNetworkControllerClient()},initializeDefaultNetwork(){const t=this.getRequestedCaipNetworks();t.length>0&&this.setCaipNetwork(t[0])},setDefaultCaipNetwork(t){t&&(It.setCaipNetwork(t.chain,t,!0),It.setChainNetworkData(t.chain,{isDefaultCaipNetwork:!0}),c1.set({selectedNetworkId:t.id}))},setActiveCaipNetwork(t){var e,r;t&&(It.setActiveCaipNetwork(t),It.setChainNetworkData(t.chain,{caipNetwork:t}),c1.set({activeChain:t.chain,selectedNetworkId:t==null?void 0:t.id}),(r=(e=It.state.chains.get(t.chain))==null?void 0:e.networkState)!=null&&r.allowUnsupportedChain||this.checkIfSupportedNetwork()||this.showUnsupportedChainUI())},setCaipNetwork(t){var e,r;if(t){if(!(t!=null&&t.chain))throw new Error("chain is required to set active network");It.setCaipNetwork(t==null?void 0:t.chain,t),(r=(e=It.state.chains.get(t.chain))==null?void 0:e.networkState)!=null&&r.allowUnsupportedChain||this.checkIfSupportedNetwork()||this.showUnsupportedChainUI()}},setRequestedCaipNetworks(t,e){It.setChainNetworkData(e,{requestedCaipNetworks:t})},setAllowUnsupportedChain(t,e){It.setChainNetworkData(e||It.state.activeChain,{allowUnsupportedChain:t})},setSmartAccountEnabledNetworks(t,e){It.setChainNetworkData(e,{smartAccountEnabledNetworks:t})},getRequestedCaipNetworks(t){let e;if(!It.state.activeChain)throw new Error("activeChain is required to get requested networks");if(t){const s=t;if(!s)throw new Error("chain is required to get requested networks");e=[s]}else e=[...It.state.chains.keys()];const r=[],n=[];return e.forEach(s=>{var a,o,f,c,d,p,g,x;(o=(a=It.state.chains.get(s))==null?void 0:a.networkState)!=null&&o.approvedCaipNetworkIds&&r.push(...((c=(f=It.state.chains.get(s))==null?void 0:f.networkState)==null?void 0:c.approvedCaipNetworkIds)||[]),(p=(d=It.state.chains.get(s))==null?void 0:d.networkState)!=null&&p.requestedCaipNetworks&&n.push(...((x=(g=It.state.chains.get(s))==null?void 0:g.networkState)==null?void 0:x.requestedCaipNetworks)||[])}),Ot.sortRequestedNetworks(r,n)},async switchActiveNetwork(t){var r;const e=t?(r=It.state.chains.get(t.chain))==null?void 0:r.networkControllerClient:void 0;if(!e)throw new Error("networkControllerClient not found for given network object");It.setActiveCaipNetwork(t),await(e==null?void 0:e.switchCaipNetwork(t)),t&&Ht.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:t.id}})},getApprovedCaipNetworkIds(t){var r,n;if(t){const i=t;if(!i)throw new Error("chain is required to get approved network IDs");return(n=(r=It.state.chains.get(i))==null?void 0:r.networkState)==null?void 0:n.approvedCaipNetworkIds}const e=[];return Object.values(It.state.chains).forEach(i=>{var s;i.networkState.approvedCaipNetworkIds&&e.push(...((s=i.networkState)==null?void 0:s.approvedCaipNetworkIds)||[])}),e},async setApprovedCaipNetworksData(t){const r=await It.getNetworkControllerClient().getApprovedCaipNetworksData();if(!t)throw new Error("chain is required to set approved network data");It.setChainNetworkData(t,{approvedCaipNetworkIds:r==null?void 0:r.approvedCaipNetworkIds,supportsAllNetworks:(r==null?void 0:r.supportsAllNetworks)||!1})},checkIfSupportedNetwork(){var n,i;const t=It.state.activeChain;if(!t)return!1;const e=(i=(n=It.state.chains.get(t))==null?void 0:n.networkState)==null?void 0:i.caipNetwork,r=this.getRequestedCaipNetworks();return r.length?r==null?void 0:r.some(s=>s.id===(e==null?void 0:e.id)):!0},checkIfSmartAccountEnabled(){var n;const t=vl.caipNetworkIdToNumber((n=WF.caipNetwork)==null?void 0:n.id);if(!It.state.activeChain)throw new Error("activeChain is required to check if smart account is enabled");if(!t)return!1;const r=It.getNetworkProp("smartAccountEnabledNetworks");return!!(r!=null&&r.includes(t))},resetNetwork(){const t=It.state.activeChain;if(!t)throw new Error("chain is required to reset network");It.setChainNetworkData(t,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},getSupportsAllNetworks(){var e,r;const t=It.state.activeChain;if(!t)throw new Error("chain is required to check if network supports all networks");return(r=(e=It.state.chains.get(t))==null?void 0:e.networkState)==null?void 0:r.supportsAllNetworks},showUnsupportedChainUI(){setTimeout(()=>{gr.open({view:"UnsupportedChain"})},300)},getActiveNetworkTokenAddress(){var e,r;const t=S0.NATIVE_TOKEN_ADDRESS[((e=this.state.caipNetwork)==null?void 0:e.chain)||"evm"];return`${((r=this.state.caipNetwork)==null?void 0:r.id)||"eip155:1"}:${t}`}},Cut=Ot.getApiUrl(),Cs=new pP({baseUrl:Cut,clientId:null}),Sut="40",Hce="4",Tut=20,$0=zi({page:1,count:0,featured:[],recommended:[],wallets:[],search:[],isAnalyticsEnabled:!1,excludedRDNS:[]}),cr={state:$0,subscribeKey(t,e){return ho($0,t,e)},_getApiHeaders(){const{projectId:t,sdkType:e,sdkVersion:r}=zt.state;return{"x-project-id":t,"x-sdk-type":e,"x-sdk-version":r}},_filterOutExtensions(t){return zt.state.isUniversalProvider?t.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):t},async _fetchWalletImage(t){const e=`${Cs.baseUrl}/getWalletImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setWalletImage(t,URL.createObjectURL(r))},async _fetchNetworkImage(t){const e=`${Cs.baseUrl}/public/getAssetImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setNetworkImage(t,URL.createObjectURL(r))},async _fetchConnectorImage(t){const e=`${Cs.baseUrl}/public/getAssetImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setConnectorImage(t,URL.createObjectURL(r))},async _fetchCurrencyImage(t){const e=`${Cs.baseUrl}/public/getCurrencyImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setCurrencyImage(t,URL.createObjectURL(r))},async _fetchTokenImage(t){const e=`${Cs.baseUrl}/public/getTokenImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setTokenImage(t,URL.createObjectURL(r))},async fetchNetworkImages(){const t=Ct.getRequestedCaipNetworks(),e=t==null?void 0:t.map(({imageId:r})=>r).filter(Boolean);e&&await Promise.allSettled(e.map(r=>cr._fetchNetworkImage(r)))},async fetchConnectorImages(){const{connectors:t}=Zt.state,e=t.map(({imageId:r})=>r).filter(Boolean);await Promise.allSettled(e.map(r=>cr._fetchConnectorImage(r)))},async fetchCurrencyImages(t=[]){await Promise.allSettled(t.map(e=>cr._fetchCurrencyImage(e)))},async fetchTokenImages(t=[]){await Promise.allSettled(t.map(e=>cr._fetchTokenImage(e)))},async fetchFeaturedWallets(){const{featuredWalletIds:t}=zt.state;if(t!=null&&t.length){const{data:e}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",entries:t!=null&&t.length?String(t.length):Hce,include:t==null?void 0:t.join(",")}});e.sort((n,i)=>t.indexOf(n.id)-t.indexOf(i.id));const r=e.map(n=>n.image_id).filter(Boolean);await Promise.allSettled(r.map(n=>cr._fetchWalletImage(n))),$0.featured=e}},async fetchRecommendedWallets(){var c;const{includeWalletIds:t,excludeWalletIds:e,featuredWalletIds:r}=zt.state,n=[...e??[],...r??[]].filter(Boolean),{data:i,count:s}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",chains:(c=Ct.state.caipNetwork)==null?void 0:c.id,entries:Hce,include:t==null?void 0:t.join(","),exclude:n==null?void 0:n.join(",")}}),a=En.getRecentWallets(),o=i.map(d=>d.image_id).filter(Boolean),f=a.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...o,...f].map(d=>cr._fetchWalletImage(d))),$0.recommended=i,$0.count=s??0},async fetchWallets({page:t}){var f;const{includeWalletIds:e,excludeWalletIds:r,featuredWalletIds:n}=zt.state,i=[...$0.recommended.map(({id:c})=>c),...r??[],...n??[]].filter(Boolean),{data:s,count:a}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:String(t),entries:Sut,chains:(f=Ct.state.caipNetwork)==null?void 0:f.id,include:e==null?void 0:e.join(","),exclude:i.join(",")}}),o=s.slice(0,Tut).map(c=>c.image_id).filter(Boolean);await Promise.allSettled(o.map(c=>cr._fetchWalletImage(c))),$0.wallets=Ot.uniqueBy([...$0.wallets,...cr._filterOutExtensions(s)],"id"),$0.count=a>$0.count?a:$0.count,$0.page=t},async searchWalletByIds({ids:t}){var r;const{data:e}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",entries:String(t.length),chains:(r=Ct.state.caipNetwork)==null?void 0:r.id,include:t==null?void 0:t.join(",")}});e&&e.forEach(n=>{n!=null&&n.rdns&&$0.excludedRDNS.push(n.rdns)})},async searchWallet({search:t}){var s;const{includeWalletIds:e,excludeWalletIds:r}=zt.state;$0.search=[];const{data:n}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",entries:"100",search:t==null?void 0:t.trim(),chains:(s=Ct.state.caipNetwork)==null?void 0:s.id,include:e==null?void 0:e.join(","),exclude:r==null?void 0:r.join(",")}}),i=n.map(a=>a.image_id).filter(Boolean);await Promise.allSettled([...i.map(a=>cr._fetchWalletImage(a)),Ot.wait(300)]),$0.search=cr._filterOutExtensions(n)},async reFetchWallets(){$0.page=1,$0.wallets=[],await cr.fetchFeaturedWallets(),await cr.fetchRecommendedWallets()},prefetch(){const t=[cr.fetchFeaturedWallets(),cr.fetchRecommendedWallets(),cr.fetchNetworkImages(),cr.fetchConnectorImages()];zt.state.enableAnalytics===void 0&&t.push(cr.fetchAnalyticsConfig()),$0.prefetchPromise=Promise.race([Promise.allSettled(t)])},async fetchAnalyticsConfig(){const{isAnalyticsEnabled:t}=await Cs.get({path:"/getAnalyticsConfig",headers:cr._getApiHeaders()});zt.setEnableAnalytics(t)}},Oi=zi({projectId:"",sdkType:"w3m",sdkVersion:"html-wagmi-undefined"}),zt={state:Oi,subscribeKey(t,e){return ho(Oi,t,e)},setOptions(t){Object.assign(Oi,t)},setProjectId(t){Oi.projectId=t},setAllWallets(t){Oi.allWallets=t},setIncludeWalletIds(t){Oi.includeWalletIds=t},setExcludeWalletIds(t){Oi.excludeWalletIds=t,t&&cr.searchWalletByIds({ids:t})},setFeaturedWalletIds(t){Oi.featuredWalletIds=t},setTokens(t){Oi.tokens=t},setTermsConditionsUrl(t){Oi.termsConditionsUrl=t},setPrivacyPolicyUrl(t){Oi.privacyPolicyUrl=t},setCustomWallets(t){Oi.customWallets=t},setIsSiweEnabled(t){Oi.isSiweEnabled=t},setIsUniversalProvider(t){Oi.isUniversalProvider=t},setEnableAnalytics(t){Oi.enableAnalytics=t},setSdkVersion(t){Oi.sdkVersion=t},setMetadata(t){Oi.metadata=t},setOnrampEnabled(t){Oi.enableOnramp=t},setDisableAppend(t){Oi.disableAppend=t},setEIP6963Enabled(t){Oi.enableEIP6963=t},setHasMultipleAddresses(t){Oi.hasMultipleAddresses=t},setEnableSwaps(t){Oi.enableSwaps=t}},Iut={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},Pye=Ot.getBlockchainApiUrl(),s0=zi({clientId:null,api:new pP({baseUrl:Pye,clientId:null})}),gi={state:s0,fetchIdentity({address:t}){return s0.api.get({path:`/v1/identity/${t}`,params:{projectId:zt.state.projectId,sender:Je.state.address}})},fetchTransactions({account:t,projectId:e,cursor:r,onramp:n,signal:i,cache:s,chainId:a}){return s0.api.get({path:`/v1/account/${t}/history`,params:{projectId:e,cursor:r,onramp:n,chainId:a},signal:i,cache:s})},fetchSwapQuote({projectId:t,amount:e,userAddress:r,from:n,to:i,gasPrice:s}){return s0.api.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{projectId:t,amount:e,userAddress:r,from:n,to:i,gasPrice:s}})},fetchSwapTokens({projectId:t,chainId:e}){return s0.api.get({path:"/v1/convert/tokens",params:{projectId:t,chainId:e}})},fetchTokenPrice({projectId:t,addresses:e}){return s0.api.post({path:"/v1/fungible/price",body:{projectId:t,currency:"usd",addresses:e},headers:{"Content-Type":"application/json"}})},fetchSwapAllowance({projectId:t,tokenAddress:e,userAddress:r}){const{sdkType:n,sdkVersion:i}=zt.state;return s0.api.get({path:"/v1/convert/allowance",params:{projectId:t,tokenAddress:e,userAddress:r},headers:{"Content-Type":"application/json","x-sdk-type":n,"x-sdk-version":i}})},fetchGasPrice({projectId:t,chainId:e}){const{sdkType:r,sdkVersion:n}=zt.state;return s0.api.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json","x-sdk-type":r,"x-sdk-version":n},params:{projectId:t,chainId:e}})},generateSwapCalldata({amount:t,from:e,projectId:r,to:n,userAddress:i}){return s0.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:t,eip155:{slippage:S0.CONVERT_SLIPPAGE_TOLERANCE},from:e,projectId:r,to:n,userAddress:i}})},generateApproveCalldata({from:t,projectId:e,to:r,userAddress:n}){const{sdkType:i,sdkVersion:s}=zt.state;return s0.api.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json","x-sdk-type":i,"x-sdk-version":s},params:{projectId:e,userAddress:n,from:t,to:r}})},async getBalance(t,e,r){const{sdkType:n,sdkVersion:i}=zt.state;return s0.api.get({path:`/v1/account/${t}/balance`,headers:{"x-sdk-type":n,"x-sdk-version":i},params:{currency:"usd",projectId:zt.state.projectId,chainId:e,forceUpdate:r}})},async lookupEnsName(t){return s0.api.get({path:`/v1/profile/account/${t}${zn.WC_NAME_SUFFIX}`,params:{projectId:zt.state.projectId,apiVersion:"2"}})},async reverseLookupEnsName({address:t}){return s0.api.get({path:`/v1/profile/reverse/${t}`,params:{sender:Je.state.address,projectId:zt.state.projectId,apiVersion:"2"}})},async getEnsNameSuggestions(t){return s0.api.get({path:`/v1/profile/suggestions/${t}`,params:{projectId:zt.state.projectId}})},async registerEnsName({coinType:t,address:e,message:r,signature:n}){return s0.api.post({path:"/v1/profile/account",body:{coin_type:t,address:e,message:r,signature:n},headers:{"Content-Type":"application/json"}})},async generateOnRampURL({destinationWallets:t,partnerUserId:e,defaultNetwork:r,purchaseAmount:n,paymentAmount:i}){return(await s0.api.post({path:"/v1/generators/onrampurl",params:{projectId:zt.state.projectId},body:{destinationWallets:t,defaultNetwork:r,partnerUserId:e,defaultExperience:"buy",presetCryptoAmount:n,presetFiatAmount:i}})).url},async getOnrampOptions(){try{return await s0.api.get({path:"/v1/onramp/options",params:{projectId:zt.state.projectId}})}catch{return Iut}},async getOnrampQuote({purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}){try{return await s0.api.post({path:"/v1/onramp/quote",params:{projectId:zt.state.projectId},body:{purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}})}catch{return{coinbaseFee:{amount:r,currency:e.id},networkFee:{amount:r,currency:e.id},paymentSubtotal:{amount:r,currency:e.id},paymentTotal:{amount:r,currency:e.id},purchaseAmount:{amount:r,currency:e.id},quoteId:"mocked-quote-id"}}},setClientId(t){s0.clientId=t,s0.api=new pP({baseUrl:Pye,clientId:t})}},Tf=zi({message:"",variant:"success",open:!1}),nr={state:Tf,subscribeKey(t,e){return ho(Tf,t,e)},showLoading(t){Tf.message=t,Tf.variant="loading",Tf.open=!0},showSuccess(t){Tf.message=t,Tf.variant="success",Tf.open=!0},showError(t){const e=Ot.parseError(t);Tf.message=e,Tf.variant="error",Tf.open=!0},hide(){Tf.open=!1}};var Nye={};const Rut=Nye.NEXT_PUBLIC_SECURE_SITE_SDK_URL||"https://secure.walletconnect.org/sdk",Mut=Nye.NEXT_PUBLIC_DEFAULT_LOG_LEVEL||"error",lr={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@w3m-storage/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",SOCIAL:"@w3m/connected_social",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",FRAME_SWITCH_NETWORK_ERROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},Lr={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}};var _n;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const s={};for(const a of i)s[a]=a;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of s)a[o]=i[o];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(const a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(_n||(_n={}));var IH;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(IH||(IH={}));const Kt=_n.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lp=t=>{switch(typeof t){case"undefined":return Kt.undefined;case"string":return Kt.string;case"number":return isNaN(t)?Kt.nan:Kt.number;case"boolean":return Kt.boolean;case"function":return Kt.function;case"bigint":return Kt.bigint;case"symbol":return Kt.symbol;case"object":return Array.isArray(t)?Kt.array:t===null?Kt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Kt.promise:typeof Map<"u"&&t instanceof Map?Kt.map:typeof Set<"u"&&t instanceof Set?Kt.set:typeof Date<"u"&&t instanceof Date?Kt.date:Kt.object;default:return Kt.unknown}},Dt=_n.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),kut=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class xu extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(s){return s.message},n={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let o=n,f=0;for(;fr.message){const r={},n=[];for(const i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}xu.create=t=>new xu(t);const Ex=(t,e)=>{let r;switch(t.code){case Dt.invalid_type:t.received===Kt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Dt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,_n.jsonStringifyReplacer)}`;break;case Dt.unrecognized_keys:r=`Unrecognized key(s) in object: ${_n.joinValues(t.keys,", ")}`;break;case Dt.invalid_union:r="Invalid input";break;case Dt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${_n.joinValues(t.options)}`;break;case Dt.invalid_enum_value:r=`Invalid enum value. Expected ${_n.joinValues(t.options)}, received '${t.received}'`;break;case Dt.invalid_arguments:r="Invalid function arguments";break;case Dt.invalid_return_type:r="Invalid function return type";break;case Dt.invalid_date:r="Invalid date";break;case Dt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:_n.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Dt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Dt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Dt.custom:r="Invalid input";break;case Dt.invalid_intersection_types:r="Intersection results could not be merged";break;case Dt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Dt.not_finite:r="Number must be finite";break;default:r=e.defaultError,_n.assertNever(t)}return{message:r}};let Oye=Ex;function Put(t){Oye=t}function hR(){return Oye}const pR=t=>{const{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],a={...i,path:s};let o="";const f=n.filter(c=>!!c).slice().reverse();for(const c of f)o=c(a,{data:e,defaultError:o}).message;return{...i,path:s,message:i.message||o}},Nut=[];function Xt(t,e){const r=pR({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hR(),Ex].filter(n=>!!n)});t.common.issues.push(r)}class zs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const i of r){if(i.status==="aborted")return Ir;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const i of r)n.push({key:await i.key,value:await i.value});return zs.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const i of r){const{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return Ir;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}}const Ir=Object.freeze({status:"aborted"}),Dye=t=>({status:"dirty",value:t}),pa=t=>({status:"valid",value:t}),RH=t=>t.status==="aborted",MH=t=>t.status==="dirty",Cx=t=>t.status==="valid",mR=t=>typeof Promise<"u"&&t instanceof Promise;var dr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(dr||(dr={}));class w1{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Vce=(t,e)=>{if(Cx(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new xu(t.common.issues);return this._error=r,this._error}}};function Fr(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:r??o.defaultError},description:i}}class Vr{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Lp(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Lp(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new zs,ctx:{common:e.parent.common,data:e.data,parsedType:Lp(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(mR(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;const i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lp(e)},s=this._parseSync({data:e,path:i.path,parent:i});return Vce(i,s)}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lp(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(mR(i)?i:Promise.resolve(i));return Vce(n,s)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{const a=e(i),o=()=>s.addIssue({code:Dt.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(f=>f?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Mu({schema:this,typeName:xr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ch.create(this,this._def)}nullable(){return qm.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Au.create(this,this._def)}promise(){return My.create(this,this._def)}or(e){return Rx.create([this,e],this._def)}and(e){return Mx.create(this,e,this._def)}transform(e){return new Mu({...Fr(this._def),schema:this,typeName:xr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Dx({...Fr(this._def),innerType:this,defaultValue:r,typeName:xr.ZodDefault})}brand(){return new Bye({typeName:xr.ZodBranded,type:this,...Fr(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new wR({...Fr(this._def),innerType:this,catchValue:r,typeName:xr.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return O_.create(this,e)}readonly(){return xR.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Out=/^c[^\s-]{8,}$/i,Dut=/^[a-z][a-z0-9]*$/,$ut=/^[0-9A-HJKMNP-TV-Z]{26}$/,But=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Uut=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Lut="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let GF;const Fut=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,jut=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,zut=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function qut(t,e){return!!((e==="v4"||!e)&&Fut.test(t)||(e==="v6"||!e)&&jut.test(t))}class yu extends Vr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Kt.string){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.string,received:s.parsedType}),Ir}const n=new zs;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),Xt(i,{code:Dt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,o=e.data.lengthe.test(i),{validation:r,code:Dt.invalid_string,...dr.errToObj(n)})}_addCheck(e){return new yu({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...dr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...dr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...dr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...dr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...dr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...dr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...dr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...dr.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...dr.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...dr.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...dr.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...dr.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...dr.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...dr.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...dr.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...dr.errToObj(r)})}nonempty(e){return this.min(1,dr.errToObj(e))}trim(){return new yu({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yu({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yu({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new yu({checks:[],typeName:xr.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Fr(t)})};function Hut(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}class K6 extends Vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Kt.number){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.number,received:s.parsedType}),Ir}let n;const i=new zs;for(const s of this._def.checks)s.kind==="int"?_n.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Hut(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.not_finite,message:s.message}),i.dirty()):_n.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,dr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,dr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,dr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,dr.toString(r))}setLimit(e,r,n,i){return new K6({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:dr.toString(i)}]})}_addCheck(e){return new K6({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:dr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:dr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:dr.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:dr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:dr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:dr.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&_n.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew K6({checks:[],typeName:xr.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Fr(t)});class Q6 extends Vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Kt.bigint){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.bigint,received:s.parsedType}),Ir}let n;const i=new zs;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):_n.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,dr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,dr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,dr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,dr.toString(r))}setLimit(e,r,n,i){return new Q6({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:dr.toString(i)}]})}_addCheck(e){return new Q6({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:dr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:dr.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Q6({checks:[],typeName:xr.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Fr(t)})};class Sx extends Vr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Kt.boolean){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.boolean,received:n.parsedType}),Ir}return pa(e.data)}}Sx.create=t=>new Sx({typeName:xr.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Fr(t)});class jm extends Vr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Kt.date){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.date,received:s.parsedType}),Ir}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_date}),Ir}const n=new zs;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),Xt(i,{code:Dt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):_n.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jm({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:dr.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:dr.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew jm({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:xr.ZodDate,...Fr(t)});class gR extends Vr{_parse(e){if(this._getType(e)!==Kt.symbol){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.symbol,received:n.parsedType}),Ir}return pa(e.data)}}gR.create=t=>new gR({typeName:xr.ZodSymbol,...Fr(t)});class Tx extends Vr{_parse(e){if(this._getType(e)!==Kt.undefined){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.undefined,received:n.parsedType}),Ir}return pa(e.data)}}Tx.create=t=>new Tx({typeName:xr.ZodUndefined,...Fr(t)});class Ix extends Vr{_parse(e){if(this._getType(e)!==Kt.null){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.null,received:n.parsedType}),Ir}return pa(e.data)}}Ix.create=t=>new Ix({typeName:xr.ZodNull,...Fr(t)});class Ry extends Vr{constructor(){super(...arguments),this._any=!0}_parse(e){return pa(e.data)}}Ry.create=t=>new Ry({typeName:xr.ZodAny,...Fr(t)});class pm extends Vr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pa(e.data)}}pm.create=t=>new pm({typeName:xr.ZodUnknown,...Fr(t)});class Ah extends Vr{_parse(e){const r=this._getOrReturnCtx(e);return Xt(r,{code:Dt.invalid_type,expected:Kt.never,received:r.parsedType}),Ir}}Ah.create=t=>new Ah({typeName:xr.ZodNever,...Fr(t)});class bR extends Vr{_parse(e){if(this._getType(e)!==Kt.undefined){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.void,received:n.parsedType}),Ir}return pa(e.data)}}bR.create=t=>new bR({typeName:xr.ZodVoid,...Fr(t)});class Au extends Vr{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Kt.array)return Xt(r,{code:Dt.invalid_type,expected:Kt.array,received:r.parsedType}),Ir;if(i.exactLength!==null){const a=r.data.length>i.exactLength.value,o=r.data.lengthi.maxLength.value&&(Xt(r,{code:Dt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>i.type._parseAsync(new w1(r,a,r.path,o)))).then(a=>zs.mergeArray(n,a));const s=[...r.data].map((a,o)=>i.type._parseSync(new w1(r,a,r.path,o)));return zs.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Au({...this._def,minLength:{value:e,message:dr.toString(r)}})}max(e,r){return new Au({...this._def,maxLength:{value:e,message:dr.toString(r)}})}length(e,r){return new Au({...this._def,exactLength:{value:e,message:dr.toString(r)}})}nonempty(e){return this.min(1,e)}}Au.create=(t,e)=>new Au({type:t,minLength:null,maxLength:null,exactLength:null,typeName:xr.ZodArray,...Fr(e)});function Pb(t){if(t instanceof Si){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=ch.create(Pb(n))}return new Si({...t._def,shape:()=>e})}else return t instanceof Au?new Au({...t._def,type:Pb(t.element)}):t instanceof ch?ch.create(Pb(t.unwrap())):t instanceof qm?qm.create(Pb(t.unwrap())):t instanceof v1?v1.create(t.items.map(e=>Pb(e))):t}class Si extends Vr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=_n.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Kt.object){const c=this._getOrReturnCtx(e);return Xt(c,{code:Dt.invalid_type,expected:Kt.object,received:c.parsedType}),Ir}const{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ah&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||o.push(c);const f=[];for(const c of a){const d=s[c],p=i.data[c];f.push({key:{status:"valid",value:c},value:d._parse(new w1(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ah){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)f.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(c==="strict")o.length>0&&(Xt(i,{code:Dt.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const p=i.data[d];f.push({key:{status:"valid",value:d},value:c._parse(new w1(i,p,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of f){const p=await d.key;c.push({key:p,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>zs.mergeObjectSync(n,c)):zs.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return dr.errToObj,new Si({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,o;const f=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=dr.errToObj(e).message)!==null&&o!==void 0?o:f}:{message:f}}}:{}})}strip(){return new Si({...this._def,unknownKeys:"strip"})}passthrough(){return new Si({...this._def,unknownKeys:"passthrough"})}extend(e){return new Si({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Si({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:xr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Si({...this._def,catchall:e})}pick(e){const r={};return _n.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Si({...this._def,shape:()=>r})}omit(e){const r={};return _n.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new Si({...this._def,shape:()=>r})}deepPartial(){return Pb(this)}partial(e){const r={};return _n.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new Si({...this._def,shape:()=>r})}required(e){const r={};return _n.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof ch;)s=s._def.innerType;r[n]=s}}),new Si({...this._def,shape:()=>r})}keyof(){return $ye(_n.objectKeys(this.shape))}}Si.create=(t,e)=>new Si({shape:()=>t,unknownKeys:"strip",catchall:Ah.create(),typeName:xr.ZodObject,...Fr(e)});Si.strictCreate=(t,e)=>new Si({shape:()=>t,unknownKeys:"strict",catchall:Ah.create(),typeName:xr.ZodObject,...Fr(e)});Si.lazycreate=(t,e)=>new Si({shape:t,unknownKeys:"strip",catchall:Ah.create(),typeName:xr.ZodObject,...Fr(e)});class Rx extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function i(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(o=>new xu(o.ctx.common.issues));return Xt(r,{code:Dt.invalid_union,unionErrors:a}),Ir}if(r.common.async)return Promise.all(n.map(async s=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const f of n){const c={...r,common:{...r.common,issues:[]},parent:null},d=f._parseSync({data:r.data,path:r.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(f=>new xu(f));return Xt(r,{code:Dt.invalid_union,unionErrors:o}),Ir}}get options(){return this._def.options}}Rx.create=(t,e)=>new Rx({options:t,typeName:xr.ZodUnion,...Fr(e)});const OT=t=>t instanceof Px?OT(t.schema):t instanceof Mu?OT(t.innerType()):t instanceof Nx?[t.value]:t instanceof Z6?t.options:t instanceof Ox?Object.keys(t.enum):t instanceof Dx?OT(t._def.innerType):t instanceof Tx?[void 0]:t instanceof Ix?[null]:null;class mP extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Kt.object)return Xt(r,{code:Dt.invalid_type,expected:Kt.object,received:r.parsedType}),Ir;const n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Xt(r,{code:Dt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ir)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const i=new Map;for(const s of r){const a=OT(s.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new mP({typeName:xr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Fr(n)})}}function kH(t,e){const r=Lp(t),n=Lp(e);if(t===e)return{valid:!0,data:t};if(r===Kt.object&&n===Kt.object){const i=_n.objectKeys(e),s=_n.objectKeys(t).filter(o=>i.indexOf(o)!==-1),a={...t,...e};for(const o of s){const f=kH(t[o],e[o]);if(!f.valid)return{valid:!1};a[o]=f.data}return{valid:!0,data:a}}else if(r===Kt.array&&n===Kt.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s{if(RH(s)||RH(a))return Ir;const o=kH(s.value,a.value);return o.valid?((MH(s)||MH(a))&&r.dirty(),{status:r.value,value:o.data}):(Xt(n,{code:Dt.invalid_intersection_types}),Ir)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Mx.create=(t,e,r)=>new Mx({left:t,right:e,typeName:xr.ZodIntersection,...Fr(r)});class v1 extends Vr{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.array)return Xt(n,{code:Dt.invalid_type,expected:Kt.array,received:n.parsedType}),Ir;if(n.data.lengththis._def.items.length&&(Xt(n,{code:Dt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((a,o)=>{const f=this._def.items[o]||this._def.rest;return f?f._parse(new w1(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>zs.mergeArray(r,a)):zs.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new v1({...this._def,rest:e})}}v1.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new v1({items:t,typeName:xr.ZodTuple,rest:null,...Fr(e)})};class kx extends Vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.object)return Xt(n,{code:Dt.invalid_type,expected:Kt.object,received:n.parsedType}),Ir;const i=[],s=this._def.keyType,a=this._def.valueType;for(const o in n.data)i.push({key:s._parse(new w1(n,o,n.path,o)),value:a._parse(new w1(n,n.data[o],n.path,o))});return n.common.async?zs.mergeObjectAsync(r,i):zs.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Vr?new kx({keyType:e,valueType:r,typeName:xr.ZodRecord,...Fr(n)}):new kx({keyType:yu.create(),valueType:e,typeName:xr.ZodRecord,...Fr(r)})}}class yR extends Vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.map)return Xt(n,{code:Dt.invalid_type,expected:Kt.map,received:n.parsedType}),Ir;const i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([o,f],c)=>({key:i._parse(new w1(n,o,n.path,[c,"key"])),value:s._parse(new w1(n,f,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const f of a){const c=await f.key,d=await f.value;if(c.status==="aborted"||d.status==="aborted")return Ir;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(c.value,d.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const f of a){const c=f.key,d=f.value;if(c.status==="aborted"||d.status==="aborted")return Ir;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(c.value,d.value)}return{status:r.value,value:o}}}}yR.create=(t,e,r)=>new yR({valueType:e,keyType:t,typeName:xr.ZodMap,...Fr(r)});class zm extends Vr{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.set)return Xt(n,{code:Dt.invalid_type,expected:Kt.set,received:n.parsedType}),Ir;const i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(Xt(n,{code:Dt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const s=this._def.valueType;function a(f){const c=new Set;for(const d of f){if(d.status==="aborted")return Ir;d.status==="dirty"&&r.dirty(),c.add(d.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((f,c)=>s._parse(new w1(n,f,n.path,c)));return n.common.async?Promise.all(o).then(f=>a(f)):a(o)}min(e,r){return new zm({...this._def,minSize:{value:e,message:dr.toString(r)}})}max(e,r){return new zm({...this._def,maxSize:{value:e,message:dr.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}zm.create=(t,e)=>new zm({valueType:t,minSize:null,maxSize:null,typeName:xr.ZodSet,...Fr(e)});class M3 extends Vr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Kt.function)return Xt(r,{code:Dt.invalid_type,expected:Kt.function,received:r.parsedType}),Ir;function n(o,f){return pR({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hR(),Ex].filter(c=>!!c),issueData:{code:Dt.invalid_arguments,argumentsError:f}})}function i(o,f){return pR({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hR(),Ex].filter(c=>!!c),issueData:{code:Dt.invalid_return_type,returnTypeError:f}})}const s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof My){const o=this;return pa(async function(...f){const c=new xu([]),d=await o._def.args.parseAsync(f,s).catch(x=>{throw c.addIssue(n(f,x)),c}),p=await Reflect.apply(a,this,d);return await o._def.returns._def.type.parseAsync(p,s).catch(x=>{throw c.addIssue(i(p,x)),c})})}else{const o=this;return pa(function(...f){const c=o._def.args.safeParse(f,s);if(!c.success)throw new xu([n(f,c.error)]);const d=Reflect.apply(a,this,c.data),p=o._def.returns.safeParse(d,s);if(!p.success)throw new xu([i(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new M3({...this._def,args:v1.create(e).rest(pm.create())})}returns(e){return new M3({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new M3({args:e||v1.create([]).rest(pm.create()),returns:r||pm.create(),typeName:xr.ZodFunction,...Fr(n)})}}class Px extends Vr{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Px.create=(t,e)=>new Px({getter:t,typeName:xr.ZodLazy,...Fr(e)});class Nx extends Vr{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return Xt(r,{received:r.data,code:Dt.invalid_literal,expected:this._def.value}),Ir}return{status:"valid",value:e.data}}get value(){return this._def.value}}Nx.create=(t,e)=>new Nx({value:t,typeName:xr.ZodLiteral,...Fr(e)});function $ye(t,e){return new Z6({values:t,typeName:xr.ZodEnum,...Fr(e)})}class Z6 extends Vr{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return Xt(r,{expected:_n.joinValues(n),received:r.parsedType,code:Dt.invalid_type}),Ir}if(this._def.values.indexOf(e.data)===-1){const r=this._getOrReturnCtx(e),n=this._def.values;return Xt(r,{received:r.data,code:Dt.invalid_enum_value,options:n}),Ir}return pa(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e){return Z6.create(e)}exclude(e){return Z6.create(this.options.filter(r=>!e.includes(r)))}}Z6.create=$ye;class Ox extends Vr{_parse(e){const r=_n.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Kt.string&&n.parsedType!==Kt.number){const i=_n.objectValues(r);return Xt(n,{expected:_n.joinValues(i),received:n.parsedType,code:Dt.invalid_type}),Ir}if(r.indexOf(e.data)===-1){const i=_n.objectValues(r);return Xt(n,{received:n.data,code:Dt.invalid_enum_value,options:i}),Ir}return pa(e.data)}get enum(){return this._def.values}}Ox.create=(t,e)=>new Ox({values:t,typeName:xr.ZodNativeEnum,...Fr(e)});class My extends Vr{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Kt.promise&&r.common.async===!1)return Xt(r,{code:Dt.invalid_type,expected:Kt.promise,received:r.parsedType}),Ir;const n=r.parsedType===Kt.promise?r.data:Promise.resolve(r.data);return pa(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}}My.create=(t,e)=>new My({type:t,typeName:xr.ZodPromise,...Fr(e)});class Mu extends Vr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{Xt(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(n.data,s);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(i.type==="refinement"){const a=o=>{const f=i.refinement(o,s);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ir:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?Ir:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Cx(a))return a;const o=i.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Cx(a)?Promise.resolve(i.transform(a.value,s)).then(o=>({status:r.value,value:o})):a);_n.assertNever(i)}}Mu.create=(t,e,r)=>new Mu({schema:t,typeName:xr.ZodEffects,effect:e,...Fr(r)});Mu.createWithPreprocess=(t,e,r)=>new Mu({schema:e,effect:{type:"preprocess",transform:t},typeName:xr.ZodEffects,...Fr(r)});class ch extends Vr{_parse(e){return this._getType(e)===Kt.undefined?pa(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ch.create=(t,e)=>new ch({innerType:t,typeName:xr.ZodOptional,...Fr(e)});class qm extends Vr{_parse(e){return this._getType(e)===Kt.null?pa(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}qm.create=(t,e)=>new qm({innerType:t,typeName:xr.ZodNullable,...Fr(e)});class Dx extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===Kt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Dx.create=(t,e)=>new Dx({innerType:t,typeName:xr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fr(e)});class wR extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mR(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new xu(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xu(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wR.create=(t,e)=>new wR({innerType:t,typeName:xr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fr(e)});class vR extends Vr{_parse(e){if(this._getType(e)!==Kt.nan){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.nan,received:n.parsedType}),Ir}return{status:"valid",value:e.data}}}vR.create=t=>new vR({typeName:xr.ZodNaN,...Fr(t)});const Vut=Symbol("zod_brand");class Bye extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class O_ extends Vr{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Ir:s.status==="dirty"?(r.dirty(),Dye(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ir:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new O_({in:e,out:r,typeName:xr.ZodPipeline})}}class xR extends Vr{_parse(e){const r=this._def.innerType._parse(e);return Cx(r)&&(r.value=Object.freeze(r.value)),r}}xR.create=(t,e)=>new xR({innerType:t,typeName:xr.ZodReadonly,...Fr(e)});const Uye=(t,e={},r)=>t?Ry.create().superRefine((n,i)=>{var s,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,f=(a=(s=o.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0,c=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...c,fatal:f})}}):Ry.create(),Wut={object:Si.lazycreate};var xr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(xr||(xr={}));const Gut=(t,e={message:`Input not instance of ${t.name}`})=>Uye(r=>r instanceof t,e),Lye=yu.create,Fye=K6.create,Kut=vR.create,Qut=Q6.create,jye=Sx.create,Zut=jm.create,Yut=gR.create,Jut=Tx.create,Xut=Ix.create,elt=Ry.create,tlt=pm.create,rlt=Ah.create,nlt=bR.create,ilt=Au.create,slt=Si.create,alt=Si.strictCreate,olt=Rx.create,flt=mP.create,clt=Mx.create,ult=v1.create,llt=kx.create,dlt=yR.create,hlt=zm.create,plt=M3.create,mlt=Px.create,glt=Nx.create,blt=Z6.create,ylt=Ox.create,wlt=My.create,Wce=Mu.create,vlt=ch.create,xlt=qm.create,Alt=Mu.createWithPreprocess,_lt=O_.create,Elt=()=>Lye().optional(),Clt=()=>Fye().optional(),Slt=()=>jye().optional(),Tlt={string:t=>yu.create({...t,coerce:!0}),number:t=>K6.create({...t,coerce:!0}),boolean:t=>Sx.create({...t,coerce:!0}),bigint:t=>Q6.create({...t,coerce:!0}),date:t=>jm.create({...t,coerce:!0})},Ilt=Ir;var ge=Object.freeze({__proto__:null,defaultErrorMap:Ex,setErrorMap:Put,getErrorMap:hR,makeIssue:pR,EMPTY_PATH:Nut,addIssueToContext:Xt,ParseStatus:zs,INVALID:Ir,DIRTY:Dye,OK:pa,isAborted:RH,isDirty:MH,isValid:Cx,isAsync:mR,get util(){return _n},get objectUtil(){return IH},ZodParsedType:Kt,getParsedType:Lp,ZodType:Vr,ZodString:yu,ZodNumber:K6,ZodBigInt:Q6,ZodBoolean:Sx,ZodDate:jm,ZodSymbol:gR,ZodUndefined:Tx,ZodNull:Ix,ZodAny:Ry,ZodUnknown:pm,ZodNever:Ah,ZodVoid:bR,ZodArray:Au,ZodObject:Si,ZodUnion:Rx,ZodDiscriminatedUnion:mP,ZodIntersection:Mx,ZodTuple:v1,ZodRecord:kx,ZodMap:yR,ZodSet:zm,ZodFunction:M3,ZodLazy:Px,ZodLiteral:Nx,ZodEnum:Z6,ZodNativeEnum:Ox,ZodPromise:My,ZodEffects:Mu,ZodTransformer:Mu,ZodOptional:ch,ZodNullable:qm,ZodDefault:Dx,ZodCatch:wR,ZodNaN:vR,BRAND:Vut,ZodBranded:Bye,ZodPipeline:O_,ZodReadonly:xR,custom:Uye,Schema:Vr,ZodSchema:Vr,late:Wut,get ZodFirstPartyTypeKind(){return xr},coerce:Tlt,any:elt,array:ilt,bigint:Qut,boolean:jye,date:Zut,discriminatedUnion:flt,effect:Wce,enum:blt,function:plt,instanceof:Gut,intersection:clt,lazy:mlt,literal:glt,map:dlt,nan:Kut,nativeEnum:ylt,never:rlt,null:Xut,nullable:xlt,number:Fye,object:slt,oboolean:Slt,onumber:Clt,optional:vlt,ostring:Elt,pipeline:_lt,preprocess:Alt,promise:wlt,record:llt,set:hlt,strictObject:alt,string:Lye,symbol:Yut,transformer:Wce,tuple:ult,undefined:Jut,union:olt,unknown:tlt,void:nlt,NEVER:Ilt,ZodIssueCode:Dt,quotelessJson:kut,ZodError:xu});const Wi=ge.object({message:ge.string()});function ar(t){return ge.literal(lr[t])}ge.object({accessList:ge.array(ge.string()),blockHash:ge.string().nullable(),blockNumber:ge.string().nullable(),chainId:ge.string().or(ge.number()),from:ge.string(),gas:ge.string(),hash:ge.string(),input:ge.string().nullable(),maxFeePerGas:ge.string(),maxPriorityFeePerGas:ge.string(),nonce:ge.string(),r:ge.string(),s:ge.string(),to:ge.string(),transactionIndex:ge.string().nullable(),type:ge.string(),v:ge.string(),value:ge.string()});const Rlt=ge.object({chainId:ge.string().or(ge.number())}),Mlt=ge.object({email:ge.string().email()}),klt=ge.object({otp:ge.string()}),Plt=ge.object({uri:ge.string()}),Nlt=ge.object({chainId:ge.optional(ge.string().or(ge.number())),preferredAccountType:ge.optional(ge.string())}),Olt=ge.object({provider:ge.enum(["google","github","apple","facebook","x","discord"])}),Dlt=ge.object({email:ge.string().email()}),$lt=ge.object({otp:ge.string()}),Blt=ge.object({otp:ge.string()}),Ult=ge.object({themeMode:ge.optional(ge.enum(["light","dark"])),themeVariables:ge.optional(ge.record(ge.string(),ge.string().or(ge.number()))),w3mThemeVariables:ge.optional(ge.record(ge.string(),ge.string()))}),Llt=ge.object({metadata:ge.object({name:ge.string(),description:ge.string(),url:ge.string(),icons:ge.array(ge.string())}).optional(),sdkVersion:ge.string(),projectId:ge.string()}),Flt=ge.object({type:ge.string()}),jlt=ge.object({action:ge.enum(["VERIFY_DEVICE","VERIFY_OTP"])}),zlt=ge.object({url:ge.string()}),qlt=ge.object({userName:ge.string()}),Hlt=ge.object({email:ge.string(),address:ge.string(),chainId:ge.string().or(ge.number()),accounts:ge.array(ge.object({address:ge.string(),type:ge.enum([Lr.ACCOUNT_TYPES.EOA,Lr.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:ge.string().optional()}),Vlt=ge.object({action:ge.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),Wlt=ge.object({email:ge.string().email().optional().nullable(),address:ge.string(),chainId:ge.string().or(ge.number()),smartAccountDeployed:ge.optional(ge.boolean()),accounts:ge.array(ge.object({address:ge.string(),type:ge.enum([Lr.ACCOUNT_TYPES.EOA,Lr.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:ge.optional(ge.string())}),Glt=ge.object({uri:ge.string()}),Klt=ge.object({isConnected:ge.boolean()}),Qlt=ge.object({chainId:ge.string().or(ge.number())}),Zlt=ge.object({chainId:ge.string().or(ge.number())}),Ylt=ge.object({newEmail:ge.string().email()}),Jlt=ge.object({smartAccountEnabledNetworks:ge.array(ge.number())});ge.object({address:ge.string(),isDeployed:ge.boolean()});const Xlt=ge.object({type:ge.string(),address:ge.string()}),e1t=ge.any(),t1t=ge.object({method:ge.literal("eth_accounts")}),r1t=ge.object({method:ge.literal("eth_blockNumber")}),n1t=ge.object({method:ge.literal("eth_call"),params:ge.array(ge.any())}),i1t=ge.object({method:ge.literal("eth_chainId")}),s1t=ge.object({method:ge.literal("eth_estimateGas"),params:ge.array(ge.any())}),a1t=ge.object({method:ge.literal("eth_feeHistory"),params:ge.array(ge.any())}),o1t=ge.object({method:ge.literal("eth_gasPrice")}),f1t=ge.object({method:ge.literal("eth_getAccount"),params:ge.array(ge.any())}),c1t=ge.object({method:ge.literal("eth_getBalance"),params:ge.array(ge.any())}),u1t=ge.object({method:ge.literal("eth_getBlockByHash"),params:ge.array(ge.any())}),l1t=ge.object({method:ge.literal("eth_getBlockByNumber"),params:ge.array(ge.any())}),d1t=ge.object({method:ge.literal("eth_getBlockReceipts"),params:ge.array(ge.any())}),h1t=ge.object({method:ge.literal("eth_getBlockTransactionCountByHash"),params:ge.array(ge.any())}),p1t=ge.object({method:ge.literal("eth_getBlockTransactionCountByNumber"),params:ge.array(ge.any())}),m1t=ge.object({method:ge.literal("eth_getCode"),params:ge.array(ge.any())}),g1t=ge.object({method:ge.literal("eth_getFilterChanges"),params:ge.array(ge.any())}),b1t=ge.object({method:ge.literal("eth_getFilterLogs"),params:ge.array(ge.any())}),y1t=ge.object({method:ge.literal("eth_getLogs"),params:ge.array(ge.any())}),w1t=ge.object({method:ge.literal("eth_getProof"),params:ge.array(ge.any())}),v1t=ge.object({method:ge.literal("eth_getStorageAt"),params:ge.array(ge.any())}),x1t=ge.object({method:ge.literal("eth_getTransactionByBlockHashAndIndex"),params:ge.array(ge.any())}),A1t=ge.object({method:ge.literal("eth_getTransactionByBlockNumberAndIndex"),params:ge.array(ge.any())}),_1t=ge.object({method:ge.literal("eth_getTransactionByHash"),params:ge.array(ge.any())}),E1t=ge.object({method:ge.literal("eth_getTransactionCount"),params:ge.array(ge.any())}),C1t=ge.object({method:ge.literal("eth_getTransactionReceipt"),params:ge.array(ge.any())}),S1t=ge.object({method:ge.literal("eth_getUncleCountByBlockHash"),params:ge.array(ge.any())}),T1t=ge.object({method:ge.literal("eth_getUncleCountByBlockNumber"),params:ge.array(ge.any())}),I1t=ge.object({method:ge.literal("eth_maxPriorityFeePerGas")}),R1t=ge.object({method:ge.literal("eth_newBlockFilter")}),M1t=ge.object({method:ge.literal("eth_newFilter"),params:ge.array(ge.any())}),k1t=ge.object({method:ge.literal("eth_newPendingTransactionFilter")}),P1t=ge.object({method:ge.literal("eth_sendRawTransaction"),params:ge.array(ge.any())}),N1t=ge.object({method:ge.literal("eth_syncing"),params:ge.array(ge.any())}),O1t=ge.object({method:ge.literal("eth_uninstallFilter"),params:ge.array(ge.any())}),Gce=ge.object({method:ge.literal("personal_sign"),params:ge.array(ge.any())}),D1t=ge.object({method:ge.literal("eth_signTypedData_v4"),params:ge.array(ge.any())}),Kce=ge.object({method:ge.literal("eth_sendTransaction"),params:ge.array(ge.any())}),$1t=ge.object({method:ge.literal("solana_signMessage"),params:ge.object({message:ge.string(),pubkey:ge.string()})}),B1t=ge.object({method:ge.literal("solana_signTransaction"),params:ge.object({transaction:ge.string()})}),U1t=ge.object({method:ge.literal("solana_signAllTransactions"),params:ge.object({transactions:ge.array(ge.string())})}),L1t=ge.object({method:ge.literal("solana_signAndSendTransaction"),params:ge.object({transaction:ge.string(),options:ge.object({skipPreflight:ge.boolean().optional(),preflightCommitment:ge.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:ge.number().optional(),minContextSlot:ge.number().optional()}).optional()})}),F1t=ge.object({method:ge.literal("wallet_sendCalls"),params:ge.array(ge.object({chainId:ge.string().or(ge.number()).optional(),from:ge.string().optional(),version:ge.string().optional(),capabilities:ge.any().optional(),calls:ge.array(ge.object({to:ge.string().startsWith("0x"),data:ge.string().startsWith("0x").optional(),value:ge.string().optional()}))}))}),j1t=ge.object({method:ge.literal("wallet_getCallsStatus"),params:ge.array(ge.string())}),z1t=ge.object({method:ge.literal("wallet_getCapabilities")}),q1t=ge.object({method:ge.literal("wallet_grantPermissions"),params:ge.array(ge.any())}),Qce=ge.object({token:ge.string()}),or=ge.object({id:ge.string().optional()}),Xv={appEvent:or.extend({type:ar("APP_SWITCH_NETWORK"),payload:Rlt}).or(or.extend({type:ar("APP_CONNECT_EMAIL"),payload:Mlt})).or(or.extend({type:ar("APP_CONNECT_DEVICE")})).or(or.extend({type:ar("APP_CONNECT_OTP"),payload:klt})).or(or.extend({type:ar("APP_CONNECT_SOCIAL"),payload:Plt})).or(or.extend({type:ar("APP_GET_FARCASTER_URI")})).or(or.extend({type:ar("APP_CONNECT_FARCASTER")})).or(or.extend({type:ar("APP_GET_USER"),payload:ge.optional(Nlt)})).or(or.extend({type:ar("APP_GET_SOCIAL_REDIRECT_URI"),payload:Olt})).or(or.extend({type:ar("APP_SIGN_OUT")})).or(or.extend({type:ar("APP_IS_CONNECTED"),payload:ge.optional(Qce)})).or(or.extend({type:ar("APP_GET_CHAIN_ID")})).or(or.extend({type:ar("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(or.extend({type:ar("APP_INIT_SMART_ACCOUNT")})).or(or.extend({type:ar("APP_SET_PREFERRED_ACCOUNT"),payload:Flt})).or(or.extend({type:ar("APP_RPC_REQUEST"),payload:Gce.or(Kce).or(t1t).or(r1t).or(n1t).or(i1t).or(s1t).or(a1t).or(o1t).or(f1t).or(c1t).or(u1t).or(l1t).or(d1t).or(h1t).or(p1t).or(m1t).or(g1t).or(b1t).or(y1t).or(w1t).or(v1t).or(x1t).or(A1t).or(_1t).or(E1t).or(C1t).or(S1t).or(T1t).or(I1t).or(R1t).or(M1t).or(k1t).or(P1t).or(N1t).or(O1t).or(Gce).or(D1t).or(Kce).or($1t).or(B1t).or(U1t).or(L1t).or(j1t).or(F1t).or(z1t).or(q1t)})).or(or.extend({type:ar("APP_UPDATE_EMAIL"),payload:Dlt})).or(or.extend({type:ar("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:$lt})).or(or.extend({type:ar("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:Blt})).or(or.extend({type:ar("APP_SYNC_THEME"),payload:Ult})).or(or.extend({type:ar("APP_SYNC_DAPP_DATA"),payload:Llt})),frameEvent:or.extend({type:ar("FRAME_SWITCH_NETWORK_ERROR"),payload:Wi}).or(or.extend({type:ar("FRAME_SWITCH_NETWORK_SUCCESS"),payload:Zlt})).or(or.extend({type:ar("FRAME_CONNECT_EMAIL_SUCCESS"),payload:jlt})).or(or.extend({type:ar("FRAME_CONNECT_EMAIL_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:zlt})).or(or.extend({type:ar("FRAME_GET_FARCASTER_URI_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:qlt})).or(or.extend({type:ar("FRAME_CONNECT_FARCASTER_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_OTP_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_OTP_SUCCESS")})).or(or.extend({type:ar("FRAME_CONNECT_DEVICE_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_DEVICE_SUCCESS")})).or(or.extend({type:ar("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:Hlt})).or(or.extend({type:ar("FRAME_CONNECT_SOCIAL_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_USER_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_USER_SUCCESS"),payload:Wlt})).or(or.extend({type:ar("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:Glt})).or(or.extend({type:ar("FRAME_SIGN_OUT_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SIGN_OUT_SUCCESS")})).or(or.extend({type:ar("FRAME_IS_CONNECTED_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_IS_CONNECTED_SUCCESS"),payload:Klt})).or(or.extend({type:ar("FRAME_GET_CHAIN_ID_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_CHAIN_ID_SUCCESS"),payload:Qlt})).or(or.extend({type:ar("FRAME_RPC_REQUEST_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_RPC_REQUEST_SUCCESS"),payload:e1t})).or(or.extend({type:ar("FRAME_SESSION_UPDATE"),payload:Qce})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_SUCCESS"),payload:Vlt})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:Ylt})).or(or.extend({type:ar("FRAME_SYNC_THEME_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SYNC_THEME_SUCCESS")})).or(or.extend({type:ar("FRAME_SYNC_DAPP_DATA_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(or.extend({type:ar("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:Jlt})).or(or.extend({type:ar("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:Xlt})).or(or.extend({type:ar("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:Wi}))},ss={set(t,e){Ds.isClient&&localStorage.setItem(`${lr.STORAGE_KEY}${t}`,e)},get(t){return Ds.isClient?localStorage.getItem(`${lr.STORAGE_KEY}${t}`):null},delete(t,e){Ds.isClient&&(e?localStorage.removeItem(t):localStorage.removeItem(`${lr.STORAGE_KEY}${t}`))}},Zce={address:/^0x(?:[A-Fa-f0-9]{40})$/u,transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u},kS=30*1e3,Ds={checkIfAllowedToTriggerEmail(){const t=ss.get(lr.LAST_EMAIL_LOGIN_TIME);if(t){const e=Date.now()-Number(t);if(e{function o({data:f}){var d;if(!((d=f.type)!=null&&d.includes(lr.FRAME_EVENT_KEY)))return;const c=Xv.frameEvent.parse(f);c.id===i&&(s(c),window.removeEventListener("message",o))}Ds.isClient&&(window.addEventListener("message",o),a.addEventListener("abort",()=>{window.removeEventListener("message",o)}))},onFrameEvent:i=>{Ds.isClient&&window.addEventListener("message",({data:s})=>{var o;if(!((o=s.type)!=null&&o.includes(lr.FRAME_EVENT_KEY)))return;const a=Xv.frameEvent.parse(s);i(a)})},onAppEvent:i=>{Ds.isClient&&window.addEventListener("message",({data:s})=>{var o;if(!((o=s.type)!=null&&o.includes(lr.APP_EVENT_KEY)))return;const a=Xv.appEvent.parse(s);i(a)})},postAppEvent:i=>{var s;if(Ds.isClient){if(!((s=this.iframe)!=null&&s.contentWindow))throw new Error("W3mFrame: iframe is not set");Xv.appEvent.parse(i),this.iframe.contentWindow.postMessage(i,"*")}},postFrameEvent:i=>{if(Ds.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");Xv.frameEvent.parse(i),parent.postMessage(i,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise((i,s)=>{this.frameLoadPromiseResolver={resolve:i,reject:s}}),r&&(this.frameLoadPromise=new Promise((i,s)=>{this.frameLoadPromiseResolver={resolve:i,reject:s}}),Ds.isClient)){const i=document.createElement("iframe");i.id="w3m-iframe",i.src=`${Rut}?projectId=${e}&chainId=${n}`,i.name="w3m-secure-iframe",i.style.position="fixed",i.style.zIndex="999999",i.style.display="none",i.style.animationDelay="0s, 50ms",i.style.borderBottomLeftRadius="clamp(0px, var(--wui-border-radius-l), 44px)",i.style.borderBottomRightRadius="clamp(0px, var(--wui-border-radius-l), 44px)",document.body.appendChild(i),this.iframe=i,this.iframe.onload=()=>{var s;(s=this.frameLoadPromiseResolver)==null||s.resolve(void 0)},this.iframe.onerror=()=>{var s;(s=this.frameLoadPromiseResolver)==null||s.reject("Unable to load email login dependency")}}}get networks(){const e=["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map(r=>({[r]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${r}&projectId=${this.projectId}`,chainId:r}}));return Object.assign({},...e)}}class V1t{constructor(e){var s;const r=__({level:Mut}),{logger:n,chunkLoggerController:i}=u3e({opts:r});this.logger=qs(n,this.constructor.name),this.chunkLoggerController=i,typeof window<"u"&&((s=this.chunkLoggerController)!=null&&s.downloadLogsBlobInBrowser)&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{var a;(a=this.chunkLoggerController)!=null&&a.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}class W1t{constructor(e,r){this.openRpcRequests=[],this.w3mLogger=new V1t(e),this.w3mFrame=new H1t(e,!0,r)}getLoginEmailUsed(){return!!ss.get(lr.EMAIL_LOGIN_USED_KEY)}getEmail(){return ss.get(lr.EMAIL)}async connectEmail(e){try{Ds.checkIfAllowedToTriggerEmail();const r=await this.appEvent({type:lr.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting email"),r}}async connectDevice(){try{return this.appEvent({type:lr.APP_CONNECT_DEVICE})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting device"),e}}async connectOtp(e){try{return this.appEvent({type:lr.APP_CONNECT_OTP,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting otp"),r}}async isConnected(){try{const e=await this.appEvent({type:lr.APP_IS_CONNECTED});return e.isConnected||this.deleteAuthLoginCache(),e}catch(e){throw this.deleteAuthLoginCache(),this.w3mLogger.logger.error({error:e},"Error checking connection"),e}}async getChainId(){try{const e=await this.appEvent({type:lr.APP_GET_CHAIN_ID});return this.setLastUsedChainId(e.chainId),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting chain id"),e}}async getSocialRedirectUri(e){try{return this.appEvent({type:lr.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error getting social redirect uri"),r}}async updateEmail(e){try{const r=await this.appEvent({type:lr.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error updating email"),r}}async updateEmailPrimaryOtp(e){try{return this.appEvent({type:lr.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error updating email primary otp"),r}}async updateEmailSecondaryOtp(e){try{const r=await this.appEvent({type:lr.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(r.newEmail),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error updating email secondary otp"),r}}async syncTheme(e){try{return this.appEvent({type:lr.APP_SYNC_THEME,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error syncing theme"),r}}async syncDappData(e){try{return this.appEvent({type:lr.APP_SYNC_DAPP_DATA,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error syncing dapp data"),r}}async getSmartAccountEnabledNetworks(){try{const e=await this.appEvent({type:lr.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(e.smartAccountEnabledNetworks),e}catch(e){throw this.persistSmartAccountEnabledNetworks([]),this.w3mLogger.logger.error({error:e},"Error getting smart account enabled networks"),e}}async setPreferredAccount(e){try{return this.appEvent({type:lr.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error setting preferred account"),r}}async connect(e){try{const r=(e==null?void 0:e.chainId)??this.getLastUsedChainId()??1,n=await this.appEvent({type:lr.APP_GET_USER,payload:{...e,chainId:r}});return this.setLoginSuccess(n.email),this.setLastUsedChainId(n.chainId),n}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting"),r}}async connectSocial(e){try{const r=await this.appEvent({type:lr.APP_CONNECT_SOCIAL,payload:{uri:e}});return r.userName&&this.setSocialLoginSuccess(r.userName),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting social"),r}}async getFarcasterUri(){try{return await this.appEvent({type:lr.APP_GET_FARCASTER_URI})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting farcaster uri"),e}}async connectFarcaster(){try{const e=await this.appEvent({type:lr.APP_CONNECT_FARCASTER});return e.userName&&this.setSocialLoginSuccess(e.userName),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting farcaster"),e}}async switchNetwork(e){try{const r=await this.appEvent({type:lr.APP_SWITCH_NETWORK,payload:{chainId:e}});return this.setLastUsedChainId(r.chainId),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error switching network"),r}}async disconnect(){try{const e=await this.appEvent({type:lr.APP_SIGN_OUT});return this.deleteAuthLoginCache(),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error disconnecting"),e}}async request(e){var r,n,i;try{if(Lr.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();(r=this.rpcRequestHandler)==null||r.call(this,e);const s=await this.appEvent({type:lr.APP_RPC_REQUEST,payload:e});return(n=this.rpcSuccessHandler)==null||n.call(this,s,e),s}catch(s){throw(i=this.rpcErrorHandler)==null||i.call(this,s,e),this.w3mLogger.logger.error({error:s},"Error requesting"),s}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_GET_USER_SUCCESS&&e(r.payload)})}onNotConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_IS_CONNECTED_ERROR&&e(),r.type===lr.FRAME_IS_CONNECTED_SUCCESS&&!r.payload.isConnected&&e()})}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(r.payload):r.type===lr.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:Lr.ACCOUNT_TYPES.EOA})})}onGetSmartAccountEnabledNetworks(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS?e(r.payload.smartAccountEnabledNetworks):r.type===lr.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR&&e([])})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){try{this.openRpcRequests.forEach(({abortController:e,method:r})=>{Lr.SAFE_RPC_METHODS.includes(r)||e.abort()}),this.openRpcRequests=[]}catch(e){this.w3mLogger.logger.error({error:e},"Error aborting RPC request")}}async appEvent(e){await this.w3mFrame.frameLoadPromise;const r=e.type.replace("@w3m-app/","");return new Promise((n,i)=>{var f,c;const s=Math.random().toString(36).substring(7);(c=(f=this.w3mLogger.logger).info)==null||c.call(f,{event:e,id:s},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:s});const a=new AbortController;if(r==="RPC_REQUEST"){const d=e;this.openRpcRequests=[...this.openRpcRequests,{...d.payload,abortController:a}]}a.signal.addEventListener("abort",()=>{r==="RPC_REQUEST"&&i(new Error("Request was aborted"))});function o(d){var p;d.type===`@w3m-frame/${r}_SUCCESS`?("payload"in d&&n(d.payload),n(void 0)):d.type===`@w3m-frame/${r}_ERROR`&&("payload"in d&&i(new Error(((p=d.payload)==null?void 0:p.message)||"An error occurred")),i(new Error("An error occurred")))}this.w3mFrame.events.registerFrameEventHandler(s,o,a.signal)})}setNewLastEmailLoginTime(){ss.set(lr.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){ss.set(lr.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&ss.set(lr.EMAIL,e),ss.set(lr.EMAIL_LOGIN_USED_KEY,"true"),ss.delete(lr.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){ss.delete(lr.EMAIL_LOGIN_USED_KEY),ss.delete(lr.EMAIL),ss.delete(lr.LAST_USED_CHAIN_KEY),ss.delete(lr.SOCIAL_USERNAME),ss.delete(lr.SOCIAL,!0)}setLastUsedChainId(e){ss.set(lr.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){return Number(ss.get(lr.LAST_USED_CHAIN_KEY))}persistSmartAccountEnabledNetworks(e){ss.set(lr.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}}const Xn=zi({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),y0={state:Xn,subscribe(t){return ha(Xn,()=>t(Xn))},setLastNetworkInView(t){Xn.lastNetworkInView=t},async fetchTransactions(t,e){var n;const{projectId:r}=zt.state;if(!r||!t)throw new Error("Transactions can't be fetched without a projectId and an accountAddress");Xn.loading=!0;try{const i=await gi.fetchTransactions({account:t,projectId:r,cursor:Xn.next,onramp:e,cache:e==="coinbase"?"no-cache":void 0,chainId:(n=Ct.state.caipNetwork)==null?void 0:n.id}),s=this.filterSpamTransactions(i.data),a=this.filterByConnectedChain(s),o=[...Xn.transactions,...a];Xn.loading=!1,e==="coinbase"?Xn.coinbaseTransactions=this.groupTransactionsByYearAndMonth(Xn.coinbaseTransactions,i.data):(Xn.transactions=o,Xn.transactionsByYear=this.groupTransactionsByYearAndMonth(Xn.transactionsByYear,a)),Xn.empty=o.length===0,Xn.next=i.next?i.next:void 0}catch{Ht.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:t,projectId:r,cursor:Xn.next,isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT}}),nr.showError("Failed to fetch transactions"),Xn.loading=!1,Xn.empty=!0,Xn.next=void 0}},groupTransactionsByYearAndMonth(t={},e=[]){const r=t;return e.forEach(n=>{const i=new Date(n.metadata.minedAt).getFullYear(),s=new Date(n.metadata.minedAt).getMonth(),a=r[i]??{},f=(a[s]??[]).filter(c=>c.id!==n.id);r[i]={...a,[s]:[...f,n].sort((c,d)=>new Date(d.metadata.minedAt).getTime()-new Date(c.metadata.minedAt).getTime())}}),r},filterSpamTransactions(t){return t.filter(e=>!e.transfers.every(n=>{var i;return((i=n.nft_info)==null?void 0:i.flags.is_spam)===!0}))},filterByConnectedChain(t){var n;const e=(n=Ct.state.caipNetwork)==null?void 0:n.id;return t.filter(i=>i.metadata.chain===e)},clearCursor(){Xn.next=void 0},resetTransactions(){Xn.transactions=[],Xn.transactionsByYear={},Xn.lastNetworkInView=void 0,Xn.loading=!1,Xn.empty=!1,Xn.next=void 0}},Ma=zi({wcError:!1,buffering:!1}),hr={state:Ma,subscribeKey(t,e){return ho(Ma,t,e)},_getClient(t){return It.getConnectionControllerClient(t)},setClient(t){Ma._client=Yf(t)},async connectWalletConnect(){En.setConnectedConnector("WALLET_CONNECT"),await this._getClient().connectWalletConnect(t=>{Ma.wcUri=t,Ma.wcPairingExpiry=Ot.getPairingExpiry()})},async connectExternal(t,e){var r,n;await((n=(r=this._getClient(e)).connectExternal)==null?void 0:n.call(r,t)),It.setActiveChain(e),En.setConnectedConnector(t.type)},async reconnectExternal(t){var e,r;await((r=(e=this._getClient()).reconnectExternal)==null?void 0:r.call(e,t)),En.setConnectedConnector(t.type)},async setPreferredAccountType(t){var r;gr.setLoading(!0);const e=Zt.getAuthConnector();e&&(await(e==null?void 0:e.provider.setPreferredAccount(t)),await this.reconnectExternal(e),gr.setLoading(!1),Ht.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:t,network:((r=Ct.state.caipNetwork)==null?void 0:r.id)||""}}))},async signMessage(t){return this._getClient().signMessage(t)},parseUnits(t,e){return this._getClient().parseUnits(t,e)},formatUnits(t,e){return this._getClient().formatUnits(t,e)},async sendTransaction(t){return this._getClient().sendTransaction(t)},async estimateGas(t){return this._getClient().estimateGas(t)},async writeContract(t){return this._getClient().writeContract(t)},async getEnsAddress(t){return this._getClient().getEnsAddress(t)},async getEnsAvatar(t){return this._getClient().getEnsAvatar(t)},checkInstalled(t,e){var r,n;return((n=(r=this._getClient(e)).checkInstalled)==null?void 0:n.call(r,t))||!1},resetWcConnection(){Ma.wcUri=void 0,Ma.wcPairingExpiry=void 0,Ma.wcLinking=void 0,Ma.recentWallet=void 0,y0.resetTransactions(),En.deleteWalletConnectDeepLink()},setWcLinking(t){Ma.wcLinking=t},setWcError(t){Ma.wcError=t,Ma.buffering=!1},setRecentWallet(t){Ma.recentWallet=t},setBuffering(t){Ma.buffering=t},async disconnect(){const t=this._getClient();try{await t.disconnect(),this.resetWcConnection()}catch{throw new Error("Failed to disconnect")}}},T9={async getTokenList(){var n;const t=Ct.state.caipNetwork,e=await gi.fetchSwapTokens({chainId:t==null?void 0:t.id,projectId:zt.state.projectId});return((n=e==null?void 0:e.tokens)==null?void 0:n.map(i=>({...i,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){const t=zt.state.projectId,e=Ct.state.caipNetwork;if(!e)return null;try{switch(e.chain){case"solana":const r=(await hr.estimateGas({chainNamespace:"solana"})).toString();return{standard:r,fast:r,instant:r};case"evm":default:return await gi.fetchGasPrice({projectId:t,chainId:e.id})}}catch{return null}},async fetchSwapAllowance({tokenAddress:t,userAddress:e,sourceTokenAmount:r,sourceTokenDecimals:n}){const i=zt.state.projectId,s=await gi.fetchSwapAllowance({projectId:i,tokenAddress:t,userAddress:e});if(s!=null&&s.allowance&&r&&n){const a=hr.parseUnits(r,n)||0;return BigInt(s.allowance)>=a}return!1},async getMyTokensWithBalance(t){const e=Je.state.address,r=Ct.state.caipNetwork;if(!e||!r)return[];const i=(await gi.getBalance(e,r.id,t)).balances.filter(s=>s.quantity.decimals!=="0");return Je.setTokenBalance(i,It.state.activeChain),this.mapBalancesToSwapTokens(i)},mapBalancesToSwapTokens(t){return(t==null?void 0:t.map(e=>({...e,address:e!=null&&e.address?e.address:Ct.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1})))||[]}},ai=zi({view:"Connect",history:["Connect"],transactionStack:[]}),Ve={state:ai,subscribeKey(t,e){return ho(ai,t,e)},pushTransactionStack(t){ai.transactionStack.push(t)},popTransactionStack(t){var r,n;const e=ai.transactionStack.pop();e&&(t?(this.goBack(),(r=e==null?void 0:e.onCancel)==null||r.call(e)):(e.goBack?this.goBack():e.view&&this.reset(e.view),(n=e==null?void 0:e.onSuccess)==null||n.call(e)))},push(t,e){t!==ai.view&&(ai.view=t,ai.history.push(t),ai.data=e)},reset(t){ai.view=t,ai.history=[t]},replace(t,e){ai.history.length>=1&&ai.history.at(-1)!==t&&(ai.view=t,ai.history[ai.history.length-1]=t,ai.data=e)},goBack(){if(ai.history.length>1){ai.history.pop();const[t]=ai.history.slice(-1);t&&(ai.view=t)}},goBackToIndex(t){if(ai.history.length>1){ai.history=ai.history.slice(0,t+1);const[e]=ai.history.slice(-1);e&&(ai.view=e)}}},bd={getGasPriceInEther(t,e){const r=e*t;return Number(r)/1e18},getGasPriceInUSD(t,e,r){const n=bd.getGasPriceInEther(e,r);return dn.bigNumber(t).multipliedBy(n).toNumber()},getPriceImpact({sourceTokenAmount:t,sourceTokenPriceInUSD:e,toTokenPriceInUSD:r,toTokenAmount:n}){const i=dn.bigNumber(t).multipliedBy(e),s=dn.bigNumber(n).multipliedBy(r);return i.minus(s).dividedBy(i).multipliedBy(100).toNumber()},getMaxSlippage(t,e){const r=dn.bigNumber(t).dividedBy(100);return dn.multiply(e,r).toNumber()},getProviderFee(t,e=.0085){return dn.bigNumber(t).multipliedBy(e).toString()},isInsufficientNetworkTokenForGas(t,e){const r=e||"0";return dn.bigNumber(t).isZero()?!0:dn.bigNumber(dn.bigNumber(r)).isGreaterThan(t)},isInsufficientSourceTokenForSwap(t,e,r){var s,a;const n=(a=(s=r==null?void 0:r.find(o=>o.address===e))==null?void 0:s.quantity)==null?void 0:a.numeric;return dn.bigNumber(n||"0").isLessThan(t)},getToTokenAmount({sourceToken:t,toToken:e,sourceTokenPrice:r,toTokenPrice:n,sourceTokenAmount:i}){if(i==="0"||!t||!e)return"0";const s=t.decimals,a=r,o=e.decimals,f=n;if(f<=0)return"0";const c=dn.bigNumber(i).multipliedBy(.0085),p=dn.bigNumber(i).minus(c).multipliedBy(dn.bigNumber(10).pow(s)),g=dn.bigNumber(a).dividedBy(f),x=s-o;return p.multipliedBy(g).dividedBy(dn.bigNumber(10).pow(x)).dividedBy(dn.bigNumber(10).pow(o)).toFixed(o).toString()}},Yce=15e4,G1t=6,ka={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:S0.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},nt=zi(ka),jt={state:nt,subscribe(t){return ha(nt,()=>t(nt))},subscribeKey(t,e){return ho(nt,t,e)},getParams(){var f,c,d,p,g,x,S,I;const t=Je.state.address,e=Ct.getActiveNetworkTokenAddress(),r=En.getConnectedConnector(),n=Zt.getAuthConnector();if(!t)throw new Error("No address found to swap the tokens from.");const i=Je.state.caipAddress,s=!((f=nt.toToken)!=null&&f.address)||!((c=nt.toToken)!=null&&c.decimals),a=!((d=nt.sourceToken)!=null&&d.address)||!((p=nt.sourceToken)!=null&&p.decimals)||!dn.bigNumber(nt.sourceTokenAmount).isGreaterThan(0),o=!nt.sourceTokenAmount;return{networkAddress:e,fromAddress:t,fromCaipAddress:Je.state.caipAddress,sourceTokenAddress:(g=nt.sourceToken)==null?void 0:g.address,toTokenAddress:(x=nt.toToken)==null?void 0:x.address,toTokenAmount:nt.toTokenAmount,toTokenDecimals:(S=nt.toToken)==null?void 0:S.decimals,sourceTokenAmount:nt.sourceTokenAmount,sourceTokenDecimals:(I=nt.sourceToken)==null?void 0:I.decimals,invalidToToken:s,invalidSourceToken:a,invalidSourceTokenAmount:o,availableToSwap:i&&!s&&!a&&!o,isAuthConnector:(n==null?void 0:n.walletFeatures)&&r==="AUTH"}},setSourceToken(t){if(!t){nt.sourceToken=t,nt.sourceTokenAmount="",nt.sourceTokenPriceInUSD=0;return}nt.sourceToken=t,this.setTokenPrice(t.address,"sourceToken")},setSourceTokenAmount(t){nt.sourceTokenAmount=t},setToToken(t){if(!t){nt.toToken=t,nt.toTokenAmount="",nt.toTokenPriceInUSD=0;return}nt.toToken=t,this.setTokenPrice(t.address,"toToken")},setToTokenAmount(t){nt.toTokenAmount=t?dn.formatNumberToLocalString(t,G1t):""},async setTokenPrice(t,e){const{availableToSwap:r}=this.getParams();let n=nt.tokensPriceMap[t]||0;n||(nt.loadingPrices=!0,n=await this.getAddressPrice(t)),e==="sourceToken"?nt.sourceTokenPriceInUSD=n:e==="toToken"&&(nt.toTokenPriceInUSD=n),nt.loadingPrices&&(nt.loadingPrices=!1,r&&this.swapTokens())},switchTokens(){if(nt.initializing||!nt.initialized)return;const t=nt.toToken?{...nt.toToken}:void 0,e=nt.sourceToken?{...nt.sourceToken}:void 0,r=t&&nt.toTokenAmount===""?"1":nt.toTokenAmount;this.setSourceToken(t),this.setToToken(e),this.setSourceTokenAmount(r),this.setToTokenAmount(""),this.swapTokens()},resetState(){nt.myTokensWithBalance=ka.myTokensWithBalance,nt.tokensPriceMap=ka.tokensPriceMap,nt.initialized=ka.initialized,nt.sourceToken=ka.sourceToken,nt.sourceTokenAmount=ka.sourceTokenAmount,nt.sourceTokenPriceInUSD=ka.sourceTokenPriceInUSD,nt.toToken=ka.toToken,nt.toTokenAmount=ka.toTokenAmount,nt.toTokenPriceInUSD=ka.toTokenPriceInUSD,nt.networkPrice=ka.networkPrice,nt.networkTokenSymbol=ka.networkTokenSymbol,nt.networkBalanceInUSD=ka.networkBalanceInUSD,nt.inputError=ka.inputError},resetValues(){var r;const{networkAddress:t}=this.getParams(),e=(r=nt.tokens)==null?void 0:r.find(n=>n.address===t);this.setSourceToken(e),this.setToToken(void 0)},getApprovalLoadingState(){return nt.loadingApprovalTransaction},clearError(){nt.transactionError=void 0},async initializeState(){if(!nt.initializing){if(nt.initializing=!0,!nt.initialized)try{await this.fetchTokens(),nt.initialized=!0}catch{nt.initialized=!1,nr.showError("Failed to initialize swap"),Ve.goBack()}nt.initializing=!1}},async fetchTokens(){var r;const{networkAddress:t}=this.getParams();await this.getTokenList(),await this.getNetworkTokenPrice(),await this.getMyTokensWithBalance();const e=(r=nt.tokens)==null?void 0:r.find(n=>n.address===t);e&&(nt.networkTokenSymbol=e.symbol,this.setSourceToken(e),this.setSourceTokenAmount("1"))},async getTokenList(){const t=await T9.getTokenList();nt.tokens=t,nt.popularTokens=t.sort((e,r)=>e.symbolr.symbol?1:0),nt.suggestedTokens=t.filter(e=>!!S0.SWAP_SUGGESTED_TOKENS.includes(e.symbol),{})},async getAddressPrice(t){var f,c;const e=nt.tokensPriceMap[t];if(e)return e;const n=(await gi.fetchTokenPrice({projectId:zt.state.projectId,addresses:[t]})).fungibles||[],i=[...nt.tokens||[],...nt.myTokensWithBalance||[]],s=(f=i==null?void 0:i.find(d=>d.address===t))==null?void 0:f.symbol,a=((c=n.find(d=>d.symbol.toLowerCase()===(s==null?void 0:s.toLowerCase())))==null?void 0:c.price)||0,o=parseFloat(a.toString());return nt.tokensPriceMap[t]=o,o},async getNetworkTokenPrice(){var i;const{networkAddress:t}=this.getParams(),r=(i=(await gi.fetchTokenPrice({projectId:zt.state.projectId,addresses:[t]}).catch(()=>(nr.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:i[0],n=(r==null?void 0:r.price.toString())||"0";nt.tokensPriceMap[t]=parseFloat(n),nt.networkTokenSymbol=(r==null?void 0:r.symbol)||"",nt.networkPrice=n},async getMyTokensWithBalance(t){const e=await T9.getMyTokensWithBalance(t);e&&(await this.getInitialGasPrice(),this.setBalances(e))},setBalances(t){const{networkAddress:e}=this.getParams(),r=Ct.state.caipNetwork;if(!r)return;const n=t.find(i=>i.address===e);t.forEach(i=>{nt.tokensPriceMap[i.address]=i.price||0}),nt.myTokensWithBalance=t.filter(i=>i.address.startsWith(r.id)),nt.networkBalanceInUSD=n?dn.multiply(n.quantity.numeric,n.price).toString():"0"},async getInitialGasPrice(){var e;const t=await T9.fetchGasPrice();if(!t)return{gasPrice:null,gasPriceInUSD:null};switch((e=Ct.state.caipNetwork)==null?void 0:e.chain){case"solana":return nt.gasFee=t.standard,nt.gasPriceInUSD=dn.multiply(t.standard,nt.networkPrice).dividedBy(1e9).toNumber(),{gasPrice:BigInt(nt.gasFee),gasPriceInUSD:Number(nt.gasPriceInUSD)};case"evm":default:const r=t.standard,n=BigInt(r),i=BigInt(Yce),s=bd.getGasPriceInUSD(nt.networkPrice,i,n);return nt.gasFee=r,nt.gasPriceInUSD=s,{gasPrice:n,gasPriceInUSD:s}}},async swapTokens(){var c,d;const t=Je.state.address,e=nt.sourceToken,r=nt.toToken,n=dn.bigNumber(nt.sourceTokenAmount).isGreaterThan(0);if(!r||!e||nt.loadingPrices||!n)return;nt.loadingQuote=!0;const i=dn.bigNumber(nt.sourceTokenAmount).multipliedBy(10**e.decimals),s=await gi.fetchSwapQuote({userAddress:t,projectId:zt.state.projectId,from:e.address,to:r.address,gasPrice:nt.gasFee,amount:i.toString()});nt.loadingQuote=!1;const a=(d=(c=s==null?void 0:s.quotes)==null?void 0:c[0])==null?void 0:d.toAmount;if(!a)return;const o=dn.bigNumber(a).dividedBy(10**r.decimals).toString();this.setToTokenAmount(o),this.hasInsufficientToken(nt.sourceTokenAmount,e.address)?nt.inputError="Insufficient balance":(nt.inputError=void 0,this.setTransactionDetails())},async getTransaction(){const{fromCaipAddress:t,availableToSwap:e}=this.getParams(),r=nt.sourceToken,n=nt.toToken;if(!(!t||!e||!r||!n||nt.loadingQuote))try{nt.loadingBuildTransaction=!0;const i=await T9.fetchSwapAllowance({userAddress:t,tokenAddress:r.address,sourceTokenAmount:nt.sourceTokenAmount,sourceTokenDecimals:r.decimals});let s;return i?s=await this.createSwapTransaction():s=await this.createAllowanceTransaction(),nt.loadingBuildTransaction=!1,nt.fetchError=!1,s}catch{Ve.goBack(),nr.showError("Failed to check allowance"),nt.loadingBuildTransaction=!1,nt.approvalTransaction=void 0,nt.swapTransaction=void 0,nt.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:t,fromAddress:e,sourceTokenAddress:r,toTokenAddress:n}=this.getParams();if(!(!t||!n)){if(!r)throw new Error("createAllowanceTransaction - No source token address found.");try{const i=await gi.generateApproveCalldata({projectId:zt.state.projectId,from:r,to:n,userAddress:t}),s=await hr.estimateGas({address:e,to:Ot.getPlainAddress(i.tx.to),data:i.tx.data}),a={data:i.tx.data,to:Ot.getPlainAddress(i.tx.from),gas:s,gasPrice:BigInt(i.tx.eip155.gasPrice),value:BigInt(i.tx.value),toAmount:nt.toTokenAmount};return nt.swapTransaction=void 0,nt.approvalTransaction=a,a}catch{Ve.goBack(),nr.showError("Failed to create approval transaction"),nt.approvalTransaction=void 0,nt.swapTransaction=void 0,nt.fetchError=!0;return}}},async createSwapTransaction(){const{networkAddress:t,fromCaipAddress:e,sourceTokenAmount:r}=this.getParams(),n=nt.sourceToken,i=nt.toToken;if(!e||!r||!n||!i)return;const s=hr.parseUnits(r,n.decimals).toString();try{const a=await gi.generateSwapCalldata({projectId:zt.state.projectId,userAddress:e,from:n.address,to:i.address,amount:s}),o=n.address===t,f=BigInt(a.tx.eip155.gas),c=BigInt(a.tx.eip155.gasPrice),d={data:a.tx.data,to:Ot.getPlainAddress(a.tx.to),gas:f,gasPrice:c,value:BigInt(o?s:"0"),toAmount:nt.toTokenAmount};return nt.gasPriceInUSD=bd.getGasPriceInUSD(nt.networkPrice,f,c),nt.approvalTransaction=void 0,nt.swapTransaction=d,d}catch{Ve.goBack(),nr.showError("Failed to create transaction"),nt.approvalTransaction=void 0,nt.swapTransaction=void 0,nt.fetchError=!0;return}},async sendTransactionForApproval(t){const{fromAddress:e,isAuthConnector:r}=this.getParams();nt.loadingApprovalTransaction=!0;const n="Approve limit increase in your wallet";r?Ve.pushTransactionStack({view:null,goBack:!0,onSuccess(){nr.showLoading(n)}}):nr.showLoading(n);try{await hr.sendTransaction({address:e,to:t.to,data:t.data,value:BigInt(t.value),gasPrice:BigInt(t.gasPrice)}),await this.swapTokens(),await this.getTransaction(),nt.approvalTransaction=void 0,nt.loadingApprovalTransaction=!1}catch(i){const s=i;nt.transactionError=s==null?void 0:s.shortMessage,nt.loadingApprovalTransaction=!1,nr.showError((s==null?void 0:s.shortMessage)||"Transaction error")}},async sendTransactionForSwap(t){var a,o,f,c,d,p,g,x,S,I,R,O;if(!t)return;const{fromAddress:e,toTokenAmount:r,isAuthConnector:n}=this.getParams();nt.loadingTransaction=!0;const i=`Swapping ${(a=nt.sourceToken)==null?void 0:a.symbol} to ${dn.formatNumberToLocalString(r,3)} ${(o=nt.toToken)==null?void 0:o.symbol}`,s=`Swapped ${(f=nt.sourceToken)==null?void 0:f.symbol} to ${dn.formatNumberToLocalString(r,3)} ${(c=nt.toToken)==null?void 0:c.symbol}`;n?Ve.pushTransactionStack({view:"Account",goBack:!1,onSuccess(){nr.showLoading(i),jt.resetState()}}):nr.showLoading("Confirm transaction in your wallet");try{const M=[(d=nt.sourceToken)==null?void 0:d.address,(p=nt.toToken)==null?void 0:p.address].join(","),U=await hr.sendTransaction({address:e,to:t.to,data:t.data,gas:t.gas,gasPrice:BigInt(t.gasPrice),value:t.value});return nt.loadingTransaction=!1,nr.showSuccess(s),Ht.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((g=Ct.state.caipNetwork)==null?void 0:g.id)||"",swapFromToken:((x=this.state.sourceToken)==null?void 0:x.symbol)||"",swapToToken:((S=this.state.toToken)==null?void 0:S.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT}}),jt.resetState(),n||Ve.replace("Account"),jt.getMyTokensWithBalance(M),U}catch(M){const U=M;nt.transactionError=U==null?void 0:U.shortMessage,nt.loadingTransaction=!1,nr.showError((U==null?void 0:U.shortMessage)||"Transaction error"),Ht.sendEvent({type:"track",event:"SWAP_ERROR",properties:{network:((I=Ct.state.caipNetwork)==null?void 0:I.id)||"",swapFromToken:((R=this.state.sourceToken)==null?void 0:R.symbol)||"",swapToToken:((O=this.state.toToken)==null?void 0:O.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(t,e){const r=bd.isInsufficientSourceTokenForSwap(t,e,nt.myTokensWithBalance);return bd.isInsufficientNetworkTokenForGas(nt.networkBalanceInUSD,nt.gasPriceInUSD)||r},setTransactionDetails(){const{toTokenAddress:t,toTokenDecimals:e}=this.getParams();!t||!e||(nt.gasPriceInUSD=bd.getGasPriceInUSD(nt.networkPrice,BigInt(nt.gasFee),BigInt(Yce)),nt.priceImpact=bd.getPriceImpact({sourceTokenAmount:nt.sourceTokenAmount,sourceTokenPriceInUSD:nt.sourceTokenPriceInUSD,toTokenPriceInUSD:nt.toTokenPriceInUSD,toTokenAmount:nt.toTokenAmount}),nt.maxSlippage=bd.getMaxSlippage(nt.slippage,nt.toTokenAmount),nt.providerFee=bd.getProviderFee(nt.sourceTokenAmount))}},Jce=zi({isConnected:!1,currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),Je={state:Jce,replaceState(t){t&&Object.assign(Jce,Yf(t))},subscribe(t){return It.subscribeChainProp("accountState",e=>{if(e)return t(e)})},subscribeKey(t,e){let r;return It.subscribeChainProp("accountState",n=>{if(n){const i=n[t];r!==i&&(r=i,e(i))}})},setIsConnected(t,e){It.setAccountProp("isConnected",t,e)},getChainIsConnected(t){return It.getAccountProp("isConnected",t)},setCaipAddress(t,e){const r=t?Ot.getPlainAddress(t):void 0;It.setAccountProp("caipAddress",t,e),It.setAccountProp("address",r,e)},setBalance(t,e,r){It.setAccountProp("balance",t,r),It.setAccountProp("balanceSymbol",e,r)},setProfileName(t,e){It.setAccountProp("profileName",t,e)},setProfileImage(t,e){It.setAccountProp("profileImage",t,e)},setAddressExplorerUrl(t,e){It.setAccountProp("addressExplorerUrl",t,e)},setSmartAccountDeployed(t,e){It.setAccountProp("smartAccountDeployed",t,e)},setCurrentTab(t){It.setAccountProp("currentTab",t,It.state.activeChain)},setTokenBalance(t,e){t&&It.setAccountProp("tokenBalance",t,e)},setShouldUpdateToAddress(t,e){It.setAccountProp("shouldUpdateToAddress",t,e)},setAllAccounts(t,e){It.setAccountProp("allAccounts",t,e)},addAddressLabel(t,e,r){const n=It.getAccountProp("addressLabels",r)||new Map;n.set(t,e),It.setAccountProp("addressLabels",n,It.state.activeChain)},removeAddressLabel(t,e){const r=It.getAccountProp("addressLabels",e)||new Map;r.delete(t),It.setAccountProp("addressLabels",r,It.state.activeChain)},setConnectedWalletInfo(t,e){It.setAccountProp("connectedWalletInfo",t,e)},setPreferredAccountType(t,e){It.setAccountProp("preferredAccountType",t,e)},setSocialProvider(t,e){t&&It.setAccountProp("socialProvider",t,e)},setSocialWindow(t,e){t&&It.setAccountProp("socialWindow",Yf(t),e)},setFarcasterUrl(t,e){t&&It.setAccountProp("farcasterUrl",t,e)},async fetchTokenBalance(){var n,i;const t=(n=Ct.state.caipNetwork)==null?void 0:n.id,e=(i=Ct.state.caipNetwork)==null?void 0:i.chain,r=Je.state.address;try{if(r&&t&&e){const s=await gi.getBalance(r,t),a=s.balances.filter(o=>o.quantity.decimals!=="0");this.setTokenBalance(a,e),jt.setBalances(T9.mapBalancesToSwapTokens(s.balances))}}catch{nr.showError("Failed to fetch token balance")}},resetAccount(t){It.resetAccount(t)}},al=zi({loading:!1,open:!1,shake:!1}),gr={state:al,subscribe(t){return ha(al,()=>t(al))},subscribeKey(t,e){return ho(al,t,e)},async open(t){await cr.state.prefetchPromise;const e=Je.state.isConnected;t!=null&&t.view?Ve.reset(t.view):e?Ve.reset("Account"):Ve.reset("Connect"),al.open=!0,c1.set({open:!0}),Ht.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:e}})},close(){const t=Je.state.isConnected||!1;al.open=!1,c1.set({open:!1}),Ht.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}})},setLoading(t){al.loading=t,c1.set({loading:t})},shake(){al.shake||(al.shake=!0,setTimeout(()=>{al.shake=!1},500))}},e7={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},PH={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},K1t={providers:kye,selectedProvider:null,error:null,purchaseCurrency:e7,paymentCurrency:PH,purchaseCurrencies:[e7],paymentCurrencies:[],quotesLoading:!1},Tn=zi(K1t),In={state:Tn,subscribe(t){return ha(Tn,()=>t(Tn))},subscribeKey(t,e){return ho(Tn,t,e)},setSelectedProvider(t){if(t&&t.name==="meld"){const e=yut,r=It.state.activeChain===zn.CHAIN.SOLANA?"SOL":"USDC",n=Je.state.address??"",i=new URL(t.url);i.searchParams.append("publicKey",e),i.searchParams.append("destinationCurrencyCode",r),i.searchParams.append("walletAddress",n),t.url=i.toString()}Tn.selectedProvider=t},setPurchaseCurrency(t){Tn.purchaseCurrency=t},setPaymentCurrency(t){Tn.paymentCurrency=t},setPurchaseAmount(t){this.state.purchaseAmount=t},setPaymentAmount(t){this.state.paymentAmount=t},async getAvailableCurrencies(){const t=await gi.getOnrampOptions();Tn.purchaseCurrencies=t.purchaseCurrencies,Tn.paymentCurrencies=t.paymentCurrencies,Tn.paymentCurrency=t.paymentCurrencies[0]||PH,Tn.purchaseCurrency=t.purchaseCurrencies[0]||e7,await cr.fetchCurrencyImages(t.paymentCurrencies.map(e=>e.id)),await cr.fetchTokenImages(t.purchaseCurrencies.map(e=>e.symbol))},async getQuote(){var t,e;Tn.quotesLoading=!0;try{const r=await gi.getOnrampQuote({purchaseCurrency:Tn.purchaseCurrency,paymentCurrency:Tn.paymentCurrency,amount:((t=Tn.paymentAmount)==null?void 0:t.toString())||"0",network:(e=Tn.purchaseCurrency)==null?void 0:e.symbol});return Tn.quotesLoading=!1,Tn.purchaseAmount=Number(r.purchaseAmount.amount),r}catch(r){return Tn.error=r.message,Tn.quotesLoading=!1,null}finally{Tn.quotesLoading=!1}},resetState(){Tn.providers=kye,Tn.selectedProvider=null,Tn.error=null,Tn.purchaseCurrency=e7,Tn.paymentCurrency=PH,Tn.purchaseCurrencies=[e7],Tn.paymentCurrencies=[],Tn.paymentAmount=void 0,Tn.purchaseAmount=void 0,Tn.quotesLoading=!1}},B0=zi({loading:!1}),An={state:B0,subscribe(t){return ha(B0,()=>t(B0))},subscribeKey(t,e){return ho(B0,t,e)},setToken(t){t&&(B0.token=Yf(t))},setTokenAmount(t){B0.sendTokenAmount=t},setReceiverAddress(t){B0.receiverAddress=t},setReceiverProfileImageUrl(t){B0.receiverProfileImageUrl=t},setReceiverProfileName(t){B0.receiverProfileName=t},setGasPrice(t){B0.gasPrice=t},setGasPriceInUsd(t){B0.gasPriceInUSD=t},setLoading(t){B0.loading=t},sendToken(){var t;switch((t=It.state.activeCaipNetwork)==null?void 0:t.chain){case"evm":this.sendEvmToken();return;case"solana":this.sendSolanaToken();return;default:throw new Error("Unsupported chain")}},sendEvmToken(){var t,e,r,n,i;(t=this.state.token)!=null&&t.address&&this.state.sendTokenAmount&&this.state.receiverAddress?(Ht.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token.address,amount:this.state.sendTokenAmount,network:((e=Ct.state.caipNetwork)==null?void 0:e.id)||""}}),this.sendERC20Token({receiverAddress:this.state.receiverAddress,tokenAddress:this.state.token.address,sendTokenAmount:this.state.sendTokenAmount,decimals:this.state.token.quantity.decimals})):this.state.receiverAddress&&this.state.sendTokenAmount&&this.state.gasPrice&&((r=this.state.token)!=null&&r.quantity.decimals)&&(Ht.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:(n=this.state.token)==null?void 0:n.symbol,amount:this.state.sendTokenAmount,network:((i=Ct.state.caipNetwork)==null?void 0:i.id)||""}}),this.sendNativeToken({receiverAddress:this.state.receiverAddress,sendTokenAmount:this.state.sendTokenAmount,gasPrice:this.state.gasPrice,decimals:this.state.token.quantity.decimals}))},async sendNativeToken(t){var s,a,o,f;Ve.pushTransactionStack({view:"Account",goBack:!1});const e=t.receiverAddress,r=Je.state.address,n=hr.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals)),i="0x";try{await hr.sendTransaction({to:e,address:r,data:i,value:n,gasPrice:t.gasPrice}),nr.showSuccess("Transaction started"),Ht.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:((s=this.state.token)==null?void 0:s.symbol)||"",amount:t.sendTokenAmount,network:((a=Ct.state.caipNetwork)==null?void 0:a.id)||""}}),this.resetSend()}catch{Ht.sendEvent({type:"track",event:"SEND_ERROR",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:((o=this.state.token)==null?void 0:o.symbol)||"",amount:t.sendTokenAmount,network:((f=Ct.state.caipNetwork)==null?void 0:f.id)||""}}),nr.showError("Something went wrong")}},async sendERC20Token(t){Ve.pushTransactionStack({view:"Account",goBack:!1});const e=hr.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals));try{Je.state.address&&t.sendTokenAmount&&t.receiverAddress&&t.tokenAddress&&(await hr.writeContract({fromAddress:Je.state.address,tokenAddress:Ot.getPlainAddress(t.tokenAddress),receiverAddress:t.receiverAddress,tokenAmount:e,method:"transfer",abi:Zot}),nr.showSuccess("Transaction started"),this.resetSend())}catch{nr.showError("Something went wrong")}},sendSolanaToken(){if(!this.state.sendTokenAmount||!this.state.receiverAddress){nr.showError("Please enter a valid amount and receiver address");return}Ve.pushTransactionStack({view:"Account",goBack:!1}),hr.sendTransaction({chainNamespace:"solana",to:this.state.receiverAddress,value:this.state.sendTokenAmount}).then(()=>{this.resetSend(),Je.fetchTokenBalance()}).catch(t=>{nr.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send solana transaction",t)})},resetSend(){B0.token=void 0,B0.sendTokenAmount=void 0,B0.receiverAddress=void 0,B0.receiverProfileImageUrl=void 0,B0.receiverProfileName=void 0,B0.loading=!1}},$c=zi({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),ko={state:$c,subscribe(t){return ha($c,()=>t($c))},subscribeKey(t,e){return ho($c,t,e)},showTooltip({message:t,triggerRect:e,variant:r}){$c.open=!0,$c.message=t,$c.triggerRect=e,$c.variant=r},hide(){$c.open=!1,$c.message="",$c.triggerRect={width:0,height:0,top:0,left:0}}},Xce=2147483648,Q1t={convertEVMChainIdToCoinType(t){if(t>=Xce)throw new Error("Invalid chainId");return(Xce|t)>>>0}},If=zi({suggestions:[],loading:!1}),yl={state:If,subscribe(t){return ha(If,()=>t(If))},subscribeKey(t,e){return ho(If,t,e)},async resolveName(t){var e,r;try{return await gi.lookupEnsName(t)}catch(n){const i=n;throw new Error(((r=(e=i==null?void 0:i.reasons)==null?void 0:e[0])==null?void 0:r.description)||"Error resolving name")}},async isNameRegistered(t){try{return await gi.lookupEnsName(t),!0}catch{return!1}},async getSuggestions(t){try{If.loading=!0,If.suggestions=[];const e=await gi.getEnsNameSuggestions(t);return If.suggestions=e.suggestions.map(r=>({...r,name:r.name.replace(zn.WC_NAME_SUFFIX,"")}))||[],If.suggestions}catch(e){const r=this.parseEnsApiError(e,"Error fetching name suggestions");throw new Error(r)}finally{If.loading=!1}},async getNamesForAddress(t){try{return Ct.state.caipNetwork?await gi.reverseLookupEnsName({address:t}):[]}catch(e){const r=this.parseEnsApiError(e,"Error fetching names for address");throw new Error(r)}},async registerName(t){const e=Ct.state.caipNetwork;if(!e)throw new Error("Network not found");const r=Je.state.address,n=Zt.getAuthConnector();if(!r||!n)throw new Error("Address or auth connector not found");If.loading=!0;try{const i=JSON.stringify({name:`${t}${zn.WC_NAME_SUFFIX}`,attributes:{},timestamp:Math.floor(Date.now()/1e3)});Ve.pushTransactionStack({view:"RegisterAccountNameSuccess",goBack:!1,replace:!0,onCancel(){If.loading=!1}});const s=await hr.signMessage(i),a=vl.caipNetworkIdToNumber(e.id);if(!a)throw new Error("Network not found");const o=Q1t.convertEVMChainIdToCoinType(a);await gi.registerEnsName({coinType:o,address:r,signature:s,message:i}),Je.setProfileName(`${t}${zn.WC_NAME_SUFFIX}`,It.state.activeChain),Ve.replace("RegisterAccountNameSuccess")}catch(i){const s=this.parseEnsApiError(i,`Error registering name ${t}`);throw Ve.replace("RegisterAccountName"),new Error(s)}finally{If.loading=!1}},validateName(t){return/^[a-zA-Z0-9-]{4,}$/u.test(t)},parseEnsApiError(t,e){var n,i;const r=t;return((i=(n=r==null?void 0:r.reasons)==null?void 0:n[0])==null?void 0:i.description)||e}},Z1t={evm:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700"},nn={async fetchWalletImage(t){if(t)return await cr._fetchWalletImage(t),this.getWalletImageById(t)},getWalletImageById(t){if(t)return Ri.state.walletImages[t]},getWalletImage(t){if(t!=null&&t.image_url)return t==null?void 0:t.image_url;if(t!=null&&t.image_id)return Ri.state.walletImages[t.image_id]},getNetworkImage(t){if(t!=null&&t.imageUrl)return t==null?void 0:t.imageUrl;if(t!=null&&t.imageId)return Ri.state.networkImages[t.imageId]},getNetworkImageById(t){if(t)return Ri.state.networkImages[t]},getConnectorImage(t){if(t!=null&&t.imageUrl)return t.imageUrl;if(t!=null&&t.imageId)return Ri.state.connectorImages[t.imageId]},getChainImage(t){return Ri.state.networkImages[Z1t[t]]}},NH={goBackOrCloseModal(){Ve.state.history.length>1?Ve.goBack():gr.close()},navigateAfterNetworkSwitch(){const{history:t}=Ve.state,e=t.findIndex(r=>r==="Networks");e>=1?Ve.goBackToIndex(e-1):gr.close()},navigateAfterPreferredAccountTypeSelect(){const{isSiweEnabled:t}=zt.state;t&&It.state.activeChain===zn.CHAIN.EVM?Ve.push("ConnectingSiwe"):Ve.push("Account")}};function Y1t(t){if(t)return{id:`${_r.EIP155}:${t.id}`,name:t.name,imageId:Rd.EIP155NetworkImageIds[t.id],chain:zn.CHAIN.EVM}}async function J1t(t){var s,a,o,f;if(!t)throw new Error("networkControllerClient:getApprovedCaipNetworks - connector is undefined");const e=await(t==null?void 0:t.getProvider()),r=(a=(s=e==null?void 0:e.signer)==null?void 0:s.session)==null?void 0:a.namespaces,n=(o=r==null?void 0:r[_r.EIP155])==null?void 0:o.methods,i=tft(((f=r==null?void 0:r[_r.EIP155])==null?void 0:f.accounts)||[]);return{supportsAllNetworks:!!(n!=null&&n.includes(_r.ADD_CHAIN_METHOD)),approvedCaipNetworkIds:i}}function X1t(){return{supportsAllNetworks:!1,approvedCaipNetworkIds:Rd.WalletConnectRpcChainIds.map(t=>`${_r.EIP155}:${t}`)}}function edt({chain:t,projectId:e}){var i,s;const r=Ot.getBlockchainApiUrl(),n=(s=(i=t.rpcUrls[0])==null?void 0:i.http)==null?void 0:s[0];return Rd.WalletConnectRpcChainIds.includes(t.id)?sze([wL(`${r}/v1/?chainId=${_r.EIP155}:${t.id}&projectId=${e}`,{fetchOptions:{headers:{"Content-Type":"text/plain"}}}),wL(n)]):wL(n)}function eue(t){if(!t)throw new Error("No CAIP address provided");const e=t.split(":")[2];if(!e)throw new Error("Invalid CAIP address");return e}var tdt="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";const tue=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),rue=4;function rdt(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let B=1;B>--f&1}const p=31,g=2**p,x=g>>>1,S=x>>1,I=g-1;let R=0;for(let B=0;B1;){let Y=F+k>>>1;B>>1|d(),N=N<<1^x,W=(W^x)<<1|x|1;M=N,U=1+W-N}let D=n-4;return O.map(B=>{switch(B-D){case 3:return D+65792+(t[o++]<<16|t[o++]<<8|t[o++]);case 2:return D+256+(t[o++]<<8|t[o++]);case 1:return D+t[o++];default:return B-1}})}function ndt(t){let e=0;return()=>t[e++]}function zye(t){return ndt(rdt(idt(t)))}function idt(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,s=0,a=0,o=0;i=8&&(n[s++]=o>>(a-=8));return n}function sdt(t){return t&1?~t>>1:t>>1}function adt(t,e){let r=Array(t);for(let n=0,i=0;n{let e=$x(t);if(e.length)return e})}function Hye(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(odt(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(fdt(r,t))}return e.flat()}function Bx(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function Vye(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;in[a].push(s));return n}function odt(t,e){let r=1+e(),n=e(),i=Bx(e);return Vye(i.length,1+t,e).flatMap((a,o)=>{let[f,...c]=a;return Array(i[o]).fill().map((d,p)=>{let g=p*n;return[f+p*r,c.map(x=>x+g)]})})}function fdt(t,e){let r=1+e();return Vye(r,1+t,e).map(i=>[i[0],i.slice(1)])}function cdt(t){let e=[],r=$x(t);return i(n([]),[]),e;function n(s){let a=t(),o=Bx(()=>{let f=$x(t).map(c=>r[c]);if(f.length)return n(f)});return{S:a,B:o,Q:s}}function i({S:s,B:a},o,f){if(!(s&4&&f===o[o.length-1])){s&2&&(f=o[o.length-1]),s&1&&e.push(o);for(let c of a)for(let d of c.Q)i(c,[...o,d],f)}}}function udt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function Wye(t){return`{${udt(t)}}`}function ldt(t){let e=[];for(let r=0,n=t.length;r>24&255}function Qye(t){return t&16777215}let OH,nue,DH,DT;function wdt(){let t=zye(hdt);OH=new Map(qye(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),nue=new Set($x(t)),DH=new Map,DT=new Map;for(let[e,r]of Hye(t)){if(!nue.has(e)&&r.length==2){let[n,i]=r,s=DT.get(n);s||(s=new Map,DT.set(n,s)),s.set(i,e)}DH.set(e,r.reverse())}}function Zye(t){return t>=Ux&&t=AR&&t=_R&&eER&&e0&&i(ER+c)}else{let a=DH.get(s);a?r.push(...a):i(s)}if(!r.length)break;s=r.pop()}if(n&&e.length>1){let s=I9(e[0]);for(let a=1;a0&&i>=a)a==0?(e.push(n,...r),r.length=0,n=o):r.push(o),i=a;else{let f=vdt(n,o);f>=0?n=f:i==0&&a==0?(e.push(n),n=o):(r.push(o),i=a)}}return n>=0&&e.push(n,...r),e}function Jye(t){return Yye(t).map(Qye)}function Adt(t){return xdt(Yye(t))}const iue=45,Xye=".",ewe=65039,twe=1,t3=t=>Array.from(t);function Lx(t,e){return t.P.has(e)||t.Q.has(e)}class _dt extends Array{get is_emoji(){return!0}}let $H,rwe,v2,BH,nwe,k3,KF,Nb,iwe,sue,UH;function uQ(){if($H)return;let t=zye(tdt);const e=()=>$x(t),r=()=>new Set(e());$H=new Map(Hye(t)),rwe=r(),v2=e(),BH=new Set(e().map(d=>v2[d])),v2=new Set(v2),nwe=r(),r();let n=qye(t),i=t();const s=()=>new Set(e().flatMap(d=>n[d]).concat(e()));k3=Bx(d=>{let p=Bx(t).map(g=>g+96);if(p.length){let g=d>=i;p[0]-=32,p=ky(p),g&&(p=`Restricted[${p}]`);let x=s(),S=s(),I=!t();return{N:p,P:x,Q:S,M:I,R:g}}}),KF=r(),Nb=new Map;let a=e().concat(t3(KF)).sort((d,p)=>d-p);a.forEach((d,p)=>{let g=t(),x=a[p]=g?a[p-g]:{V:[],M:new Map};x.V.push(d),KF.has(d)||Nb.set(d,x)});for(let{V:d,M:p}of new Set(Nb.values())){let g=[];for(let S of d){let I=k3.filter(O=>Lx(O,S)),R=g.find(({G:O})=>I.some(M=>O.has(M)));R||(R={G:new Set,V:[]},g.push(R)),R.V.push(S),I.forEach(O=>R.G.add(O))}let x=g.flatMap(S=>t3(S.G));for(let{G:S,V:I}of g){let R=new Set(x.filter(O=>!S.has(O)));for(let O of I)p.set(O,R)}}let o=new Set,f=new Set;const c=d=>o.has(d)?f.add(d):o.add(d);for(let d of k3){for(let p of d.P)c(p);for(let p of d.Q)c(p)}for(let d of o)!Nb.has(d)&&!f.has(d)&&Nb.set(d,twe);iwe=new Set(t3(o).concat(t3(Jye(o)))),sue=cdt(t).map(d=>_dt.from(d)).sort(ddt),UH=new Map;for(let d of sue){let p=[UH];for(let g of d){let x=p.map(S=>{let I=S.get(g);return I||(I=new Map,S.set(g,I)),I});g===ewe?p.push(...x):p=x}for(let g of p)g.V=d}}function lQ(t){return(swe(t)?"":`${dQ(gP([t]))} `)+Wye(t)}function dQ(t){return`"${t}"‎`}function Edt(t){if(t.length>=4&&t[2]==iue&&t[3]==iue)throw new Error(`invalid label extension: "${ky(t.slice(0,4))}"`)}function Cdt(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function Sdt(t){let e=t[0],r=tue.get(e);if(r)throw t7(`leading ${r}`);let n=t.length,i=-1;for(let s=1;s{let s=ldt(i),a={input:s,offset:n};n+=s.length+1;try{let o=a.tokens=Odt(s,e,r),f=o.length,c;if(!f)throw new Error("empty label");let d=a.output=o.flat();if(Cdt(d),!(a.emoji=f>1||o[0].is_emoji)&&d.every(g=>g<128))Edt(d),c="ASCII";else{let g=o.flatMap(x=>x.is_emoji?[]:x);if(!g.length)c="Emoji";else{if(v2.has(d[0]))throw t7("leading combining mark");for(let I=1;Ia.has(o)):t3(a),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(s=>Lx(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function kdt(t){let e=k3;for(let r of t){let n=e.filter(i=>Lx(i,r));if(!n.length)throw k3.some(i=>Lx(i,r))?owe(e[0],r):awe(r);if(e=n,n.length==1)break}return e}function Pdt(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${dQ(gP(e))}: ${i}`)}return ky(n)}).join(Xye)}function awe(t){return new Error(`disallowed character: ${lQ(t)}`)}function owe(t,e){let r=lQ(e),n=k3.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function t7(t){return new Error(`illegal placement: ${t}`)}function Ndt(t,e){for(let r of e)if(!Lx(t,r))throw owe(t,r);if(t.M){let r=Jye(e);for(let n=1,i=r.length;nrue)throw new Error(`excessive non-spacing marks: ${dQ(gP(r.slice(n-1,s)))} (${s-n}/${rue})`);n=s}}}function Odt(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let s=$dt(t);if(s)i.length&&(n.push(e(i)),i=[]),n.push(r(s));else{let a=t.pop();if(iwe.has(a))i.push(a);else{let o=$H.get(a);if(o)i.push(...o);else if(!rwe.has(a))throw awe(a)}}}return i.length&&n.push(e(i)),n}function Ddt(t){return t.filter(e=>e!=ewe)}function $dt(t,e){let r=UH,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:s}=r;s&&(n=s,t.length=i)}return n}function aue(t){return Idt(t)}class Bdt{constructor(e){var i,s,a;this.appKit=void 0,this.options=void 0,this.chain=zn.CHAIN.EVM,this.defaultChain=void 0,this.tokens=bce.getCaipTokens((i=this.options)==null?void 0:i.tokens),this.getCaipDefaultChain=(s=this.options)==null?void 0:s.defaultChain,this.siweControllerClient=(a=this.options)==null?void 0:a.siweConfig;const{wagmiConfig:r,defaultChain:n}=e;if(!r)throw new Error("wagmiConfig is undefined");this.wagmiConfig=r,this.defaultChain=Y1t(n),this.siweControllerClient=e.siweConfig,this.networkControllerClient={switchCaipNetwork:async o=>{const f=vl.caipNetworkIdToNumber(o==null?void 0:o.id);f&&await Cze(this.wagmiConfig,{chainId:f})},getApprovedCaipNetworksData:async()=>new Promise(o=>{var d,p;const c=new Map(this.wagmiConfig.state.connections).get(this.wagmiConfig.state.current||"");if(((d=c==null?void 0:c.connector)==null?void 0:d.id)===_r.AUTH_CONNECTOR_ID)o(X1t());else if(((p=c==null?void 0:c.connector)==null?void 0:p.id)===_r.WALLET_CONNECT_CONNECTOR_ID){const g=this.wagmiConfig.connectors.find(x=>x.id===_r.WALLET_CONNECT_CONNECTOR_ID);o(J1t(g))}o({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},this.connectionControllerClient={connectWalletConnect:async o=>{var S,I,R,O,M,U,D,B,F,k,N;const f=(S=this.options)==null?void 0:S.siweConfig,c=this.wagmiConfig.connectors.find(W=>W.id===_r.WALLET_CONNECT_CONNECTOR_ID);if(!c)throw new Error("connectionControllerClient:getWalletConnectUri - connector is undefined");const d=await c.getProvider();d.on("display_uri",W=>{o(W)});const p=await((M=(O=(R=(I=d.signer)==null?void 0:I.client)==null?void 0:R.core)==null?void 0:O.crypto)==null?void 0:M.getClientId());p&&((U=this.appKit)==null||U.setClientId(p));const g=vl.caipNetworkIdToNumber((B=(D=this.appKit)==null?void 0:D.getCaipNetwork())==null?void 0:B.id),x=await((F=f==null?void 0:f.getMessageParams)==null?void 0:F.call(f));if((k=f==null?void 0:f.options)!=null&&k.enabled&&typeof(d==null?void 0:d.authenticate)=="function"&&x&&Object.keys(x||{}).length>0){const{SIWEController:W,getDidChainId:Y,getDidAddress:z}=await Ya(async()=>{const{SIWEController:h,getDidChainId:w,getDidAddress:_}=await import("./index-DV5_LVti.js");return{SIWEController:h,getDidChainId:w,getDidAddress:_}},[]);await c.setRequestedChainsIds(x.chains);let P=x.chains;g&&(P=[g,...x.chains.filter(h=>h!==g)]);const u=await d.authenticate({nonce:await f.getNonce(),methods:[...iQ],...x,chains:P}),l=(N=u==null?void 0:u.auths)==null?void 0:N[0];if(l){const{p:h,s:w}=l,_=Y(h.iss)||"",E=z(h.iss);E&&_&&W.setSession({address:E,chainId:parseInt(_,10)});try{const T=d.signer.client.formatAuthMessage({request:h,iss:h.iss});await W.verifyMessage({message:T,signature:w.s,cacao:l})}catch(T){throw console.error("Error verifying message",T),await d.disconnect().catch(console.error),await W.signOut().catch(console.error),T}}this.wagmiConfig.state.current=""}await Jse(this.wagmiConfig,{connector:c,chainId:g})},connectExternal:async({id:o,provider:f,info:c})=>{var g,x,S,I;const d=this.wagmiConfig.connectors.find(R=>R.id===o);if(!d)throw new Error("connectionControllerClient:connectExternal - connector is undefined");(g=this.appKit)==null||g.setClientId(null),f&&c&&d.id===_r.EIP6963_CONNECTOR_ID&&((x=d.setEip6963Wallet)==null||x.call(d,{provider:f,info:c}));const p=vl.caipNetworkIdToNumber((I=(S=this.appKit)==null?void 0:S.getCaipNetwork())==null?void 0:I.id);await Jse(this.wagmiConfig,{connector:d,chainId:p})},checkInstalled:o=>{var c;const f=(c=this.appKit)==null?void 0:c.getConnectors().find(d=>d.type==="INJECTED");return o?f&&window!=null&&window.ethereum?o.some(d=>{var p;return!!((p=window.ethereum)!=null&&p[String(d)])}):!1:!!window.ethereum},disconnect:async()=>{var o,f,c,d;if(await cze(this.wagmiConfig),(o=this.appKit)==null||o.setClientId(null),(d=(c=(f=this.options)==null?void 0:f.siweConfig)==null?void 0:c.options)!=null&&d.signOutOnDisconnect){const{SIWEController:p}=await Ya(async()=>{const{SIWEController:g}=await import("./index-DV5_LVti.js");return{SIWEController:g}},[]);await p.signOut()}},signMessage:async o=>{var d;const f=((d=this.appKit)==null?void 0:d.getCaipAddress())||"",c=eue(f);return xze(this.wagmiConfig,{message:o,account:c})},estimateGas:async o=>{if(o.chainNamespace&&o.chainNamespace!=="eip155")throw new Error("connectionControllerClient:estimateGas - invalid chain namespace");try{return await uze(this.wagmiConfig,{account:o.address,to:o.to,data:o.data,type:"legacy"})}catch{return 0n}},sendTransaction:async o=>{if(o.chainNamespace&&o.chainNamespace!=="eip155")throw new Error("connectionControllerClient:sendTransaction - invalid chain namespace");const{chainId:f}=_w(this.wagmiConfig),c={account:o.address,to:o.to,value:o.value,gas:o.gas,gasPrice:o.gasPrice,data:o.data,chainId:f,type:"legacy"};await wze(this.wagmiConfig,c);const d=await vze(this.wagmiConfig,c);return await Ize(this.wagmiConfig,{hash:d,timeout:25e3}),d},writeContract:async o=>{var g,x,S;const f=((g=this.appKit)==null?void 0:g.getCaipAddress())||"",c=eue(f),d=vl.caipNetworkIdToNumber((S=(x=this.appKit)==null?void 0:x.getCaipNetwork())==null?void 0:S.id);return await Rze(this.wagmiConfig,{chainId:d,address:o.tokenAddress,account:c,abi:o.abi,functionName:o.method,args:[o.receiverAddress,o.tokenAmount]})},getEnsAddress:async o=>{var f,c,d;try{const p=vl.caipNetworkIdToNumber((c=(f=this.appKit)==null?void 0:f.getCaipNetwork())==null?void 0:c.id);let g=!1,x=!1;return o!=null&&o.endsWith(zn.WC_NAME_SUFFIX)&&(x=await((d=this.appKit)==null?void 0:d.resolveWalletConnectName(o))||!1),p===TF.id&&(g=await gze(this.wagmiConfig,{name:aue(o),chainId:p})),g||x||!1}catch{return!1}},getEnsAvatar:async o=>{var d,p;const f=vl.caipNetworkIdToNumber((p=(d=this.appKit)==null?void 0:d.getCaipNetwork())==null?void 0:p.id);return f!==TF.id?!1:await rae(this.wagmiConfig,{name:aue(o),chainId:f})||!1},parseUnits:Hje,formatUnits:u_}}construct(e,r){var n,i;if(!r.projectId)throw new Error("projectId is undefined");this.appKit=e,this.options=r,this.tokens=bce.getCaipTokens(r.tokens),this.syncRequestedNetworks([...this.wagmiConfig.chains]),this.syncConnectors(this.wagmiConfig.connectors),this.initAuthConnectorListeners([...this.wagmiConfig.connectors]),Tze(this.wagmiConfig,{onChange:s=>this.syncConnectors(s)}),nge(this.wagmiConfig,{onChange:s=>this.syncAccount({...s})}),(n=this.appKit)==null||n.setEIP6963Enabled(r.enableEIP6963!==!1),(i=this.appKit)==null||i.subscribeShouldUpdateToAddress(s=>{var a;if(s){const f=(a=mze(this.wagmiConfig)[0])==null?void 0:a.connector;f&&_ze(this.wagmiConfig,{connector:f}).then(c=>this.syncAccount({address:s,isConnected:!0,addresses:c.accounts,connector:f,chainId:c.chainId}))}})}subscribeState(e){var r;return(r=this.appKit)==null?void 0:r.subscribeState(n=>e({...n,selectedNetworkId:vl.caipNetworkIdToNumber(n.selectedNetworkId)}))}syncRequestedNetworks(e){var n;const r=e==null?void 0:e.map(i=>{var s,a;return{id:`${_r.EIP155}:${i.id}`,name:i.name,imageId:Rd.EIP155NetworkImageIds[i.id],imageUrl:(a=(s=this.options)==null?void 0:s.chainImages)==null?void 0:a[i.id],chain:this.chain}});(n=this.appKit)==null||n.setRequestedCaipNetworks(r??[],this.chain)}async syncAccount({address:e,chainId:r,connector:n,addresses:i,status:s}){var o,f,c,d,p,g,x,S,I,R;const a=`${_r.EIP155}:${r}:${e}`;((o=this.appKit)==null?void 0:o.getCaipAddress())!==a&&(s==="connected"&&e&&r?(this.syncNetwork(e,r,!0),(f=this.appKit)==null||f.setIsConnected(!0,this.chain),(c=this.appKit)==null||c.setCaipAddress(a,this.chain),await Promise.all([this.syncProfile(e,r),this.syncBalance(e,r),this.syncConnectedWalletInfo(n),(d=this.appKit)==null?void 0:d.setApprovedCaipNetworksData(this.chain)]),n&&this.syncConnectedWalletInfo(n),!((n==null?void 0:n.id)===_r.AUTH_CONNECTOR_ID)&&(i!=null&&i.length)&&((p=this.appKit)==null||p.setAllAccounts(i.map(M=>({address:M,type:"eoa"})),this.chain))):s==="disconnected"&&((g=this.appKit)==null||g.resetAccount(this.chain),(x=this.appKit)==null||x.resetWcConnection(),(S=this.appKit)==null||S.resetNetwork(),(I=this.appKit)==null||I.setAllAccounts([],this.chain),(R=this.appKit)==null||R.setIsConnected(!1,this.chain)))}async syncNetwork(e,r,n){var s,a,o,f,c,d,p,g;const i=this.wagmiConfig.chains.find(x=>x.id===r);if(i||r){const x=(i==null?void 0:i.name)??(r==null?void 0:r.toString()),S=Number((i==null?void 0:i.id)??r),I=`${_r.EIP155}:${S}`;if((o=this.appKit)==null||o.setCaipNetwork({id:I,name:x,imageId:Rd.EIP155NetworkImageIds[S],imageUrl:(a=(s=this.options)==null?void 0:s.chainImages)==null?void 0:a[S],chain:this.chain}),n&&e&&r){const R=`${_r.EIP155}:${S}:${e}`;if((f=this.appKit)==null||f.setCaipAddress(R,this.chain),(d=(c=i==null?void 0:i.blockExplorers)==null?void 0:c.default)!=null&&d.url){const O=`${i.blockExplorers.default.url}/address/${e}`;(p=this.appKit)==null||p.setAddressExplorerUrl(O,this.chain)}else(g=this.appKit)==null||g.setAddressExplorerUrl(void 0,this.chain);await this.syncBalance(e,r)}}}async syncWalletConnectName(e){var r,n,i;if(!this.appKit)throw new Error("syncWalletConnectName - appKit is undefined");try{const s=await this.appKit.getWalletConnectName(e);if(s[0]){const a=s[0];(r=this.appKit)==null||r.setProfileName(a.name,this.chain)}else(n=this.appKit)==null||n.setProfileName(null,this.chain)}catch{(i=this.appKit)==null||i.setProfileName(null,this.chain)}}async syncProfile(e,r){var n,i,s,a,o,f;if(!this.appKit)throw new Error("syncProfile - appKit is undefined");try{const{name:c,avatar:d}=await this.appKit.fetchIdentity({address:e});(n=this.appKit)==null||n.setProfileName(c,this.chain),(i=this.appKit)==null||i.setProfileImage(d,this.chain),c||await this.syncWalletConnectName(e)}catch{if(r===TF.id){const c=await bze(this.wagmiConfig,{address:e,chainId:r});if(c){(s=this.appKit)==null||s.setProfileName(c,this.chain);const d=await rae(this.wagmiConfig,{name:c,chainId:r});d&&((a=this.appKit)==null||a.setProfileImage(d,this.chain))}else await this.syncWalletConnectName(e),(o=this.appKit)==null||o.setProfileImage(null,this.chain)}else await this.syncWalletConnectName(e),(f=this.appKit)==null||f.setProfileImage(null,this.chain)}}async syncBalance(e,r){var i,s,a,o,f;const n=this.wagmiConfig.chains.find(c=>c.id===r);if(n){const c=await pze(this.wagmiConfig,{address:e,chainId:n.id,token:(a=(s=(i=this.options)==null?void 0:i.tokens)==null?void 0:s[n.id])==null?void 0:a.address});(o=this.appKit)==null||o.setBalance(c.formatted,c.symbol,this.chain);return}(f=this.appKit)==null||f.setBalance(void 0,void 0,this.chain)}async syncConnectedWalletInfo(e){var r,n,i,s;if(!e)throw Error("syncConnectedWalletInfo - connector is undefined");if(e.id===_r.WALLET_CONNECT_CONNECTOR_ID&&e.getProvider){const a=await e.getProvider();a.session&&((n=this.appKit)==null||n.setConnectedWalletInfo({...a.session.peer.metadata,name:a.session.peer.metadata.name,icon:(r=a.session.peer.metadata.icons)==null?void 0:r[0]},this.chain))}else{const a=(i=this.appKit)==null?void 0:i.getConnectors().find(o=>o.id===e.id);(s=this.appKit)==null||s.setConnectedWalletInfo({name:e.name,icon:e.icon||this.appKit.getConnectorImage(a)},this.chain)}}syncConnectors(e){var s;const r=new Set,n=e.filter(a=>!r.has(a.id)&&r.add(a.id)),i=[];n.forEach(({id:a,name:o,type:f,icon:c})=>{var p,g;_r.AUTH_CONNECTOR_ID===a||i.push({id:a,explorerId:Rd.ConnectorExplorerIds[a],imageUrl:((g=(p=this.options)==null?void 0:p.connectorImages)==null?void 0:g[a])??c,name:Rd.ConnectorNamesMap[a]??o,imageId:Rd.ConnectorImageIds[a],type:Rd.ConnectorTypesMap[f]??"EXTERNAL",info:{rdns:a},chain:this.chain})}),(s=this.appKit)==null||s.setConnectors(i),this.syncAuthConnector(n)}async syncAuthConnector(e){var n;const r=e.find(({id:i})=>i===_r.AUTH_CONNECTOR_ID);if(r){const i=await r.getProvider();(n=this.appKit)==null||n.addConnector({id:_r.AUTH_CONNECTOR_ID,type:"AUTH",name:"Auth",provider:i,email:r.email,socials:r.socials,showWallets:r.showWallets,chain:this.chain,walletFeatures:r.walletFeatures})}}async initAuthConnectorListeners(e){const r=e.find(({id:n})=>n===_r.AUTH_CONNECTOR_ID);r&&(await this.listenAuthConnector(r),await this.listenModal(r))}async listenAuthConnector(e){var r,n,i;if(typeof window<"u"&&e){(r=this.appKit)==null||r.setLoading(!0);const s=await e.getProvider(),a=s.getLoginEmailUsed();(n=this.appKit)==null||n.setLoading(a),a&&((i=this.appKit)==null||i.setIsConnected(!1,this.chain)),s.onRpcRequest(o=>{var f,c;Ds.checkIfRequestExists(o)?Ds.checkIfRequestIsSafe(o)||(f=this.appKit)==null||f.handleUnsafeRPCRequest():((c=this.appKit)==null||c.open(),console.error(Lr.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:o.method}),setTimeout(()=>{var d;(d=this.appKit)==null||d.showErrorMessage(Lr.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),s.rejectRpcRequests())}),s.onRpcError(()=>{var f,c,d,p;((f=this.appKit)==null?void 0:f.isOpen())&&((c=this.appKit)!=null&&c.isTransactionStackEmpty()?(d=this.appKit)==null||d.close():(p=this.appKit)==null||p.popTransactionStack(!0))}),s.onRpcSuccess((o,f)=>{var d,p,g;Ds.checkIfRequestIsSafe(f)||((d=this.appKit)!=null&&d.isTransactionStackEmpty()?(p=this.appKit)==null||p.close():(g=this.appKit)==null||g.popTransactionStack())}),s.onNotConnected(()=>{var f,c,d;((f=this.appKit)==null?void 0:f.getIsConnectedState())||((c=this.appKit)==null||c.setIsConnected(!1,this.chain),(d=this.appKit)==null||d.setLoading(!1))}),s.onIsConnected(o=>{var f,c,d,p,g;(f=this.appKit)==null||f.setIsConnected(!0,this.chain),(c=this.appKit)==null||c.setSmartAccountDeployed(!!o.smartAccountDeployed,this.chain),(d=this.appKit)==null||d.setPreferredAccountType(o.preferredAccountType,this.chain),(p=this.appKit)==null||p.setLoading(!1),(g=this.appKit)==null||g.setAllAccounts(o.accounts||[{address:o.address,type:o.preferredAccountType||"eoa"}],this.chain)}),s.onGetSmartAccountEnabledNetworks(o=>{var f;(f=this.appKit)==null||f.setSmartAccountEnabledNetworks(o,this.chain)}),s.onSetPreferredAccount(({address:o,type:f})=>{var c;o&&((c=this.appKit)==null||c.setPreferredAccountType(f,this.chain),rge(this.wagmiConfig,{connectors:[e]}))})}}async listenModal(e){const r=await e.getProvider();this.subscribeState(n=>{n.open||r.rejectRpcRequests()})}}bP.type="coinbaseWallet";function bP(t={}){return t.version==="3"||t.headlessMode?Ldt(t):Udt(t)}function Udt(t){let e,r,n,i,s;return a=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:bP.type,async connect({chainId:o}={}){try{const f=await this.getProvider(),c=(await f.request({method:"eth_requestAccounts"})).map(p=>$s(p));n||(n=this.onAccountsChanged.bind(this),f.on("accountsChanged",n)),i||(i=this.onChainChanged.bind(this),f.on("chainChanged",i)),s||(s=this.onDisconnect.bind(this),f.on("disconnect",s));let d=await this.getChainId();if(o&&d!==o){const p=await this.switchChain({chainId:o}).catch(g=>{if(g.code===ci.code)throw g;return{id:d}});d=(p==null?void 0:p.id)??d}return{accounts:c,chainId:d}}catch(f){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(f.message)?new ci(f):f}},async disconnect(){var f;const o=await this.getProvider();n&&(o.removeListener("accountsChanged",n),n=void 0),i&&(o.removeListener("chainChanged",i),i=void 0),s&&(o.removeListener("disconnect",s),s=void 0),o.disconnect(),(f=o.close)==null||f.call(o)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(f=>$s(f))},async getChainId(){const f=await(await this.getProvider()).request({method:"eth_chainId"});return Number(f)},async getProvider(){if(!r){const o=await(async()=>{const{default:f}=await Ya(async()=>{const{default:c}=await import("./index-CbiTlW7Y.js").then(d=>d.i);return{default:c}},__vite__mapDeps([0,1]));return typeof f!="function"&&typeof f.default=="function"?f.default:f})();e=new o({...t,appChainIds:a.chains.map(f=>f.id)}),r=e.makeWeb3Provider({...t,options:t.preference??"all"})}return r},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:o,chainId:f}){var p,g,x,S;const c=a.chains.find(I=>I.id===f);if(!c)throw new to(new Dm);const d=await this.getProvider();try{return await d.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(c.id)}]}),c}catch(I){if(I.code===4902)try{let R;o!=null&&o.blockExplorerUrls?R=o.blockExplorerUrls:R=(p=c.blockExplorers)!=null&&p.default.url?[(g=c.blockExplorers)==null?void 0:g.default.url]:[];let O;(x=o==null?void 0:o.rpcUrls)!=null&&x.length?O=o.rpcUrls:O=[((S=c.rpcUrls.default)==null?void 0:S.http[0])??""];const M={blockExplorerUrls:R,chainId:Tr(f),chainName:(o==null?void 0:o.chainName)??c.name,iconUrls:o==null?void 0:o.iconUrls,nativeCurrency:(o==null?void 0:o.nativeCurrency)??c.nativeCurrency,rpcUrls:O};return await d.request({method:"wallet_addEthereumChain",params:[M]}),c}catch(R){throw new ci(R)}throw new to(I)}},onAccountsChanged(o){o.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:o.map(f=>$s(f))})},onChainChanged(o){const f=Number(o);a.emitter.emit("change",{chainId:f})},async onDisconnect(o){a.emitter.emit("disconnect");const f=await this.getProvider();n&&(f.removeListener("accountsChanged",n),n=void 0),i&&(f.removeListener("chainChanged",i),i=void 0),s&&(f.removeListener("disconnect",s),s=void 0)}})}function Ldt(t){let r,n,i,s,a;return o=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:bP.type,async connect({chainId:f}={}){try{const c=await this.getProvider(),d=(await c.request({method:"eth_requestAccounts"})).map(g=>$s(g));i||(i=this.onAccountsChanged.bind(this),c.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),c.on("chainChanged",s)),a||(a=this.onDisconnect.bind(this),c.on("disconnect",a));let p=await this.getChainId();if(f&&p!==f){const g=await this.switchChain({chainId:f}).catch(x=>{if(x.code===ci.code)throw x;return{id:p}});p=(g==null?void 0:g.id)??p}return{accounts:d,chainId:p}}catch(c){throw/(user closed modal|accounts received is empty|user denied account)/i.test(c.message)?new ci(c):c}},async disconnect(){const f=await this.getProvider();i&&(f.removeListener("accountsChanged",i),i=void 0),s&&(f.removeListener("chainChanged",s),s=void 0),a&&(f.removeListener("disconnect",a),a=void 0),f.disconnect(),f.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(c=>$s(c))},async getChainId(){const c=await(await this.getProvider()).request({method:"eth_chainId"});return Number(c)},async getProvider(){var f;if(!n){const c=await(async()=>{const{default:S}=await Ya(async()=>{const{default:I}=await import("./index-Dp7JVq_m.js").then(R=>R.i);return{default:I}},__vite__mapDeps([2,1]));return typeof S!="function"&&typeof S.default=="function"?S.default:S})();r=new c({...t,reloadOnDisconnect:!1});const d=(f=r.walletExtension)==null?void 0:f.getChainId(),p=o.chains.find(S=>t.chainId?S.id===t.chainId:S.id===d)||o.chains[0],g=t.chainId||(p==null?void 0:p.id),x=t.jsonRpcUrl||(p==null?void 0:p.rpcUrls.default.http[0]);n=r.makeWeb3Provider(x,g)}return n},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:f,chainId:c}){var g,x,S,I;const d=o.chains.find(R=>R.id===c);if(!d)throw new to(new Dm);const p=await this.getProvider();try{return await p.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(d.id)}]}),d}catch(R){if(R.code===4902)try{let O;f!=null&&f.blockExplorerUrls?O=f.blockExplorerUrls:O=(g=d.blockExplorers)!=null&&g.default.url?[(x=d.blockExplorers)==null?void 0:x.default.url]:[];let M;(S=f==null?void 0:f.rpcUrls)!=null&&S.length?M=f.rpcUrls:M=[((I=d.rpcUrls.default)==null?void 0:I.http[0])??""];const U={blockExplorerUrls:O,chainId:Tr(c),chainName:(f==null?void 0:f.chainName)??d.name,iconUrls:f==null?void 0:f.iconUrls,nativeCurrency:(f==null?void 0:f.nativeCurrency)??d.nativeCurrency,rpcUrls:M};return await p.request({method:"wallet_addEthereumChain",params:[U]}),d}catch(O){throw new ci(O)}throw new to(R)}},onAccountsChanged(f){f.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:f.map(c=>$s(c))})},onChainChanged(f){const c=Number(f);o.emitter.emit("change",{chainId:c})},async onDisconnect(f){o.emitter.emit("disconnect");const c=await this.getProvider();i&&(c.removeListener("accountsChanged",i),i=void 0),s&&(c.removeListener("chainChanged",s),s=void 0),a&&(c.removeListener("disconnect",a),a=void 0)}})}hQ.type="walletConnect";function hQ(t){const e=t.isNewChainsStale??!0;let r,n;const i="eip155";let s,a,o,f,c,d;return p=>({id:"walletConnect",name:"WalletConnect",type:hQ.type,async setup(){const g=await this.getProvider().catch(()=>null);g&&(o||(o=this.onConnect.bind(this),g.on("connect",o)),c||(c=this.onSessionDelete.bind(this),g.on("session_delete",c)))},async connect({chainId:g,...x}={}){var S,I;try{const R=await this.getProvider();if(!R)throw new Cp;f||(f=this.onDisplayUri,R.on("display_uri",f));let O=g;if(!O){const B=await((S=p.storage)==null?void 0:S.getItem("state"))??{};p.chains.some(k=>k.id===B.chainId)?O=B.chainId:O=(I=p.chains[0])==null?void 0:I.id}if(!O)throw new Error("No chains found on connector.");const M=await this.isChainsStale();if(R.session&&M&&await R.disconnect(),!R.session||M){const B=p.chains.filter(F=>F.id!==O).map(F=>F.id);await R.connect({optionalChains:[O,...B],..."pairingTopic"in x?{pairingTopic:x.pairingTopic}:{}}),this.setRequestedChainsIds(p.chains.map(F=>F.id))}const U=(await R.enable()).map(B=>$s(B)),D=await this.getChainId();return f&&(R.removeListener("display_uri",f),f=void 0),o&&(R.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),R.on("accountsChanged",s)),a||(a=this.onChainChanged.bind(this),R.on("chainChanged",a)),d||(d=this.onDisconnect.bind(this),R.on("disconnect",d)),c||(c=this.onSessionDelete.bind(this),R.on("session_delete",c)),{accounts:U,chainId:D}}catch(R){throw/(user rejected|connection request reset)/i.test(R==null?void 0:R.message)?new ci(R):R}},async disconnect(){const g=await this.getProvider();try{await(g==null?void 0:g.disconnect())}catch(x){if(!/No matching key/i.test(x.message))throw x}finally{a&&(g==null||g.removeListener("chainChanged",a),a=void 0),d&&(g==null||g.removeListener("disconnect",d),d=void 0),o||(o=this.onConnect.bind(this),g==null||g.on("connect",o)),s&&(g==null||g.removeListener("accountsChanged",s),s=void 0),c&&(g==null||g.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(x=>$s(x))},async getProvider({chainId:g}={}){var S;async function x(){const I=p.chains.map(O=>O.id);if(!I.length)return;const{EthereumProvider:R}=await Ya(async()=>{const{EthereumProvider:O}=await Promise.resolve().then(()=>kot);return{EthereumProvider:O}},void 0);return await R.init({...t,disableProviderPing:!0,optionalChains:I,projectId:t.projectId,rpcMap:Object.fromEntries(p.chains.map(O=>{const[M]=tqe({chain:O,transports:p.transports});return[O.id,M]})),showQrModal:t.showQrModal??!0})}return r||(n||(n=x()),r=await n,r==null||r.events.setMaxListeners(Number.POSITIVE_INFINITY)),g&&await((S=this.switchChain)==null?void 0:S.call(this,{chainId:g})),r},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[g,x]=await Promise.all([this.getAccounts(),this.getProvider()]);return g.length?await this.isChainsStale()&&x.session?(await x.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:g,chainId:x}){var R,O,M;const S=await this.getProvider();if(!S)throw new Cp;const I=p.chains.find(U=>U.id===x);if(!I)throw new to(new Dm);try{await Promise.all([new Promise(D=>{const B=({chainId:F})=>{F===x&&(p.emitter.off("change",B),D())};p.emitter.on("change",B)}),S.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(x)}]})]);const U=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...U,x]),I}catch(U){const D=U;if(/(user rejected)/i.test(D.message))throw new ci(D);try{let B;g!=null&&g.blockExplorerUrls?B=g.blockExplorerUrls:B=(R=I.blockExplorers)!=null&&R.default.url?[(O=I.blockExplorers)==null?void 0:O.default.url]:[];let F;(M=g==null?void 0:g.rpcUrls)!=null&&M.length?F=g.rpcUrls:F=[...I.rpcUrls.default.http];const k={blockExplorerUrls:B,chainId:Tr(x),chainName:(g==null?void 0:g.chainName)??I.name,iconUrls:g==null?void 0:g.iconUrls,nativeCurrency:(g==null?void 0:g.nativeCurrency)??I.nativeCurrency,rpcUrls:F};await S.request({method:"wallet_addEthereumChain",params:[k]});const N=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...N,x]),I}catch(B){throw new ci(B)}}},onAccountsChanged(g){g.length===0?this.onDisconnect():p.emitter.emit("change",{accounts:g.map(x=>$s(x))})},onChainChanged(g){const x=Number(g);p.emitter.emit("change",{chainId:x})},async onConnect(g){const x=Number(g.chainId),S=await this.getAccounts();p.emitter.emit("connect",{accounts:S,chainId:x})},async onDisconnect(g){this.setRequestedChainsIds([]),p.emitter.emit("disconnect");const x=await this.getProvider();s&&(x.removeListener("accountsChanged",s),s=void 0),a&&(x.removeListener("chainChanged",a),a=void 0),d&&(x.removeListener("disconnect",d),d=void 0),c&&(x.removeListener("session_delete",c),c=void 0),o||(o=this.onConnect.bind(this),x.on("connect",o))},onDisplayUri(g){p.emitter.emit("message",{type:"display_uri",data:g})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var x,S,I;return r?((I=(S=(x=r.session)==null?void 0:x.namespaces[i])==null?void 0:S.accounts)==null?void 0:I.map(R=>Number.parseInt(R.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var g;return await((g=p.storage)==null?void 0:g.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!e)return!1;const g=p.chains.map(I=>I.id),x=this.getNamespaceChainsIds();if(x.length&&!x.some(I=>g.includes(I)))return!1;const S=await this.getRequestedChainsIds();return!g.every(I=>S.includes(I))},async setRequestedChainsIds(g){var x;await((x=p.storage)==null?void 0:x.setItem(this.requestedChainsStorageKey,g))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}function Fdt(t){function e(r){return vl.parseEvmChainId(r)||1}return r=>({id:_r.AUTH_CONNECTOR_ID,name:"Web3Modal Auth",type:"w3mAuth",socials:t.socials,email:t.email,showWallets:t.showWallets,walletFeatures:t.walletFeatures,chain:zn.CHAIN.EVM,async connect(n={}){const i=await this.getProvider(),{address:s,chainId:a}=await i.connect({chainId:n.chainId});await i.getSmartAccountEnabledNetworks();const o=e(a);return{accounts:[s],account:s,chainId:o,chain:{id:o,unsuported:!1}}},async disconnect(){await(await this.getProvider()).disconnect()},async getAccounts(){const n=await this.getProvider(),{address:i}=await n.connect();return r.emitter.emit("change",{accounts:[i]}),[i]},async getProvider(){return this.provider||(this.provider=new W1t(t.options.projectId)),Promise.resolve(this.provider)},async getChainId(){const n=await this.getProvider(),{chainId:i}=await n.getChainId();return e(i)},async isAuthorized(){const n=await this.getProvider(),{isConnected:i}=await n.isConnected();return i},async switchChain({chainId:n}){try{const i=r.chains.find(o=>o.id===n);if(!i)throw new to(new Error("chain not found on connector."));const a=await(await this.getProvider()).connect({chainId:n});return r.emitter.emit("change",{chainId:Number(n),accounts:[a.address]}),i}catch(i){throw i instanceof Error?new to(i):i}},onAccountsChanged(n){n.length===0?this.onDisconnect():r.emitter.emit("change",{accounts:n.map($s)})},onChainChanged(n){const i=Number(n);r.emitter.emit("change",{chainId:i})},async onConnect(n){const i=Number(n.chainId),s=await this.getAccounts();r.emitter.emit("connect",{accounts:s,chainId:i})},async onDisconnect(n){await(await this.getProvider()).disconnect()}})}function jdt({projectId:t,chains:e,metadata:r,enableCoinbase:n,enableInjected:i,auth:s={},enableWalletConnect:a,enableEIP6963:o,...f}){var S;const c=(f==null?void 0:f.connectors)??[],d=e.map(I=>[I.id,edt({chain:I,projectId:t})]),p=Object.fromEntries(d),g={email:!0,showWallets:!0,walletFeatures:!0,socials:["google","x","discord","farcaster","github","apple","facebook"]};a!==!1&&c.push(hQ({projectId:t,metadata:r,showQrModal:!1})),i!==!1&&c.push($k({shimDisconnect:!0})),n!==!1&&c.push(bP({version:"4",appName:(r==null?void 0:r.name)??"Unknown",appLogoUrl:(r==null?void 0:r.icons[0])??"Unknown",preference:f.coinbasePreference||"all"}));const x={...g,...s};return(x.email||(S=x.socials)!=null&&S.length)&&c.push(Fdt({chains:[...e],options:{projectId:t},socials:x.socials,email:x.email,showWallets:x.showWallets,walletFeatures:x.walletFeatures})),Yze({chains:e,multiInjectedProviderDiscovery:o!==!1,transports:p,...f,connectors:c})}const fwe="6562ee7f0e72671353204776ca7a132c",zdt={name:"Quest Chains EAS Test",description:"Testing creating attestations for Quest Chains.",url:"https://localhost:5173",icons:["https://avatars.githubusercontent.com/u/37784886"]},qdt=[Lot],cwe=jdt({chains:qdt,projectId:fwe,metadata:zdt,auth:{email:!0,socials:["google","x","github","discord","apple"],showWallets:!0,walletFeatures:!0},ssr:!1,storage:sge({storage:Xze})});/** +*/(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",a=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?i=X8e:s&&(i=self);var o=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,f=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],p=[4,1024,262144,67108864],g=[1,256,65536,16777216],x=[6,1536,393216,100663296],S=[0,8,16,24],I=[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],R=[224,256,384,512],O=[128,256],M=["hex","buffer","arrayBuffer","array","digest"],U={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var D=function(y,G,H){return function(K){return new A(y,G,y).update(K)[H]()}},B=function(y,G,H){return function(K,ee){return new A(y,G,ee).update(K)[H]()}},F=function(y,G,H){return function(K,ee,j,X){return l["cshake"+y].update(K,ee,j,X)[H]()}},k=function(y,G,H){return function(K,ee,j,X){return l["kmac"+y].update(K,ee,j,X)[H]()}},N=function(y,G,H,K){for(var ee=0;ee>5,this.byteCount=this.blockCount<<2,this.outputBlocks=H>>5,this.extraBytes=(H&31)>>3;for(var K=0;K<50;++K)this.s[K]=0}A.prototype.update=function(y){if(this.finalized)throw new Error(r);var G,H=typeof y;if(H!=="string"){if(H==="object"){if(y===null)throw new Error(e);if(f&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!f||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);G=!0}for(var K=this.blocks,ee=this.byteCount,j=y.length,X=this.blockCount,oe=0,be=this.s,ue,Te;oe>2]|=y[oe]<>2]|=Te<>2]|=(192|Te>>6)<>2]|=(128|Te&63)<=57344?(K[ue>>2]|=(224|Te>>12)<>2]|=(128|Te>>6&63)<>2]|=(128|Te&63)<>2]|=(240|Te>>18)<>2]|=(128|Te>>12&63)<>2]|=(128|Te>>6&63)<>2]|=(128|Te&63)<=ee){for(this.start=ue-ee,this.block=K[X],ue=0;ue>8,H=y&255;H>0;)ee.unshift(H),y=y>>8,H=y&255,++K;return G?ee.push(K):ee.unshift(K),this.update(ee),ee.length},A.prototype.encodeString=function(y){var G,H=typeof y;if(H!=="string"){if(H==="object"){if(y===null)throw new Error(e);if(f&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!f||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);G=!0}var K=0,ee=y.length;if(G)K=ee;else for(var j=0;j=57344?K+=3:(X=65536+((X&1023)<<10|y.charCodeAt(++j)&1023),K+=4)}return K+=this.encode(K*8),this.update(y),K},A.prototype.bytepad=function(y,G){for(var H=this.encode(G),K=0;K>2]|=this.padding[G&3],this.lastByteIndex===this.byteCount)for(y[0]=y[H],G=1;G>4&15]+c[oe&15]+c[oe>>12&15]+c[oe>>8&15]+c[oe>>20&15]+c[oe>>16&15]+c[oe>>28&15]+c[oe>>24&15];j%y===0&&(ie(G),ee=0)}return K&&(oe=G[ee],X+=c[oe>>4&15]+c[oe&15],K>1&&(X+=c[oe>>12&15]+c[oe>>8&15]),K>2&&(X+=c[oe>>20&15]+c[oe>>16&15])),X},A.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,G=this.s,H=this.outputBlocks,K=this.extraBytes,ee=0,j=0,X=this.outputBits>>3,oe;K?oe=new ArrayBuffer(H+1<<2):oe=new ArrayBuffer(X);for(var be=new Uint32Array(oe);j>8&255,X[oe+2]=be>>16&255,X[oe+3]=be>>24&255;j%y===0&&ie(G)}return K&&(oe=j<<2,be=G[ee],X[oe]=be&255,K>1&&(X[oe+1]=be>>8&255),K>2&&(X[oe+2]=be>>16&255)),X};function Z(y,G,H){A.call(this,y,G,H)}Z.prototype=new A,Z.prototype.finalize=function(){return this.encode(this.outputBits,!0),A.prototype.finalize.call(this)};var ie=function(y){var G,H,K,ee,j,X,oe,be,ue,Te,Ye,Fe,At,tt,Qe,ht,ze,je,lt,Be,Ze,ne,V,$,re,se,le,ve,Re,de,Pe,te,ke,mt,Ue,rt,st,Xe,Ie,Oe,dt,et,q,_e,fe,Ce,we,De,ft,Le,ot,gt,at,bt,Pt,yt,pt,sr,Rr,Mr,kr,Pr,vr;for(K=0;K<48;K+=2)ee=y[0]^y[10]^y[20]^y[30]^y[40],j=y[1]^y[11]^y[21]^y[31]^y[41],X=y[2]^y[12]^y[22]^y[32]^y[42],oe=y[3]^y[13]^y[23]^y[33]^y[43],be=y[4]^y[14]^y[24]^y[34]^y[44],ue=y[5]^y[15]^y[25]^y[35]^y[45],Te=y[6]^y[16]^y[26]^y[36]^y[46],Ye=y[7]^y[17]^y[27]^y[37]^y[47],Fe=y[8]^y[18]^y[28]^y[38]^y[48],At=y[9]^y[19]^y[29]^y[39]^y[49],G=Fe^(X<<1|oe>>>31),H=At^(oe<<1|X>>>31),y[0]^=G,y[1]^=H,y[10]^=G,y[11]^=H,y[20]^=G,y[21]^=H,y[30]^=G,y[31]^=H,y[40]^=G,y[41]^=H,G=ee^(be<<1|ue>>>31),H=j^(ue<<1|be>>>31),y[2]^=G,y[3]^=H,y[12]^=G,y[13]^=H,y[22]^=G,y[23]^=H,y[32]^=G,y[33]^=H,y[42]^=G,y[43]^=H,G=X^(Te<<1|Ye>>>31),H=oe^(Ye<<1|Te>>>31),y[4]^=G,y[5]^=H,y[14]^=G,y[15]^=H,y[24]^=G,y[25]^=H,y[34]^=G,y[35]^=H,y[44]^=G,y[45]^=H,G=be^(Fe<<1|At>>>31),H=ue^(At<<1|Fe>>>31),y[6]^=G,y[7]^=H,y[16]^=G,y[17]^=H,y[26]^=G,y[27]^=H,y[36]^=G,y[37]^=H,y[46]^=G,y[47]^=H,G=Te^(ee<<1|j>>>31),H=Ye^(j<<1|ee>>>31),y[8]^=G,y[9]^=H,y[18]^=G,y[19]^=H,y[28]^=G,y[29]^=H,y[38]^=G,y[39]^=H,y[48]^=G,y[49]^=H,tt=y[0],Qe=y[1],Ce=y[11]<<4|y[10]>>>28,we=y[10]<<4|y[11]>>>28,ve=y[20]<<3|y[21]>>>29,Re=y[21]<<3|y[20]>>>29,Mr=y[31]<<9|y[30]>>>23,kr=y[30]<<9|y[31]>>>23,et=y[40]<<18|y[41]>>>14,q=y[41]<<18|y[40]>>>14,mt=y[2]<<1|y[3]>>>31,Ue=y[3]<<1|y[2]>>>31,ht=y[13]<<12|y[12]>>>20,ze=y[12]<<12|y[13]>>>20,De=y[22]<<10|y[23]>>>22,ft=y[23]<<10|y[22]>>>22,de=y[33]<<13|y[32]>>>19,Pe=y[32]<<13|y[33]>>>19,Pr=y[42]<<2|y[43]>>>30,vr=y[43]<<2|y[42]>>>30,bt=y[5]<<30|y[4]>>>2,Pt=y[4]<<30|y[5]>>>2,rt=y[14]<<6|y[15]>>>26,st=y[15]<<6|y[14]>>>26,je=y[25]<<11|y[24]>>>21,lt=y[24]<<11|y[25]>>>21,Le=y[34]<<15|y[35]>>>17,ot=y[35]<<15|y[34]>>>17,te=y[45]<<29|y[44]>>>3,ke=y[44]<<29|y[45]>>>3,$=y[6]<<28|y[7]>>>4,re=y[7]<<28|y[6]>>>4,yt=y[17]<<23|y[16]>>>9,pt=y[16]<<23|y[17]>>>9,Xe=y[26]<<25|y[27]>>>7,Ie=y[27]<<25|y[26]>>>7,Be=y[36]<<21|y[37]>>>11,Ze=y[37]<<21|y[36]>>>11,gt=y[47]<<24|y[46]>>>8,at=y[46]<<24|y[47]>>>8,_e=y[8]<<27|y[9]>>>5,fe=y[9]<<27|y[8]>>>5,se=y[18]<<20|y[19]>>>12,le=y[19]<<20|y[18]>>>12,sr=y[29]<<7|y[28]>>>25,Rr=y[28]<<7|y[29]>>>25,Oe=y[38]<<8|y[39]>>>24,dt=y[39]<<8|y[38]>>>24,ne=y[48]<<14|y[49]>>>18,V=y[49]<<14|y[48]>>>18,y[0]=tt^~ht&je,y[1]=Qe^~ze<,y[10]=$^~se&ve,y[11]=re^~le&Re,y[20]=mt^~rt&Xe,y[21]=Ue^~st&Ie,y[30]=_e^~Ce&De,y[31]=fe^~we&ft,y[40]=bt^~yt&sr,y[41]=Pt^~pt&Rr,y[2]=ht^~je&Be,y[3]=ze^~lt&Ze,y[12]=se^~ve&de,y[13]=le^~Re&Pe,y[22]=rt^~Xe&Oe,y[23]=st^~Ie&dt,y[32]=Ce^~De&Le,y[33]=we^~ft&ot,y[42]=yt^~sr&Mr,y[43]=pt^~Rr&kr,y[4]=je^~Be&ne,y[5]=lt^~Ze&V,y[14]=ve^~de&te,y[15]=Re^~Pe&ke,y[24]=Xe^~Oe&et,y[25]=Ie^~dt&q,y[34]=De^~Le>,y[35]=ft^~ot&at,y[44]=sr^~Mr&Pr,y[45]=Rr^~kr&vr,y[6]=Be^~ne&tt,y[7]=Ze^~V&Qe,y[16]=de^~te&$,y[17]=Pe^~ke&re,y[26]=Oe^~et&mt,y[27]=dt^~q&Ue,y[36]=Le^~gt&_e,y[37]=ot^~at&fe,y[46]=Mr^~Pr&bt,y[47]=kr^~vr&Pt,y[8]=ne^~tt&ht,y[9]=V^~Qe&ze,y[18]=te^~$&se,y[19]=ke^~re&le,y[28]=et^~mt&rt,y[29]=q^~Ue&st,y[38]=gt^~_e&Ce,y[39]=at^~fe&we,y[48]=Pr^~bt&yt,y[49]=vr^~Pt&pt,y[0]^=I[K],y[1]^=I[K+1]};if(o)t.exports=l;else for(w=0;w{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const Ace=sft();var AH;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(AH||(AH={}));var Kc;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Kc||(Kc={}));const _ce="0123456789abcdef";let Ga=class g0{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();MT[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(xce>MT[n])&&console.log.apply(console,r)}debug(...e){this._log(g0.levels.DEBUG,e)}info(...e){this._log(g0.levels.INFO,e)}warn(...e){this._log(g0.levels.WARNING,e)}makeError(e,r,n){if(vce)return this.makeError("censored error",r,{});r||(r=g0.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(f=>{const c=n[f];try{if(c instanceof Uint8Array){let d="";for(let p=0;p>4],d+=_ce[c[p]&15];i.push(f+"=Uint8Array(0x"+d+")")}else i.push(f+"="+JSON.stringify(c))}catch{i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let a="";switch(r){case Kc.NUMERIC_FAULT:{a="NUMERIC_FAULT";const f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":a+="-"+f;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case Kc.CALL_EXCEPTION:case Kc.INSUFFICIENT_FUNDS:case Kc.MISSING_NEW:case Kc.NONCE_EXPIRED:case Kc.REPLACEMENT_UNDERPRICED:case Kc.TRANSACTION_REPLACED:case Kc.UNPREDICTABLE_GAS_LIMIT:a=r;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const o=new Error(e);return o.reason=s,o.code=r,Object.keys(n).forEach(function(f){o[f]=n[f]}),o}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,g0.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){Ace&&this.throwError("platform missing String.prototype.normalize",g0.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ace})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,g0.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,g0.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,g0.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",g0.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",g0.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",g0.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return kF||(kF=new g0(ift)),kF}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",g0.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),wce){if(!e)return;this.globalLogger().throwError("error censorship permanent",g0.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}vce=!!e,wce=!!r}static setLogLevel(e){const r=MT[e.toLowerCase()];if(r==null){g0.globalLogger().warn("invalid log level - "+e);return}xce=r}static from(e){return new g0(e)}};Ga.errors=Kc,Ga.levels=AH;const aft="bytes/5.7.0",O6=new Ga(aft);function eye(t){return!!t.toHexString}function kT(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return kT(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ece(t){return typeof t=="number"&&t==t&&t%1===0}function P_(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Ece(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function tye(t,e){if(e||(e={}),typeof t=="number"){O6.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),kT(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),eye(t)&&(t=t.toHexString()),Sy(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":O6.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;i>4]+PF[i&15]}return r}return O6.throwArgumentError("invalid hexlify value","value",t)}function cR(t,e){for(typeof t!="string"?t=rye(t):Sy(t)||O6.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&O6.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var nye={exports:{}},oft={},fft=Object.freeze({__proto__:null,default:oft}),cft=rft(fft);(function(t){(function(e,r){function n(u,l){if(!u)throw new Error(l||"Assertion failed")}function i(u,l){u.super_=l;var h=function(){};h.prototype=l.prototype,u.prototype=new h,u.prototype.constructor=u}function s(u,l,h){if(s.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((l==="le"||l==="be")&&(h=l,l=10),this._init(u||0,l||10,h||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=cft.Buffer}catch{}s.isBN=function(u){return u instanceof s?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===s.wordSize&&Array.isArray(u.words)},s.max=function(u,l){return u.cmp(l)>0?u:l},s.min=function(u,l){return u.cmp(l)<0?u:l},s.prototype._init=function(u,l,h){if(typeof u=="number")return this._initNumber(u,l,h);if(typeof u=="object")return this._initArray(u,l,h);l==="hex"&&(l=16),n(l===(l|0)&&l>=2&&l<=36),u=u.toString().replace(/\s+/g,"");var w=0;u[0]==="-"&&(w++,this.negative=1),w=0;w-=3)E=u[w]|u[w-1]<<8|u[w-2]<<16,this.words[_]|=E<>>26-T&67108863,T+=24,T>=26&&(T-=26,_++);else if(h==="le")for(w=0,_=0;w>>26-T&67108863,T+=24,T>=26&&(T-=26,_++);return this._strip()};function o(u,l){var h=u.charCodeAt(l);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+u)}function f(u,l,h){var w=o(u,h);return h-1>=l&&(w|=o(u,h-1)<<4),w}s.prototype._parseHex=function(u,l,h){this.length=Math.ceil((u.length-l)/6),this.words=new Array(this.length);for(var w=0;w=l;w-=2)T=f(u,l,w)<<_,this.words[E]|=T&67108863,_>=18?(_-=18,E+=1,this.words[E]|=T>>>26):_+=8;else{var v=u.length-l;for(w=v%2===0?l+1:l;w=18?(_-=18,E+=1,this.words[E]|=T>>>26):_+=8}this._strip()};function c(u,l,h,w){for(var _=0,E=0,T=Math.min(u.length,h),v=l;v=49?E=m-49+10:m>=17?E=m-17+10:E=m,n(m>=0&&E1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{s.prototype.inspect=p}else s.prototype.inspect=p;function p(){return(this.red?""}var g=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],x=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],S=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(u,l){u=u||10,l=l|0||1;var h;if(u===16||u==="hex"){h="";for(var w=0,_=0,E=0;E>>24-w&16777215,w+=2,w>=26&&(w-=26,E--),_!==0||E!==this.length-1?h=g[6-v.length]+v+h:h=v+h}for(_!==0&&(h=_.toString(16)+h);h.length%l!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(u===(u|0)&&u>=2&&u<=36){var m=x[u],A=S[u];h="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ie=Z.modrn(A).toString(u);Z=Z.idivn(A),Z.isZero()?h=ie+h:h=g[m-ie.length]+ie+h}for(this.isZero()&&(h="0"+h);h.length%l!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(u,l){return this.toArrayLike(a,u,l)}),s.prototype.toArray=function(u,l){return this.toArrayLike(Array,u,l)};var I=function(u,l){return u.allocUnsafe?u.allocUnsafe(l):new u(l)};s.prototype.toArrayLike=function(u,l,h){this._strip();var w=this.byteLength(),_=h||Math.max(1,w);n(w<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var E=I(u,_),T=l==="le"?"LE":"BE";return this["_toArrayLike"+T](E,w),E},s.prototype._toArrayLikeLE=function(u,l){for(var h=0,w=0,_=0,E=0;_>8&255),h>16&255),E===6?(h>24&255),w=0,E=0):(w=T>>>24,E+=2)}if(h=0&&(u[h--]=T>>8&255),h>=0&&(u[h--]=T>>16&255),E===6?(h>=0&&(u[h--]=T>>24&255),w=0,E=0):(w=T>>>24,E+=2)}if(h>=0)for(u[h--]=w;h>=0;)u[h--]=0},Math.clz32?s.prototype._countBits=function(u){return 32-Math.clz32(u)}:s.prototype._countBits=function(u){var l=u,h=0;return l>=4096&&(h+=13,l>>>=13),l>=64&&(h+=7,l>>>=7),l>=8&&(h+=4,l>>>=4),l>=2&&(h+=2,l>>>=2),h+l},s.prototype._zeroBits=function(u){if(u===0)return 26;var l=u,h=0;return l&8191||(h+=13,l>>>=13),l&127||(h+=7,l>>>=7),l&15||(h+=4,l>>>=4),l&3||(h+=2,l>>>=2),l&1||h++,h},s.prototype.bitLength=function(){var u=this.words[this.length-1],l=this._countBits(u);return(this.length-1)*26+l};function R(u){for(var l=new Array(u.bitLength()),h=0;h>>_&1}return l}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,l=0;lu.length?this.clone().ior(u):u.clone().ior(this)},s.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},s.prototype.iuand=function(u){var l;this.length>u.length?l=u:l=this;for(var h=0;hu.length?this.clone().iand(u):u.clone().iand(this)},s.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},s.prototype.iuxor=function(u){var l,h;this.length>u.length?(l=this,h=u):(l=u,h=this);for(var w=0;wu.length?this.clone().ixor(u):u.clone().ixor(this)},s.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},s.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var l=Math.ceil(u/26)|0,h=u%26;this._expand(l),h>0&&l--;for(var w=0;w0&&(this.words[w]=~this.words[w]&67108863>>26-h),this._strip()},s.prototype.notn=function(u){return this.clone().inotn(u)},s.prototype.setn=function(u,l){n(typeof u=="number"&&u>=0);var h=u/26|0,w=u%26;return this._expand(h+1),l?this.words[h]=this.words[h]|1<u.length?(h=this,w=u):(h=u,w=this);for(var _=0,E=0;E>>26;for(;_!==0&&E>>26;if(this.length=h.length,_!==0)this.words[this.length]=_,this.length++;else if(h!==this)for(;Eu.length?this.clone().iadd(u):u.clone().iadd(this)},s.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var l=this.iadd(u);return u.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var h=this.cmp(u);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,_;h>0?(w=this,_=u):(w=u,_=this);for(var E=0,T=0;T<_.length;T++)l=(w.words[T]|0)-(_.words[T]|0)+E,E=l>>26,this.words[T]=l&67108863;for(;E!==0&&T>26,this.words[T]=l&67108863;if(E===0&&T>>26,ie=m&67108863,y=Math.min(A,l.length-1),G=Math.max(0,A-u.length+1);G<=y;G++){var H=A-G|0;_=u.words[H]|0,E=l.words[G]|0,T=_*E+ie,Z+=T/67108864|0,ie=T&67108863}h.words[A]=ie|0,m=Z|0}return m!==0?h.words[A]=m|0:h.length--,h._strip()}var M=function(u,l,h){var w=u.words,_=l.words,E=h.words,T=0,v,m,A,Z=w[0]|0,ie=Z&8191,y=Z>>>13,G=w[1]|0,H=G&8191,K=G>>>13,ee=w[2]|0,j=ee&8191,X=ee>>>13,oe=w[3]|0,be=oe&8191,ue=oe>>>13,Te=w[4]|0,Ye=Te&8191,Fe=Te>>>13,At=w[5]|0,tt=At&8191,Qe=At>>>13,ht=w[6]|0,ze=ht&8191,je=ht>>>13,lt=w[7]|0,Be=lt&8191,Ze=lt>>>13,ne=w[8]|0,V=ne&8191,$=ne>>>13,re=w[9]|0,se=re&8191,le=re>>>13,ve=_[0]|0,Re=ve&8191,de=ve>>>13,Pe=_[1]|0,te=Pe&8191,ke=Pe>>>13,mt=_[2]|0,Ue=mt&8191,rt=mt>>>13,st=_[3]|0,Xe=st&8191,Ie=st>>>13,Oe=_[4]|0,dt=Oe&8191,et=Oe>>>13,q=_[5]|0,_e=q&8191,fe=q>>>13,Ce=_[6]|0,we=Ce&8191,De=Ce>>>13,ft=_[7]|0,Le=ft&8191,ot=ft>>>13,gt=_[8]|0,at=gt&8191,bt=gt>>>13,Pt=_[9]|0,yt=Pt&8191,pt=Pt>>>13;h.negative=u.negative^l.negative,h.length=19,v=Math.imul(ie,Re),m=Math.imul(ie,de),m=m+Math.imul(y,Re)|0,A=Math.imul(y,de);var sr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(sr>>>26)|0,sr&=67108863,v=Math.imul(H,Re),m=Math.imul(H,de),m=m+Math.imul(K,Re)|0,A=Math.imul(K,de),v=v+Math.imul(ie,te)|0,m=m+Math.imul(ie,ke)|0,m=m+Math.imul(y,te)|0,A=A+Math.imul(y,ke)|0;var Rr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Rr>>>26)|0,Rr&=67108863,v=Math.imul(j,Re),m=Math.imul(j,de),m=m+Math.imul(X,Re)|0,A=Math.imul(X,de),v=v+Math.imul(H,te)|0,m=m+Math.imul(H,ke)|0,m=m+Math.imul(K,te)|0,A=A+Math.imul(K,ke)|0,v=v+Math.imul(ie,Ue)|0,m=m+Math.imul(ie,rt)|0,m=m+Math.imul(y,Ue)|0,A=A+Math.imul(y,rt)|0;var Mr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,v=Math.imul(be,Re),m=Math.imul(be,de),m=m+Math.imul(ue,Re)|0,A=Math.imul(ue,de),v=v+Math.imul(j,te)|0,m=m+Math.imul(j,ke)|0,m=m+Math.imul(X,te)|0,A=A+Math.imul(X,ke)|0,v=v+Math.imul(H,Ue)|0,m=m+Math.imul(H,rt)|0,m=m+Math.imul(K,Ue)|0,A=A+Math.imul(K,rt)|0,v=v+Math.imul(ie,Xe)|0,m=m+Math.imul(ie,Ie)|0,m=m+Math.imul(y,Xe)|0,A=A+Math.imul(y,Ie)|0;var kr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(kr>>>26)|0,kr&=67108863,v=Math.imul(Ye,Re),m=Math.imul(Ye,de),m=m+Math.imul(Fe,Re)|0,A=Math.imul(Fe,de),v=v+Math.imul(be,te)|0,m=m+Math.imul(be,ke)|0,m=m+Math.imul(ue,te)|0,A=A+Math.imul(ue,ke)|0,v=v+Math.imul(j,Ue)|0,m=m+Math.imul(j,rt)|0,m=m+Math.imul(X,Ue)|0,A=A+Math.imul(X,rt)|0,v=v+Math.imul(H,Xe)|0,m=m+Math.imul(H,Ie)|0,m=m+Math.imul(K,Xe)|0,A=A+Math.imul(K,Ie)|0,v=v+Math.imul(ie,dt)|0,m=m+Math.imul(ie,et)|0,m=m+Math.imul(y,dt)|0,A=A+Math.imul(y,et)|0;var Pr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Pr>>>26)|0,Pr&=67108863,v=Math.imul(tt,Re),m=Math.imul(tt,de),m=m+Math.imul(Qe,Re)|0,A=Math.imul(Qe,de),v=v+Math.imul(Ye,te)|0,m=m+Math.imul(Ye,ke)|0,m=m+Math.imul(Fe,te)|0,A=A+Math.imul(Fe,ke)|0,v=v+Math.imul(be,Ue)|0,m=m+Math.imul(be,rt)|0,m=m+Math.imul(ue,Ue)|0,A=A+Math.imul(ue,rt)|0,v=v+Math.imul(j,Xe)|0,m=m+Math.imul(j,Ie)|0,m=m+Math.imul(X,Xe)|0,A=A+Math.imul(X,Ie)|0,v=v+Math.imul(H,dt)|0,m=m+Math.imul(H,et)|0,m=m+Math.imul(K,dt)|0,A=A+Math.imul(K,et)|0,v=v+Math.imul(ie,_e)|0,m=m+Math.imul(ie,fe)|0,m=m+Math.imul(y,_e)|0,A=A+Math.imul(y,fe)|0;var vr=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(vr>>>26)|0,vr&=67108863,v=Math.imul(ze,Re),m=Math.imul(ze,de),m=m+Math.imul(je,Re)|0,A=Math.imul(je,de),v=v+Math.imul(tt,te)|0,m=m+Math.imul(tt,ke)|0,m=m+Math.imul(Qe,te)|0,A=A+Math.imul(Qe,ke)|0,v=v+Math.imul(Ye,Ue)|0,m=m+Math.imul(Ye,rt)|0,m=m+Math.imul(Fe,Ue)|0,A=A+Math.imul(Fe,rt)|0,v=v+Math.imul(be,Xe)|0,m=m+Math.imul(be,Ie)|0,m=m+Math.imul(ue,Xe)|0,A=A+Math.imul(ue,Ie)|0,v=v+Math.imul(j,dt)|0,m=m+Math.imul(j,et)|0,m=m+Math.imul(X,dt)|0,A=A+Math.imul(X,et)|0,v=v+Math.imul(H,_e)|0,m=m+Math.imul(H,fe)|0,m=m+Math.imul(K,_e)|0,A=A+Math.imul(K,fe)|0,v=v+Math.imul(ie,we)|0,m=m+Math.imul(ie,De)|0,m=m+Math.imul(y,we)|0,A=A+Math.imul(y,De)|0;var Zn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,v=Math.imul(Be,Re),m=Math.imul(Be,de),m=m+Math.imul(Ze,Re)|0,A=Math.imul(Ze,de),v=v+Math.imul(ze,te)|0,m=m+Math.imul(ze,ke)|0,m=m+Math.imul(je,te)|0,A=A+Math.imul(je,ke)|0,v=v+Math.imul(tt,Ue)|0,m=m+Math.imul(tt,rt)|0,m=m+Math.imul(Qe,Ue)|0,A=A+Math.imul(Qe,rt)|0,v=v+Math.imul(Ye,Xe)|0,m=m+Math.imul(Ye,Ie)|0,m=m+Math.imul(Fe,Xe)|0,A=A+Math.imul(Fe,Ie)|0,v=v+Math.imul(be,dt)|0,m=m+Math.imul(be,et)|0,m=m+Math.imul(ue,dt)|0,A=A+Math.imul(ue,et)|0,v=v+Math.imul(j,_e)|0,m=m+Math.imul(j,fe)|0,m=m+Math.imul(X,_e)|0,A=A+Math.imul(X,fe)|0,v=v+Math.imul(H,we)|0,m=m+Math.imul(H,De)|0,m=m+Math.imul(K,we)|0,A=A+Math.imul(K,De)|0,v=v+Math.imul(ie,Le)|0,m=m+Math.imul(ie,ot)|0,m=m+Math.imul(y,Le)|0,A=A+Math.imul(y,ot)|0;var bi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(bi>>>26)|0,bi&=67108863,v=Math.imul(V,Re),m=Math.imul(V,de),m=m+Math.imul($,Re)|0,A=Math.imul($,de),v=v+Math.imul(Be,te)|0,m=m+Math.imul(Be,ke)|0,m=m+Math.imul(Ze,te)|0,A=A+Math.imul(Ze,ke)|0,v=v+Math.imul(ze,Ue)|0,m=m+Math.imul(ze,rt)|0,m=m+Math.imul(je,Ue)|0,A=A+Math.imul(je,rt)|0,v=v+Math.imul(tt,Xe)|0,m=m+Math.imul(tt,Ie)|0,m=m+Math.imul(Qe,Xe)|0,A=A+Math.imul(Qe,Ie)|0,v=v+Math.imul(Ye,dt)|0,m=m+Math.imul(Ye,et)|0,m=m+Math.imul(Fe,dt)|0,A=A+Math.imul(Fe,et)|0,v=v+Math.imul(be,_e)|0,m=m+Math.imul(be,fe)|0,m=m+Math.imul(ue,_e)|0,A=A+Math.imul(ue,fe)|0,v=v+Math.imul(j,we)|0,m=m+Math.imul(j,De)|0,m=m+Math.imul(X,we)|0,A=A+Math.imul(X,De)|0,v=v+Math.imul(H,Le)|0,m=m+Math.imul(H,ot)|0,m=m+Math.imul(K,Le)|0,A=A+Math.imul(K,ot)|0,v=v+Math.imul(ie,at)|0,m=m+Math.imul(ie,bt)|0,m=m+Math.imul(y,at)|0,A=A+Math.imul(y,bt)|0;var Yn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,v=Math.imul(se,Re),m=Math.imul(se,de),m=m+Math.imul(le,Re)|0,A=Math.imul(le,de),v=v+Math.imul(V,te)|0,m=m+Math.imul(V,ke)|0,m=m+Math.imul($,te)|0,A=A+Math.imul($,ke)|0,v=v+Math.imul(Be,Ue)|0,m=m+Math.imul(Be,rt)|0,m=m+Math.imul(Ze,Ue)|0,A=A+Math.imul(Ze,rt)|0,v=v+Math.imul(ze,Xe)|0,m=m+Math.imul(ze,Ie)|0,m=m+Math.imul(je,Xe)|0,A=A+Math.imul(je,Ie)|0,v=v+Math.imul(tt,dt)|0,m=m+Math.imul(tt,et)|0,m=m+Math.imul(Qe,dt)|0,A=A+Math.imul(Qe,et)|0,v=v+Math.imul(Ye,_e)|0,m=m+Math.imul(Ye,fe)|0,m=m+Math.imul(Fe,_e)|0,A=A+Math.imul(Fe,fe)|0,v=v+Math.imul(be,we)|0,m=m+Math.imul(be,De)|0,m=m+Math.imul(ue,we)|0,A=A+Math.imul(ue,De)|0,v=v+Math.imul(j,Le)|0,m=m+Math.imul(j,ot)|0,m=m+Math.imul(X,Le)|0,A=A+Math.imul(X,ot)|0,v=v+Math.imul(H,at)|0,m=m+Math.imul(H,bt)|0,m=m+Math.imul(K,at)|0,A=A+Math.imul(K,bt)|0,v=v+Math.imul(ie,yt)|0,m=m+Math.imul(ie,pt)|0,m=m+Math.imul(y,yt)|0,A=A+Math.imul(y,pt)|0;var yi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(yi>>>26)|0,yi&=67108863,v=Math.imul(se,te),m=Math.imul(se,ke),m=m+Math.imul(le,te)|0,A=Math.imul(le,ke),v=v+Math.imul(V,Ue)|0,m=m+Math.imul(V,rt)|0,m=m+Math.imul($,Ue)|0,A=A+Math.imul($,rt)|0,v=v+Math.imul(Be,Xe)|0,m=m+Math.imul(Be,Ie)|0,m=m+Math.imul(Ze,Xe)|0,A=A+Math.imul(Ze,Ie)|0,v=v+Math.imul(ze,dt)|0,m=m+Math.imul(ze,et)|0,m=m+Math.imul(je,dt)|0,A=A+Math.imul(je,et)|0,v=v+Math.imul(tt,_e)|0,m=m+Math.imul(tt,fe)|0,m=m+Math.imul(Qe,_e)|0,A=A+Math.imul(Qe,fe)|0,v=v+Math.imul(Ye,we)|0,m=m+Math.imul(Ye,De)|0,m=m+Math.imul(Fe,we)|0,A=A+Math.imul(Fe,De)|0,v=v+Math.imul(be,Le)|0,m=m+Math.imul(be,ot)|0,m=m+Math.imul(ue,Le)|0,A=A+Math.imul(ue,ot)|0,v=v+Math.imul(j,at)|0,m=m+Math.imul(j,bt)|0,m=m+Math.imul(X,at)|0,A=A+Math.imul(X,bt)|0,v=v+Math.imul(H,yt)|0,m=m+Math.imul(H,pt)|0,m=m+Math.imul(K,yt)|0,A=A+Math.imul(K,pt)|0;var wi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(wi>>>26)|0,wi&=67108863,v=Math.imul(se,Ue),m=Math.imul(se,rt),m=m+Math.imul(le,Ue)|0,A=Math.imul(le,rt),v=v+Math.imul(V,Xe)|0,m=m+Math.imul(V,Ie)|0,m=m+Math.imul($,Xe)|0,A=A+Math.imul($,Ie)|0,v=v+Math.imul(Be,dt)|0,m=m+Math.imul(Be,et)|0,m=m+Math.imul(Ze,dt)|0,A=A+Math.imul(Ze,et)|0,v=v+Math.imul(ze,_e)|0,m=m+Math.imul(ze,fe)|0,m=m+Math.imul(je,_e)|0,A=A+Math.imul(je,fe)|0,v=v+Math.imul(tt,we)|0,m=m+Math.imul(tt,De)|0,m=m+Math.imul(Qe,we)|0,A=A+Math.imul(Qe,De)|0,v=v+Math.imul(Ye,Le)|0,m=m+Math.imul(Ye,ot)|0,m=m+Math.imul(Fe,Le)|0,A=A+Math.imul(Fe,ot)|0,v=v+Math.imul(be,at)|0,m=m+Math.imul(be,bt)|0,m=m+Math.imul(ue,at)|0,A=A+Math.imul(ue,bt)|0,v=v+Math.imul(j,yt)|0,m=m+Math.imul(j,pt)|0,m=m+Math.imul(X,yt)|0,A=A+Math.imul(X,pt)|0;var Jn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,v=Math.imul(se,Xe),m=Math.imul(se,Ie),m=m+Math.imul(le,Xe)|0,A=Math.imul(le,Ie),v=v+Math.imul(V,dt)|0,m=m+Math.imul(V,et)|0,m=m+Math.imul($,dt)|0,A=A+Math.imul($,et)|0,v=v+Math.imul(Be,_e)|0,m=m+Math.imul(Be,fe)|0,m=m+Math.imul(Ze,_e)|0,A=A+Math.imul(Ze,fe)|0,v=v+Math.imul(ze,we)|0,m=m+Math.imul(ze,De)|0,m=m+Math.imul(je,we)|0,A=A+Math.imul(je,De)|0,v=v+Math.imul(tt,Le)|0,m=m+Math.imul(tt,ot)|0,m=m+Math.imul(Qe,Le)|0,A=A+Math.imul(Qe,ot)|0,v=v+Math.imul(Ye,at)|0,m=m+Math.imul(Ye,bt)|0,m=m+Math.imul(Fe,at)|0,A=A+Math.imul(Fe,bt)|0,v=v+Math.imul(be,yt)|0,m=m+Math.imul(be,pt)|0,m=m+Math.imul(ue,yt)|0,A=A+Math.imul(ue,pt)|0;var di=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(di>>>26)|0,di&=67108863,v=Math.imul(se,dt),m=Math.imul(se,et),m=m+Math.imul(le,dt)|0,A=Math.imul(le,et),v=v+Math.imul(V,_e)|0,m=m+Math.imul(V,fe)|0,m=m+Math.imul($,_e)|0,A=A+Math.imul($,fe)|0,v=v+Math.imul(Be,we)|0,m=m+Math.imul(Be,De)|0,m=m+Math.imul(Ze,we)|0,A=A+Math.imul(Ze,De)|0,v=v+Math.imul(ze,Le)|0,m=m+Math.imul(ze,ot)|0,m=m+Math.imul(je,Le)|0,A=A+Math.imul(je,ot)|0,v=v+Math.imul(tt,at)|0,m=m+Math.imul(tt,bt)|0,m=m+Math.imul(Qe,at)|0,A=A+Math.imul(Qe,bt)|0,v=v+Math.imul(Ye,yt)|0,m=m+Math.imul(Ye,pt)|0,m=m+Math.imul(Fe,yt)|0,A=A+Math.imul(Fe,pt)|0;var hi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(hi>>>26)|0,hi&=67108863,v=Math.imul(se,_e),m=Math.imul(se,fe),m=m+Math.imul(le,_e)|0,A=Math.imul(le,fe),v=v+Math.imul(V,we)|0,m=m+Math.imul(V,De)|0,m=m+Math.imul($,we)|0,A=A+Math.imul($,De)|0,v=v+Math.imul(Be,Le)|0,m=m+Math.imul(Be,ot)|0,m=m+Math.imul(Ze,Le)|0,A=A+Math.imul(Ze,ot)|0,v=v+Math.imul(ze,at)|0,m=m+Math.imul(ze,bt)|0,m=m+Math.imul(je,at)|0,A=A+Math.imul(je,bt)|0,v=v+Math.imul(tt,yt)|0,m=m+Math.imul(tt,pt)|0,m=m+Math.imul(Qe,yt)|0,A=A+Math.imul(Qe,pt)|0;var Cn=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,v=Math.imul(se,we),m=Math.imul(se,De),m=m+Math.imul(le,we)|0,A=Math.imul(le,De),v=v+Math.imul(V,Le)|0,m=m+Math.imul(V,ot)|0,m=m+Math.imul($,Le)|0,A=A+Math.imul($,ot)|0,v=v+Math.imul(Be,at)|0,m=m+Math.imul(Be,bt)|0,m=m+Math.imul(Ze,at)|0,A=A+Math.imul(Ze,bt)|0,v=v+Math.imul(ze,yt)|0,m=m+Math.imul(ze,pt)|0,m=m+Math.imul(je,yt)|0,A=A+Math.imul(je,pt)|0;var vi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(vi>>>26)|0,vi&=67108863,v=Math.imul(se,Le),m=Math.imul(se,ot),m=m+Math.imul(le,Le)|0,A=Math.imul(le,ot),v=v+Math.imul(V,at)|0,m=m+Math.imul(V,bt)|0,m=m+Math.imul($,at)|0,A=A+Math.imul($,bt)|0,v=v+Math.imul(Be,yt)|0,m=m+Math.imul(Be,pt)|0,m=m+Math.imul(Ze,yt)|0,A=A+Math.imul(Ze,pt)|0;var xi=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(xi>>>26)|0,xi&=67108863,v=Math.imul(se,at),m=Math.imul(se,bt),m=m+Math.imul(le,at)|0,A=Math.imul(le,bt),v=v+Math.imul(V,yt)|0,m=m+Math.imul(V,pt)|0,m=m+Math.imul($,yt)|0,A=A+Math.imul($,pt)|0;var Ai=(T+v|0)+((m&8191)<<13)|0;T=(A+(m>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,v=Math.imul(se,yt),m=Math.imul(se,pt),m=m+Math.imul(le,yt)|0,A=Math.imul(le,pt);var l0=(T+v|0)+((m&8191)<<13)|0;return T=(A+(m>>>13)|0)+(l0>>>26)|0,l0&=67108863,E[0]=sr,E[1]=Rr,E[2]=Mr,E[3]=kr,E[4]=Pr,E[5]=vr,E[6]=Zn,E[7]=bi,E[8]=Yn,E[9]=yi,E[10]=wi,E[11]=Jn,E[12]=di,E[13]=hi,E[14]=Cn,E[15]=vi,E[16]=xi,E[17]=Ai,E[18]=l0,T!==0&&(E[19]=T,h.length++),h};Math.imul||(M=O);function U(u,l,h){h.negative=l.negative^u.negative,h.length=u.length+l.length;for(var w=0,_=0,E=0;E>>26)|0,_+=T>>>26,T&=67108863}h.words[E]=v,w=T,T=_}return w!==0?h.words[E]=w:h.length--,h._strip()}function D(u,l,h){return U(u,l,h)}s.prototype.mulTo=function(u,l){var h,w=this.length+u.length;return this.length===10&&u.length===10?h=M(this,u,l):w<63?h=O(this,u,l):w<1024?h=U(this,u,l):h=D(this,u,l),h},s.prototype.mul=function(u){var l=new s(null);return l.words=new Array(this.length+u.length),this.mulTo(u,l)},s.prototype.mulf=function(u){var l=new s(null);return l.words=new Array(this.length+u.length),D(this,u,l)},s.prototype.imul=function(u){return this.clone().mulTo(u,this)},s.prototype.imuln=function(u){var l=u<0;l&&(u=-u),n(typeof u=="number"),n(u<67108864);for(var h=0,w=0;w>=26,h+=_/67108864|0,h+=E>>>26,this.words[w]=E&67108863}return h!==0&&(this.words[w]=h,this.length++),l?this.ineg():this},s.prototype.muln=function(u){return this.clone().imuln(u)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(u){var l=R(u);if(l.length===0)return new s(1);for(var h=this,w=0;w=0);var l=u%26,h=(u-l)/26,w=67108863>>>26-l<<26-l,_;if(l!==0){var E=0;for(_=0;_>>26-l}E&&(this.words[_]=E,this.length++)}if(h!==0){for(_=this.length-1;_>=0;_--)this.words[_+h]=this.words[_];for(_=0;_=0);var w;l?w=(l-l%26)/26:w=0;var _=u%26,E=Math.min((u-_)/26,this.length),T=67108863^67108863>>>_<<_,v=h;if(w-=E,w=Math.max(0,w),v){for(var m=0;mE)for(this.length-=E,m=0;m=0&&(A!==0||m>=w);m--){var Z=this.words[m]|0;this.words[m]=A<<26-_|Z>>>_,A=Z&T}return v&&A!==0&&(v.words[v.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(u,l,h){return n(this.negative===0),this.iushrn(u,l,h)},s.prototype.shln=function(u){return this.clone().ishln(u)},s.prototype.ushln=function(u){return this.clone().iushln(u)},s.prototype.shrn=function(u){return this.clone().ishrn(u)},s.prototype.ushrn=function(u){return this.clone().iushrn(u)},s.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var l=u%26,h=(u-l)/26,w=1<=0);var l=u%26,h=(u-l)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(l!==0&&h++,this.length=Math.min(h,this.length),l!==0){var w=67108863^67108863>>>l<=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},s.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l>26)-(v/67108864|0),this.words[_+h]=E&67108863}for(;_>26,this.words[_+h]=E&67108863;if(T===0)return this._strip();for(n(T===-1),T=0,_=0;_>26,this.words[_]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(u,l){var h=this.length-u.length,w=this.clone(),_=u,E=_.words[_.length-1]|0,T=this._countBits(E);h=26-T,h!==0&&(_=_.ushln(h),w.iushln(h),E=_.words[_.length-1]|0);var v=w.length-_.length,m;if(l!=="mod"){m=new s(null),m.length=v+1,m.words=new Array(m.length);for(var A=0;A=0;ie--){var y=(w.words[_.length+ie]|0)*67108864+(w.words[_.length+ie-1]|0);for(y=Math.min(y/E|0,67108863),w._ishlnsubmul(_,y,ie);w.negative!==0;)y--,w.negative=0,w._ishlnsubmul(_,1,ie),w.isZero()||(w.negative^=1);m&&(m.words[ie]=y)}return m&&m._strip(),w._strip(),l!=="div"&&h!==0&&w.iushrn(h),{div:m||null,mod:w}},s.prototype.divmod=function(u,l,h){if(n(!u.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var w,_,E;return this.negative!==0&&u.negative===0?(E=this.neg().divmod(u,l),l!=="mod"&&(w=E.div.neg()),l!=="div"&&(_=E.mod.neg(),h&&_.negative!==0&&_.iadd(u)),{div:w,mod:_}):this.negative===0&&u.negative!==0?(E=this.divmod(u.neg(),l),l!=="mod"&&(w=E.div.neg()),{div:w,mod:E.mod}):this.negative&u.negative?(E=this.neg().divmod(u.neg(),l),l!=="div"&&(_=E.mod.neg(),h&&_.negative!==0&&_.isub(u)),{div:E.div,mod:_}):u.length>this.length||this.cmp(u)<0?{div:new s(0),mod:this}:u.length===1?l==="div"?{div:this.divn(u.words[0]),mod:null}:l==="mod"?{div:null,mod:new s(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new s(this.modrn(u.words[0]))}:this._wordDiv(u,l)},s.prototype.div=function(u){return this.divmod(u,"div",!1).div},s.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},s.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},s.prototype.divRound=function(u){var l=this.divmod(u);if(l.mod.isZero())return l.div;var h=l.div.negative!==0?l.mod.isub(u):l.mod,w=u.ushrn(1),_=u.andln(1),E=h.cmp(w);return E<0||_===1&&E===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},s.prototype.modrn=function(u){var l=u<0;l&&(u=-u),n(u<=67108863);for(var h=(1<<26)%u,w=0,_=this.length-1;_>=0;_--)w=(h*w+(this.words[_]|0))%u;return l?-w:w},s.prototype.modn=function(u){return this.modrn(u)},s.prototype.idivn=function(u){var l=u<0;l&&(u=-u),n(u<=67108863);for(var h=0,w=this.length-1;w>=0;w--){var _=(this.words[w]|0)+h*67108864;this.words[w]=_/u|0,h=_%u}return this._strip(),l?this.ineg():this},s.prototype.divn=function(u){return this.clone().idivn(u)},s.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var l=this,h=u.clone();l.negative!==0?l=l.umod(u):l=l.clone();for(var w=new s(1),_=new s(0),E=new s(0),T=new s(1),v=0;l.isEven()&&h.isEven();)l.iushrn(1),h.iushrn(1),++v;for(var m=h.clone(),A=l.clone();!l.isZero();){for(var Z=0,ie=1;!(l.words[0]&ie)&&Z<26;++Z,ie<<=1);if(Z>0)for(l.iushrn(Z);Z-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(m),_.isub(A)),w.iushrn(1),_.iushrn(1);for(var y=0,G=1;!(h.words[0]&G)&&y<26;++y,G<<=1);if(y>0)for(h.iushrn(y);y-- >0;)(E.isOdd()||T.isOdd())&&(E.iadd(m),T.isub(A)),E.iushrn(1),T.iushrn(1);l.cmp(h)>=0?(l.isub(h),w.isub(E),_.isub(T)):(h.isub(l),E.isub(w),T.isub(_))}return{a:E,b:T,gcd:h.iushln(v)}},s.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var l=this,h=u.clone();l.negative!==0?l=l.umod(u):l=l.clone();for(var w=new s(1),_=new s(0),E=h.clone();l.cmpn(1)>0&&h.cmpn(1)>0;){for(var T=0,v=1;!(l.words[0]&v)&&T<26;++T,v<<=1);if(T>0)for(l.iushrn(T);T-- >0;)w.isOdd()&&w.iadd(E),w.iushrn(1);for(var m=0,A=1;!(h.words[0]&A)&&m<26;++m,A<<=1);if(m>0)for(h.iushrn(m);m-- >0;)_.isOdd()&&_.iadd(E),_.iushrn(1);l.cmp(h)>=0?(l.isub(h),w.isub(_)):(h.isub(l),_.isub(w))}var Z;return l.cmpn(1)===0?Z=w:Z=_,Z.cmpn(0)<0&&Z.iadd(u),Z},s.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var l=this.clone(),h=u.clone();l.negative=0,h.negative=0;for(var w=0;l.isEven()&&h.isEven();w++)l.iushrn(1),h.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;h.isEven();)h.iushrn(1);var _=l.cmp(h);if(_<0){var E=l;l=h,h=E}else if(_===0||h.cmpn(1)===0)break;l.isub(h)}while(!0);return h.iushln(w)},s.prototype.invm=function(u){return this.egcd(u).a.umod(u)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(u){return this.words[0]&u},s.prototype.bincn=function(u){n(typeof u=="number");var l=u%26,h=(u-l)/26,w=1<>>26,T&=67108863,this.words[E]=T}return _!==0&&(this.words[E]=_,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(u){var l=u<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this._strip();var h;if(this.length>1)h=1;else{l&&(u=-u),n(u<=67108863,"Number is too big");var w=this.words[0]|0;h=w===u?0:wu.length)return 1;if(this.length=0;h--){var w=this.words[h]|0,_=u.words[h]|0;if(w!==_){w<_?l=-1:w>_&&(l=1);break}}return l},s.prototype.gtn=function(u){return this.cmpn(u)===1},s.prototype.gt=function(u){return this.cmp(u)===1},s.prototype.gten=function(u){return this.cmpn(u)>=0},s.prototype.gte=function(u){return this.cmp(u)>=0},s.prototype.ltn=function(u){return this.cmpn(u)===-1},s.prototype.lt=function(u){return this.cmp(u)===-1},s.prototype.lten=function(u){return this.cmpn(u)<=0},s.prototype.lte=function(u){return this.cmp(u)<=0},s.prototype.eqn=function(u){return this.cmpn(u)===0},s.prototype.eq=function(u){return this.cmp(u)===0},s.red=function(u){return new z(u)},s.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(u){return this.red=u,this},s.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},s.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},s.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},s.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},s.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},s.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},s.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},s.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var B={k256:null,p224:null,p192:null,p25519:null};function F(u,l){this.name=u,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var u=new s(null);return u.words=new Array(Math.ceil(this.n/13)),u},F.prototype.ireduce=function(u){var l=u,h;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),h=l.bitLength();while(h>this.n);var w=h0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},F.prototype.split=function(u,l){u.iushrn(this.n,0,l)},F.prototype.imulK=function(u){return u.imul(this.k)};function k(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(k,F),k.prototype.split=function(u,l){for(var h=4194303,w=Math.min(u.length,9),_=0;_>>22,E=T}E>>>=22,u.words[_-10]=E,E===0&&u.length>10?u.length-=10:u.length-=9},k.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var l=0,h=0;h>>=26,u.words[h]=_,l=w}return l!==0&&(u.words[u.length++]=l),u},s._prime=function(u){if(B[u])return B[u];var l;if(u==="k256")l=new k;else if(u==="p224")l=new N;else if(u==="p192")l=new W;else if(u==="p25519")l=new Y;else throw new Error("Unknown prime "+u);return B[u]=l,l};function z(u){if(typeof u=="string"){var l=s._prime(u);this.m=l.p,this.prime=l}else n(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}z.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},z.prototype._verify2=function(u,l){n((u.negative|l.negative)===0,"red works only with positives"),n(u.red&&u.red===l.red,"red works only with red numbers")},z.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(d(u,u.umod(this.m)._forceRed(this)),u)},z.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},z.prototype.add=function(u,l){this._verify2(u,l);var h=u.add(l);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},z.prototype.iadd=function(u,l){this._verify2(u,l);var h=u.iadd(l);return h.cmp(this.m)>=0&&h.isub(this.m),h},z.prototype.sub=function(u,l){this._verify2(u,l);var h=u.sub(l);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},z.prototype.isub=function(u,l){this._verify2(u,l);var h=u.isub(l);return h.cmpn(0)<0&&h.iadd(this.m),h},z.prototype.shl=function(u,l){return this._verify1(u),this.imod(u.ushln(l))},z.prototype.imul=function(u,l){return this._verify2(u,l),this.imod(u.imul(l))},z.prototype.mul=function(u,l){return this._verify2(u,l),this.imod(u.mul(l))},z.prototype.isqr=function(u){return this.imul(u,u.clone())},z.prototype.sqr=function(u){return this.mul(u,u)},z.prototype.sqrt=function(u){if(u.isZero())return u.clone();var l=this.m.andln(3);if(n(l%2===1),l===3){var h=this.m.add(new s(1)).iushrn(2);return this.pow(u,h)}for(var w=this.m.subn(1),_=0;!w.isZero()&&w.andln(1)===0;)_++,w.iushrn(1);n(!w.isZero());var E=new s(1).toRed(this),T=E.redNeg(),v=this.m.subn(1).iushrn(1),m=this.m.bitLength();for(m=new s(2*m*m).toRed(this);this.pow(m,v).cmp(T)!==0;)m.redIAdd(T);for(var A=this.pow(m,w),Z=this.pow(u,w.addn(1).iushrn(1)),ie=this.pow(u,w),y=_;ie.cmp(E)!==0;){for(var G=ie,H=0;G.cmp(E)!==0;H++)G=G.redSqr();n(H=0;_--){for(var A=l.words[_],Z=m-1;Z>=0;Z--){var ie=A>>Z&1;if(E!==w[0]&&(E=this.sqr(E)),ie===0&&T===0){v=0;continue}T<<=1,T|=ie,v++,!(v!==h&&(_!==0||Z!==0))&&(E=this.mul(E,w[T]),v=0,T=0)}m=26}return E},z.prototype.convertTo=function(u){var l=u.umod(this.m);return l===u?l.clone():l},z.prototype.convertFrom=function(u){var l=u.clone();return l.red=null,l},s.mont=function(u){return new P(u)};function P(u){z.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(P,z),P.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},P.prototype.convertFrom=function(u){var l=this.imod(u.mul(this.rinv));return l.red=null,l},P.prototype.imul=function(u,l){if(u.isZero()||l.isZero())return u.words[0]=0,u.length=1,u;var h=u.imul(l),w=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=h.isub(w).iushrn(this.shift),E=_;return _.cmp(this.m)>=0?E=_.isub(this.m):_.cmpn(0)<0&&(E=_.iadd(this.m)),E._forceRed(this)},P.prototype.mul=function(u,l){if(u.isZero()||l.isZero())return new s(0)._forceRed(this);var h=u.mul(l),w=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=h.isub(w).iushrn(this.shift),E=_;return _.cmp(this.m)>=0?E=_.isub(this.m):_.cmpn(0)<0&&(E=_.iadd(this.m)),E._forceRed(this)},P.prototype.invm=function(u){var l=this.imod(u._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(t,X8e)})(nye);var Ur=nye.exports;const iye="bignumber/5.7.0";var _H=Ur.BN;const _d=new Ga(iye),NF={},Cce=9007199254740991;function uft(t){return t!=null&&(da.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Sy(t)||typeof t=="bigint"||P_(t))}let Sce=!1,da=class Fc{constructor(e,r){e!==NF&&_d.throwError("cannot call constructor directly; use BigNumber.from",Ga.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Ra(rn(this).fromTwos(e))}toTwos(e){return Ra(rn(this).toTwos(e))}abs(){return this._hex[0]==="-"?Fc.from(this._hex.substring(1)):this}add(e){return Ra(rn(this).add(rn(e)))}sub(e){return Ra(rn(this).sub(rn(e)))}div(e){return Fc.from(e).isZero()&&Ef("division-by-zero","div"),Ra(rn(this).div(rn(e)))}mul(e){return Ra(rn(this).mul(rn(e)))}mod(e){const r=rn(e);return r.isNeg()&&Ef("division-by-zero","mod"),Ra(rn(this).umod(r))}pow(e){const r=rn(e);return r.isNeg()&&Ef("negative-power","pow"),Ra(rn(this).pow(r))}and(e){const r=rn(e);return(this.isNegative()||r.isNeg())&&Ef("unbound-bitwise-result","and"),Ra(rn(this).and(r))}or(e){const r=rn(e);return(this.isNegative()||r.isNeg())&&Ef("unbound-bitwise-result","or"),Ra(rn(this).or(r))}xor(e){const r=rn(e);return(this.isNegative()||r.isNeg())&&Ef("unbound-bitwise-result","xor"),Ra(rn(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Ef("negative-width","mask"),Ra(rn(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ef("negative-width","shl"),Ra(rn(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ef("negative-width","shr"),Ra(rn(this).shrn(e))}eq(e){return rn(this).eq(rn(e))}lt(e){return rn(this).lt(rn(e))}lte(e){return rn(this).lte(rn(e))}gt(e){return rn(this).gt(rn(e))}gte(e){return rn(this).gte(rn(e))}isNegative(){return this._hex[0]==="-"}isZero(){return rn(this).isZero()}toNumber(){try{return rn(this).toNumber()}catch{Ef("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return _d.throwError("this platform does not support BigInt",Ga.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Sce||(Sce=!0,_d.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?_d.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ga.errors.UNEXPECTED_ARGUMENT,{}):_d.throwError("BigNumber.toString does not accept parameters",Ga.errors.UNEXPECTED_ARGUMENT,{})),rn(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Fc)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Fc(NF,_x(e)):e.match(/^-?[0-9]+$/)?new Fc(NF,_x(new _H(e))):_d.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ef("underflow","BigNumber.from",e),(e>=Cce||e<=-Cce)&&Ef("overflow","BigNumber.from",e),Fc.from(String(e));const r=e;if(typeof r=="bigint")return Fc.from(r.toString());if(P_(r))return Fc.from(rye(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Fc.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(Sy(n)||n[0]==="-"&&Sy(n.substring(1))))return Fc.from(n)}return _d.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function _x(t){if(typeof t!="string")return _x(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&_d.throwArgumentError("invalid hex","value",t),t=_x(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Ra(t){return da.from(_x(t))}function rn(t){const e=da.from(t).toHexString();return e[0]==="-"?new _H("-"+e.substring(3),16):new _H(e.substring(2),16)}function Ef(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),_d.throwError(t,Ga.errors.NUMERIC_FAULT,n)}const sa=new Ga(iye),J9={},sye=da.from(0),aye=da.from(-1);function oye(t,e,r,n){const i={fault:e,operation:r};return n!==void 0&&(i.value=n),sa.throwError(t,Ga.errors.NUMERIC_FAULT,i)}let X9="0";for(;X9.length<256;)X9+=X9;function oQ(t){if(typeof t!="number")try{t=da.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+X9.substring(0,t):sa.throwArgumentError("invalid decimal size","decimals",t)}function OF(t,e){e==null&&(e=0);const r=oQ(e);t=da.from(t);const n=t.lt(sye);n&&(t=t.mul(aye));let i=t.mod(r).toString();for(;i.length2&&sa.throwArgumentError("too many decimal points","value",t);let s=i[0],a=i[1];for(s||(s="0"),a||(a="0");a[a.length-1]==="0";)a=a.substring(0,a.length-1);for(a.length>r.length-1&&oye("fractional component exceeds decimals","underflow","parseFixed"),a===""&&(a="0");a.lengthe[a]==null?f:(typeof e[a]!==o&&sa.throwArgumentError("invalid fixed format ("+a+" not "+o+")","format."+a,e[a]),e[a]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&sa.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&sa.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new I3(J9,r,n,i)}}class as{constructor(e,r,n,i){e!==J9&&sa.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ga.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&sa.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=ud(this._value,this.format.decimals),n=ud(e._value,e.format.decimals);return as.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=as.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Tce.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=as.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Tce.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&sa.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const n=as.from("1"+X9.substring(0,e),this.format),i=lft.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&sa.throwArgumentError("invalid byte width","width",e);const r=da.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return cR(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return as.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!uft(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),as.fromString(OF(e,r),I3.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=I3.from(r),i=ud(e,n.decimals);!n.signed&&i.lt(sye)&&oye("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=cR(s,n.width/8));const a=OF(i,n.decimals);return new as(J9,s,a,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=I3.from(r);if(tye(e).length>n.width/8)throw new Error("overflow");let i=da.from(e);n.signed&&(i=i.fromTwos(n.width));const s=i.toTwos((n.signed?0:1)+n.width).toHexString(),a=OF(i,n.decimals);return new as(J9,s,a,n)}static from(e,r){if(typeof e=="string")return as.fromString(e,r);if(P_(e))return as.fromBytes(e,r);try{return as.fromValue(e,0,r)}catch(n){if(n.code!==Ga.errors.INVALID_ARGUMENT)throw n}return sa.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Tce=as.from(1),lft=as.from("0.5");var Ice;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(Ice||(Ice={}));var Rce;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Rce||(Rce={}));function dft(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function Mce(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}Mce("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),DF("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),DF("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),DF("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",dft),Mce("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function hft(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(o)?i(o,a-1):r.push(o)})};return i(t,e),r}function pft(t){const e={};for(let r=0;r>--f&1}const p=31,g=Math.pow(2,p),x=g>>>1,S=x>>1,I=g-1;let R=0;for(let B=0;B1;){let Y=F+k>>>1;B>>1|d(),N=N<<1^x,W=(W^x)<<1|x|1;M=N,U=1+W-N}let D=n-4;return O.map(B=>{switch(B-D){case 3:return D+65792+(t[o++]<<16|t[o++]<<8|t[o++]);case 2:return D+256+(t[o++]<<8|t[o++]);case 1:return D+t[o++];default:return B-1}})}function gft(t){let e=0;return()=>t[e++]}function bft(t){return gft(mft(t))}function yft(t){return t&1?~t>>1:t>>1}function wft(t,e){let r=Array(t);for(let n=0;ne[a]):r}function xft(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(_ft(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Eft(r,t))}return pft(fye(e))}function Aft(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function cye(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[a].push(s));return n}function _ft(t,e){let r=1+e(),n=e(),i=Aft(e),s=cye(i.length,1+t,e);return fye(s.map((a,o)=>{const f=a[0],c=a.slice(1);return Array(i[o]).fill(void 0).map((d,p)=>{let g=p*n;return[f+p*r,c.map(x=>x+g)]})}))}function Eft(t,e){let r=1+e();return cye(r,1+t,e).map(n=>[n[0],n.slice(1)])}function Cft(t){let e=uR(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let c=uR(t,e);if(c.length==0)break;n.push({set:new Set(c),node:r()})}n.sort((c,d)=>d.set.size-c.set.size);let i=t(),s=i%3;i=i/3|0;let a=!!(i&1);i>>=1;let o=i==1,f=i==2;return{branches:n,valid:s,fe0f:a,save:o,check:f}}}function Sft(){return bft(hft("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"))}const SS=Sft();new Set(uR(SS)),new Set(uR(SS)),xft(SS),Cft(SS);const Tft=new Uint8Array(32);Tft.fill(0);const Ift=new Uint8Array(32);Ift.fill(0),da.from(-1);const Rft=da.from(0),Mft=da.from(1);da.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),cR(Mft.toHexString(),32),cR(Rft.toHexString(),32);var gl={},fn={},N_=uye;function uye(t,e){if(!t)throw new Error(e||"Assertion failed")}uye.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var EH={exports:{}};typeof Object.create=="function"?EH.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:EH.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var kft=N_,Pft=EH.exports;fn.inherits=Pft;function Nft(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function Oft(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):Nft(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}fn.htonl=lye;function $ft(t,e){for(var r="",n=0;n>>0}return s}fn.join32=Bft;function Uft(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}fn.split32=Uft;function Lft(t,e){return t>>>e|t<<32-e}fn.rotr32=Lft;function Fft(t,e){return t<>>32-e}fn.rotl32=Fft;function jft(t,e){return t+e>>>0}fn.sum32=jft;function zft(t,e,r){return t+e+r>>>0}fn.sum32_3=zft;function qft(t,e,r,n){return t+e+r+n>>>0}fn.sum32_4=qft;function Hft(t,e,r,n,i){return t+e+r+n+i>>>0}fn.sum32_5=Hft;function Vft(t,e,r,n){var i=t[e],s=t[e+1],a=n+s>>>0,o=(a>>0,t[e+1]=a}fn.sum64=Vft;function Wft(t,e,r,n){var i=e+n>>>0,s=(i>>0}fn.sum64_hi=Wft;function Gft(t,e,r,n){var i=e+n;return i>>>0}fn.sum64_lo=Gft;function Kft(t,e,r,n,i,s,a,o){var f=0,c=e;c=c+n>>>0,f+=c>>0,f+=c>>0,f+=c>>0}fn.sum64_4_hi=Kft;function Qft(t,e,r,n,i,s,a,o){var f=e+n+s+o;return f>>>0}fn.sum64_4_lo=Qft;function Zft(t,e,r,n,i,s,a,o,f,c){var d=0,p=e;p=p+n>>>0,d+=p>>0,d+=p>>0,d+=p>>0,d+=p>>0}fn.sum64_5_hi=Zft;function Yft(t,e,r,n,i,s,a,o,f,c){var d=e+n+s+o+c;return d>>>0}fn.sum64_5_lo=Yft;function Jft(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}fn.rotr64_hi=Jft;function Xft(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}fn.rotr64_lo=Xft;function ect(t,e,r){return t>>>r}fn.shr64_hi=ect;function tct(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}fn.shr64_lo=tct;var zw={},Pce=fn,rct=N_;function TS(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}zw.BlockHash=TS,TS.prototype.update=function(t,e){if(t=Pce.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=Pce.join32(t,0,t.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s>>3}U1.g0_256=oct;function fct(t){return a1(t,17)^a1(t,19)^t>>>10}U1.g1_256=fct;var Ty=fn,cct=zw,uct=U1,$F=Ty.rotl32,Qv=Ty.sum32,lct=Ty.sum32_5,dct=uct.ft_1,bye=cct.BlockHash,hct=[1518500249,1859775393,2400959708,3395469782];function Ul(){if(!(this instanceof Ul))return new Ul;bye.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ty.inherits(Ul,bye);var pct=Ul;Ul.blockSize=512,Ul.outSize=160,Ul.hmacStrength=80,Ul.padLength=64,Ul.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;nthis.blockSize&&(t=new this.Hash().update(t).digest()),tut(t.length<=this.blockSize);for(var e=t.length;e>8,g=d&255;p?f.push(p,g):f.push(g)}return f}r.toArray=n;function i(a){return a.length===1?"0"+a:a}r.zero2=i;function s(a){for(var o="",f=0;f(g>>1)-1?I=(g>>1)-R:I=R,x.isubn(I)):I=0,p[S]=I,x.iushrn(1)}return p}r.getNAF=n;function i(f,c){var d=[[],[]];f=f.clone(),c=c.clone();for(var p=0,g=0,x;f.cmpn(-p)>0||c.cmpn(-g)>0;){var S=f.andln(3)+p&3,I=c.andln(3)+g&3;S===3&&(S=-1),I===3&&(I=-1);var R;S&1?(x=f.andln(7)+p&7,(x===3||x===5)&&I===2?R=-S:R=S):R=0,d[0].push(R);var O;I&1?(x=c.andln(7)+g&7,(x===3||x===5)&&S===2?O=-I:O=I):O=0,d[1].push(O),2*p===R+1&&(p=1-p),2*g===O+1&&(g=1-g),f.iushrn(1),c.iushrn(1)}return d}r.getJSF=i;function s(f,c,d){var p="_"+c;f.prototype[c]=function(){return this[p]!==void 0?this[p]:this[p]=d.call(this)}}r.cachedProperty=s;function a(f){return typeof f=="string"?r.toArray(f,"hex"):f}r.parseBytes=a;function o(f){return new Ur(f,"hex","le")}r.intFromLE=o}),RS=zo.getNAF,iut=zo.getJSF,lR=zo.assert;function Bp(t,e){this.type=t,this.p=new Ur(e.p,16),this.red=e.prime?Ur.red(e.prime):Ur.mont(this.p),this.zero=new Ur(0).toRed(this.red),this.one=new Ur(1).toRed(this.red),this.two=new Ur(2).toRed(this.red),this.n=e.n&&new Ur(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var kg=Bp;Bp.prototype.point=function(){throw new Error("Not implemented")},Bp.prototype.validate=function(){throw new Error("Not implemented")},Bp.prototype._fixedNafMul=function(t,e){lR(t.precomputed);var r=t._getDoubles(),n=RS(e,1,this._bitLength),i=(1<=a;f--)o=(o<<1)+n[f];s.push(o)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=i;p>0;p--){for(a=0;a=0;o--){for(var f=0;o>=0&&s[o]===0;o--)f++;if(o>=0&&f++,a=a.dblp(f),o<0)break;var c=s[o];lR(c!==0),t.type==="affine"?c>0?a=a.mixedAdd(i[c-1>>1]):a=a.mixedAdd(i[-c-1>>1].neg()):c>0?a=a.add(i[c-1>>1]):a=a.add(i[-c-1>>1].neg())}return t.type==="affine"?a.toP():a},Bp.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,a=this._wnafT2,o=this._wnafT3,f=0,c,d,p;for(c=0;c=1;c-=2){var x=c-1,S=c;if(s[x]!==1||s[S]!==1){o[x]=RS(r[x],s[x],this._bitLength),o[S]=RS(r[S],s[S],this._bitLength),f=Math.max(o[x].length,f),f=Math.max(o[S].length,f);continue}var I=[e[x],null,null,e[S]];e[x].y.cmp(e[S].y)===0?(I[1]=e[x].add(e[S]),I[2]=e[x].toJ().mixedAdd(e[S].neg())):e[x].y.cmp(e[S].y.redNeg())===0?(I[1]=e[x].toJ().mixedAdd(e[S]),I[2]=e[x].add(e[S].neg())):(I[1]=e[x].toJ().mixedAdd(e[S]),I[2]=e[x].toJ().mixedAdd(e[S].neg()));var R=[-3,-1,-5,-7,0,7,5,1,3],O=iut(r[x],r[S]);for(f=Math.max(O[0].length,f),o[x]=new Array(f),o[S]=new Array(f),d=0;d=0;c--){for(var F=0;c>=0;){var k=!0;for(d=0;d=0&&F++,D=D.dblp(F),c<0)break;for(d=0;d0?p=a[d][N-1>>1]:N<0&&(p=a[d][-N-1>>1].neg()),p.type==="affine"?D=D.mixedAdd(p):D=D.add(p))}}for(c=0;c=Math.ceil((t.bitLength()+1)/e.step):!1},Cf.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(g=f,x=c),d.negative&&(d=d.neg(),p=p.neg()),g.negative&&(g=g.neg(),x=x.neg()),[{a:d,b:p},{a:g,b:x}]},Zf.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),o=s.mul(n.a),f=i.mul(r.b),c=s.mul(n.b),d=t.sub(a).sub(o),p=f.add(c).neg();return{k1:d,k2:p}},Zf.prototype.pointFromX=function(t,e){t=new Ur(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Zf.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Zf.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},D0.prototype.isInfinity=function(){return this.inf},D0.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},D0.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},D0.prototype.getX=function(){return this.x.fromRed()},D0.prototype.getY=function(){return this.y.fromRed()},D0.prototype.mul=function(t){return t=new Ur(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},D0.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},D0.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},D0.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},D0.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},D0.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function is(t,e,r,n){kg.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ur(0)):(this.x=new Ur(e,16),this.y=new Ur(r,16),this.z=new Ur(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}cQ(is,kg.BasePoint),Zf.prototype.jpoint=function(t,e,r){return new is(this,t,e,r)},is.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},is.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},is.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),o=n.redSub(i),f=s.redSub(a);if(o.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),d=c.redMul(o),p=n.redMul(c),g=f.redSqr().redIAdd(d).redISub(p).redISub(p),x=f.redMul(p.redISub(g)).redISub(s.redMul(d)),S=this.z.redMul(t.z).redMul(o);return this.curve.jpoint(g,x,S)},is.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),a=r.redSub(n),o=i.redSub(s);if(a.cmpn(0)===0)return o.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),c=f.redMul(a),d=r.redMul(f),p=o.redSqr().redIAdd(c).redISub(d).redISub(d),g=o.redMul(d.redISub(p)).redISub(i.redMul(c)),x=this.z.redMul(a);return this.curve.jpoint(p,g,x)},is.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},is.prototype.inspect=function(){return this.isInfinity()?"":""},is.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var PT=Hw(function(t,e){var r=e;r.base=kg,r.short=aut,r.mont=null,r.edwards=null}),NT=Hw(function(t,e){var r=e,n=zo.assert;function i(o){o.type==="short"?this.curve=new PT.short(o):o.type==="edwards"?this.curve=new PT.edwards(o):this.curve=new PT.mont(o),this.g=this.curve.g,this.n=this.curve.n,this.hash=o.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(o,f){Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get:function(){var c=new i(f);return Object.defineProperty(r,o,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:gl.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:gl.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:gl.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:gl.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:gl.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:gl.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:gl.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch{a=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:gl.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function Up(t){if(!(this instanceof Up))return new Up(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=bu.toArray(t.entropy,t.entropyEnc||"hex"),r=bu.toArray(t.nonce,t.nonceEnc||"hex"),n=bu.toArray(t.pers,t.persEnc||"hex");fQ(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var $ce=Up;Up.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Up.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=bu.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var out=zo.assert;function hP(t,e){if(t instanceof hP)return t;this._importDER(t,e)||(out(t.r&&t.s,"Signature without r or s"),this.r=new Ur(t.r,16),this.s=new Ur(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var MS=hP;function fut(){this.place=0}function jF(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s>>=0;return i<=127?!1:(e.place=a,i)}function Bce(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}hP.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=Bce(e),r=Bce(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];zF(n,e.length),n=n.concat(e),n.push(2),zF(n,r.length);var i=n.concat(r),s=[48];return zF(s,i.length),s=s.concat(i),zo.encode(s,t)};var cut=function(){throw new Error("unsupported")},Rye=zo.assert;function Lf(t){if(!(this instanceof Lf))return new Lf(t);typeof t=="string"&&(Rye(Object.prototype.hasOwnProperty.call(NT,t),"Unknown curve "+t),t=NT[t]),t instanceof NT.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var uut=Lf;Lf.prototype.keyPair=function(t){return new FF(this,t)},Lf.prototype.keyFromPrivate=function(t,e){return FF.fromPrivate(this,t,e)},Lf.prototype.keyFromPublic=function(t,e){return FF.fromPublic(this,t,e)},Lf.prototype.genKeyPair=function(t){t||(t={});for(var e=new $ce({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||cut(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Ur(2));;){var i=new Ur(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Lf.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Lf.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new Ur(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),a=t.toArray("be",i),o=new $ce({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new Ur(1)),c=0;;c++){var d=n.k?n.k(c):new Ur(o.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(f)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var g=p.getX(),x=g.umod(this.n);if(x.cmpn(0)!==0){var S=d.invm(this.n).mul(x.mul(e.getPrivate()).iadd(t));if(S=S.umod(this.n),S.cmpn(0)!==0){var I=(p.getY().isOdd()?1:0)|(g.cmp(x)!==0?2:0);return n.canonical&&S.cmp(this.nh)>0&&(S=this.n.sub(S),I^=1),new MS({r:x,s:S,recoveryParam:I})}}}}}},Lf.prototype.verify=function(t,e,r,n){t=this._truncateToN(new Ur(t,16)),r=this.keyFromPublic(r,n),e=new MS(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),o=a.mul(t).umod(this.n),f=a.mul(i).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(o,r.getPublic(),f),c.isInfinity()?!1:c.eqXToP(i)):(c=this.g.mulAdd(o,r.getPublic(),f),c.isInfinity()?!1:c.getX().umod(this.n).cmp(i)===0)},Lf.prototype.recoverPubKey=function(t,e,r,n){Rye((3&r)===r,"The recovery param is more than two bits"),e=new MS(e,n);var i=this.n,s=new Ur(t),a=e.r,o=e.s,f=r&1,c=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?a=this.curve.pointFromX(a.add(this.curve.n),f):a=this.curve.pointFromX(a,f);var d=e.r.invm(i),p=i.sub(s).mul(d).umod(i),g=o.mul(d).umod(i);return this.g.mulAdd(p,a,g)},Lf.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new MS(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var lut=Hw(function(t,e){var r=e;r.version="6.5.4",r.utils=zo,r.rand=function(){throw new Error("unsupported")},r.curve=PT,r.curves=NT,r.ec=uut,r.eddsa=null});lut.ec;var Uce;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Uce||(Uce={}));const dut=Symbol(),Lce=Object.getPrototypeOf,TH=new WeakMap,hut=t=>t&&(TH.has(t)?TH.get(t):Lce(t)===Object.prototype||Lce(t)===Array.prototype),put=t=>hut(t)&&t[dut]||null,Fce=(t,e=!0)=>{TH.set(t,e)},dR={BASE_URL:"/dacademy-eas-test/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REOWN_PROJECT_ID:"6562ee7f0e72671353204776ca7a132c"},qF=t=>typeof t=="object"&&t!==null,Rp=new WeakMap,S9=new WeakSet,mut=(t=Object.is,e=(c,d)=>new Proxy(c,d),r=c=>qF(c)&&!S9.has(c)&&(Array.isArray(c)||!(Symbol.iterator in c))&&!(c instanceof WeakMap)&&!(c instanceof WeakSet)&&!(c instanceof Error)&&!(c instanceof Number)&&!(c instanceof Date)&&!(c instanceof String)&&!(c instanceof RegExp)&&!(c instanceof ArrayBuffer),n=c=>{switch(c.status){case"fulfilled":return c.value;case"rejected":throw c.reason;default:throw c}},i=new WeakMap,s=(c,d,p=n)=>{const g=i.get(c);if((g==null?void 0:g[0])===d)return g[1];const x=Array.isArray(c)?[]:Object.create(Object.getPrototypeOf(c));return Fce(x,!0),i.set(c,[d,x]),Reflect.ownKeys(c).forEach(S=>{if(Object.getOwnPropertyDescriptor(x,S))return;const I=Reflect.get(c,S),R={value:I,enumerable:!0,configurable:!0};if(S9.has(I))Fce(I,!1);else if(I instanceof Promise)delete R.value,R.get=()=>p(I);else if(Rp.has(I)){const[O,M]=Rp.get(I);R.value=s(O,M(),p)}Object.defineProperty(x,S,R)}),Object.preventExtensions(x)},a=new WeakMap,o=[1,1],f=c=>{if(!qF(c))throw new Error("object required");const d=a.get(c);if(d)return d;let p=o[0];const g=new Set,x=(W,Y=++o[0])=>{p!==Y&&(p=Y,g.forEach(z=>z(W,Y)))};let S=o[1];const I=(W=++o[1])=>(S!==W&&!g.size&&(S=W,O.forEach(([Y])=>{const z=Y[1](W);z>p&&(p=z)})),p),R=W=>(Y,z)=>{const P=[...Y];P[1]=[W,...P[1]],x(P,z)},O=new Map,M=(W,Y)=>{if((dR?"production":void 0)!=="production"&&O.has(W))throw new Error("prop listener already exists");if(g.size){const z=Y[3](R(W));O.set(W,[Y,z])}else O.set(W,[Y])},U=W=>{var Y;const z=O.get(W);z&&(O.delete(W),(Y=z[1])==null||Y.call(z))},D=W=>(g.add(W),g.size===1&&O.forEach(([z,P],u)=>{if((dR?"production":void 0)!=="production"&&P)throw new Error("remove already exists");const l=z[3](R(u));O.set(u,[z,l])}),()=>{g.delete(W),g.size===0&&O.forEach(([z,P],u)=>{P&&(P(),O.set(u,[z]))})}),B=Array.isArray(c)?[]:Object.create(Object.getPrototypeOf(c)),k=e(B,{deleteProperty(W,Y){const z=Reflect.get(W,Y);U(Y);const P=Reflect.deleteProperty(W,Y);return P&&x(["delete",[Y],z]),P},set(W,Y,z,P){const u=Reflect.has(W,Y),l=Reflect.get(W,Y,P);if(u&&(t(l,z)||a.has(z)&&t(l,a.get(z))))return!0;U(Y),qF(z)&&(z=put(z)||z);let h=z;if(z instanceof Promise)z.then(w=>{z.status="fulfilled",z.value=w,x(["resolve",[Y],w])}).catch(w=>{z.status="rejected",z.reason=w,x(["reject",[Y],w])});else{!Rp.has(z)&&r(z)&&(h=f(z));const w=!S9.has(h)&&Rp.get(h);w&&M(Y,w)}return Reflect.set(W,Y,h,P),x(["set",[Y],z,l]),!0}});a.set(c,k);const N=[B,I,s,D];return Rp.set(k,N),Reflect.ownKeys(c).forEach(W=>{const Y=Object.getOwnPropertyDescriptor(c,W);"value"in Y&&(k[W]=c[W],delete Y.value,delete Y.writable),Object.defineProperty(B,W,Y)}),k})=>[f,Rp,S9,t,e,r,n,i,s,a,o],[gut]=mut();function zi(t={}){return gut(t)}function ha(t,e,r){const n=Rp.get(t);(dR?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let i;const s=[],a=n[3];let o=!1;const c=a(d=>{s.push(d),i||(i=Promise.resolve().then(()=>{i=void 0,o&&e(s.splice(0))}))});return o=!0,()=>{o=!1,c()}}function Mye(t,e){const r=Rp.get(t);(dR?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");const[n,i,s]=r;return s(n,i(),e)}function Yf(t){return S9.add(t),t}function ho(t,e,r,n){let i=t[e];return ha(t,()=>{const s=t[e];Object.is(i,s)||r(i=s)})}function but(t){const e=zi({data:Array.from([]),has(r){return this.data.some(n=>n[0]===r)},set(r,n){const i=this.data.find(s=>s[0]===r);return i?i[1]=n:this.data.push([r,n]),this},get(r){var n;return(n=this.data.find(i=>i[0]===r))==null?void 0:n[1]},delete(r){const n=this.data.findIndex(i=>i[0]===r);return n===-1?!1:(this.data.splice(n,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(r){this.data.forEach(n=>{r(n[1],n[0],this)})},keys(){return this.data.map(r=>r[0]).values()},values(){return this.data.map(r=>r[1]).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(e,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(e),e}const HF="https://secure.walletconnect.org",kye=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["evm"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["evm","solana"]}],yut="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",S0={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,ONE_SEC_MS:1e3,SECURE_SITE:HF,SECURE_SITE_DASHBOARD:`${HF}/dashboard`,SECURE_SITE_FAVICON:`${HF}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NATIVE_TOKEN_ADDRESS:{evm:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111"},CONVERT_SLIPPAGE_TOLERANCE:1},Ot={isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(t,e=""){return t==null?void 0:t.id.toLocaleLowerCase().includes(e.toLowerCase())},isAndroid(){const t=window.navigator.userAgent.toLowerCase();return Ot.isMobile()&&t.includes("android")},isIos(){const t=window.navigator.userAgent.toLowerCase();return Ot.isMobile()&&(t.includes("iphone")||t.includes("ipad"))},isClient(){return typeof window<"u"},isPairingExpired(t){return t?t-Date.now()<=S0.TEN_SEC_MS:!0},isAllowedRetry(t){return Date.now()-t>=S0.ONE_SEC_MS},copyToClopboard(t){navigator.clipboard.writeText(t)},getPairingExpiry(){return Date.now()+S0.FOUR_MINUTES_MS},getNetworkId(t){return t==null?void 0:t.split(":")[1]},getPlainAddress(t){return t==null?void 0:t.split(":")[2]},async wait(t){return new Promise(e=>{setTimeout(e,t)})},debounce(t,e=500){let r;return(...n)=>{function i(){t(...n)}r&&clearTimeout(r),r=setTimeout(i,e)}},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},formatNativeUrl(t,e){if(Ot.isHttpUrl(t))return this.formatUniversalUrl(t,e);let r=t;r.includes("://")||(r=t.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,href:r}},formatUniversalUrl(t,e){if(!Ot.isHttpUrl(t))return this.formatNativeUrl(t,e);let r=t;r.endsWith("/")||(r=`${r}/`);const n=encodeURIComponent(e);return{redirect:`${r}wc?uri=${n}`,href:r}},openHref(t,e,r){window.open(t,e,r||"noreferrer noopener")},returnOpenHref(t,e,r){return window.open(t,e,r||"noreferrer noopener")},async preloadImage(t){const e=new Promise((r,n)=>{const i=new Image;i.onload=r,i.onerror=n,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,Ot.wait(2e3)])},formatBalance(t,e){let r="0.000";if(typeof t=="string"){const n=Number(t);if(n){const i=Math.floor(n*1e3)/1e3;i&&(r=i.toString())}}return`${r}${e?` ${e}`:""}`},formatBalance2(t,e){var n;let r;if(t==="0")r="0";else if(typeof t=="string"){const i=Number(t);i&&(r=(n=i.toString().match(/^-?\d+(?:\.\d{0,3})?/u))==null?void 0:n[0])}return{value:r??"0",rest:r==="0"?"000":"",symbol:e}},getApiUrl(){return zn.W3M_API_URL},getBlockchainApiUrl(){return zn.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return zn.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})},parseError(t){var e,r;return typeof t=="string"?t:typeof((r=(e=t==null?void 0:t.issues)==null?void 0:e[0])==null?void 0:r.message)=="string"?t.issues[0].message:t instanceof Error?t.message:"Unknown error"},sortRequestedNetworks(t,e=[]){const r={};return e&&t&&(t.forEach((n,i)=>{r[n]=i}),e.sort((n,i)=>{const s=r[n.id],a=r[i.id];return s!==void 0&&a!==void 0?s-a:s!==void 0?-1:a!==void 0?1:0})),e},calculateBalance(t){let e=0;for(const r of t)e+=r.value??0;return e},formatTokenBalance(t){const e=t.toFixed(2),[r,n]=e.split(".");return{dollars:r,pennies:n}},isAddress(t,e="evm"){switch(e){case"evm":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)||/^(?:0x)?[0-9A-F]{40}$/iu.test(t))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(t);default:return!1}},uniqueBy(t,e){const r=new Set;return t.filter(n=>{const i=n[e];return r.has(i)?!1:(r.add(i),!0)})}};async function Yv(...t){const e=await fetch(...t);if(!e.ok)throw new Error(`HTTP status code: ${e.status}`,{cause:e});return e}class pP{constructor({baseUrl:e,clientId:r}){this.baseUrl=e,this.clientId=r}async get({headers:e,signal:r,cache:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"GET",headers:e,signal:r,cache:n})).json()}async getBlob({headers:e,signal:r,...n}){const i=this.createUrl(n);return(await Yv(i,{method:"GET",headers:e,signal:r})).blob()}async post({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"POST",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async put({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"PUT",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}async delete({body:e,headers:r,signal:n,...i}){const s=this.createUrl(i);return(await Yv(s,{method:"DELETE",headers:r,body:e?JSON.stringify(e):void 0,signal:n})).json()}createUrl({path:e,params:r}){const n=new URL(e,this.baseUrl);return r&&Object.entries(r).forEach(([i,s])=>{s&&n.searchParams.append(i,s)}),this.clientId&&n.searchParams.append("clientId",this.clientId),n}}const VF="WALLETCONNECT_DEEPLINK_CHOICE",jce="@w3m/recent",zce="@w3m/connected_connector",qce="@w3m/connected_social",wut="@w3m-storage/SOCIAL_USERNAME",En={setWalletConnectDeepLink({href:t,name:e}){try{localStorage.setItem(VF,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const t=localStorage.getItem(VF);if(t)return JSON.parse(t)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{localStorage.removeItem(VF)}catch{console.info("Unable to delete WalletConnect deep link")}},setWeb3ModalRecent(t){try{const e=En.getRecentWallets();e.find(n=>n.id===t.id)||(e.unshift(t),e.length>2&&e.pop(),localStorage.setItem(jce,JSON.stringify(e)))}catch{console.info("Unable to set Web3Modal recent")}},getRecentWallets(){try{const t=localStorage.getItem(jce);return t?JSON.parse(t):[]}catch{console.info("Unable to get Web3Modal recent")}return[]},setConnectedConnector(t){try{localStorage.setItem(zce,t)}catch{console.info("Unable to set Connected Connector")}},getConnectedConnector(){try{return localStorage.getItem(zce)}catch{console.info("Unable to get Connected Connector")}},setConnectedSocialProvider(t){try{localStorage.setItem(qce,t)}catch{console.info("Unable to set Connected Social Provider")}},getConnectedSocialProvider(){try{return localStorage.getItem(qce)}catch{console.info("Unable to get Connected Social Provider")}},getConnectedSocialUsername(){try{return localStorage.getItem(wut)}catch{console.info("Unable to get Connected Social Username")}}},Sf=zi({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),Ri={state:Sf,subscribeNetworkImages(t){return ha(Sf.networkImages,()=>t(Sf.networkImages))},subscribeKey(t,e){return ho(Sf,t,e)},subscribe(t){return ha(Sf,()=>t(Sf))},setWalletImage(t,e){Sf.walletImages[t]=e},setNetworkImage(t,e){Sf.networkImages[t]=e},setChainImage(t,e){Sf.chainImages[t]=e},setConnectorImage(t,e){Sf.connectorImages[t]=e},setTokenImage(t,e){Sf.tokenImages[t]=e},setCurrencyImage(t,e){Sf.currencyImages[t]=e}},ld=zi({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),Ui={state:ld,subscribe(t){return ha(ld,()=>t(ld))},setThemeMode(t){ld.themeMode=t;try{const e=Zt.getAuthConnector();if(e){const r=Ui.getSnapshot().themeVariables;e.provider.syncTheme({themeMode:t,themeVariables:r,w3mThemeVariables:w6(r,t)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(t){ld.themeVariables={...ld.themeVariables,...t};try{const e=Zt.getAuthConnector();if(e){const r=Ui.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:r,w3mThemeVariables:w6(ld.themeVariables,ld.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return Mye(ld)}},sl=zi({unMergedConnectors:[],connectors:[]}),Zt={state:sl,subscribeKey(t,e){return ho(sl,t,e)},setConnectors(t){t.forEach(this.syncIfAuthConnector),sl.unMergedConnectors=[...sl.unMergedConnectors,...t],sl.connectors=this.mergeMultiChainConnectors(sl.unMergedConnectors)},mergeMultiChainConnectors(t){const e=this.generateConnectorMapByName(t);return Array.from(e.values()).map(n=>{var i,s,a;return n.length>1?{name:(i=n[0])==null?void 0:i.name,imageUrl:(s=n[0])==null?void 0:s.imageUrl,imageId:(a=n[0])==null?void 0:a.imageId,providers:this.getUniqueConnectorsByName(n),type:"MULTI_CHAIN"}:n[0]})},generateConnectorMapByName(t){const e=new Map;return t.forEach(r=>{const{name:n}=r;if(!n)return;const i=e.get(n)||[];i.find(a=>a.chain===r.chain)||i.push(r),e.set(n,i)}),e},getUniqueConnectorsByName(t){const e=[];return t.forEach(r=>{e.find(n=>n.chain===r.chain)||e.push({...r,name:zn.CHAIN_NAME_MAP[r.chain]})}),e},addConnector(t){this.setConnectors([t])},getAuthConnector(){return sl.connectors.find(t=>t.type==="AUTH")},getAnnouncedConnectorRdns(){return sl.connectors.filter(t=>t.type==="ANNOUNCED").map(t=>{var e;return(e=t.info)==null?void 0:e.rdns})},getConnectors(){return sl.connectors},getConnector(t,e){return sl.connectors.find(r=>{var n;return r.explorerId===t||((n=r.info)==null?void 0:n.rdns)===e})},syncIfAuthConnector(t){var s,a;if(t.id!=="w3mAuth")return;const e=t,r=Mye(zt.state),n=Ui.getSnapshot().themeMode,i=Ui.getSnapshot().themeVariables;(a=(s=e==null?void 0:e.provider)==null?void 0:s.syncDappData)==null||a.call(s,{metadata:r.metadata,sdkVersion:r.sdkVersion,projectId:r.projectId}),e.provider.syncTheme({themeMode:n,themeVariables:i,w3mThemeVariables:w6(i,n)})}},vut=Ot.getAnalyticsUrl(),xut=new pP({baseUrl:vut,clientId:null}),Aut=["MODAL_CREATED"],wb=zi({timestamp:Date.now(),data:{type:"track",event:"MODAL_CREATED"}}),Ht={state:wb,subscribe(t){return ha(wb,()=>t(wb))},_getApiHeaders(){const{projectId:t,sdkType:e,sdkVersion:r}=zt.state;return{"x-project-id":t,"x-sdk-type":e,"x-sdk-version":r}},async _sendAnalyticsEvent(t){try{if(Aut.includes(t.data.event)||typeof window>"u")return;await xut.post({path:"/e",headers:Ht._getApiHeaders(),body:{eventId:Ot.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:t.timestamp,props:t.data}})}catch{}},sendEvent(t){wb.timestamp=Date.now(),wb.data=t,zt.state.enableAnalytics&&Ht._sendAnalyticsEvent(wb)}},Jv=zi({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0}),c1={state:Jv,subscribe(t){return ha(Jv,()=>t(Jv))},set(t){Object.assign(Jv,{...Jv,...t})}},_ut={isConnected:!1,currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]},Eut={supportsAllNetworks:!0,isDefaultCaipNetwork:!1,smartAccountEnabledNetworks:[]},pn=zi({chains:but(),activeChain:void 0,activeCaipNetwork:void 0}),It={state:pn,subscribeKey(t,e){return ho(pn,t,e)},subscribeChain(t){let e;return ha(pn.chains,()=>{const r=pn.activeChain;if(r){const n=pn.chains.get(r);(!e||e!==n)&&(e=n,t(n))}})},subscribeChainProp(t,e){let r;return ha(pn.chains,()=>{var i;const n=pn.activeChain;if(n){const s=(i=pn.chains.get(n))==null?void 0:i[t];r!==s&&(r=s,e(s))}})},initialize(t){const e=t==null?void 0:t[0];if(!e)throw new Error("Adapter is required to initialize ChainController");pn.activeChain=e.chain,c1.set({activeChain:e.chain}),this.setActiveCaipNetwork(e.defaultChain),t.forEach(r=>{pn.chains.set(r.chain,{chain:r.chain,connectionControllerClient:r.connectionControllerClient,networkControllerClient:r.networkControllerClient,accountState:_ut,networkState:Eut})})},setChainNetworkData(t,e,r=!1){if(!t)throw new Error("Chain is required to update chain network data");const n=pn.chains.get(t);n&&(n.networkState=Yf({...n.networkState,...e}),pn.chains.set(t,Yf(n)),(r||pn.chains.size===1||pn.activeChain===t)&&Ct.replaceState(n.networkState))},setChainAccountData(t,e,r=!0){if(!t)throw new Error("Chain is required to update chain account data");const n=pn.chains.get(t);n&&(n.accountState=Yf({...n.accountState,...e}),pn.chains.set(t,n),(r||pn.chains.size===1||pn.activeChain===t)&&Je.replaceState(n.accountState))},setAccountProp(t,e,r){this.setChainAccountData(r,{[t]:e})},setActiveChain(t){var r,n,i,s,a;const e=t?pn.chains.get(t):void 0;e&&e.chain!==pn.activeChain&&(pn.activeChain=e.chain,pn.activeCaipNetwork=(r=e.networkState)!=null&&r.caipNetwork?Yf((n=e.networkState)==null?void 0:n.caipNetwork):void 0,Je.replaceState(e.accountState),Ct.replaceState(e.networkState),this.setCaipNetwork(e.chain,(i=e.networkState)==null?void 0:i.caipNetwork),c1.set({activeChain:t,selectedNetworkId:(a=(s=e.networkState)==null?void 0:s.caipNetwork)==null?void 0:a.id}))},setActiveCaipNetwork(t){t&&(t.chain!==pn.activeChain&&this.setActiveChain(t.chain),pn.activeCaipNetwork=Yf(t),pn.activeChain=t.chain,this.setCaipNetwork(t.chain,t,!0),c1.set({activeChain:t.chain,selectedNetworkId:t==null?void 0:t.id}))},setCaipNetwork(t,e,r=!1){this.setChainNetworkData(t,{caipNetwork:e},r)},setActiveConnector(t){t&&(pn.activeConnector=Yf(t))},getNetworkControllerClient(){const t=pn.activeChain;if(!t)throw new Error("Chain is required to get network controller client");const e=pn.chains.get(t);if(!e)throw new Error("Chain adapter not found");if(!e.networkControllerClient)throw new Error("NetworkController client not set");return e.networkControllerClient},getConnectionControllerClient(t){const e=t||pn.activeChain;if(!e)throw new Error("Chain is required to get connection controller client");const r=pn.chains.get(e);if(!r)throw new Error("Chain adapter not found");if(!r.connectionControllerClient)throw new Error("ConnectionController client not set");return r.connectionControllerClient},getAccountProp(t,e){var i;let r=pn.activeChain;if(e&&(r=e),!r)return;const n=(i=pn.chains.get(r))==null?void 0:i.accountState;if(n)return n[t]},getNetworkProp(t){var n;const e=pn.activeChain;if(!e)return;const r=(n=pn.chains.get(e))==null?void 0:n.networkState;if(r)return r[t]},resetAccount(t){const e=t;if(!e)throw new Error("Chain is required to set account prop");this.setChainAccountData(e,Yf({isConnected:!1,smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0}))}},WF=zi({supportsAllNetworks:!0,isDefaultCaipNetwork:!1,smartAccountEnabledNetworks:[]}),Ct={state:WF,replaceState(t){t&&Object.assign(WF,Yf(t))},subscribeKey(t,e){let r;return It.subscribeChainProp("networkState",n=>{if(n){const i=n[t];r!==i&&(r=i,e(i))}})},_getClient(){return It.getNetworkControllerClient()},initializeDefaultNetwork(){const t=this.getRequestedCaipNetworks();t.length>0&&this.setCaipNetwork(t[0])},setDefaultCaipNetwork(t){t&&(It.setCaipNetwork(t.chain,t,!0),It.setChainNetworkData(t.chain,{isDefaultCaipNetwork:!0}),c1.set({selectedNetworkId:t.id}))},setActiveCaipNetwork(t){var e,r;t&&(It.setActiveCaipNetwork(t),It.setChainNetworkData(t.chain,{caipNetwork:t}),c1.set({activeChain:t.chain,selectedNetworkId:t==null?void 0:t.id}),(r=(e=It.state.chains.get(t.chain))==null?void 0:e.networkState)!=null&&r.allowUnsupportedChain||this.checkIfSupportedNetwork()||this.showUnsupportedChainUI())},setCaipNetwork(t){var e,r;if(t){if(!(t!=null&&t.chain))throw new Error("chain is required to set active network");It.setCaipNetwork(t==null?void 0:t.chain,t),(r=(e=It.state.chains.get(t.chain))==null?void 0:e.networkState)!=null&&r.allowUnsupportedChain||this.checkIfSupportedNetwork()||this.showUnsupportedChainUI()}},setRequestedCaipNetworks(t,e){It.setChainNetworkData(e,{requestedCaipNetworks:t})},setAllowUnsupportedChain(t,e){It.setChainNetworkData(e||It.state.activeChain,{allowUnsupportedChain:t})},setSmartAccountEnabledNetworks(t,e){It.setChainNetworkData(e,{smartAccountEnabledNetworks:t})},getRequestedCaipNetworks(t){let e;if(!It.state.activeChain)throw new Error("activeChain is required to get requested networks");if(t){const s=t;if(!s)throw new Error("chain is required to get requested networks");e=[s]}else e=[...It.state.chains.keys()];const r=[],n=[];return e.forEach(s=>{var a,o,f,c,d,p,g,x;(o=(a=It.state.chains.get(s))==null?void 0:a.networkState)!=null&&o.approvedCaipNetworkIds&&r.push(...((c=(f=It.state.chains.get(s))==null?void 0:f.networkState)==null?void 0:c.approvedCaipNetworkIds)||[]),(p=(d=It.state.chains.get(s))==null?void 0:d.networkState)!=null&&p.requestedCaipNetworks&&n.push(...((x=(g=It.state.chains.get(s))==null?void 0:g.networkState)==null?void 0:x.requestedCaipNetworks)||[])}),Ot.sortRequestedNetworks(r,n)},async switchActiveNetwork(t){var r;const e=t?(r=It.state.chains.get(t.chain))==null?void 0:r.networkControllerClient:void 0;if(!e)throw new Error("networkControllerClient not found for given network object");It.setActiveCaipNetwork(t),await(e==null?void 0:e.switchCaipNetwork(t)),t&&Ht.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:t.id}})},getApprovedCaipNetworkIds(t){var r,n;if(t){const i=t;if(!i)throw new Error("chain is required to get approved network IDs");return(n=(r=It.state.chains.get(i))==null?void 0:r.networkState)==null?void 0:n.approvedCaipNetworkIds}const e=[];return Object.values(It.state.chains).forEach(i=>{var s;i.networkState.approvedCaipNetworkIds&&e.push(...((s=i.networkState)==null?void 0:s.approvedCaipNetworkIds)||[])}),e},async setApprovedCaipNetworksData(t){const r=await It.getNetworkControllerClient().getApprovedCaipNetworksData();if(!t)throw new Error("chain is required to set approved network data");It.setChainNetworkData(t,{approvedCaipNetworkIds:r==null?void 0:r.approvedCaipNetworkIds,supportsAllNetworks:(r==null?void 0:r.supportsAllNetworks)||!1})},checkIfSupportedNetwork(){var n,i;const t=It.state.activeChain;if(!t)return!1;const e=(i=(n=It.state.chains.get(t))==null?void 0:n.networkState)==null?void 0:i.caipNetwork,r=this.getRequestedCaipNetworks();return r.length?r==null?void 0:r.some(s=>s.id===(e==null?void 0:e.id)):!0},checkIfSmartAccountEnabled(){var n;const t=vl.caipNetworkIdToNumber((n=WF.caipNetwork)==null?void 0:n.id);if(!It.state.activeChain)throw new Error("activeChain is required to check if smart account is enabled");if(!t)return!1;const r=It.getNetworkProp("smartAccountEnabledNetworks");return!!(r!=null&&r.includes(t))},resetNetwork(){const t=It.state.activeChain;if(!t)throw new Error("chain is required to reset network");It.setChainNetworkData(t,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},getSupportsAllNetworks(){var e,r;const t=It.state.activeChain;if(!t)throw new Error("chain is required to check if network supports all networks");return(r=(e=It.state.chains.get(t))==null?void 0:e.networkState)==null?void 0:r.supportsAllNetworks},showUnsupportedChainUI(){setTimeout(()=>{gr.open({view:"UnsupportedChain"})},300)},getActiveNetworkTokenAddress(){var e,r;const t=S0.NATIVE_TOKEN_ADDRESS[((e=this.state.caipNetwork)==null?void 0:e.chain)||"evm"];return`${((r=this.state.caipNetwork)==null?void 0:r.id)||"eip155:1"}:${t}`}},Cut=Ot.getApiUrl(),Cs=new pP({baseUrl:Cut,clientId:null}),Sut="40",Hce="4",Tut=20,$0=zi({page:1,count:0,featured:[],recommended:[],wallets:[],search:[],isAnalyticsEnabled:!1,excludedRDNS:[]}),cr={state:$0,subscribeKey(t,e){return ho($0,t,e)},_getApiHeaders(){const{projectId:t,sdkType:e,sdkVersion:r}=zt.state;return{"x-project-id":t,"x-sdk-type":e,"x-sdk-version":r}},_filterOutExtensions(t){return zt.state.isUniversalProvider?t.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):t},async _fetchWalletImage(t){const e=`${Cs.baseUrl}/getWalletImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setWalletImage(t,URL.createObjectURL(r))},async _fetchNetworkImage(t){const e=`${Cs.baseUrl}/public/getAssetImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setNetworkImage(t,URL.createObjectURL(r))},async _fetchConnectorImage(t){const e=`${Cs.baseUrl}/public/getAssetImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setConnectorImage(t,URL.createObjectURL(r))},async _fetchCurrencyImage(t){const e=`${Cs.baseUrl}/public/getCurrencyImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setCurrencyImage(t,URL.createObjectURL(r))},async _fetchTokenImage(t){const e=`${Cs.baseUrl}/public/getTokenImage/${t}`,r=await Cs.getBlob({path:e,headers:cr._getApiHeaders()});Ri.setTokenImage(t,URL.createObjectURL(r))},async fetchNetworkImages(){const t=Ct.getRequestedCaipNetworks(),e=t==null?void 0:t.map(({imageId:r})=>r).filter(Boolean);e&&await Promise.allSettled(e.map(r=>cr._fetchNetworkImage(r)))},async fetchConnectorImages(){const{connectors:t}=Zt.state,e=t.map(({imageId:r})=>r).filter(Boolean);await Promise.allSettled(e.map(r=>cr._fetchConnectorImage(r)))},async fetchCurrencyImages(t=[]){await Promise.allSettled(t.map(e=>cr._fetchCurrencyImage(e)))},async fetchTokenImages(t=[]){await Promise.allSettled(t.map(e=>cr._fetchTokenImage(e)))},async fetchFeaturedWallets(){const{featuredWalletIds:t}=zt.state;if(t!=null&&t.length){const{data:e}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",entries:t!=null&&t.length?String(t.length):Hce,include:t==null?void 0:t.join(",")}});e.sort((n,i)=>t.indexOf(n.id)-t.indexOf(i.id));const r=e.map(n=>n.image_id).filter(Boolean);await Promise.allSettled(r.map(n=>cr._fetchWalletImage(n))),$0.featured=e}},async fetchRecommendedWallets(){var c;const{includeWalletIds:t,excludeWalletIds:e,featuredWalletIds:r}=zt.state,n=[...e??[],...r??[]].filter(Boolean),{data:i,count:s}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",chains:(c=Ct.state.caipNetwork)==null?void 0:c.id,entries:Hce,include:t==null?void 0:t.join(","),exclude:n==null?void 0:n.join(",")}}),a=En.getRecentWallets(),o=i.map(d=>d.image_id).filter(Boolean),f=a.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...o,...f].map(d=>cr._fetchWalletImage(d))),$0.recommended=i,$0.count=s??0},async fetchWallets({page:t}){var f;const{includeWalletIds:e,excludeWalletIds:r,featuredWalletIds:n}=zt.state,i=[...$0.recommended.map(({id:c})=>c),...r??[],...n??[]].filter(Boolean),{data:s,count:a}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:String(t),entries:Sut,chains:(f=Ct.state.caipNetwork)==null?void 0:f.id,include:e==null?void 0:e.join(","),exclude:i.join(",")}}),o=s.slice(0,Tut).map(c=>c.image_id).filter(Boolean);await Promise.allSettled(o.map(c=>cr._fetchWalletImage(c))),$0.wallets=Ot.uniqueBy([...$0.wallets,...cr._filterOutExtensions(s)],"id"),$0.count=a>$0.count?a:$0.count,$0.page=t},async searchWalletByIds({ids:t}){var r;const{data:e}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",entries:String(t.length),chains:(r=Ct.state.caipNetwork)==null?void 0:r.id,include:t==null?void 0:t.join(",")}});e&&e.forEach(n=>{n!=null&&n.rdns&&$0.excludedRDNS.push(n.rdns)})},async searchWallet({search:t}){var s;const{includeWalletIds:e,excludeWalletIds:r}=zt.state;$0.search=[];const{data:n}=await Cs.get({path:"/getWallets",headers:cr._getApiHeaders(),params:{page:"1",entries:"100",search:t==null?void 0:t.trim(),chains:(s=Ct.state.caipNetwork)==null?void 0:s.id,include:e==null?void 0:e.join(","),exclude:r==null?void 0:r.join(",")}}),i=n.map(a=>a.image_id).filter(Boolean);await Promise.allSettled([...i.map(a=>cr._fetchWalletImage(a)),Ot.wait(300)]),$0.search=cr._filterOutExtensions(n)},async reFetchWallets(){$0.page=1,$0.wallets=[],await cr.fetchFeaturedWallets(),await cr.fetchRecommendedWallets()},prefetch(){const t=[cr.fetchFeaturedWallets(),cr.fetchRecommendedWallets(),cr.fetchNetworkImages(),cr.fetchConnectorImages()];zt.state.enableAnalytics===void 0&&t.push(cr.fetchAnalyticsConfig()),$0.prefetchPromise=Promise.race([Promise.allSettled(t)])},async fetchAnalyticsConfig(){const{isAnalyticsEnabled:t}=await Cs.get({path:"/getAnalyticsConfig",headers:cr._getApiHeaders()});zt.setEnableAnalytics(t)}},Oi=zi({projectId:"",sdkType:"w3m",sdkVersion:"html-wagmi-undefined"}),zt={state:Oi,subscribeKey(t,e){return ho(Oi,t,e)},setOptions(t){Object.assign(Oi,t)},setProjectId(t){Oi.projectId=t},setAllWallets(t){Oi.allWallets=t},setIncludeWalletIds(t){Oi.includeWalletIds=t},setExcludeWalletIds(t){Oi.excludeWalletIds=t,t&&cr.searchWalletByIds({ids:t})},setFeaturedWalletIds(t){Oi.featuredWalletIds=t},setTokens(t){Oi.tokens=t},setTermsConditionsUrl(t){Oi.termsConditionsUrl=t},setPrivacyPolicyUrl(t){Oi.privacyPolicyUrl=t},setCustomWallets(t){Oi.customWallets=t},setIsSiweEnabled(t){Oi.isSiweEnabled=t},setIsUniversalProvider(t){Oi.isUniversalProvider=t},setEnableAnalytics(t){Oi.enableAnalytics=t},setSdkVersion(t){Oi.sdkVersion=t},setMetadata(t){Oi.metadata=t},setOnrampEnabled(t){Oi.enableOnramp=t},setDisableAppend(t){Oi.disableAppend=t},setEIP6963Enabled(t){Oi.enableEIP6963=t},setHasMultipleAddresses(t){Oi.hasMultipleAddresses=t},setEnableSwaps(t){Oi.enableSwaps=t}},Iut={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},Pye=Ot.getBlockchainApiUrl(),s0=zi({clientId:null,api:new pP({baseUrl:Pye,clientId:null})}),gi={state:s0,fetchIdentity({address:t}){return s0.api.get({path:`/v1/identity/${t}`,params:{projectId:zt.state.projectId,sender:Je.state.address}})},fetchTransactions({account:t,projectId:e,cursor:r,onramp:n,signal:i,cache:s,chainId:a}){return s0.api.get({path:`/v1/account/${t}/history`,params:{projectId:e,cursor:r,onramp:n,chainId:a},signal:i,cache:s})},fetchSwapQuote({projectId:t,amount:e,userAddress:r,from:n,to:i,gasPrice:s}){return s0.api.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{projectId:t,amount:e,userAddress:r,from:n,to:i,gasPrice:s}})},fetchSwapTokens({projectId:t,chainId:e}){return s0.api.get({path:"/v1/convert/tokens",params:{projectId:t,chainId:e}})},fetchTokenPrice({projectId:t,addresses:e}){return s0.api.post({path:"/v1/fungible/price",body:{projectId:t,currency:"usd",addresses:e},headers:{"Content-Type":"application/json"}})},fetchSwapAllowance({projectId:t,tokenAddress:e,userAddress:r}){const{sdkType:n,sdkVersion:i}=zt.state;return s0.api.get({path:"/v1/convert/allowance",params:{projectId:t,tokenAddress:e,userAddress:r},headers:{"Content-Type":"application/json","x-sdk-type":n,"x-sdk-version":i}})},fetchGasPrice({projectId:t,chainId:e}){const{sdkType:r,sdkVersion:n}=zt.state;return s0.api.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json","x-sdk-type":r,"x-sdk-version":n},params:{projectId:t,chainId:e}})},generateSwapCalldata({amount:t,from:e,projectId:r,to:n,userAddress:i}){return s0.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:t,eip155:{slippage:S0.CONVERT_SLIPPAGE_TOLERANCE},from:e,projectId:r,to:n,userAddress:i}})},generateApproveCalldata({from:t,projectId:e,to:r,userAddress:n}){const{sdkType:i,sdkVersion:s}=zt.state;return s0.api.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json","x-sdk-type":i,"x-sdk-version":s},params:{projectId:e,userAddress:n,from:t,to:r}})},async getBalance(t,e,r){const{sdkType:n,sdkVersion:i}=zt.state;return s0.api.get({path:`/v1/account/${t}/balance`,headers:{"x-sdk-type":n,"x-sdk-version":i},params:{currency:"usd",projectId:zt.state.projectId,chainId:e,forceUpdate:r}})},async lookupEnsName(t){return s0.api.get({path:`/v1/profile/account/${t}${zn.WC_NAME_SUFFIX}`,params:{projectId:zt.state.projectId,apiVersion:"2"}})},async reverseLookupEnsName({address:t}){return s0.api.get({path:`/v1/profile/reverse/${t}`,params:{sender:Je.state.address,projectId:zt.state.projectId,apiVersion:"2"}})},async getEnsNameSuggestions(t){return s0.api.get({path:`/v1/profile/suggestions/${t}`,params:{projectId:zt.state.projectId}})},async registerEnsName({coinType:t,address:e,message:r,signature:n}){return s0.api.post({path:"/v1/profile/account",body:{coin_type:t,address:e,message:r,signature:n},headers:{"Content-Type":"application/json"}})},async generateOnRampURL({destinationWallets:t,partnerUserId:e,defaultNetwork:r,purchaseAmount:n,paymentAmount:i}){return(await s0.api.post({path:"/v1/generators/onrampurl",params:{projectId:zt.state.projectId},body:{destinationWallets:t,defaultNetwork:r,partnerUserId:e,defaultExperience:"buy",presetCryptoAmount:n,presetFiatAmount:i}})).url},async getOnrampOptions(){try{return await s0.api.get({path:"/v1/onramp/options",params:{projectId:zt.state.projectId}})}catch{return Iut}},async getOnrampQuote({purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}){try{return await s0.api.post({path:"/v1/onramp/quote",params:{projectId:zt.state.projectId},body:{purchaseCurrency:t,paymentCurrency:e,amount:r,network:n}})}catch{return{coinbaseFee:{amount:r,currency:e.id},networkFee:{amount:r,currency:e.id},paymentSubtotal:{amount:r,currency:e.id},paymentTotal:{amount:r,currency:e.id},purchaseAmount:{amount:r,currency:e.id},quoteId:"mocked-quote-id"}}},setClientId(t){s0.clientId=t,s0.api=new pP({baseUrl:Pye,clientId:t})}},Tf=zi({message:"",variant:"success",open:!1}),nr={state:Tf,subscribeKey(t,e){return ho(Tf,t,e)},showLoading(t){Tf.message=t,Tf.variant="loading",Tf.open=!0},showSuccess(t){Tf.message=t,Tf.variant="success",Tf.open=!0},showError(t){const e=Ot.parseError(t);Tf.message=e,Tf.variant="error",Tf.open=!0},hide(){Tf.open=!1}};var Nye={};const Rut=Nye.NEXT_PUBLIC_SECURE_SITE_SDK_URL||"https://secure.walletconnect.org/sdk",Mut=Nye.NEXT_PUBLIC_DEFAULT_LOG_LEVEL||"error",lr={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@w3m-storage/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",SOCIAL:"@w3m/connected_social",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",FRAME_SWITCH_NETWORK_ERROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},Lr={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}};var _n;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const s={};for(const a of i)s[a]=a;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of s)a[o]=i[o];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(const a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(_n||(_n={}));var IH;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(IH||(IH={}));const Kt=_n.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lp=t=>{switch(typeof t){case"undefined":return Kt.undefined;case"string":return Kt.string;case"number":return isNaN(t)?Kt.nan:Kt.number;case"boolean":return Kt.boolean;case"function":return Kt.function;case"bigint":return Kt.bigint;case"symbol":return Kt.symbol;case"object":return Array.isArray(t)?Kt.array:t===null?Kt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Kt.promise:typeof Map<"u"&&t instanceof Map?Kt.map:typeof Set<"u"&&t instanceof Set?Kt.set:typeof Date<"u"&&t instanceof Date?Kt.date:Kt.object;default:return Kt.unknown}},Dt=_n.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),kut=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class xu extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(s){return s.message},n={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let o=n,f=0;for(;fr.message){const r={},n=[];for(const i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}xu.create=t=>new xu(t);const Ex=(t,e)=>{let r;switch(t.code){case Dt.invalid_type:t.received===Kt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Dt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,_n.jsonStringifyReplacer)}`;break;case Dt.unrecognized_keys:r=`Unrecognized key(s) in object: ${_n.joinValues(t.keys,", ")}`;break;case Dt.invalid_union:r="Invalid input";break;case Dt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${_n.joinValues(t.options)}`;break;case Dt.invalid_enum_value:r=`Invalid enum value. Expected ${_n.joinValues(t.options)}, received '${t.received}'`;break;case Dt.invalid_arguments:r="Invalid function arguments";break;case Dt.invalid_return_type:r="Invalid function return type";break;case Dt.invalid_date:r="Invalid date";break;case Dt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:_n.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Dt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Dt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Dt.custom:r="Invalid input";break;case Dt.invalid_intersection_types:r="Intersection results could not be merged";break;case Dt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Dt.not_finite:r="Number must be finite";break;default:r=e.defaultError,_n.assertNever(t)}return{message:r}};let Oye=Ex;function Put(t){Oye=t}function hR(){return Oye}const pR=t=>{const{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],a={...i,path:s};let o="";const f=n.filter(c=>!!c).slice().reverse();for(const c of f)o=c(a,{data:e,defaultError:o}).message;return{...i,path:s,message:i.message||o}},Nut=[];function Xt(t,e){const r=pR({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,hR(),Ex].filter(n=>!!n)});t.common.issues.push(r)}class zs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const i of r){if(i.status==="aborted")return Ir;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const i of r)n.push({key:await i.key,value:await i.value});return zs.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const i of r){const{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return Ir;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}}const Ir=Object.freeze({status:"aborted"}),Dye=t=>({status:"dirty",value:t}),pa=t=>({status:"valid",value:t}),RH=t=>t.status==="aborted",MH=t=>t.status==="dirty",Cx=t=>t.status==="valid",mR=t=>typeof Promise<"u"&&t instanceof Promise;var dr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(dr||(dr={}));class w1{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Vce=(t,e)=>{if(Cx(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new xu(t.common.issues);return this._error=r,this._error}}};function Fr(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>a.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:r??o.defaultError},description:i}}class Vr{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Lp(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Lp(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new zs,ctx:{common:e.parent.common,data:e.data,parsedType:Lp(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(mR(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;const i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lp(e)},s=this._parseSync({data:e,path:i.path,parent:i});return Vce(i,s)}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Lp(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(mR(i)?i:Promise.resolve(i));return Vce(n,s)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{const a=e(i),o=()=>s.addIssue({code:Dt.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(f=>f?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Mu({schema:this,typeName:xr.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ch.create(this,this._def)}nullable(){return qm.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Au.create(this,this._def)}promise(){return My.create(this,this._def)}or(e){return Rx.create([this,e],this._def)}and(e){return Mx.create(this,e,this._def)}transform(e){return new Mu({...Fr(this._def),schema:this,typeName:xr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Dx({...Fr(this._def),innerType:this,defaultValue:r,typeName:xr.ZodDefault})}brand(){return new Bye({typeName:xr.ZodBranded,type:this,...Fr(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new wR({...Fr(this._def),innerType:this,catchValue:r,typeName:xr.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return O_.create(this,e)}readonly(){return xR.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Out=/^c[^\s-]{8,}$/i,Dut=/^[a-z][a-z0-9]*$/,$ut=/^[0-9A-HJKMNP-TV-Z]{26}$/,But=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Uut=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Lut="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let GF;const Fut=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,jut=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,zut=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function qut(t,e){return!!((e==="v4"||!e)&&Fut.test(t)||(e==="v6"||!e)&&jut.test(t))}class yu extends Vr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Kt.string){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.string,received:s.parsedType}),Ir}const n=new zs;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),Xt(i,{code:Dt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,o=e.data.lengthe.test(i),{validation:r,code:Dt.invalid_string,...dr.errToObj(n)})}_addCheck(e){return new yu({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...dr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...dr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...dr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...dr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...dr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...dr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...dr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...dr.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...dr.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...dr.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...dr.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...dr.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...dr.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...dr.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...dr.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...dr.errToObj(r)})}nonempty(e){return this.min(1,dr.errToObj(e))}trim(){return new yu({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yu({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yu({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new yu({checks:[],typeName:xr.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Fr(t)})};function Hut(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}class K6 extends Vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Kt.number){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.number,received:s.parsedType}),Ir}let n;const i=new zs;for(const s of this._def.checks)s.kind==="int"?_n.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Hut(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.not_finite,message:s.message}),i.dirty()):_n.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,dr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,dr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,dr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,dr.toString(r))}setLimit(e,r,n,i){return new K6({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:dr.toString(i)}]})}_addCheck(e){return new K6({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:dr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:dr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:dr.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:dr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:dr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:dr.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&_n.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew K6({checks:[],typeName:xr.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Fr(t)});class Q6 extends Vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Kt.bigint){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.bigint,received:s.parsedType}),Ir}let n;const i=new zs;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Xt(n,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):_n.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,dr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,dr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,dr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,dr.toString(r))}setLimit(e,r,n,i){return new Q6({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:dr.toString(i)}]})}_addCheck(e){return new Q6({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:dr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:dr.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value{var e;return new Q6({checks:[],typeName:xr.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Fr(t)})};class Sx extends Vr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Kt.boolean){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.boolean,received:n.parsedType}),Ir}return pa(e.data)}}Sx.create=t=>new Sx({typeName:xr.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Fr(t)});class jm extends Vr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Kt.date){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_type,expected:Kt.date,received:s.parsedType}),Ir}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Xt(s,{code:Dt.invalid_date}),Ir}const n=new zs;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),Xt(i,{code:Dt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):_n.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jm({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:dr.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:dr.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew jm({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:xr.ZodDate,...Fr(t)});class gR extends Vr{_parse(e){if(this._getType(e)!==Kt.symbol){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.symbol,received:n.parsedType}),Ir}return pa(e.data)}}gR.create=t=>new gR({typeName:xr.ZodSymbol,...Fr(t)});class Tx extends Vr{_parse(e){if(this._getType(e)!==Kt.undefined){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.undefined,received:n.parsedType}),Ir}return pa(e.data)}}Tx.create=t=>new Tx({typeName:xr.ZodUndefined,...Fr(t)});class Ix extends Vr{_parse(e){if(this._getType(e)!==Kt.null){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.null,received:n.parsedType}),Ir}return pa(e.data)}}Ix.create=t=>new Ix({typeName:xr.ZodNull,...Fr(t)});class Ry extends Vr{constructor(){super(...arguments),this._any=!0}_parse(e){return pa(e.data)}}Ry.create=t=>new Ry({typeName:xr.ZodAny,...Fr(t)});class pm extends Vr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pa(e.data)}}pm.create=t=>new pm({typeName:xr.ZodUnknown,...Fr(t)});class Ah extends Vr{_parse(e){const r=this._getOrReturnCtx(e);return Xt(r,{code:Dt.invalid_type,expected:Kt.never,received:r.parsedType}),Ir}}Ah.create=t=>new Ah({typeName:xr.ZodNever,...Fr(t)});class bR extends Vr{_parse(e){if(this._getType(e)!==Kt.undefined){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.void,received:n.parsedType}),Ir}return pa(e.data)}}bR.create=t=>new bR({typeName:xr.ZodVoid,...Fr(t)});class Au extends Vr{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Kt.array)return Xt(r,{code:Dt.invalid_type,expected:Kt.array,received:r.parsedType}),Ir;if(i.exactLength!==null){const a=r.data.length>i.exactLength.value,o=r.data.lengthi.maxLength.value&&(Xt(r,{code:Dt.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>i.type._parseAsync(new w1(r,a,r.path,o)))).then(a=>zs.mergeArray(n,a));const s=[...r.data].map((a,o)=>i.type._parseSync(new w1(r,a,r.path,o)));return zs.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Au({...this._def,minLength:{value:e,message:dr.toString(r)}})}max(e,r){return new Au({...this._def,maxLength:{value:e,message:dr.toString(r)}})}length(e,r){return new Au({...this._def,exactLength:{value:e,message:dr.toString(r)}})}nonempty(e){return this.min(1,e)}}Au.create=(t,e)=>new Au({type:t,minLength:null,maxLength:null,exactLength:null,typeName:xr.ZodArray,...Fr(e)});function Pb(t){if(t instanceof Si){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=ch.create(Pb(n))}return new Si({...t._def,shape:()=>e})}else return t instanceof Au?new Au({...t._def,type:Pb(t.element)}):t instanceof ch?ch.create(Pb(t.unwrap())):t instanceof qm?qm.create(Pb(t.unwrap())):t instanceof v1?v1.create(t.items.map(e=>Pb(e))):t}class Si extends Vr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=_n.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Kt.object){const c=this._getOrReturnCtx(e);return Xt(c,{code:Dt.invalid_type,expected:Kt.object,received:c.parsedType}),Ir}const{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ah&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||o.push(c);const f=[];for(const c of a){const d=s[c],p=i.data[c];f.push({key:{status:"valid",value:c},value:d._parse(new w1(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ah){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)f.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(c==="strict")o.length>0&&(Xt(i,{code:Dt.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const p=i.data[d];f.push({key:{status:"valid",value:d},value:c._parse(new w1(i,p,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of f){const p=await d.key;c.push({key:p,value:await d.value,alwaysSet:d.alwaysSet})}return c}).then(c=>zs.mergeObjectSync(n,c)):zs.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return dr.errToObj,new Si({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,o;const f=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=dr.errToObj(e).message)!==null&&o!==void 0?o:f}:{message:f}}}:{}})}strip(){return new Si({...this._def,unknownKeys:"strip"})}passthrough(){return new Si({...this._def,unknownKeys:"passthrough"})}extend(e){return new Si({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Si({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:xr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Si({...this._def,catchall:e})}pick(e){const r={};return _n.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Si({...this._def,shape:()=>r})}omit(e){const r={};return _n.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new Si({...this._def,shape:()=>r})}deepPartial(){return Pb(this)}partial(e){const r={};return _n.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new Si({...this._def,shape:()=>r})}required(e){const r={};return _n.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof ch;)s=s._def.innerType;r[n]=s}}),new Si({...this._def,shape:()=>r})}keyof(){return $ye(_n.objectKeys(this.shape))}}Si.create=(t,e)=>new Si({shape:()=>t,unknownKeys:"strip",catchall:Ah.create(),typeName:xr.ZodObject,...Fr(e)});Si.strictCreate=(t,e)=>new Si({shape:()=>t,unknownKeys:"strict",catchall:Ah.create(),typeName:xr.ZodObject,...Fr(e)});Si.lazycreate=(t,e)=>new Si({shape:t,unknownKeys:"strip",catchall:Ah.create(),typeName:xr.ZodObject,...Fr(e)});class Rx extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function i(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(o=>new xu(o.ctx.common.issues));return Xt(r,{code:Dt.invalid_union,unionErrors:a}),Ir}if(r.common.async)return Promise.all(n.map(async s=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const f of n){const c={...r,common:{...r.common,issues:[]},parent:null},d=f._parseSync({data:r.data,path:r.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(f=>new xu(f));return Xt(r,{code:Dt.invalid_union,unionErrors:o}),Ir}}get options(){return this._def.options}}Rx.create=(t,e)=>new Rx({options:t,typeName:xr.ZodUnion,...Fr(e)});const OT=t=>t instanceof Px?OT(t.schema):t instanceof Mu?OT(t.innerType()):t instanceof Nx?[t.value]:t instanceof Z6?t.options:t instanceof Ox?Object.keys(t.enum):t instanceof Dx?OT(t._def.innerType):t instanceof Tx?[void 0]:t instanceof Ix?[null]:null;class mP extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Kt.object)return Xt(r,{code:Dt.invalid_type,expected:Kt.object,received:r.parsedType}),Ir;const n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Xt(r,{code:Dt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ir)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const i=new Map;for(const s of r){const a=OT(s.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new mP({typeName:xr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Fr(n)})}}function kH(t,e){const r=Lp(t),n=Lp(e);if(t===e)return{valid:!0,data:t};if(r===Kt.object&&n===Kt.object){const i=_n.objectKeys(e),s=_n.objectKeys(t).filter(o=>i.indexOf(o)!==-1),a={...t,...e};for(const o of s){const f=kH(t[o],e[o]);if(!f.valid)return{valid:!1};a[o]=f.data}return{valid:!0,data:a}}else if(r===Kt.array&&n===Kt.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s{if(RH(s)||RH(a))return Ir;const o=kH(s.value,a.value);return o.valid?((MH(s)||MH(a))&&r.dirty(),{status:r.value,value:o.data}):(Xt(n,{code:Dt.invalid_intersection_types}),Ir)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Mx.create=(t,e,r)=>new Mx({left:t,right:e,typeName:xr.ZodIntersection,...Fr(r)});class v1 extends Vr{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.array)return Xt(n,{code:Dt.invalid_type,expected:Kt.array,received:n.parsedType}),Ir;if(n.data.lengththis._def.items.length&&(Xt(n,{code:Dt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((a,o)=>{const f=this._def.items[o]||this._def.rest;return f?f._parse(new w1(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>zs.mergeArray(r,a)):zs.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new v1({...this._def,rest:e})}}v1.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new v1({items:t,typeName:xr.ZodTuple,rest:null,...Fr(e)})};class kx extends Vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.object)return Xt(n,{code:Dt.invalid_type,expected:Kt.object,received:n.parsedType}),Ir;const i=[],s=this._def.keyType,a=this._def.valueType;for(const o in n.data)i.push({key:s._parse(new w1(n,o,n.path,o)),value:a._parse(new w1(n,n.data[o],n.path,o))});return n.common.async?zs.mergeObjectAsync(r,i):zs.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Vr?new kx({keyType:e,valueType:r,typeName:xr.ZodRecord,...Fr(n)}):new kx({keyType:yu.create(),valueType:e,typeName:xr.ZodRecord,...Fr(r)})}}class yR extends Vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.map)return Xt(n,{code:Dt.invalid_type,expected:Kt.map,received:n.parsedType}),Ir;const i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([o,f],c)=>({key:i._parse(new w1(n,o,n.path,[c,"key"])),value:s._parse(new w1(n,f,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const f of a){const c=await f.key,d=await f.value;if(c.status==="aborted"||d.status==="aborted")return Ir;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(c.value,d.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const f of a){const c=f.key,d=f.value;if(c.status==="aborted"||d.status==="aborted")return Ir;(c.status==="dirty"||d.status==="dirty")&&r.dirty(),o.set(c.value,d.value)}return{status:r.value,value:o}}}}yR.create=(t,e,r)=>new yR({valueType:e,keyType:t,typeName:xr.ZodMap,...Fr(r)});class zm extends Vr{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Kt.set)return Xt(n,{code:Dt.invalid_type,expected:Kt.set,received:n.parsedType}),Ir;const i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&(Xt(n,{code:Dt.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const s=this._def.valueType;function a(f){const c=new Set;for(const d of f){if(d.status==="aborted")return Ir;d.status==="dirty"&&r.dirty(),c.add(d.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((f,c)=>s._parse(new w1(n,f,n.path,c)));return n.common.async?Promise.all(o).then(f=>a(f)):a(o)}min(e,r){return new zm({...this._def,minSize:{value:e,message:dr.toString(r)}})}max(e,r){return new zm({...this._def,maxSize:{value:e,message:dr.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}zm.create=(t,e)=>new zm({valueType:t,minSize:null,maxSize:null,typeName:xr.ZodSet,...Fr(e)});class M3 extends Vr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Kt.function)return Xt(r,{code:Dt.invalid_type,expected:Kt.function,received:r.parsedType}),Ir;function n(o,f){return pR({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hR(),Ex].filter(c=>!!c),issueData:{code:Dt.invalid_arguments,argumentsError:f}})}function i(o,f){return pR({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hR(),Ex].filter(c=>!!c),issueData:{code:Dt.invalid_return_type,returnTypeError:f}})}const s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof My){const o=this;return pa(async function(...f){const c=new xu([]),d=await o._def.args.parseAsync(f,s).catch(x=>{throw c.addIssue(n(f,x)),c}),p=await Reflect.apply(a,this,d);return await o._def.returns._def.type.parseAsync(p,s).catch(x=>{throw c.addIssue(i(p,x)),c})})}else{const o=this;return pa(function(...f){const c=o._def.args.safeParse(f,s);if(!c.success)throw new xu([n(f,c.error)]);const d=Reflect.apply(a,this,c.data),p=o._def.returns.safeParse(d,s);if(!p.success)throw new xu([i(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new M3({...this._def,args:v1.create(e).rest(pm.create())})}returns(e){return new M3({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new M3({args:e||v1.create([]).rest(pm.create()),returns:r||pm.create(),typeName:xr.ZodFunction,...Fr(n)})}}class Px extends Vr{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Px.create=(t,e)=>new Px({getter:t,typeName:xr.ZodLazy,...Fr(e)});class Nx extends Vr{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return Xt(r,{received:r.data,code:Dt.invalid_literal,expected:this._def.value}),Ir}return{status:"valid",value:e.data}}get value(){return this._def.value}}Nx.create=(t,e)=>new Nx({value:t,typeName:xr.ZodLiteral,...Fr(e)});function $ye(t,e){return new Z6({values:t,typeName:xr.ZodEnum,...Fr(e)})}class Z6 extends Vr{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return Xt(r,{expected:_n.joinValues(n),received:r.parsedType,code:Dt.invalid_type}),Ir}if(this._def.values.indexOf(e.data)===-1){const r=this._getOrReturnCtx(e),n=this._def.values;return Xt(r,{received:r.data,code:Dt.invalid_enum_value,options:n}),Ir}return pa(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e){return Z6.create(e)}exclude(e){return Z6.create(this.options.filter(r=>!e.includes(r)))}}Z6.create=$ye;class Ox extends Vr{_parse(e){const r=_n.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Kt.string&&n.parsedType!==Kt.number){const i=_n.objectValues(r);return Xt(n,{expected:_n.joinValues(i),received:n.parsedType,code:Dt.invalid_type}),Ir}if(r.indexOf(e.data)===-1){const i=_n.objectValues(r);return Xt(n,{received:n.data,code:Dt.invalid_enum_value,options:i}),Ir}return pa(e.data)}get enum(){return this._def.values}}Ox.create=(t,e)=>new Ox({values:t,typeName:xr.ZodNativeEnum,...Fr(e)});class My extends Vr{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==Kt.promise&&r.common.async===!1)return Xt(r,{code:Dt.invalid_type,expected:Kt.promise,received:r.parsedType}),Ir;const n=r.parsedType===Kt.promise?r.data:Promise.resolve(r.data);return pa(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}}My.create=(t,e)=>new My({type:t,typeName:xr.ZodPromise,...Fr(e)});class Mu extends Vr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{Xt(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(n.data,s);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(i.type==="refinement"){const a=o=>{const f=i.refinement(o,s);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ir:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?Ir:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Cx(a))return a;const o=i.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Cx(a)?Promise.resolve(i.transform(a.value,s)).then(o=>({status:r.value,value:o})):a);_n.assertNever(i)}}Mu.create=(t,e,r)=>new Mu({schema:t,typeName:xr.ZodEffects,effect:e,...Fr(r)});Mu.createWithPreprocess=(t,e,r)=>new Mu({schema:e,effect:{type:"preprocess",transform:t},typeName:xr.ZodEffects,...Fr(r)});class ch extends Vr{_parse(e){return this._getType(e)===Kt.undefined?pa(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ch.create=(t,e)=>new ch({innerType:t,typeName:xr.ZodOptional,...Fr(e)});class qm extends Vr{_parse(e){return this._getType(e)===Kt.null?pa(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}qm.create=(t,e)=>new qm({innerType:t,typeName:xr.ZodNullable,...Fr(e)});class Dx extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===Kt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Dx.create=(t,e)=>new Dx({innerType:t,typeName:xr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Fr(e)});class wR extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mR(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new xu(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xu(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wR.create=(t,e)=>new wR({innerType:t,typeName:xr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Fr(e)});class vR extends Vr{_parse(e){if(this._getType(e)!==Kt.nan){const n=this._getOrReturnCtx(e);return Xt(n,{code:Dt.invalid_type,expected:Kt.nan,received:n.parsedType}),Ir}return{status:"valid",value:e.data}}}vR.create=t=>new vR({typeName:xr.ZodNaN,...Fr(t)});const Vut=Symbol("zod_brand");class Bye extends Vr{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class O_ extends Vr{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Ir:s.status==="dirty"?(r.dirty(),Dye(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ir:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new O_({in:e,out:r,typeName:xr.ZodPipeline})}}class xR extends Vr{_parse(e){const r=this._def.innerType._parse(e);return Cx(r)&&(r.value=Object.freeze(r.value)),r}}xR.create=(t,e)=>new xR({innerType:t,typeName:xr.ZodReadonly,...Fr(e)});const Uye=(t,e={},r)=>t?Ry.create().superRefine((n,i)=>{var s,a;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,f=(a=(s=o.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0,c=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...c,fatal:f})}}):Ry.create(),Wut={object:Si.lazycreate};var xr;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(xr||(xr={}));const Gut=(t,e={message:`Input not instance of ${t.name}`})=>Uye(r=>r instanceof t,e),Lye=yu.create,Fye=K6.create,Kut=vR.create,Qut=Q6.create,jye=Sx.create,Zut=jm.create,Yut=gR.create,Jut=Tx.create,Xut=Ix.create,elt=Ry.create,tlt=pm.create,rlt=Ah.create,nlt=bR.create,ilt=Au.create,slt=Si.create,alt=Si.strictCreate,olt=Rx.create,flt=mP.create,clt=Mx.create,ult=v1.create,llt=kx.create,dlt=yR.create,hlt=zm.create,plt=M3.create,mlt=Px.create,glt=Nx.create,blt=Z6.create,ylt=Ox.create,wlt=My.create,Wce=Mu.create,vlt=ch.create,xlt=qm.create,Alt=Mu.createWithPreprocess,_lt=O_.create,Elt=()=>Lye().optional(),Clt=()=>Fye().optional(),Slt=()=>jye().optional(),Tlt={string:t=>yu.create({...t,coerce:!0}),number:t=>K6.create({...t,coerce:!0}),boolean:t=>Sx.create({...t,coerce:!0}),bigint:t=>Q6.create({...t,coerce:!0}),date:t=>jm.create({...t,coerce:!0})},Ilt=Ir;var ge=Object.freeze({__proto__:null,defaultErrorMap:Ex,setErrorMap:Put,getErrorMap:hR,makeIssue:pR,EMPTY_PATH:Nut,addIssueToContext:Xt,ParseStatus:zs,INVALID:Ir,DIRTY:Dye,OK:pa,isAborted:RH,isDirty:MH,isValid:Cx,isAsync:mR,get util(){return _n},get objectUtil(){return IH},ZodParsedType:Kt,getParsedType:Lp,ZodType:Vr,ZodString:yu,ZodNumber:K6,ZodBigInt:Q6,ZodBoolean:Sx,ZodDate:jm,ZodSymbol:gR,ZodUndefined:Tx,ZodNull:Ix,ZodAny:Ry,ZodUnknown:pm,ZodNever:Ah,ZodVoid:bR,ZodArray:Au,ZodObject:Si,ZodUnion:Rx,ZodDiscriminatedUnion:mP,ZodIntersection:Mx,ZodTuple:v1,ZodRecord:kx,ZodMap:yR,ZodSet:zm,ZodFunction:M3,ZodLazy:Px,ZodLiteral:Nx,ZodEnum:Z6,ZodNativeEnum:Ox,ZodPromise:My,ZodEffects:Mu,ZodTransformer:Mu,ZodOptional:ch,ZodNullable:qm,ZodDefault:Dx,ZodCatch:wR,ZodNaN:vR,BRAND:Vut,ZodBranded:Bye,ZodPipeline:O_,ZodReadonly:xR,custom:Uye,Schema:Vr,ZodSchema:Vr,late:Wut,get ZodFirstPartyTypeKind(){return xr},coerce:Tlt,any:elt,array:ilt,bigint:Qut,boolean:jye,date:Zut,discriminatedUnion:flt,effect:Wce,enum:blt,function:plt,instanceof:Gut,intersection:clt,lazy:mlt,literal:glt,map:dlt,nan:Kut,nativeEnum:ylt,never:rlt,null:Xut,nullable:xlt,number:Fye,object:slt,oboolean:Slt,onumber:Clt,optional:vlt,ostring:Elt,pipeline:_lt,preprocess:Alt,promise:wlt,record:llt,set:hlt,strictObject:alt,string:Lye,symbol:Yut,transformer:Wce,tuple:ult,undefined:Jut,union:olt,unknown:tlt,void:nlt,NEVER:Ilt,ZodIssueCode:Dt,quotelessJson:kut,ZodError:xu});const Wi=ge.object({message:ge.string()});function ar(t){return ge.literal(lr[t])}ge.object({accessList:ge.array(ge.string()),blockHash:ge.string().nullable(),blockNumber:ge.string().nullable(),chainId:ge.string().or(ge.number()),from:ge.string(),gas:ge.string(),hash:ge.string(),input:ge.string().nullable(),maxFeePerGas:ge.string(),maxPriorityFeePerGas:ge.string(),nonce:ge.string(),r:ge.string(),s:ge.string(),to:ge.string(),transactionIndex:ge.string().nullable(),type:ge.string(),v:ge.string(),value:ge.string()});const Rlt=ge.object({chainId:ge.string().or(ge.number())}),Mlt=ge.object({email:ge.string().email()}),klt=ge.object({otp:ge.string()}),Plt=ge.object({uri:ge.string()}),Nlt=ge.object({chainId:ge.optional(ge.string().or(ge.number())),preferredAccountType:ge.optional(ge.string())}),Olt=ge.object({provider:ge.enum(["google","github","apple","facebook","x","discord"])}),Dlt=ge.object({email:ge.string().email()}),$lt=ge.object({otp:ge.string()}),Blt=ge.object({otp:ge.string()}),Ult=ge.object({themeMode:ge.optional(ge.enum(["light","dark"])),themeVariables:ge.optional(ge.record(ge.string(),ge.string().or(ge.number()))),w3mThemeVariables:ge.optional(ge.record(ge.string(),ge.string()))}),Llt=ge.object({metadata:ge.object({name:ge.string(),description:ge.string(),url:ge.string(),icons:ge.array(ge.string())}).optional(),sdkVersion:ge.string(),projectId:ge.string()}),Flt=ge.object({type:ge.string()}),jlt=ge.object({action:ge.enum(["VERIFY_DEVICE","VERIFY_OTP"])}),zlt=ge.object({url:ge.string()}),qlt=ge.object({userName:ge.string()}),Hlt=ge.object({email:ge.string(),address:ge.string(),chainId:ge.string().or(ge.number()),accounts:ge.array(ge.object({address:ge.string(),type:ge.enum([Lr.ACCOUNT_TYPES.EOA,Lr.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:ge.string().optional()}),Vlt=ge.object({action:ge.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),Wlt=ge.object({email:ge.string().email().optional().nullable(),address:ge.string(),chainId:ge.string().or(ge.number()),smartAccountDeployed:ge.optional(ge.boolean()),accounts:ge.array(ge.object({address:ge.string(),type:ge.enum([Lr.ACCOUNT_TYPES.EOA,Lr.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:ge.optional(ge.string())}),Glt=ge.object({uri:ge.string()}),Klt=ge.object({isConnected:ge.boolean()}),Qlt=ge.object({chainId:ge.string().or(ge.number())}),Zlt=ge.object({chainId:ge.string().or(ge.number())}),Ylt=ge.object({newEmail:ge.string().email()}),Jlt=ge.object({smartAccountEnabledNetworks:ge.array(ge.number())});ge.object({address:ge.string(),isDeployed:ge.boolean()});const Xlt=ge.object({type:ge.string(),address:ge.string()}),e1t=ge.any(),t1t=ge.object({method:ge.literal("eth_accounts")}),r1t=ge.object({method:ge.literal("eth_blockNumber")}),n1t=ge.object({method:ge.literal("eth_call"),params:ge.array(ge.any())}),i1t=ge.object({method:ge.literal("eth_chainId")}),s1t=ge.object({method:ge.literal("eth_estimateGas"),params:ge.array(ge.any())}),a1t=ge.object({method:ge.literal("eth_feeHistory"),params:ge.array(ge.any())}),o1t=ge.object({method:ge.literal("eth_gasPrice")}),f1t=ge.object({method:ge.literal("eth_getAccount"),params:ge.array(ge.any())}),c1t=ge.object({method:ge.literal("eth_getBalance"),params:ge.array(ge.any())}),u1t=ge.object({method:ge.literal("eth_getBlockByHash"),params:ge.array(ge.any())}),l1t=ge.object({method:ge.literal("eth_getBlockByNumber"),params:ge.array(ge.any())}),d1t=ge.object({method:ge.literal("eth_getBlockReceipts"),params:ge.array(ge.any())}),h1t=ge.object({method:ge.literal("eth_getBlockTransactionCountByHash"),params:ge.array(ge.any())}),p1t=ge.object({method:ge.literal("eth_getBlockTransactionCountByNumber"),params:ge.array(ge.any())}),m1t=ge.object({method:ge.literal("eth_getCode"),params:ge.array(ge.any())}),g1t=ge.object({method:ge.literal("eth_getFilterChanges"),params:ge.array(ge.any())}),b1t=ge.object({method:ge.literal("eth_getFilterLogs"),params:ge.array(ge.any())}),y1t=ge.object({method:ge.literal("eth_getLogs"),params:ge.array(ge.any())}),w1t=ge.object({method:ge.literal("eth_getProof"),params:ge.array(ge.any())}),v1t=ge.object({method:ge.literal("eth_getStorageAt"),params:ge.array(ge.any())}),x1t=ge.object({method:ge.literal("eth_getTransactionByBlockHashAndIndex"),params:ge.array(ge.any())}),A1t=ge.object({method:ge.literal("eth_getTransactionByBlockNumberAndIndex"),params:ge.array(ge.any())}),_1t=ge.object({method:ge.literal("eth_getTransactionByHash"),params:ge.array(ge.any())}),E1t=ge.object({method:ge.literal("eth_getTransactionCount"),params:ge.array(ge.any())}),C1t=ge.object({method:ge.literal("eth_getTransactionReceipt"),params:ge.array(ge.any())}),S1t=ge.object({method:ge.literal("eth_getUncleCountByBlockHash"),params:ge.array(ge.any())}),T1t=ge.object({method:ge.literal("eth_getUncleCountByBlockNumber"),params:ge.array(ge.any())}),I1t=ge.object({method:ge.literal("eth_maxPriorityFeePerGas")}),R1t=ge.object({method:ge.literal("eth_newBlockFilter")}),M1t=ge.object({method:ge.literal("eth_newFilter"),params:ge.array(ge.any())}),k1t=ge.object({method:ge.literal("eth_newPendingTransactionFilter")}),P1t=ge.object({method:ge.literal("eth_sendRawTransaction"),params:ge.array(ge.any())}),N1t=ge.object({method:ge.literal("eth_syncing"),params:ge.array(ge.any())}),O1t=ge.object({method:ge.literal("eth_uninstallFilter"),params:ge.array(ge.any())}),Gce=ge.object({method:ge.literal("personal_sign"),params:ge.array(ge.any())}),D1t=ge.object({method:ge.literal("eth_signTypedData_v4"),params:ge.array(ge.any())}),Kce=ge.object({method:ge.literal("eth_sendTransaction"),params:ge.array(ge.any())}),$1t=ge.object({method:ge.literal("solana_signMessage"),params:ge.object({message:ge.string(),pubkey:ge.string()})}),B1t=ge.object({method:ge.literal("solana_signTransaction"),params:ge.object({transaction:ge.string()})}),U1t=ge.object({method:ge.literal("solana_signAllTransactions"),params:ge.object({transactions:ge.array(ge.string())})}),L1t=ge.object({method:ge.literal("solana_signAndSendTransaction"),params:ge.object({transaction:ge.string(),options:ge.object({skipPreflight:ge.boolean().optional(),preflightCommitment:ge.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:ge.number().optional(),minContextSlot:ge.number().optional()}).optional()})}),F1t=ge.object({method:ge.literal("wallet_sendCalls"),params:ge.array(ge.object({chainId:ge.string().or(ge.number()).optional(),from:ge.string().optional(),version:ge.string().optional(),capabilities:ge.any().optional(),calls:ge.array(ge.object({to:ge.string().startsWith("0x"),data:ge.string().startsWith("0x").optional(),value:ge.string().optional()}))}))}),j1t=ge.object({method:ge.literal("wallet_getCallsStatus"),params:ge.array(ge.string())}),z1t=ge.object({method:ge.literal("wallet_getCapabilities")}),q1t=ge.object({method:ge.literal("wallet_grantPermissions"),params:ge.array(ge.any())}),Qce=ge.object({token:ge.string()}),or=ge.object({id:ge.string().optional()}),Xv={appEvent:or.extend({type:ar("APP_SWITCH_NETWORK"),payload:Rlt}).or(or.extend({type:ar("APP_CONNECT_EMAIL"),payload:Mlt})).or(or.extend({type:ar("APP_CONNECT_DEVICE")})).or(or.extend({type:ar("APP_CONNECT_OTP"),payload:klt})).or(or.extend({type:ar("APP_CONNECT_SOCIAL"),payload:Plt})).or(or.extend({type:ar("APP_GET_FARCASTER_URI")})).or(or.extend({type:ar("APP_CONNECT_FARCASTER")})).or(or.extend({type:ar("APP_GET_USER"),payload:ge.optional(Nlt)})).or(or.extend({type:ar("APP_GET_SOCIAL_REDIRECT_URI"),payload:Olt})).or(or.extend({type:ar("APP_SIGN_OUT")})).or(or.extend({type:ar("APP_IS_CONNECTED"),payload:ge.optional(Qce)})).or(or.extend({type:ar("APP_GET_CHAIN_ID")})).or(or.extend({type:ar("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(or.extend({type:ar("APP_INIT_SMART_ACCOUNT")})).or(or.extend({type:ar("APP_SET_PREFERRED_ACCOUNT"),payload:Flt})).or(or.extend({type:ar("APP_RPC_REQUEST"),payload:Gce.or(Kce).or(t1t).or(r1t).or(n1t).or(i1t).or(s1t).or(a1t).or(o1t).or(f1t).or(c1t).or(u1t).or(l1t).or(d1t).or(h1t).or(p1t).or(m1t).or(g1t).or(b1t).or(y1t).or(w1t).or(v1t).or(x1t).or(A1t).or(_1t).or(E1t).or(C1t).or(S1t).or(T1t).or(I1t).or(R1t).or(M1t).or(k1t).or(P1t).or(N1t).or(O1t).or(Gce).or(D1t).or(Kce).or($1t).or(B1t).or(U1t).or(L1t).or(j1t).or(F1t).or(z1t).or(q1t)})).or(or.extend({type:ar("APP_UPDATE_EMAIL"),payload:Dlt})).or(or.extend({type:ar("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:$lt})).or(or.extend({type:ar("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:Blt})).or(or.extend({type:ar("APP_SYNC_THEME"),payload:Ult})).or(or.extend({type:ar("APP_SYNC_DAPP_DATA"),payload:Llt})),frameEvent:or.extend({type:ar("FRAME_SWITCH_NETWORK_ERROR"),payload:Wi}).or(or.extend({type:ar("FRAME_SWITCH_NETWORK_SUCCESS"),payload:Zlt})).or(or.extend({type:ar("FRAME_CONNECT_EMAIL_SUCCESS"),payload:jlt})).or(or.extend({type:ar("FRAME_CONNECT_EMAIL_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:zlt})).or(or.extend({type:ar("FRAME_GET_FARCASTER_URI_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:qlt})).or(or.extend({type:ar("FRAME_CONNECT_FARCASTER_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_OTP_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_OTP_SUCCESS")})).or(or.extend({type:ar("FRAME_CONNECT_DEVICE_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_CONNECT_DEVICE_SUCCESS")})).or(or.extend({type:ar("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:Hlt})).or(or.extend({type:ar("FRAME_CONNECT_SOCIAL_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_USER_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_USER_SUCCESS"),payload:Wlt})).or(or.extend({type:ar("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:Glt})).or(or.extend({type:ar("FRAME_SIGN_OUT_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SIGN_OUT_SUCCESS")})).or(or.extend({type:ar("FRAME_IS_CONNECTED_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_IS_CONNECTED_SUCCESS"),payload:Klt})).or(or.extend({type:ar("FRAME_GET_CHAIN_ID_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_GET_CHAIN_ID_SUCCESS"),payload:Qlt})).or(or.extend({type:ar("FRAME_RPC_REQUEST_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_RPC_REQUEST_SUCCESS"),payload:e1t})).or(or.extend({type:ar("FRAME_SESSION_UPDATE"),payload:Qce})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_SUCCESS"),payload:Vlt})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:Ylt})).or(or.extend({type:ar("FRAME_SYNC_THEME_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SYNC_THEME_SUCCESS")})).or(or.extend({type:ar("FRAME_SYNC_DAPP_DATA_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(or.extend({type:ar("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:Jlt})).or(or.extend({type:ar("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:Wi})).or(or.extend({type:ar("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:Xlt})).or(or.extend({type:ar("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:Wi}))},ss={set(t,e){Ds.isClient&&localStorage.setItem(`${lr.STORAGE_KEY}${t}`,e)},get(t){return Ds.isClient?localStorage.getItem(`${lr.STORAGE_KEY}${t}`):null},delete(t,e){Ds.isClient&&(e?localStorage.removeItem(t):localStorage.removeItem(`${lr.STORAGE_KEY}${t}`))}},Zce={address:/^0x(?:[A-Fa-f0-9]{40})$/u,transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u},kS=30*1e3,Ds={checkIfAllowedToTriggerEmail(){const t=ss.get(lr.LAST_EMAIL_LOGIN_TIME);if(t){const e=Date.now()-Number(t);if(e{function o({data:f}){var d;if(!((d=f.type)!=null&&d.includes(lr.FRAME_EVENT_KEY)))return;const c=Xv.frameEvent.parse(f);c.id===i&&(s(c),window.removeEventListener("message",o))}Ds.isClient&&(window.addEventListener("message",o),a.addEventListener("abort",()=>{window.removeEventListener("message",o)}))},onFrameEvent:i=>{Ds.isClient&&window.addEventListener("message",({data:s})=>{var o;if(!((o=s.type)!=null&&o.includes(lr.FRAME_EVENT_KEY)))return;const a=Xv.frameEvent.parse(s);i(a)})},onAppEvent:i=>{Ds.isClient&&window.addEventListener("message",({data:s})=>{var o;if(!((o=s.type)!=null&&o.includes(lr.APP_EVENT_KEY)))return;const a=Xv.appEvent.parse(s);i(a)})},postAppEvent:i=>{var s;if(Ds.isClient){if(!((s=this.iframe)!=null&&s.contentWindow))throw new Error("W3mFrame: iframe is not set");Xv.appEvent.parse(i),this.iframe.contentWindow.postMessage(i,"*")}},postFrameEvent:i=>{if(Ds.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");Xv.frameEvent.parse(i),parent.postMessage(i,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise((i,s)=>{this.frameLoadPromiseResolver={resolve:i,reject:s}}),r&&(this.frameLoadPromise=new Promise((i,s)=>{this.frameLoadPromiseResolver={resolve:i,reject:s}}),Ds.isClient)){const i=document.createElement("iframe");i.id="w3m-iframe",i.src=`${Rut}?projectId=${e}&chainId=${n}`,i.name="w3m-secure-iframe",i.style.position="fixed",i.style.zIndex="999999",i.style.display="none",i.style.animationDelay="0s, 50ms",i.style.borderBottomLeftRadius="clamp(0px, var(--wui-border-radius-l), 44px)",i.style.borderBottomRightRadius="clamp(0px, var(--wui-border-radius-l), 44px)",document.body.appendChild(i),this.iframe=i,this.iframe.onload=()=>{var s;(s=this.frameLoadPromiseResolver)==null||s.resolve(void 0)},this.iframe.onerror=()=>{var s;(s=this.frameLoadPromiseResolver)==null||s.reject("Unable to load email login dependency")}}}get networks(){const e=["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map(r=>({[r]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${r}&projectId=${this.projectId}`,chainId:r}}));return Object.assign({},...e)}}class V1t{constructor(e){var s;const r=__({level:Mut}),{logger:n,chunkLoggerController:i}=u3e({opts:r});this.logger=qs(n,this.constructor.name),this.chunkLoggerController=i,typeof window<"u"&&((s=this.chunkLoggerController)!=null&&s.downloadLogsBlobInBrowser)&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{var a;(a=this.chunkLoggerController)!=null&&a.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}class W1t{constructor(e,r){this.openRpcRequests=[],this.w3mLogger=new V1t(e),this.w3mFrame=new H1t(e,!0,r)}getLoginEmailUsed(){return!!ss.get(lr.EMAIL_LOGIN_USED_KEY)}getEmail(){return ss.get(lr.EMAIL)}async connectEmail(e){try{Ds.checkIfAllowedToTriggerEmail();const r=await this.appEvent({type:lr.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting email"),r}}async connectDevice(){try{return this.appEvent({type:lr.APP_CONNECT_DEVICE})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting device"),e}}async connectOtp(e){try{return this.appEvent({type:lr.APP_CONNECT_OTP,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting otp"),r}}async isConnected(){try{const e=await this.appEvent({type:lr.APP_IS_CONNECTED});return e.isConnected||this.deleteAuthLoginCache(),e}catch(e){throw this.deleteAuthLoginCache(),this.w3mLogger.logger.error({error:e},"Error checking connection"),e}}async getChainId(){try{const e=await this.appEvent({type:lr.APP_GET_CHAIN_ID});return this.setLastUsedChainId(e.chainId),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting chain id"),e}}async getSocialRedirectUri(e){try{return this.appEvent({type:lr.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error getting social redirect uri"),r}}async updateEmail(e){try{const r=await this.appEvent({type:lr.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error updating email"),r}}async updateEmailPrimaryOtp(e){try{return this.appEvent({type:lr.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error updating email primary otp"),r}}async updateEmailSecondaryOtp(e){try{const r=await this.appEvent({type:lr.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(r.newEmail),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error updating email secondary otp"),r}}async syncTheme(e){try{return this.appEvent({type:lr.APP_SYNC_THEME,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error syncing theme"),r}}async syncDappData(e){try{return this.appEvent({type:lr.APP_SYNC_DAPP_DATA,payload:e})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error syncing dapp data"),r}}async getSmartAccountEnabledNetworks(){try{const e=await this.appEvent({type:lr.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(e.smartAccountEnabledNetworks),e}catch(e){throw this.persistSmartAccountEnabledNetworks([]),this.w3mLogger.logger.error({error:e},"Error getting smart account enabled networks"),e}}async setPreferredAccount(e){try{return this.appEvent({type:lr.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(r){throw this.w3mLogger.logger.error({error:r},"Error setting preferred account"),r}}async connect(e){try{const r=(e==null?void 0:e.chainId)??this.getLastUsedChainId()??1,n=await this.appEvent({type:lr.APP_GET_USER,payload:{...e,chainId:r}});return this.setLoginSuccess(n.email),this.setLastUsedChainId(n.chainId),n}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting"),r}}async connectSocial(e){try{const r=await this.appEvent({type:lr.APP_CONNECT_SOCIAL,payload:{uri:e}});return r.userName&&this.setSocialLoginSuccess(r.userName),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error connecting social"),r}}async getFarcasterUri(){try{return await this.appEvent({type:lr.APP_GET_FARCASTER_URI})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting farcaster uri"),e}}async connectFarcaster(){try{const e=await this.appEvent({type:lr.APP_CONNECT_FARCASTER});return e.userName&&this.setSocialLoginSuccess(e.userName),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting farcaster"),e}}async switchNetwork(e){try{const r=await this.appEvent({type:lr.APP_SWITCH_NETWORK,payload:{chainId:e}});return this.setLastUsedChainId(r.chainId),r}catch(r){throw this.w3mLogger.logger.error({error:r},"Error switching network"),r}}async disconnect(){try{const e=await this.appEvent({type:lr.APP_SIGN_OUT});return this.deleteAuthLoginCache(),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error disconnecting"),e}}async request(e){var r,n,i;try{if(Lr.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();(r=this.rpcRequestHandler)==null||r.call(this,e);const s=await this.appEvent({type:lr.APP_RPC_REQUEST,payload:e});return(n=this.rpcSuccessHandler)==null||n.call(this,s,e),s}catch(s){throw(i=this.rpcErrorHandler)==null||i.call(this,s,e),this.w3mLogger.logger.error({error:s},"Error requesting"),s}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_GET_USER_SUCCESS&&e(r.payload)})}onNotConnected(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_IS_CONNECTED_ERROR&&e(),r.type===lr.FRAME_IS_CONNECTED_SUCCESS&&!r.payload.isConnected&&e()})}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(r.payload):r.type===lr.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:Lr.ACCOUNT_TYPES.EOA})})}onGetSmartAccountEnabledNetworks(e){this.w3mFrame.events.onFrameEvent(r=>{r.type===lr.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS?e(r.payload.smartAccountEnabledNetworks):r.type===lr.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR&&e([])})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){try{this.openRpcRequests.forEach(({abortController:e,method:r})=>{Lr.SAFE_RPC_METHODS.includes(r)||e.abort()}),this.openRpcRequests=[]}catch(e){this.w3mLogger.logger.error({error:e},"Error aborting RPC request")}}async appEvent(e){await this.w3mFrame.frameLoadPromise;const r=e.type.replace("@w3m-app/","");return new Promise((n,i)=>{var f,c;const s=Math.random().toString(36).substring(7);(c=(f=this.w3mLogger.logger).info)==null||c.call(f,{event:e,id:s},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:s});const a=new AbortController;if(r==="RPC_REQUEST"){const d=e;this.openRpcRequests=[...this.openRpcRequests,{...d.payload,abortController:a}]}a.signal.addEventListener("abort",()=>{r==="RPC_REQUEST"&&i(new Error("Request was aborted"))});function o(d){var p;d.type===`@w3m-frame/${r}_SUCCESS`?("payload"in d&&n(d.payload),n(void 0)):d.type===`@w3m-frame/${r}_ERROR`&&("payload"in d&&i(new Error(((p=d.payload)==null?void 0:p.message)||"An error occurred")),i(new Error("An error occurred")))}this.w3mFrame.events.registerFrameEventHandler(s,o,a.signal)})}setNewLastEmailLoginTime(){ss.set(lr.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){ss.set(lr.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&ss.set(lr.EMAIL,e),ss.set(lr.EMAIL_LOGIN_USED_KEY,"true"),ss.delete(lr.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){ss.delete(lr.EMAIL_LOGIN_USED_KEY),ss.delete(lr.EMAIL),ss.delete(lr.LAST_USED_CHAIN_KEY),ss.delete(lr.SOCIAL_USERNAME),ss.delete(lr.SOCIAL,!0)}setLastUsedChainId(e){ss.set(lr.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){return Number(ss.get(lr.LAST_USED_CHAIN_KEY))}persistSmartAccountEnabledNetworks(e){ss.set(lr.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}}const Xn=zi({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),y0={state:Xn,subscribe(t){return ha(Xn,()=>t(Xn))},setLastNetworkInView(t){Xn.lastNetworkInView=t},async fetchTransactions(t,e){var n;const{projectId:r}=zt.state;if(!r||!t)throw new Error("Transactions can't be fetched without a projectId and an accountAddress");Xn.loading=!0;try{const i=await gi.fetchTransactions({account:t,projectId:r,cursor:Xn.next,onramp:e,cache:e==="coinbase"?"no-cache":void 0,chainId:(n=Ct.state.caipNetwork)==null?void 0:n.id}),s=this.filterSpamTransactions(i.data),a=this.filterByConnectedChain(s),o=[...Xn.transactions,...a];Xn.loading=!1,e==="coinbase"?Xn.coinbaseTransactions=this.groupTransactionsByYearAndMonth(Xn.coinbaseTransactions,i.data):(Xn.transactions=o,Xn.transactionsByYear=this.groupTransactionsByYearAndMonth(Xn.transactionsByYear,a)),Xn.empty=o.length===0,Xn.next=i.next?i.next:void 0}catch{Ht.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:t,projectId:r,cursor:Xn.next,isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT}}),nr.showError("Failed to fetch transactions"),Xn.loading=!1,Xn.empty=!0,Xn.next=void 0}},groupTransactionsByYearAndMonth(t={},e=[]){const r=t;return e.forEach(n=>{const i=new Date(n.metadata.minedAt).getFullYear(),s=new Date(n.metadata.minedAt).getMonth(),a=r[i]??{},f=(a[s]??[]).filter(c=>c.id!==n.id);r[i]={...a,[s]:[...f,n].sort((c,d)=>new Date(d.metadata.minedAt).getTime()-new Date(c.metadata.minedAt).getTime())}}),r},filterSpamTransactions(t){return t.filter(e=>!e.transfers.every(n=>{var i;return((i=n.nft_info)==null?void 0:i.flags.is_spam)===!0}))},filterByConnectedChain(t){var n;const e=(n=Ct.state.caipNetwork)==null?void 0:n.id;return t.filter(i=>i.metadata.chain===e)},clearCursor(){Xn.next=void 0},resetTransactions(){Xn.transactions=[],Xn.transactionsByYear={},Xn.lastNetworkInView=void 0,Xn.loading=!1,Xn.empty=!1,Xn.next=void 0}},Ma=zi({wcError:!1,buffering:!1}),hr={state:Ma,subscribeKey(t,e){return ho(Ma,t,e)},_getClient(t){return It.getConnectionControllerClient(t)},setClient(t){Ma._client=Yf(t)},async connectWalletConnect(){En.setConnectedConnector("WALLET_CONNECT"),await this._getClient().connectWalletConnect(t=>{Ma.wcUri=t,Ma.wcPairingExpiry=Ot.getPairingExpiry()})},async connectExternal(t,e){var r,n;await((n=(r=this._getClient(e)).connectExternal)==null?void 0:n.call(r,t)),It.setActiveChain(e),En.setConnectedConnector(t.type)},async reconnectExternal(t){var e,r;await((r=(e=this._getClient()).reconnectExternal)==null?void 0:r.call(e,t)),En.setConnectedConnector(t.type)},async setPreferredAccountType(t){var r;gr.setLoading(!0);const e=Zt.getAuthConnector();e&&(await(e==null?void 0:e.provider.setPreferredAccount(t)),await this.reconnectExternal(e),gr.setLoading(!1),Ht.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:t,network:((r=Ct.state.caipNetwork)==null?void 0:r.id)||""}}))},async signMessage(t){return this._getClient().signMessage(t)},parseUnits(t,e){return this._getClient().parseUnits(t,e)},formatUnits(t,e){return this._getClient().formatUnits(t,e)},async sendTransaction(t){return this._getClient().sendTransaction(t)},async estimateGas(t){return this._getClient().estimateGas(t)},async writeContract(t){return this._getClient().writeContract(t)},async getEnsAddress(t){return this._getClient().getEnsAddress(t)},async getEnsAvatar(t){return this._getClient().getEnsAvatar(t)},checkInstalled(t,e){var r,n;return((n=(r=this._getClient(e)).checkInstalled)==null?void 0:n.call(r,t))||!1},resetWcConnection(){Ma.wcUri=void 0,Ma.wcPairingExpiry=void 0,Ma.wcLinking=void 0,Ma.recentWallet=void 0,y0.resetTransactions(),En.deleteWalletConnectDeepLink()},setWcLinking(t){Ma.wcLinking=t},setWcError(t){Ma.wcError=t,Ma.buffering=!1},setRecentWallet(t){Ma.recentWallet=t},setBuffering(t){Ma.buffering=t},async disconnect(){const t=this._getClient();try{await t.disconnect(),this.resetWcConnection()}catch{throw new Error("Failed to disconnect")}}},T9={async getTokenList(){var n;const t=Ct.state.caipNetwork,e=await gi.fetchSwapTokens({chainId:t==null?void 0:t.id,projectId:zt.state.projectId});return((n=e==null?void 0:e.tokens)==null?void 0:n.map(i=>({...i,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){const t=zt.state.projectId,e=Ct.state.caipNetwork;if(!e)return null;try{switch(e.chain){case"solana":const r=(await hr.estimateGas({chainNamespace:"solana"})).toString();return{standard:r,fast:r,instant:r};case"evm":default:return await gi.fetchGasPrice({projectId:t,chainId:e.id})}}catch{return null}},async fetchSwapAllowance({tokenAddress:t,userAddress:e,sourceTokenAmount:r,sourceTokenDecimals:n}){const i=zt.state.projectId,s=await gi.fetchSwapAllowance({projectId:i,tokenAddress:t,userAddress:e});if(s!=null&&s.allowance&&r&&n){const a=hr.parseUnits(r,n)||0;return BigInt(s.allowance)>=a}return!1},async getMyTokensWithBalance(t){const e=Je.state.address,r=Ct.state.caipNetwork;if(!e||!r)return[];const i=(await gi.getBalance(e,r.id,t)).balances.filter(s=>s.quantity.decimals!=="0");return Je.setTokenBalance(i,It.state.activeChain),this.mapBalancesToSwapTokens(i)},mapBalancesToSwapTokens(t){return(t==null?void 0:t.map(e=>({...e,address:e!=null&&e.address?e.address:Ct.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1})))||[]}},ai=zi({view:"Connect",history:["Connect"],transactionStack:[]}),Ve={state:ai,subscribeKey(t,e){return ho(ai,t,e)},pushTransactionStack(t){ai.transactionStack.push(t)},popTransactionStack(t){var r,n;const e=ai.transactionStack.pop();e&&(t?(this.goBack(),(r=e==null?void 0:e.onCancel)==null||r.call(e)):(e.goBack?this.goBack():e.view&&this.reset(e.view),(n=e==null?void 0:e.onSuccess)==null||n.call(e)))},push(t,e){t!==ai.view&&(ai.view=t,ai.history.push(t),ai.data=e)},reset(t){ai.view=t,ai.history=[t]},replace(t,e){ai.history.length>=1&&ai.history.at(-1)!==t&&(ai.view=t,ai.history[ai.history.length-1]=t,ai.data=e)},goBack(){if(ai.history.length>1){ai.history.pop();const[t]=ai.history.slice(-1);t&&(ai.view=t)}},goBackToIndex(t){if(ai.history.length>1){ai.history=ai.history.slice(0,t+1);const[e]=ai.history.slice(-1);e&&(ai.view=e)}}},bd={getGasPriceInEther(t,e){const r=e*t;return Number(r)/1e18},getGasPriceInUSD(t,e,r){const n=bd.getGasPriceInEther(e,r);return dn.bigNumber(t).multipliedBy(n).toNumber()},getPriceImpact({sourceTokenAmount:t,sourceTokenPriceInUSD:e,toTokenPriceInUSD:r,toTokenAmount:n}){const i=dn.bigNumber(t).multipliedBy(e),s=dn.bigNumber(n).multipliedBy(r);return i.minus(s).dividedBy(i).multipliedBy(100).toNumber()},getMaxSlippage(t,e){const r=dn.bigNumber(t).dividedBy(100);return dn.multiply(e,r).toNumber()},getProviderFee(t,e=.0085){return dn.bigNumber(t).multipliedBy(e).toString()},isInsufficientNetworkTokenForGas(t,e){const r=e||"0";return dn.bigNumber(t).isZero()?!0:dn.bigNumber(dn.bigNumber(r)).isGreaterThan(t)},isInsufficientSourceTokenForSwap(t,e,r){var s,a;const n=(a=(s=r==null?void 0:r.find(o=>o.address===e))==null?void 0:s.quantity)==null?void 0:a.numeric;return dn.bigNumber(n||"0").isLessThan(t)},getToTokenAmount({sourceToken:t,toToken:e,sourceTokenPrice:r,toTokenPrice:n,sourceTokenAmount:i}){if(i==="0"||!t||!e)return"0";const s=t.decimals,a=r,o=e.decimals,f=n;if(f<=0)return"0";const c=dn.bigNumber(i).multipliedBy(.0085),p=dn.bigNumber(i).minus(c).multipliedBy(dn.bigNumber(10).pow(s)),g=dn.bigNumber(a).dividedBy(f),x=s-o;return p.multipliedBy(g).dividedBy(dn.bigNumber(10).pow(x)).dividedBy(dn.bigNumber(10).pow(o)).toFixed(o).toString()}},Yce=15e4,G1t=6,ka={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:S0.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},nt=zi(ka),jt={state:nt,subscribe(t){return ha(nt,()=>t(nt))},subscribeKey(t,e){return ho(nt,t,e)},getParams(){var f,c,d,p,g,x,S,I;const t=Je.state.address,e=Ct.getActiveNetworkTokenAddress(),r=En.getConnectedConnector(),n=Zt.getAuthConnector();if(!t)throw new Error("No address found to swap the tokens from.");const i=Je.state.caipAddress,s=!((f=nt.toToken)!=null&&f.address)||!((c=nt.toToken)!=null&&c.decimals),a=!((d=nt.sourceToken)!=null&&d.address)||!((p=nt.sourceToken)!=null&&p.decimals)||!dn.bigNumber(nt.sourceTokenAmount).isGreaterThan(0),o=!nt.sourceTokenAmount;return{networkAddress:e,fromAddress:t,fromCaipAddress:Je.state.caipAddress,sourceTokenAddress:(g=nt.sourceToken)==null?void 0:g.address,toTokenAddress:(x=nt.toToken)==null?void 0:x.address,toTokenAmount:nt.toTokenAmount,toTokenDecimals:(S=nt.toToken)==null?void 0:S.decimals,sourceTokenAmount:nt.sourceTokenAmount,sourceTokenDecimals:(I=nt.sourceToken)==null?void 0:I.decimals,invalidToToken:s,invalidSourceToken:a,invalidSourceTokenAmount:o,availableToSwap:i&&!s&&!a&&!o,isAuthConnector:(n==null?void 0:n.walletFeatures)&&r==="AUTH"}},setSourceToken(t){if(!t){nt.sourceToken=t,nt.sourceTokenAmount="",nt.sourceTokenPriceInUSD=0;return}nt.sourceToken=t,this.setTokenPrice(t.address,"sourceToken")},setSourceTokenAmount(t){nt.sourceTokenAmount=t},setToToken(t){if(!t){nt.toToken=t,nt.toTokenAmount="",nt.toTokenPriceInUSD=0;return}nt.toToken=t,this.setTokenPrice(t.address,"toToken")},setToTokenAmount(t){nt.toTokenAmount=t?dn.formatNumberToLocalString(t,G1t):""},async setTokenPrice(t,e){const{availableToSwap:r}=this.getParams();let n=nt.tokensPriceMap[t]||0;n||(nt.loadingPrices=!0,n=await this.getAddressPrice(t)),e==="sourceToken"?nt.sourceTokenPriceInUSD=n:e==="toToken"&&(nt.toTokenPriceInUSD=n),nt.loadingPrices&&(nt.loadingPrices=!1,r&&this.swapTokens())},switchTokens(){if(nt.initializing||!nt.initialized)return;const t=nt.toToken?{...nt.toToken}:void 0,e=nt.sourceToken?{...nt.sourceToken}:void 0,r=t&&nt.toTokenAmount===""?"1":nt.toTokenAmount;this.setSourceToken(t),this.setToToken(e),this.setSourceTokenAmount(r),this.setToTokenAmount(""),this.swapTokens()},resetState(){nt.myTokensWithBalance=ka.myTokensWithBalance,nt.tokensPriceMap=ka.tokensPriceMap,nt.initialized=ka.initialized,nt.sourceToken=ka.sourceToken,nt.sourceTokenAmount=ka.sourceTokenAmount,nt.sourceTokenPriceInUSD=ka.sourceTokenPriceInUSD,nt.toToken=ka.toToken,nt.toTokenAmount=ka.toTokenAmount,nt.toTokenPriceInUSD=ka.toTokenPriceInUSD,nt.networkPrice=ka.networkPrice,nt.networkTokenSymbol=ka.networkTokenSymbol,nt.networkBalanceInUSD=ka.networkBalanceInUSD,nt.inputError=ka.inputError},resetValues(){var r;const{networkAddress:t}=this.getParams(),e=(r=nt.tokens)==null?void 0:r.find(n=>n.address===t);this.setSourceToken(e),this.setToToken(void 0)},getApprovalLoadingState(){return nt.loadingApprovalTransaction},clearError(){nt.transactionError=void 0},async initializeState(){if(!nt.initializing){if(nt.initializing=!0,!nt.initialized)try{await this.fetchTokens(),nt.initialized=!0}catch{nt.initialized=!1,nr.showError("Failed to initialize swap"),Ve.goBack()}nt.initializing=!1}},async fetchTokens(){var r;const{networkAddress:t}=this.getParams();await this.getTokenList(),await this.getNetworkTokenPrice(),await this.getMyTokensWithBalance();const e=(r=nt.tokens)==null?void 0:r.find(n=>n.address===t);e&&(nt.networkTokenSymbol=e.symbol,this.setSourceToken(e),this.setSourceTokenAmount("1"))},async getTokenList(){const t=await T9.getTokenList();nt.tokens=t,nt.popularTokens=t.sort((e,r)=>e.symbolr.symbol?1:0),nt.suggestedTokens=t.filter(e=>!!S0.SWAP_SUGGESTED_TOKENS.includes(e.symbol),{})},async getAddressPrice(t){var f,c;const e=nt.tokensPriceMap[t];if(e)return e;const n=(await gi.fetchTokenPrice({projectId:zt.state.projectId,addresses:[t]})).fungibles||[],i=[...nt.tokens||[],...nt.myTokensWithBalance||[]],s=(f=i==null?void 0:i.find(d=>d.address===t))==null?void 0:f.symbol,a=((c=n.find(d=>d.symbol.toLowerCase()===(s==null?void 0:s.toLowerCase())))==null?void 0:c.price)||0,o=parseFloat(a.toString());return nt.tokensPriceMap[t]=o,o},async getNetworkTokenPrice(){var i;const{networkAddress:t}=this.getParams(),r=(i=(await gi.fetchTokenPrice({projectId:zt.state.projectId,addresses:[t]}).catch(()=>(nr.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:i[0],n=(r==null?void 0:r.price.toString())||"0";nt.tokensPriceMap[t]=parseFloat(n),nt.networkTokenSymbol=(r==null?void 0:r.symbol)||"",nt.networkPrice=n},async getMyTokensWithBalance(t){const e=await T9.getMyTokensWithBalance(t);e&&(await this.getInitialGasPrice(),this.setBalances(e))},setBalances(t){const{networkAddress:e}=this.getParams(),r=Ct.state.caipNetwork;if(!r)return;const n=t.find(i=>i.address===e);t.forEach(i=>{nt.tokensPriceMap[i.address]=i.price||0}),nt.myTokensWithBalance=t.filter(i=>i.address.startsWith(r.id)),nt.networkBalanceInUSD=n?dn.multiply(n.quantity.numeric,n.price).toString():"0"},async getInitialGasPrice(){var e;const t=await T9.fetchGasPrice();if(!t)return{gasPrice:null,gasPriceInUSD:null};switch((e=Ct.state.caipNetwork)==null?void 0:e.chain){case"solana":return nt.gasFee=t.standard,nt.gasPriceInUSD=dn.multiply(t.standard,nt.networkPrice).dividedBy(1e9).toNumber(),{gasPrice:BigInt(nt.gasFee),gasPriceInUSD:Number(nt.gasPriceInUSD)};case"evm":default:const r=t.standard,n=BigInt(r),i=BigInt(Yce),s=bd.getGasPriceInUSD(nt.networkPrice,i,n);return nt.gasFee=r,nt.gasPriceInUSD=s,{gasPrice:n,gasPriceInUSD:s}}},async swapTokens(){var c,d;const t=Je.state.address,e=nt.sourceToken,r=nt.toToken,n=dn.bigNumber(nt.sourceTokenAmount).isGreaterThan(0);if(!r||!e||nt.loadingPrices||!n)return;nt.loadingQuote=!0;const i=dn.bigNumber(nt.sourceTokenAmount).multipliedBy(10**e.decimals),s=await gi.fetchSwapQuote({userAddress:t,projectId:zt.state.projectId,from:e.address,to:r.address,gasPrice:nt.gasFee,amount:i.toString()});nt.loadingQuote=!1;const a=(d=(c=s==null?void 0:s.quotes)==null?void 0:c[0])==null?void 0:d.toAmount;if(!a)return;const o=dn.bigNumber(a).dividedBy(10**r.decimals).toString();this.setToTokenAmount(o),this.hasInsufficientToken(nt.sourceTokenAmount,e.address)?nt.inputError="Insufficient balance":(nt.inputError=void 0,this.setTransactionDetails())},async getTransaction(){const{fromCaipAddress:t,availableToSwap:e}=this.getParams(),r=nt.sourceToken,n=nt.toToken;if(!(!t||!e||!r||!n||nt.loadingQuote))try{nt.loadingBuildTransaction=!0;const i=await T9.fetchSwapAllowance({userAddress:t,tokenAddress:r.address,sourceTokenAmount:nt.sourceTokenAmount,sourceTokenDecimals:r.decimals});let s;return i?s=await this.createSwapTransaction():s=await this.createAllowanceTransaction(),nt.loadingBuildTransaction=!1,nt.fetchError=!1,s}catch{Ve.goBack(),nr.showError("Failed to check allowance"),nt.loadingBuildTransaction=!1,nt.approvalTransaction=void 0,nt.swapTransaction=void 0,nt.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:t,fromAddress:e,sourceTokenAddress:r,toTokenAddress:n}=this.getParams();if(!(!t||!n)){if(!r)throw new Error("createAllowanceTransaction - No source token address found.");try{const i=await gi.generateApproveCalldata({projectId:zt.state.projectId,from:r,to:n,userAddress:t}),s=await hr.estimateGas({address:e,to:Ot.getPlainAddress(i.tx.to),data:i.tx.data}),a={data:i.tx.data,to:Ot.getPlainAddress(i.tx.from),gas:s,gasPrice:BigInt(i.tx.eip155.gasPrice),value:BigInt(i.tx.value),toAmount:nt.toTokenAmount};return nt.swapTransaction=void 0,nt.approvalTransaction=a,a}catch{Ve.goBack(),nr.showError("Failed to create approval transaction"),nt.approvalTransaction=void 0,nt.swapTransaction=void 0,nt.fetchError=!0;return}}},async createSwapTransaction(){const{networkAddress:t,fromCaipAddress:e,sourceTokenAmount:r}=this.getParams(),n=nt.sourceToken,i=nt.toToken;if(!e||!r||!n||!i)return;const s=hr.parseUnits(r,n.decimals).toString();try{const a=await gi.generateSwapCalldata({projectId:zt.state.projectId,userAddress:e,from:n.address,to:i.address,amount:s}),o=n.address===t,f=BigInt(a.tx.eip155.gas),c=BigInt(a.tx.eip155.gasPrice),d={data:a.tx.data,to:Ot.getPlainAddress(a.tx.to),gas:f,gasPrice:c,value:BigInt(o?s:"0"),toAmount:nt.toTokenAmount};return nt.gasPriceInUSD=bd.getGasPriceInUSD(nt.networkPrice,f,c),nt.approvalTransaction=void 0,nt.swapTransaction=d,d}catch{Ve.goBack(),nr.showError("Failed to create transaction"),nt.approvalTransaction=void 0,nt.swapTransaction=void 0,nt.fetchError=!0;return}},async sendTransactionForApproval(t){const{fromAddress:e,isAuthConnector:r}=this.getParams();nt.loadingApprovalTransaction=!0;const n="Approve limit increase in your wallet";r?Ve.pushTransactionStack({view:null,goBack:!0,onSuccess(){nr.showLoading(n)}}):nr.showLoading(n);try{await hr.sendTransaction({address:e,to:t.to,data:t.data,value:BigInt(t.value),gasPrice:BigInt(t.gasPrice)}),await this.swapTokens(),await this.getTransaction(),nt.approvalTransaction=void 0,nt.loadingApprovalTransaction=!1}catch(i){const s=i;nt.transactionError=s==null?void 0:s.shortMessage,nt.loadingApprovalTransaction=!1,nr.showError((s==null?void 0:s.shortMessage)||"Transaction error")}},async sendTransactionForSwap(t){var a,o,f,c,d,p,g,x,S,I,R,O;if(!t)return;const{fromAddress:e,toTokenAmount:r,isAuthConnector:n}=this.getParams();nt.loadingTransaction=!0;const i=`Swapping ${(a=nt.sourceToken)==null?void 0:a.symbol} to ${dn.formatNumberToLocalString(r,3)} ${(o=nt.toToken)==null?void 0:o.symbol}`,s=`Swapped ${(f=nt.sourceToken)==null?void 0:f.symbol} to ${dn.formatNumberToLocalString(r,3)} ${(c=nt.toToken)==null?void 0:c.symbol}`;n?Ve.pushTransactionStack({view:"Account",goBack:!1,onSuccess(){nr.showLoading(i),jt.resetState()}}):nr.showLoading("Confirm transaction in your wallet");try{const M=[(d=nt.sourceToken)==null?void 0:d.address,(p=nt.toToken)==null?void 0:p.address].join(","),U=await hr.sendTransaction({address:e,to:t.to,data:t.data,gas:t.gas,gasPrice:BigInt(t.gasPrice),value:t.value});return nt.loadingTransaction=!1,nr.showSuccess(s),Ht.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((g=Ct.state.caipNetwork)==null?void 0:g.id)||"",swapFromToken:((x=this.state.sourceToken)==null?void 0:x.symbol)||"",swapToToken:((S=this.state.toToken)==null?void 0:S.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT}}),jt.resetState(),n||Ve.replace("Account"),jt.getMyTokensWithBalance(M),U}catch(M){const U=M;nt.transactionError=U==null?void 0:U.shortMessage,nt.loadingTransaction=!1,nr.showError((U==null?void 0:U.shortMessage)||"Transaction error"),Ht.sendEvent({type:"track",event:"SWAP_ERROR",properties:{network:((I=Ct.state.caipNetwork)==null?void 0:I.id)||"",swapFromToken:((R=this.state.sourceToken)==null?void 0:R.symbol)||"",swapToToken:((O=this.state.toToken)==null?void 0:O.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(t,e){const r=bd.isInsufficientSourceTokenForSwap(t,e,nt.myTokensWithBalance);return bd.isInsufficientNetworkTokenForGas(nt.networkBalanceInUSD,nt.gasPriceInUSD)||r},setTransactionDetails(){const{toTokenAddress:t,toTokenDecimals:e}=this.getParams();!t||!e||(nt.gasPriceInUSD=bd.getGasPriceInUSD(nt.networkPrice,BigInt(nt.gasFee),BigInt(Yce)),nt.priceImpact=bd.getPriceImpact({sourceTokenAmount:nt.sourceTokenAmount,sourceTokenPriceInUSD:nt.sourceTokenPriceInUSD,toTokenPriceInUSD:nt.toTokenPriceInUSD,toTokenAmount:nt.toTokenAmount}),nt.maxSlippage=bd.getMaxSlippage(nt.slippage,nt.toTokenAmount),nt.providerFee=bd.getProviderFee(nt.sourceTokenAmount))}},Jce=zi({isConnected:!1,currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),Je={state:Jce,replaceState(t){t&&Object.assign(Jce,Yf(t))},subscribe(t){return It.subscribeChainProp("accountState",e=>{if(e)return t(e)})},subscribeKey(t,e){let r;return It.subscribeChainProp("accountState",n=>{if(n){const i=n[t];r!==i&&(r=i,e(i))}})},setIsConnected(t,e){It.setAccountProp("isConnected",t,e)},getChainIsConnected(t){return It.getAccountProp("isConnected",t)},setCaipAddress(t,e){const r=t?Ot.getPlainAddress(t):void 0;It.setAccountProp("caipAddress",t,e),It.setAccountProp("address",r,e)},setBalance(t,e,r){It.setAccountProp("balance",t,r),It.setAccountProp("balanceSymbol",e,r)},setProfileName(t,e){It.setAccountProp("profileName",t,e)},setProfileImage(t,e){It.setAccountProp("profileImage",t,e)},setAddressExplorerUrl(t,e){It.setAccountProp("addressExplorerUrl",t,e)},setSmartAccountDeployed(t,e){It.setAccountProp("smartAccountDeployed",t,e)},setCurrentTab(t){It.setAccountProp("currentTab",t,It.state.activeChain)},setTokenBalance(t,e){t&&It.setAccountProp("tokenBalance",t,e)},setShouldUpdateToAddress(t,e){It.setAccountProp("shouldUpdateToAddress",t,e)},setAllAccounts(t,e){It.setAccountProp("allAccounts",t,e)},addAddressLabel(t,e,r){const n=It.getAccountProp("addressLabels",r)||new Map;n.set(t,e),It.setAccountProp("addressLabels",n,It.state.activeChain)},removeAddressLabel(t,e){const r=It.getAccountProp("addressLabels",e)||new Map;r.delete(t),It.setAccountProp("addressLabels",r,It.state.activeChain)},setConnectedWalletInfo(t,e){It.setAccountProp("connectedWalletInfo",t,e)},setPreferredAccountType(t,e){It.setAccountProp("preferredAccountType",t,e)},setSocialProvider(t,e){t&&It.setAccountProp("socialProvider",t,e)},setSocialWindow(t,e){t&&It.setAccountProp("socialWindow",Yf(t),e)},setFarcasterUrl(t,e){t&&It.setAccountProp("farcasterUrl",t,e)},async fetchTokenBalance(){var n,i;const t=(n=Ct.state.caipNetwork)==null?void 0:n.id,e=(i=Ct.state.caipNetwork)==null?void 0:i.chain,r=Je.state.address;try{if(r&&t&&e){const s=await gi.getBalance(r,t),a=s.balances.filter(o=>o.quantity.decimals!=="0");this.setTokenBalance(a,e),jt.setBalances(T9.mapBalancesToSwapTokens(s.balances))}}catch{nr.showError("Failed to fetch token balance")}},resetAccount(t){It.resetAccount(t)}},al=zi({loading:!1,open:!1,shake:!1}),gr={state:al,subscribe(t){return ha(al,()=>t(al))},subscribeKey(t,e){return ho(al,t,e)},async open(t){await cr.state.prefetchPromise;const e=Je.state.isConnected;t!=null&&t.view?Ve.reset(t.view):e?Ve.reset("Account"):Ve.reset("Connect"),al.open=!0,c1.set({open:!0}),Ht.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:e}})},close(){const t=Je.state.isConnected||!1;al.open=!1,c1.set({open:!1}),Ht.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}})},setLoading(t){al.loading=t,c1.set({loading:t})},shake(){al.shake||(al.shake=!0,setTimeout(()=>{al.shake=!1},500))}},e7={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},PH={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},K1t={providers:kye,selectedProvider:null,error:null,purchaseCurrency:e7,paymentCurrency:PH,purchaseCurrencies:[e7],paymentCurrencies:[],quotesLoading:!1},Tn=zi(K1t),In={state:Tn,subscribe(t){return ha(Tn,()=>t(Tn))},subscribeKey(t,e){return ho(Tn,t,e)},setSelectedProvider(t){if(t&&t.name==="meld"){const e=yut,r=It.state.activeChain===zn.CHAIN.SOLANA?"SOL":"USDC",n=Je.state.address??"",i=new URL(t.url);i.searchParams.append("publicKey",e),i.searchParams.append("destinationCurrencyCode",r),i.searchParams.append("walletAddress",n),t.url=i.toString()}Tn.selectedProvider=t},setPurchaseCurrency(t){Tn.purchaseCurrency=t},setPaymentCurrency(t){Tn.paymentCurrency=t},setPurchaseAmount(t){this.state.purchaseAmount=t},setPaymentAmount(t){this.state.paymentAmount=t},async getAvailableCurrencies(){const t=await gi.getOnrampOptions();Tn.purchaseCurrencies=t.purchaseCurrencies,Tn.paymentCurrencies=t.paymentCurrencies,Tn.paymentCurrency=t.paymentCurrencies[0]||PH,Tn.purchaseCurrency=t.purchaseCurrencies[0]||e7,await cr.fetchCurrencyImages(t.paymentCurrencies.map(e=>e.id)),await cr.fetchTokenImages(t.purchaseCurrencies.map(e=>e.symbol))},async getQuote(){var t,e;Tn.quotesLoading=!0;try{const r=await gi.getOnrampQuote({purchaseCurrency:Tn.purchaseCurrency,paymentCurrency:Tn.paymentCurrency,amount:((t=Tn.paymentAmount)==null?void 0:t.toString())||"0",network:(e=Tn.purchaseCurrency)==null?void 0:e.symbol});return Tn.quotesLoading=!1,Tn.purchaseAmount=Number(r.purchaseAmount.amount),r}catch(r){return Tn.error=r.message,Tn.quotesLoading=!1,null}finally{Tn.quotesLoading=!1}},resetState(){Tn.providers=kye,Tn.selectedProvider=null,Tn.error=null,Tn.purchaseCurrency=e7,Tn.paymentCurrency=PH,Tn.purchaseCurrencies=[e7],Tn.paymentCurrencies=[],Tn.paymentAmount=void 0,Tn.purchaseAmount=void 0,Tn.quotesLoading=!1}},B0=zi({loading:!1}),An={state:B0,subscribe(t){return ha(B0,()=>t(B0))},subscribeKey(t,e){return ho(B0,t,e)},setToken(t){t&&(B0.token=Yf(t))},setTokenAmount(t){B0.sendTokenAmount=t},setReceiverAddress(t){B0.receiverAddress=t},setReceiverProfileImageUrl(t){B0.receiverProfileImageUrl=t},setReceiverProfileName(t){B0.receiverProfileName=t},setGasPrice(t){B0.gasPrice=t},setGasPriceInUsd(t){B0.gasPriceInUSD=t},setLoading(t){B0.loading=t},sendToken(){var t;switch((t=It.state.activeCaipNetwork)==null?void 0:t.chain){case"evm":this.sendEvmToken();return;case"solana":this.sendSolanaToken();return;default:throw new Error("Unsupported chain")}},sendEvmToken(){var t,e,r,n,i;(t=this.state.token)!=null&&t.address&&this.state.sendTokenAmount&&this.state.receiverAddress?(Ht.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token.address,amount:this.state.sendTokenAmount,network:((e=Ct.state.caipNetwork)==null?void 0:e.id)||""}}),this.sendERC20Token({receiverAddress:this.state.receiverAddress,tokenAddress:this.state.token.address,sendTokenAmount:this.state.sendTokenAmount,decimals:this.state.token.quantity.decimals})):this.state.receiverAddress&&this.state.sendTokenAmount&&this.state.gasPrice&&((r=this.state.token)!=null&&r.quantity.decimals)&&(Ht.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:(n=this.state.token)==null?void 0:n.symbol,amount:this.state.sendTokenAmount,network:((i=Ct.state.caipNetwork)==null?void 0:i.id)||""}}),this.sendNativeToken({receiverAddress:this.state.receiverAddress,sendTokenAmount:this.state.sendTokenAmount,gasPrice:this.state.gasPrice,decimals:this.state.token.quantity.decimals}))},async sendNativeToken(t){var s,a,o,f;Ve.pushTransactionStack({view:"Account",goBack:!1});const e=t.receiverAddress,r=Je.state.address,n=hr.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals)),i="0x";try{await hr.sendTransaction({to:e,address:r,data:i,value:n,gasPrice:t.gasPrice}),nr.showSuccess("Transaction started"),Ht.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:((s=this.state.token)==null?void 0:s.symbol)||"",amount:t.sendTokenAmount,network:((a=Ct.state.caipNetwork)==null?void 0:a.id)||""}}),this.resetSend()}catch{Ht.sendEvent({type:"track",event:"SEND_ERROR",properties:{isSmartAccount:Je.state.preferredAccountType===Lr.ACCOUNT_TYPES.SMART_ACCOUNT,token:((o=this.state.token)==null?void 0:o.symbol)||"",amount:t.sendTokenAmount,network:((f=Ct.state.caipNetwork)==null?void 0:f.id)||""}}),nr.showError("Something went wrong")}},async sendERC20Token(t){Ve.pushTransactionStack({view:"Account",goBack:!1});const e=hr.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals));try{Je.state.address&&t.sendTokenAmount&&t.receiverAddress&&t.tokenAddress&&(await hr.writeContract({fromAddress:Je.state.address,tokenAddress:Ot.getPlainAddress(t.tokenAddress),receiverAddress:t.receiverAddress,tokenAmount:e,method:"transfer",abi:Zot}),nr.showSuccess("Transaction started"),this.resetSend())}catch{nr.showError("Something went wrong")}},sendSolanaToken(){if(!this.state.sendTokenAmount||!this.state.receiverAddress){nr.showError("Please enter a valid amount and receiver address");return}Ve.pushTransactionStack({view:"Account",goBack:!1}),hr.sendTransaction({chainNamespace:"solana",to:this.state.receiverAddress,value:this.state.sendTokenAmount}).then(()=>{this.resetSend(),Je.fetchTokenBalance()}).catch(t=>{nr.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send solana transaction",t)})},resetSend(){B0.token=void 0,B0.sendTokenAmount=void 0,B0.receiverAddress=void 0,B0.receiverProfileImageUrl=void 0,B0.receiverProfileName=void 0,B0.loading=!1}},$c=zi({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),ko={state:$c,subscribe(t){return ha($c,()=>t($c))},subscribeKey(t,e){return ho($c,t,e)},showTooltip({message:t,triggerRect:e,variant:r}){$c.open=!0,$c.message=t,$c.triggerRect=e,$c.variant=r},hide(){$c.open=!1,$c.message="",$c.triggerRect={width:0,height:0,top:0,left:0}}},Xce=2147483648,Q1t={convertEVMChainIdToCoinType(t){if(t>=Xce)throw new Error("Invalid chainId");return(Xce|t)>>>0}},If=zi({suggestions:[],loading:!1}),yl={state:If,subscribe(t){return ha(If,()=>t(If))},subscribeKey(t,e){return ho(If,t,e)},async resolveName(t){var e,r;try{return await gi.lookupEnsName(t)}catch(n){const i=n;throw new Error(((r=(e=i==null?void 0:i.reasons)==null?void 0:e[0])==null?void 0:r.description)||"Error resolving name")}},async isNameRegistered(t){try{return await gi.lookupEnsName(t),!0}catch{return!1}},async getSuggestions(t){try{If.loading=!0,If.suggestions=[];const e=await gi.getEnsNameSuggestions(t);return If.suggestions=e.suggestions.map(r=>({...r,name:r.name.replace(zn.WC_NAME_SUFFIX,"")}))||[],If.suggestions}catch(e){const r=this.parseEnsApiError(e,"Error fetching name suggestions");throw new Error(r)}finally{If.loading=!1}},async getNamesForAddress(t){try{return Ct.state.caipNetwork?await gi.reverseLookupEnsName({address:t}):[]}catch(e){const r=this.parseEnsApiError(e,"Error fetching names for address");throw new Error(r)}},async registerName(t){const e=Ct.state.caipNetwork;if(!e)throw new Error("Network not found");const r=Je.state.address,n=Zt.getAuthConnector();if(!r||!n)throw new Error("Address or auth connector not found");If.loading=!0;try{const i=JSON.stringify({name:`${t}${zn.WC_NAME_SUFFIX}`,attributes:{},timestamp:Math.floor(Date.now()/1e3)});Ve.pushTransactionStack({view:"RegisterAccountNameSuccess",goBack:!1,replace:!0,onCancel(){If.loading=!1}});const s=await hr.signMessage(i),a=vl.caipNetworkIdToNumber(e.id);if(!a)throw new Error("Network not found");const o=Q1t.convertEVMChainIdToCoinType(a);await gi.registerEnsName({coinType:o,address:r,signature:s,message:i}),Je.setProfileName(`${t}${zn.WC_NAME_SUFFIX}`,It.state.activeChain),Ve.replace("RegisterAccountNameSuccess")}catch(i){const s=this.parseEnsApiError(i,`Error registering name ${t}`);throw Ve.replace("RegisterAccountName"),new Error(s)}finally{If.loading=!1}},validateName(t){return/^[a-zA-Z0-9-]{4,}$/u.test(t)},parseEnsApiError(t,e){var n,i;const r=t;return((i=(n=r==null?void 0:r.reasons)==null?void 0:n[0])==null?void 0:i.description)||e}},Z1t={evm:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700"},nn={async fetchWalletImage(t){if(t)return await cr._fetchWalletImage(t),this.getWalletImageById(t)},getWalletImageById(t){if(t)return Ri.state.walletImages[t]},getWalletImage(t){if(t!=null&&t.image_url)return t==null?void 0:t.image_url;if(t!=null&&t.image_id)return Ri.state.walletImages[t.image_id]},getNetworkImage(t){if(t!=null&&t.imageUrl)return t==null?void 0:t.imageUrl;if(t!=null&&t.imageId)return Ri.state.networkImages[t.imageId]},getNetworkImageById(t){if(t)return Ri.state.networkImages[t]},getConnectorImage(t){if(t!=null&&t.imageUrl)return t.imageUrl;if(t!=null&&t.imageId)return Ri.state.connectorImages[t.imageId]},getChainImage(t){return Ri.state.networkImages[Z1t[t]]}},NH={goBackOrCloseModal(){Ve.state.history.length>1?Ve.goBack():gr.close()},navigateAfterNetworkSwitch(){const{history:t}=Ve.state,e=t.findIndex(r=>r==="Networks");e>=1?Ve.goBackToIndex(e-1):gr.close()},navigateAfterPreferredAccountTypeSelect(){const{isSiweEnabled:t}=zt.state;t&&It.state.activeChain===zn.CHAIN.EVM?Ve.push("ConnectingSiwe"):Ve.push("Account")}};function Y1t(t){if(t)return{id:`${_r.EIP155}:${t.id}`,name:t.name,imageId:Rd.EIP155NetworkImageIds[t.id],chain:zn.CHAIN.EVM}}async function J1t(t){var s,a,o,f;if(!t)throw new Error("networkControllerClient:getApprovedCaipNetworks - connector is undefined");const e=await(t==null?void 0:t.getProvider()),r=(a=(s=e==null?void 0:e.signer)==null?void 0:s.session)==null?void 0:a.namespaces,n=(o=r==null?void 0:r[_r.EIP155])==null?void 0:o.methods,i=tft(((f=r==null?void 0:r[_r.EIP155])==null?void 0:f.accounts)||[]);return{supportsAllNetworks:!!(n!=null&&n.includes(_r.ADD_CHAIN_METHOD)),approvedCaipNetworkIds:i}}function X1t(){return{supportsAllNetworks:!1,approvedCaipNetworkIds:Rd.WalletConnectRpcChainIds.map(t=>`${_r.EIP155}:${t}`)}}function edt({chain:t,projectId:e}){var i,s;const r=Ot.getBlockchainApiUrl(),n=(s=(i=t.rpcUrls[0])==null?void 0:i.http)==null?void 0:s[0];return Rd.WalletConnectRpcChainIds.includes(t.id)?sze([wL(`${r}/v1/?chainId=${_r.EIP155}:${t.id}&projectId=${e}`,{fetchOptions:{headers:{"Content-Type":"text/plain"}}}),wL(n)]):wL(n)}function eue(t){if(!t)throw new Error("No CAIP address provided");const e=t.split(":")[2];if(!e)throw new Error("Invalid CAIP address");return e}var tdt="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";const tue=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),rue=4;function rdt(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let B=1;B>--f&1}const p=31,g=2**p,x=g>>>1,S=x>>1,I=g-1;let R=0;for(let B=0;B1;){let Y=F+k>>>1;B>>1|d(),N=N<<1^x,W=(W^x)<<1|x|1;M=N,U=1+W-N}let D=n-4;return O.map(B=>{switch(B-D){case 3:return D+65792+(t[o++]<<16|t[o++]<<8|t[o++]);case 2:return D+256+(t[o++]<<8|t[o++]);case 1:return D+t[o++];default:return B-1}})}function ndt(t){let e=0;return()=>t[e++]}function zye(t){return ndt(rdt(idt(t)))}function idt(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,s=0,a=0,o=0;i=8&&(n[s++]=o>>(a-=8));return n}function sdt(t){return t&1?~t>>1:t>>1}function adt(t,e){let r=Array(t);for(let n=0,i=0;n{let e=$x(t);if(e.length)return e})}function Hye(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(odt(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(fdt(r,t))}return e.flat()}function Bx(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function Vye(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;in[a].push(s));return n}function odt(t,e){let r=1+e(),n=e(),i=Bx(e);return Vye(i.length,1+t,e).flatMap((a,o)=>{let[f,...c]=a;return Array(i[o]).fill().map((d,p)=>{let g=p*n;return[f+p*r,c.map(x=>x+g)]})})}function fdt(t,e){let r=1+e();return Vye(r,1+t,e).map(i=>[i[0],i.slice(1)])}function cdt(t){let e=[],r=$x(t);return i(n([]),[]),e;function n(s){let a=t(),o=Bx(()=>{let f=$x(t).map(c=>r[c]);if(f.length)return n(f)});return{S:a,B:o,Q:s}}function i({S:s,B:a},o,f){if(!(s&4&&f===o[o.length-1])){s&2&&(f=o[o.length-1]),s&1&&e.push(o);for(let c of a)for(let d of c.Q)i(c,[...o,d],f)}}}function udt(t){return t.toString(16).toUpperCase().padStart(2,"0")}function Wye(t){return`{${udt(t)}}`}function ldt(t){let e=[];for(let r=0,n=t.length;r>24&255}function Qye(t){return t&16777215}let OH,nue,DH,DT;function wdt(){let t=zye(hdt);OH=new Map(qye(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),nue=new Set($x(t)),DH=new Map,DT=new Map;for(let[e,r]of Hye(t)){if(!nue.has(e)&&r.length==2){let[n,i]=r,s=DT.get(n);s||(s=new Map,DT.set(n,s)),s.set(i,e)}DH.set(e,r.reverse())}}function Zye(t){return t>=Ux&&t=AR&&t=_R&&eER&&e0&&i(ER+c)}else{let a=DH.get(s);a?r.push(...a):i(s)}if(!r.length)break;s=r.pop()}if(n&&e.length>1){let s=I9(e[0]);for(let a=1;a0&&i>=a)a==0?(e.push(n,...r),r.length=0,n=o):r.push(o),i=a;else{let f=vdt(n,o);f>=0?n=f:i==0&&a==0?(e.push(n),n=o):(r.push(o),i=a)}}return n>=0&&e.push(n,...r),e}function Jye(t){return Yye(t).map(Qye)}function Adt(t){return xdt(Yye(t))}const iue=45,Xye=".",ewe=65039,twe=1,t3=t=>Array.from(t);function Lx(t,e){return t.P.has(e)||t.Q.has(e)}class _dt extends Array{get is_emoji(){return!0}}let $H,rwe,v2,BH,nwe,k3,KF,Nb,iwe,sue,UH;function uQ(){if($H)return;let t=zye(tdt);const e=()=>$x(t),r=()=>new Set(e());$H=new Map(Hye(t)),rwe=r(),v2=e(),BH=new Set(e().map(d=>v2[d])),v2=new Set(v2),nwe=r(),r();let n=qye(t),i=t();const s=()=>new Set(e().flatMap(d=>n[d]).concat(e()));k3=Bx(d=>{let p=Bx(t).map(g=>g+96);if(p.length){let g=d>=i;p[0]-=32,p=ky(p),g&&(p=`Restricted[${p}]`);let x=s(),S=s(),I=!t();return{N:p,P:x,Q:S,M:I,R:g}}}),KF=r(),Nb=new Map;let a=e().concat(t3(KF)).sort((d,p)=>d-p);a.forEach((d,p)=>{let g=t(),x=a[p]=g?a[p-g]:{V:[],M:new Map};x.V.push(d),KF.has(d)||Nb.set(d,x)});for(let{V:d,M:p}of new Set(Nb.values())){let g=[];for(let S of d){let I=k3.filter(O=>Lx(O,S)),R=g.find(({G:O})=>I.some(M=>O.has(M)));R||(R={G:new Set,V:[]},g.push(R)),R.V.push(S),I.forEach(O=>R.G.add(O))}let x=g.flatMap(S=>t3(S.G));for(let{G:S,V:I}of g){let R=new Set(x.filter(O=>!S.has(O)));for(let O of I)p.set(O,R)}}let o=new Set,f=new Set;const c=d=>o.has(d)?f.add(d):o.add(d);for(let d of k3){for(let p of d.P)c(p);for(let p of d.Q)c(p)}for(let d of o)!Nb.has(d)&&!f.has(d)&&Nb.set(d,twe);iwe=new Set(t3(o).concat(t3(Jye(o)))),sue=cdt(t).map(d=>_dt.from(d)).sort(ddt),UH=new Map;for(let d of sue){let p=[UH];for(let g of d){let x=p.map(S=>{let I=S.get(g);return I||(I=new Map,S.set(g,I)),I});g===ewe?p.push(...x):p=x}for(let g of p)g.V=d}}function lQ(t){return(swe(t)?"":`${dQ(gP([t]))} `)+Wye(t)}function dQ(t){return`"${t}"‎`}function Edt(t){if(t.length>=4&&t[2]==iue&&t[3]==iue)throw new Error(`invalid label extension: "${ky(t.slice(0,4))}"`)}function Cdt(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function Sdt(t){let e=t[0],r=tue.get(e);if(r)throw t7(`leading ${r}`);let n=t.length,i=-1;for(let s=1;s{let s=ldt(i),a={input:s,offset:n};n+=s.length+1;try{let o=a.tokens=Odt(s,e,r),f=o.length,c;if(!f)throw new Error("empty label");let d=a.output=o.flat();if(Cdt(d),!(a.emoji=f>1||o[0].is_emoji)&&d.every(g=>g<128))Edt(d),c="ASCII";else{let g=o.flatMap(x=>x.is_emoji?[]:x);if(!g.length)c="Emoji";else{if(v2.has(d[0]))throw t7("leading combining mark");for(let I=1;Ia.has(o)):t3(a),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(s=>Lx(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function kdt(t){let e=k3;for(let r of t){let n=e.filter(i=>Lx(i,r));if(!n.length)throw k3.some(i=>Lx(i,r))?owe(e[0],r):awe(r);if(e=n,n.length==1)break}return e}function Pdt(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${dQ(gP(e))}: ${i}`)}return ky(n)}).join(Xye)}function awe(t){return new Error(`disallowed character: ${lQ(t)}`)}function owe(t,e){let r=lQ(e),n=k3.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function t7(t){return new Error(`illegal placement: ${t}`)}function Ndt(t,e){for(let r of e)if(!Lx(t,r))throw owe(t,r);if(t.M){let r=Jye(e);for(let n=1,i=r.length;nrue)throw new Error(`excessive non-spacing marks: ${dQ(gP(r.slice(n-1,s)))} (${s-n}/${rue})`);n=s}}}function Odt(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let s=$dt(t);if(s)i.length&&(n.push(e(i)),i=[]),n.push(r(s));else{let a=t.pop();if(iwe.has(a))i.push(a);else{let o=$H.get(a);if(o)i.push(...o);else if(!rwe.has(a))throw awe(a)}}}return i.length&&n.push(e(i)),n}function Ddt(t){return t.filter(e=>e!=ewe)}function $dt(t,e){let r=UH,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:s}=r;s&&(n=s,t.length=i)}return n}function aue(t){return Idt(t)}class Bdt{constructor(e){var i,s,a;this.appKit=void 0,this.options=void 0,this.chain=zn.CHAIN.EVM,this.defaultChain=void 0,this.tokens=bce.getCaipTokens((i=this.options)==null?void 0:i.tokens),this.getCaipDefaultChain=(s=this.options)==null?void 0:s.defaultChain,this.siweControllerClient=(a=this.options)==null?void 0:a.siweConfig;const{wagmiConfig:r,defaultChain:n}=e;if(!r)throw new Error("wagmiConfig is undefined");this.wagmiConfig=r,this.defaultChain=Y1t(n),this.siweControllerClient=e.siweConfig,this.networkControllerClient={switchCaipNetwork:async o=>{const f=vl.caipNetworkIdToNumber(o==null?void 0:o.id);f&&await Cze(this.wagmiConfig,{chainId:f})},getApprovedCaipNetworksData:async()=>new Promise(o=>{var d,p;const c=new Map(this.wagmiConfig.state.connections).get(this.wagmiConfig.state.current||"");if(((d=c==null?void 0:c.connector)==null?void 0:d.id)===_r.AUTH_CONNECTOR_ID)o(X1t());else if(((p=c==null?void 0:c.connector)==null?void 0:p.id)===_r.WALLET_CONNECT_CONNECTOR_ID){const g=this.wagmiConfig.connectors.find(x=>x.id===_r.WALLET_CONNECT_CONNECTOR_ID);o(J1t(g))}o({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},this.connectionControllerClient={connectWalletConnect:async o=>{var S,I,R,O,M,U,D,B,F,k,N;const f=(S=this.options)==null?void 0:S.siweConfig,c=this.wagmiConfig.connectors.find(W=>W.id===_r.WALLET_CONNECT_CONNECTOR_ID);if(!c)throw new Error("connectionControllerClient:getWalletConnectUri - connector is undefined");const d=await c.getProvider();d.on("display_uri",W=>{o(W)});const p=await((M=(O=(R=(I=d.signer)==null?void 0:I.client)==null?void 0:R.core)==null?void 0:O.crypto)==null?void 0:M.getClientId());p&&((U=this.appKit)==null||U.setClientId(p));const g=vl.caipNetworkIdToNumber((B=(D=this.appKit)==null?void 0:D.getCaipNetwork())==null?void 0:B.id),x=await((F=f==null?void 0:f.getMessageParams)==null?void 0:F.call(f));if((k=f==null?void 0:f.options)!=null&&k.enabled&&typeof(d==null?void 0:d.authenticate)=="function"&&x&&Object.keys(x||{}).length>0){const{SIWEController:W,getDidChainId:Y,getDidAddress:z}=await Ya(async()=>{const{SIWEController:h,getDidChainId:w,getDidAddress:_}=await import("./index-DNfjtiM6.js");return{SIWEController:h,getDidChainId:w,getDidAddress:_}},[]);await c.setRequestedChainsIds(x.chains);let P=x.chains;g&&(P=[g,...x.chains.filter(h=>h!==g)]);const u=await d.authenticate({nonce:await f.getNonce(),methods:[...iQ],...x,chains:P}),l=(N=u==null?void 0:u.auths)==null?void 0:N[0];if(l){const{p:h,s:w}=l,_=Y(h.iss)||"",E=z(h.iss);E&&_&&W.setSession({address:E,chainId:parseInt(_,10)});try{const T=d.signer.client.formatAuthMessage({request:h,iss:h.iss});await W.verifyMessage({message:T,signature:w.s,cacao:l})}catch(T){throw console.error("Error verifying message",T),await d.disconnect().catch(console.error),await W.signOut().catch(console.error),T}}this.wagmiConfig.state.current=""}await Jse(this.wagmiConfig,{connector:c,chainId:g})},connectExternal:async({id:o,provider:f,info:c})=>{var g,x,S,I;const d=this.wagmiConfig.connectors.find(R=>R.id===o);if(!d)throw new Error("connectionControllerClient:connectExternal - connector is undefined");(g=this.appKit)==null||g.setClientId(null),f&&c&&d.id===_r.EIP6963_CONNECTOR_ID&&((x=d.setEip6963Wallet)==null||x.call(d,{provider:f,info:c}));const p=vl.caipNetworkIdToNumber((I=(S=this.appKit)==null?void 0:S.getCaipNetwork())==null?void 0:I.id);await Jse(this.wagmiConfig,{connector:d,chainId:p})},checkInstalled:o=>{var c;const f=(c=this.appKit)==null?void 0:c.getConnectors().find(d=>d.type==="INJECTED");return o?f&&window!=null&&window.ethereum?o.some(d=>{var p;return!!((p=window.ethereum)!=null&&p[String(d)])}):!1:!!window.ethereum},disconnect:async()=>{var o,f,c,d;if(await cze(this.wagmiConfig),(o=this.appKit)==null||o.setClientId(null),(d=(c=(f=this.options)==null?void 0:f.siweConfig)==null?void 0:c.options)!=null&&d.signOutOnDisconnect){const{SIWEController:p}=await Ya(async()=>{const{SIWEController:g}=await import("./index-DNfjtiM6.js");return{SIWEController:g}},[]);await p.signOut()}},signMessage:async o=>{var d;const f=((d=this.appKit)==null?void 0:d.getCaipAddress())||"",c=eue(f);return xze(this.wagmiConfig,{message:o,account:c})},estimateGas:async o=>{if(o.chainNamespace&&o.chainNamespace!=="eip155")throw new Error("connectionControllerClient:estimateGas - invalid chain namespace");try{return await uze(this.wagmiConfig,{account:o.address,to:o.to,data:o.data,type:"legacy"})}catch{return 0n}},sendTransaction:async o=>{if(o.chainNamespace&&o.chainNamespace!=="eip155")throw new Error("connectionControllerClient:sendTransaction - invalid chain namespace");const{chainId:f}=_w(this.wagmiConfig),c={account:o.address,to:o.to,value:o.value,gas:o.gas,gasPrice:o.gasPrice,data:o.data,chainId:f,type:"legacy"};await wze(this.wagmiConfig,c);const d=await vze(this.wagmiConfig,c);return await Ize(this.wagmiConfig,{hash:d,timeout:25e3}),d},writeContract:async o=>{var g,x,S;const f=((g=this.appKit)==null?void 0:g.getCaipAddress())||"",c=eue(f),d=vl.caipNetworkIdToNumber((S=(x=this.appKit)==null?void 0:x.getCaipNetwork())==null?void 0:S.id);return await Rze(this.wagmiConfig,{chainId:d,address:o.tokenAddress,account:c,abi:o.abi,functionName:o.method,args:[o.receiverAddress,o.tokenAmount]})},getEnsAddress:async o=>{var f,c,d;try{const p=vl.caipNetworkIdToNumber((c=(f=this.appKit)==null?void 0:f.getCaipNetwork())==null?void 0:c.id);let g=!1,x=!1;return o!=null&&o.endsWith(zn.WC_NAME_SUFFIX)&&(x=await((d=this.appKit)==null?void 0:d.resolveWalletConnectName(o))||!1),p===TF.id&&(g=await gze(this.wagmiConfig,{name:aue(o),chainId:p})),g||x||!1}catch{return!1}},getEnsAvatar:async o=>{var d,p;const f=vl.caipNetworkIdToNumber((p=(d=this.appKit)==null?void 0:d.getCaipNetwork())==null?void 0:p.id);return f!==TF.id?!1:await rae(this.wagmiConfig,{name:aue(o),chainId:f})||!1},parseUnits:Hje,formatUnits:u_}}construct(e,r){var n,i;if(!r.projectId)throw new Error("projectId is undefined");this.appKit=e,this.options=r,this.tokens=bce.getCaipTokens(r.tokens),this.syncRequestedNetworks([...this.wagmiConfig.chains]),this.syncConnectors(this.wagmiConfig.connectors),this.initAuthConnectorListeners([...this.wagmiConfig.connectors]),Tze(this.wagmiConfig,{onChange:s=>this.syncConnectors(s)}),nge(this.wagmiConfig,{onChange:s=>this.syncAccount({...s})}),(n=this.appKit)==null||n.setEIP6963Enabled(r.enableEIP6963!==!1),(i=this.appKit)==null||i.subscribeShouldUpdateToAddress(s=>{var a;if(s){const f=(a=mze(this.wagmiConfig)[0])==null?void 0:a.connector;f&&_ze(this.wagmiConfig,{connector:f}).then(c=>this.syncAccount({address:s,isConnected:!0,addresses:c.accounts,connector:f,chainId:c.chainId}))}})}subscribeState(e){var r;return(r=this.appKit)==null?void 0:r.subscribeState(n=>e({...n,selectedNetworkId:vl.caipNetworkIdToNumber(n.selectedNetworkId)}))}syncRequestedNetworks(e){var n;const r=e==null?void 0:e.map(i=>{var s,a;return{id:`${_r.EIP155}:${i.id}`,name:i.name,imageId:Rd.EIP155NetworkImageIds[i.id],imageUrl:(a=(s=this.options)==null?void 0:s.chainImages)==null?void 0:a[i.id],chain:this.chain}});(n=this.appKit)==null||n.setRequestedCaipNetworks(r??[],this.chain)}async syncAccount({address:e,chainId:r,connector:n,addresses:i,status:s}){var o,f,c,d,p,g,x,S,I,R;const a=`${_r.EIP155}:${r}:${e}`;((o=this.appKit)==null?void 0:o.getCaipAddress())!==a&&(s==="connected"&&e&&r?(this.syncNetwork(e,r,!0),(f=this.appKit)==null||f.setIsConnected(!0,this.chain),(c=this.appKit)==null||c.setCaipAddress(a,this.chain),await Promise.all([this.syncProfile(e,r),this.syncBalance(e,r),this.syncConnectedWalletInfo(n),(d=this.appKit)==null?void 0:d.setApprovedCaipNetworksData(this.chain)]),n&&this.syncConnectedWalletInfo(n),!((n==null?void 0:n.id)===_r.AUTH_CONNECTOR_ID)&&(i!=null&&i.length)&&((p=this.appKit)==null||p.setAllAccounts(i.map(M=>({address:M,type:"eoa"})),this.chain))):s==="disconnected"&&((g=this.appKit)==null||g.resetAccount(this.chain),(x=this.appKit)==null||x.resetWcConnection(),(S=this.appKit)==null||S.resetNetwork(),(I=this.appKit)==null||I.setAllAccounts([],this.chain),(R=this.appKit)==null||R.setIsConnected(!1,this.chain)))}async syncNetwork(e,r,n){var s,a,o,f,c,d,p,g;const i=this.wagmiConfig.chains.find(x=>x.id===r);if(i||r){const x=(i==null?void 0:i.name)??(r==null?void 0:r.toString()),S=Number((i==null?void 0:i.id)??r),I=`${_r.EIP155}:${S}`;if((o=this.appKit)==null||o.setCaipNetwork({id:I,name:x,imageId:Rd.EIP155NetworkImageIds[S],imageUrl:(a=(s=this.options)==null?void 0:s.chainImages)==null?void 0:a[S],chain:this.chain}),n&&e&&r){const R=`${_r.EIP155}:${S}:${e}`;if((f=this.appKit)==null||f.setCaipAddress(R,this.chain),(d=(c=i==null?void 0:i.blockExplorers)==null?void 0:c.default)!=null&&d.url){const O=`${i.blockExplorers.default.url}/address/${e}`;(p=this.appKit)==null||p.setAddressExplorerUrl(O,this.chain)}else(g=this.appKit)==null||g.setAddressExplorerUrl(void 0,this.chain);await this.syncBalance(e,r)}}}async syncWalletConnectName(e){var r,n,i;if(!this.appKit)throw new Error("syncWalletConnectName - appKit is undefined");try{const s=await this.appKit.getWalletConnectName(e);if(s[0]){const a=s[0];(r=this.appKit)==null||r.setProfileName(a.name,this.chain)}else(n=this.appKit)==null||n.setProfileName(null,this.chain)}catch{(i=this.appKit)==null||i.setProfileName(null,this.chain)}}async syncProfile(e,r){var n,i,s,a,o,f;if(!this.appKit)throw new Error("syncProfile - appKit is undefined");try{const{name:c,avatar:d}=await this.appKit.fetchIdentity({address:e});(n=this.appKit)==null||n.setProfileName(c,this.chain),(i=this.appKit)==null||i.setProfileImage(d,this.chain),c||await this.syncWalletConnectName(e)}catch{if(r===TF.id){const c=await bze(this.wagmiConfig,{address:e,chainId:r});if(c){(s=this.appKit)==null||s.setProfileName(c,this.chain);const d=await rae(this.wagmiConfig,{name:c,chainId:r});d&&((a=this.appKit)==null||a.setProfileImage(d,this.chain))}else await this.syncWalletConnectName(e),(o=this.appKit)==null||o.setProfileImage(null,this.chain)}else await this.syncWalletConnectName(e),(f=this.appKit)==null||f.setProfileImage(null,this.chain)}}async syncBalance(e,r){var i,s,a,o,f;const n=this.wagmiConfig.chains.find(c=>c.id===r);if(n){const c=await pze(this.wagmiConfig,{address:e,chainId:n.id,token:(a=(s=(i=this.options)==null?void 0:i.tokens)==null?void 0:s[n.id])==null?void 0:a.address});(o=this.appKit)==null||o.setBalance(c.formatted,c.symbol,this.chain);return}(f=this.appKit)==null||f.setBalance(void 0,void 0,this.chain)}async syncConnectedWalletInfo(e){var r,n,i,s;if(!e)throw Error("syncConnectedWalletInfo - connector is undefined");if(e.id===_r.WALLET_CONNECT_CONNECTOR_ID&&e.getProvider){const a=await e.getProvider();a.session&&((n=this.appKit)==null||n.setConnectedWalletInfo({...a.session.peer.metadata,name:a.session.peer.metadata.name,icon:(r=a.session.peer.metadata.icons)==null?void 0:r[0]},this.chain))}else{const a=(i=this.appKit)==null?void 0:i.getConnectors().find(o=>o.id===e.id);(s=this.appKit)==null||s.setConnectedWalletInfo({name:e.name,icon:e.icon||this.appKit.getConnectorImage(a)},this.chain)}}syncConnectors(e){var s;const r=new Set,n=e.filter(a=>!r.has(a.id)&&r.add(a.id)),i=[];n.forEach(({id:a,name:o,type:f,icon:c})=>{var p,g;_r.AUTH_CONNECTOR_ID===a||i.push({id:a,explorerId:Rd.ConnectorExplorerIds[a],imageUrl:((g=(p=this.options)==null?void 0:p.connectorImages)==null?void 0:g[a])??c,name:Rd.ConnectorNamesMap[a]??o,imageId:Rd.ConnectorImageIds[a],type:Rd.ConnectorTypesMap[f]??"EXTERNAL",info:{rdns:a},chain:this.chain})}),(s=this.appKit)==null||s.setConnectors(i),this.syncAuthConnector(n)}async syncAuthConnector(e){var n;const r=e.find(({id:i})=>i===_r.AUTH_CONNECTOR_ID);if(r){const i=await r.getProvider();(n=this.appKit)==null||n.addConnector({id:_r.AUTH_CONNECTOR_ID,type:"AUTH",name:"Auth",provider:i,email:r.email,socials:r.socials,showWallets:r.showWallets,chain:this.chain,walletFeatures:r.walletFeatures})}}async initAuthConnectorListeners(e){const r=e.find(({id:n})=>n===_r.AUTH_CONNECTOR_ID);r&&(await this.listenAuthConnector(r),await this.listenModal(r))}async listenAuthConnector(e){var r,n,i;if(typeof window<"u"&&e){(r=this.appKit)==null||r.setLoading(!0);const s=await e.getProvider(),a=s.getLoginEmailUsed();(n=this.appKit)==null||n.setLoading(a),a&&((i=this.appKit)==null||i.setIsConnected(!1,this.chain)),s.onRpcRequest(o=>{var f,c;Ds.checkIfRequestExists(o)?Ds.checkIfRequestIsSafe(o)||(f=this.appKit)==null||f.handleUnsafeRPCRequest():((c=this.appKit)==null||c.open(),console.error(Lr.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:o.method}),setTimeout(()=>{var d;(d=this.appKit)==null||d.showErrorMessage(Lr.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),s.rejectRpcRequests())}),s.onRpcError(()=>{var f,c,d,p;((f=this.appKit)==null?void 0:f.isOpen())&&((c=this.appKit)!=null&&c.isTransactionStackEmpty()?(d=this.appKit)==null||d.close():(p=this.appKit)==null||p.popTransactionStack(!0))}),s.onRpcSuccess((o,f)=>{var d,p,g;Ds.checkIfRequestIsSafe(f)||((d=this.appKit)!=null&&d.isTransactionStackEmpty()?(p=this.appKit)==null||p.close():(g=this.appKit)==null||g.popTransactionStack())}),s.onNotConnected(()=>{var f,c,d;((f=this.appKit)==null?void 0:f.getIsConnectedState())||((c=this.appKit)==null||c.setIsConnected(!1,this.chain),(d=this.appKit)==null||d.setLoading(!1))}),s.onIsConnected(o=>{var f,c,d,p,g;(f=this.appKit)==null||f.setIsConnected(!0,this.chain),(c=this.appKit)==null||c.setSmartAccountDeployed(!!o.smartAccountDeployed,this.chain),(d=this.appKit)==null||d.setPreferredAccountType(o.preferredAccountType,this.chain),(p=this.appKit)==null||p.setLoading(!1),(g=this.appKit)==null||g.setAllAccounts(o.accounts||[{address:o.address,type:o.preferredAccountType||"eoa"}],this.chain)}),s.onGetSmartAccountEnabledNetworks(o=>{var f;(f=this.appKit)==null||f.setSmartAccountEnabledNetworks(o,this.chain)}),s.onSetPreferredAccount(({address:o,type:f})=>{var c;o&&((c=this.appKit)==null||c.setPreferredAccountType(f,this.chain),rge(this.wagmiConfig,{connectors:[e]}))})}}async listenModal(e){const r=await e.getProvider();this.subscribeState(n=>{n.open||r.rejectRpcRequests()})}}bP.type="coinbaseWallet";function bP(t={}){return t.version==="3"||t.headlessMode?Ldt(t):Udt(t)}function Udt(t){let e,r,n,i,s;return a=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:bP.type,async connect({chainId:o}={}){try{const f=await this.getProvider(),c=(await f.request({method:"eth_requestAccounts"})).map(p=>$s(p));n||(n=this.onAccountsChanged.bind(this),f.on("accountsChanged",n)),i||(i=this.onChainChanged.bind(this),f.on("chainChanged",i)),s||(s=this.onDisconnect.bind(this),f.on("disconnect",s));let d=await this.getChainId();if(o&&d!==o){const p=await this.switchChain({chainId:o}).catch(g=>{if(g.code===ci.code)throw g;return{id:d}});d=(p==null?void 0:p.id)??d}return{accounts:c,chainId:d}}catch(f){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(f.message)?new ci(f):f}},async disconnect(){var f;const o=await this.getProvider();n&&(o.removeListener("accountsChanged",n),n=void 0),i&&(o.removeListener("chainChanged",i),i=void 0),s&&(o.removeListener("disconnect",s),s=void 0),o.disconnect(),(f=o.close)==null||f.call(o)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(f=>$s(f))},async getChainId(){const f=await(await this.getProvider()).request({method:"eth_chainId"});return Number(f)},async getProvider(){if(!r){const o=await(async()=>{const{default:f}=await Ya(async()=>{const{default:c}=await import("./index-IoMmGEzv.js").then(d=>d.i);return{default:c}},__vite__mapDeps([0,1]));return typeof f!="function"&&typeof f.default=="function"?f.default:f})();e=new o({...t,appChainIds:a.chains.map(f=>f.id)}),r=e.makeWeb3Provider({...t,options:t.preference??"all"})}return r},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:o,chainId:f}){var p,g,x,S;const c=a.chains.find(I=>I.id===f);if(!c)throw new to(new Dm);const d=await this.getProvider();try{return await d.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(c.id)}]}),c}catch(I){if(I.code===4902)try{let R;o!=null&&o.blockExplorerUrls?R=o.blockExplorerUrls:R=(p=c.blockExplorers)!=null&&p.default.url?[(g=c.blockExplorers)==null?void 0:g.default.url]:[];let O;(x=o==null?void 0:o.rpcUrls)!=null&&x.length?O=o.rpcUrls:O=[((S=c.rpcUrls.default)==null?void 0:S.http[0])??""];const M={blockExplorerUrls:R,chainId:Tr(f),chainName:(o==null?void 0:o.chainName)??c.name,iconUrls:o==null?void 0:o.iconUrls,nativeCurrency:(o==null?void 0:o.nativeCurrency)??c.nativeCurrency,rpcUrls:O};return await d.request({method:"wallet_addEthereumChain",params:[M]}),c}catch(R){throw new ci(R)}throw new to(I)}},onAccountsChanged(o){o.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:o.map(f=>$s(f))})},onChainChanged(o){const f=Number(o);a.emitter.emit("change",{chainId:f})},async onDisconnect(o){a.emitter.emit("disconnect");const f=await this.getProvider();n&&(f.removeListener("accountsChanged",n),n=void 0),i&&(f.removeListener("chainChanged",i),i=void 0),s&&(f.removeListener("disconnect",s),s=void 0)}})}function Ldt(t){let r,n,i,s,a;return o=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:bP.type,async connect({chainId:f}={}){try{const c=await this.getProvider(),d=(await c.request({method:"eth_requestAccounts"})).map(g=>$s(g));i||(i=this.onAccountsChanged.bind(this),c.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),c.on("chainChanged",s)),a||(a=this.onDisconnect.bind(this),c.on("disconnect",a));let p=await this.getChainId();if(f&&p!==f){const g=await this.switchChain({chainId:f}).catch(x=>{if(x.code===ci.code)throw x;return{id:p}});p=(g==null?void 0:g.id)??p}return{accounts:d,chainId:p}}catch(c){throw/(user closed modal|accounts received is empty|user denied account)/i.test(c.message)?new ci(c):c}},async disconnect(){const f=await this.getProvider();i&&(f.removeListener("accountsChanged",i),i=void 0),s&&(f.removeListener("chainChanged",s),s=void 0),a&&(f.removeListener("disconnect",a),a=void 0),f.disconnect(),f.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(c=>$s(c))},async getChainId(){const c=await(await this.getProvider()).request({method:"eth_chainId"});return Number(c)},async getProvider(){var f;if(!n){const c=await(async()=>{const{default:S}=await Ya(async()=>{const{default:I}=await import("./index-DethetlS.js").then(R=>R.i);return{default:I}},__vite__mapDeps([2,1]));return typeof S!="function"&&typeof S.default=="function"?S.default:S})();r=new c({...t,reloadOnDisconnect:!1});const d=(f=r.walletExtension)==null?void 0:f.getChainId(),p=o.chains.find(S=>t.chainId?S.id===t.chainId:S.id===d)||o.chains[0],g=t.chainId||(p==null?void 0:p.id),x=t.jsonRpcUrl||(p==null?void 0:p.rpcUrls.default.http[0]);n=r.makeWeb3Provider(x,g)}return n},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:f,chainId:c}){var g,x,S,I;const d=o.chains.find(R=>R.id===c);if(!d)throw new to(new Dm);const p=await this.getProvider();try{return await p.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(d.id)}]}),d}catch(R){if(R.code===4902)try{let O;f!=null&&f.blockExplorerUrls?O=f.blockExplorerUrls:O=(g=d.blockExplorers)!=null&&g.default.url?[(x=d.blockExplorers)==null?void 0:x.default.url]:[];let M;(S=f==null?void 0:f.rpcUrls)!=null&&S.length?M=f.rpcUrls:M=[((I=d.rpcUrls.default)==null?void 0:I.http[0])??""];const U={blockExplorerUrls:O,chainId:Tr(c),chainName:(f==null?void 0:f.chainName)??d.name,iconUrls:f==null?void 0:f.iconUrls,nativeCurrency:(f==null?void 0:f.nativeCurrency)??d.nativeCurrency,rpcUrls:M};return await p.request({method:"wallet_addEthereumChain",params:[U]}),d}catch(O){throw new ci(O)}throw new to(R)}},onAccountsChanged(f){f.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:f.map(c=>$s(c))})},onChainChanged(f){const c=Number(f);o.emitter.emit("change",{chainId:c})},async onDisconnect(f){o.emitter.emit("disconnect");const c=await this.getProvider();i&&(c.removeListener("accountsChanged",i),i=void 0),s&&(c.removeListener("chainChanged",s),s=void 0),a&&(c.removeListener("disconnect",a),a=void 0)}})}hQ.type="walletConnect";function hQ(t){const e=t.isNewChainsStale??!0;let r,n;const i="eip155";let s,a,o,f,c,d;return p=>({id:"walletConnect",name:"WalletConnect",type:hQ.type,async setup(){const g=await this.getProvider().catch(()=>null);g&&(o||(o=this.onConnect.bind(this),g.on("connect",o)),c||(c=this.onSessionDelete.bind(this),g.on("session_delete",c)))},async connect({chainId:g,...x}={}){var S,I;try{const R=await this.getProvider();if(!R)throw new Cp;f||(f=this.onDisplayUri,R.on("display_uri",f));let O=g;if(!O){const B=await((S=p.storage)==null?void 0:S.getItem("state"))??{};p.chains.some(k=>k.id===B.chainId)?O=B.chainId:O=(I=p.chains[0])==null?void 0:I.id}if(!O)throw new Error("No chains found on connector.");const M=await this.isChainsStale();if(R.session&&M&&await R.disconnect(),!R.session||M){const B=p.chains.filter(F=>F.id!==O).map(F=>F.id);await R.connect({optionalChains:[O,...B],..."pairingTopic"in x?{pairingTopic:x.pairingTopic}:{}}),this.setRequestedChainsIds(p.chains.map(F=>F.id))}const U=(await R.enable()).map(B=>$s(B)),D=await this.getChainId();return f&&(R.removeListener("display_uri",f),f=void 0),o&&(R.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),R.on("accountsChanged",s)),a||(a=this.onChainChanged.bind(this),R.on("chainChanged",a)),d||(d=this.onDisconnect.bind(this),R.on("disconnect",d)),c||(c=this.onSessionDelete.bind(this),R.on("session_delete",c)),{accounts:U,chainId:D}}catch(R){throw/(user rejected|connection request reset)/i.test(R==null?void 0:R.message)?new ci(R):R}},async disconnect(){const g=await this.getProvider();try{await(g==null?void 0:g.disconnect())}catch(x){if(!/No matching key/i.test(x.message))throw x}finally{a&&(g==null||g.removeListener("chainChanged",a),a=void 0),d&&(g==null||g.removeListener("disconnect",d),d=void 0),o||(o=this.onConnect.bind(this),g==null||g.on("connect",o)),s&&(g==null||g.removeListener("accountsChanged",s),s=void 0),c&&(g==null||g.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(x=>$s(x))},async getProvider({chainId:g}={}){var S;async function x(){const I=p.chains.map(O=>O.id);if(!I.length)return;const{EthereumProvider:R}=await Ya(async()=>{const{EthereumProvider:O}=await Promise.resolve().then(()=>kot);return{EthereumProvider:O}},void 0);return await R.init({...t,disableProviderPing:!0,optionalChains:I,projectId:t.projectId,rpcMap:Object.fromEntries(p.chains.map(O=>{const[M]=tqe({chain:O,transports:p.transports});return[O.id,M]})),showQrModal:t.showQrModal??!0})}return r||(n||(n=x()),r=await n,r==null||r.events.setMaxListeners(Number.POSITIVE_INFINITY)),g&&await((S=this.switchChain)==null?void 0:S.call(this,{chainId:g})),r},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[g,x]=await Promise.all([this.getAccounts(),this.getProvider()]);return g.length?await this.isChainsStale()&&x.session?(await x.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:g,chainId:x}){var R,O,M;const S=await this.getProvider();if(!S)throw new Cp;const I=p.chains.find(U=>U.id===x);if(!I)throw new to(new Dm);try{await Promise.all([new Promise(D=>{const B=({chainId:F})=>{F===x&&(p.emitter.off("change",B),D())};p.emitter.on("change",B)}),S.request({method:"wallet_switchEthereumChain",params:[{chainId:Tr(x)}]})]);const U=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...U,x]),I}catch(U){const D=U;if(/(user rejected)/i.test(D.message))throw new ci(D);try{let B;g!=null&&g.blockExplorerUrls?B=g.blockExplorerUrls:B=(R=I.blockExplorers)!=null&&R.default.url?[(O=I.blockExplorers)==null?void 0:O.default.url]:[];let F;(M=g==null?void 0:g.rpcUrls)!=null&&M.length?F=g.rpcUrls:F=[...I.rpcUrls.default.http];const k={blockExplorerUrls:B,chainId:Tr(x),chainName:(g==null?void 0:g.chainName)??I.name,iconUrls:g==null?void 0:g.iconUrls,nativeCurrency:(g==null?void 0:g.nativeCurrency)??I.nativeCurrency,rpcUrls:F};await S.request({method:"wallet_addEthereumChain",params:[k]});const N=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...N,x]),I}catch(B){throw new ci(B)}}},onAccountsChanged(g){g.length===0?this.onDisconnect():p.emitter.emit("change",{accounts:g.map(x=>$s(x))})},onChainChanged(g){const x=Number(g);p.emitter.emit("change",{chainId:x})},async onConnect(g){const x=Number(g.chainId),S=await this.getAccounts();p.emitter.emit("connect",{accounts:S,chainId:x})},async onDisconnect(g){this.setRequestedChainsIds([]),p.emitter.emit("disconnect");const x=await this.getProvider();s&&(x.removeListener("accountsChanged",s),s=void 0),a&&(x.removeListener("chainChanged",a),a=void 0),d&&(x.removeListener("disconnect",d),d=void 0),c&&(x.removeListener("session_delete",c),c=void 0),o||(o=this.onConnect.bind(this),x.on("connect",o))},onDisplayUri(g){p.emitter.emit("message",{type:"display_uri",data:g})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var x,S,I;return r?((I=(S=(x=r.session)==null?void 0:x.namespaces[i])==null?void 0:S.accounts)==null?void 0:I.map(R=>Number.parseInt(R.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var g;return await((g=p.storage)==null?void 0:g.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!e)return!1;const g=p.chains.map(I=>I.id),x=this.getNamespaceChainsIds();if(x.length&&!x.some(I=>g.includes(I)))return!1;const S=await this.getRequestedChainsIds();return!g.every(I=>S.includes(I))},async setRequestedChainsIds(g){var x;await((x=p.storage)==null?void 0:x.setItem(this.requestedChainsStorageKey,g))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}function Fdt(t){function e(r){return vl.parseEvmChainId(r)||1}return r=>({id:_r.AUTH_CONNECTOR_ID,name:"Web3Modal Auth",type:"w3mAuth",socials:t.socials,email:t.email,showWallets:t.showWallets,walletFeatures:t.walletFeatures,chain:zn.CHAIN.EVM,async connect(n={}){const i=await this.getProvider(),{address:s,chainId:a}=await i.connect({chainId:n.chainId});await i.getSmartAccountEnabledNetworks();const o=e(a);return{accounts:[s],account:s,chainId:o,chain:{id:o,unsuported:!1}}},async disconnect(){await(await this.getProvider()).disconnect()},async getAccounts(){const n=await this.getProvider(),{address:i}=await n.connect();return r.emitter.emit("change",{accounts:[i]}),[i]},async getProvider(){return this.provider||(this.provider=new W1t(t.options.projectId)),Promise.resolve(this.provider)},async getChainId(){const n=await this.getProvider(),{chainId:i}=await n.getChainId();return e(i)},async isAuthorized(){const n=await this.getProvider(),{isConnected:i}=await n.isConnected();return i},async switchChain({chainId:n}){try{const i=r.chains.find(o=>o.id===n);if(!i)throw new to(new Error("chain not found on connector."));const a=await(await this.getProvider()).connect({chainId:n});return r.emitter.emit("change",{chainId:Number(n),accounts:[a.address]}),i}catch(i){throw i instanceof Error?new to(i):i}},onAccountsChanged(n){n.length===0?this.onDisconnect():r.emitter.emit("change",{accounts:n.map($s)})},onChainChanged(n){const i=Number(n);r.emitter.emit("change",{chainId:i})},async onConnect(n){const i=Number(n.chainId),s=await this.getAccounts();r.emitter.emit("connect",{accounts:s,chainId:i})},async onDisconnect(n){await(await this.getProvider()).disconnect()}})}function jdt({projectId:t,chains:e,metadata:r,enableCoinbase:n,enableInjected:i,auth:s={},enableWalletConnect:a,enableEIP6963:o,...f}){var S;const c=(f==null?void 0:f.connectors)??[],d=e.map(I=>[I.id,edt({chain:I,projectId:t})]),p=Object.fromEntries(d),g={email:!0,showWallets:!0,walletFeatures:!0,socials:["google","x","discord","farcaster","github","apple","facebook"]};a!==!1&&c.push(hQ({projectId:t,metadata:r,showQrModal:!1})),i!==!1&&c.push($k({shimDisconnect:!0})),n!==!1&&c.push(bP({version:"4",appName:(r==null?void 0:r.name)??"Unknown",appLogoUrl:(r==null?void 0:r.icons[0])??"Unknown",preference:f.coinbasePreference||"all"}));const x={...g,...s};return(x.email||(S=x.socials)!=null&&S.length)&&c.push(Fdt({chains:[...e],options:{projectId:t},socials:x.socials,email:x.email,showWallets:x.showWallets,walletFeatures:x.walletFeatures})),Yze({chains:e,multiInjectedProviderDiscovery:o!==!1,transports:p,...f,connectors:c})}const fwe="6562ee7f0e72671353204776ca7a132c",zdt={name:"Quest Chains EAS Test",description:"Testing creating attestations for Quest Chains.",url:"https://localhost:5173",icons:["https://avatars.githubusercontent.com/u/37784886"]},qdt=[Lot],cwe=jdt({chains:qdt,projectId:fwe,metadata:zdt,auth:{email:!0,socials:["google","x","github","discord","apple"],showWallets:!0,walletFeatures:!0},ssr:!1,storage:sge({storage:Xze})});/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause @@ -6078,7 +6078,7 @@ Minimum version required to store current data is: `+s+`. padding: 0px 10px; background-color: var(--wui-color-modal-bg); } -`;var Qwe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let LR=class extends Ft{constructor(){super(...arguments),this.text=""}render(){return Ke`${this.template()}`}template(){return this.text?Ke`${this.text}`:null}};LR.styles=[Gt,S2t];Qwe([xe()],LR.prototype,"text",void 0);LR=Qwe([We("wui-separator")],LR);const OS={interpolate(t,e,r){if(t.length!==2||e.length!==2)throw new Error("inputRange and outputRange must be an array of length 2");const n=t[0]||0,i=t[1]||0,s=e[0]||0,a=e[1]||0;return ri?a:(a-s)/(i-n)*(r-n)+s}},T2t=3,I2t=["receive","deposit","borrow","claim"],R2t=["withdraw","repay","burn"],A2={getMonthName(t){const e=new Date;return e.setMonth(t),e.toLocaleString("en-US",{month:"long"})},getTransactionGroupTitle(t,e){const r=sQ.getYear(),n=this.getMonthName(e);return t===r?n:`${n} ${t}`},getTransactionImages(t){const[e,r]=t,n=!!e&&(t==null?void 0:t.every(a=>!!a.nft_info)),i=(t==null?void 0:t.length)>1;return(t==null?void 0:t.length)===2&&!n?[this.getTransactionImage(e),this.getTransactionImage(r)]:i?t.map(a=>this.getTransactionImage(a)):[this.getTransactionImage(e)]},getTransactionImage(t){return{type:A2.getTransactionTransferTokenType(t),url:A2.getTransactionImageURL(t)}},getTransactionImageURL(t){var i,s,a,o,f;let e;const r=!!(t!=null&&t.nft_info),n=!!(t!=null&&t.fungible_info);return t&&r?e=(a=(s=(i=t==null?void 0:t.nft_info)==null?void 0:i.content)==null?void 0:s.preview)==null?void 0:a.url:t&&n&&(e=(f=(o=t==null?void 0:t.fungible_info)==null?void 0:o.icon)==null?void 0:f.url),e},getTransactionTransferTokenType(t){if(t!=null&&t.fungible_info)return"FUNGIBLE";if(t!=null&&t.nft_info)return"NFT"},getTransactionDescriptions(t){var p,g,x;const e=(p=t==null?void 0:t.metadata)==null?void 0:p.operationType,r=t==null?void 0:t.transfers,n=((g=t==null?void 0:t.transfers)==null?void 0:g.length)>0,i=((x=t==null?void 0:t.transfers)==null?void 0:x.length)>1,s=n&&(r==null?void 0:r.every(S=>!!(S!=null&&S.fungible_info))),[a,o]=r;let f=this.getTransferDescription(a),c=this.getTransferDescription(o);if(!n)return(e==="send"||e==="receive")&&s?(f=ur.getTruncateString({string:t==null?void 0:t.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),c=ur.getTruncateString({string:t==null?void 0:t.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"}),[f,c]):[t.metadata.status];if(i)return r.map(S=>this.getTransferDescription(S));let d="";return I2t.includes(e)?d="+":R2t.includes(e)&&(d="-"),f=d.concat(f),[f]},getTransferDescription(t){var r;let e="";return t&&(t!=null&&t.nft_info?e=((r=t==null?void 0:t.nft_info)==null?void 0:r.name)||"-":t!=null&&t.fungible_info&&(e=this.getFungibleTransferDescription(t)||"-")),e},getFungibleTransferDescription(t){var n;return t?[this.getQuantityFixedValue(t==null?void 0:t.quantity.numeric),(n=t==null?void 0:t.fungible_info)==null?void 0:n.symbol].join(" ").trim():null},getQuantityFixedValue(t){return t?parseFloat(t).toFixed(T2t):null}};let _ue=!1;class M2t{constructor(e){var r;this.initPromise=void 0,this.setIsConnected=(n,i)=>{Je.setIsConnected(n,i)},this.getIsConnectedState=()=>Je.state.isConnected,this.setAllAccounts=(n,i)=>{Je.setAllAccounts(n,i),zt.setHasMultipleAddresses((n==null?void 0:n.length)>1)},this.addAddressLabel=(n,i,s)=>{Je.addAddressLabel(n,i,s)},this.removeAddressLabel=(n,i)=>{Je.removeAddressLabel(n,i)},this.getCaipAddress=()=>Je.state.caipAddress,this.setCaipAddress=(n,i)=>{Je.setCaipAddress(n,i)},this.setBalance=(n,i,s)=>{Je.setBalance(n,i,s)},this.setProfileName=(n,i)=>{Je.setProfileName(n,i)},this.setProfileImage=(n,i)=>{Je.setProfileImage(n,i)},this.resetAccount=n=>{Je.resetAccount(n)},this.setCaipNetwork=n=>{Ct.setCaipNetwork(n)},this.getCaipNetwork=()=>Ct.state.caipNetwork,this.setRequestedCaipNetworks=(n,i)=>{Ct.setRequestedCaipNetworks(n,i)},this.getApprovedCaipNetworkIds=()=>Ct.getApprovedCaipNetworkIds(),this.setApprovedCaipNetworksData=n=>Ct.setApprovedCaipNetworksData(n),this.resetNetwork=()=>{Ct.resetNetwork()},this.setConnectors=n=>{Zt.setConnectors(n)},this.addConnector=n=>{Zt.addConnector(n)},this.getConnectors=()=>Zt.getConnectors(),this.resetWcConnection=()=>{hr.resetWcConnection()},this.fetchIdentity=n=>gi.fetchIdentity(n),this.setAddressExplorerUrl=(n,i)=>{Je.setAddressExplorerUrl(n,i)},this.setSmartAccountDeployed=(n,i)=>{Je.setSmartAccountDeployed(n,i)},this.setConnectedWalletInfo=(n,i)=>{Je.setConnectedWalletInfo(n,i)},this.setSmartAccountEnabledNetworks=(n,i)=>{Ct.setSmartAccountEnabledNetworks(n,i)},this.setPreferredAccountType=(n,i)=>{Je.setPreferredAccountType(n,i)},this.getWalletConnectName=n=>yl.getNamesForAddress(n),this.resolveWalletConnectName=async n=>{var o;const i=n.replace(zn.WC_NAME_SUFFIX,""),s=await yl.resolveName(i);return((o=(Object.values(s==null?void 0:s.addresses)||[])[0])==null?void 0:o.address)||!1},this.setEIP6963Enabled=n=>{zt.setEIP6963Enabled(n)},this.setClientId=n=>{gi.setClientId(n)},this.getConnectorImage=n=>nn.getConnectorImage(n),this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.isTransactionShouldReplaceView()?this.replace("ApproveTransaction"):this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.adapter=(r=e.adapters)==null?void 0:r[0],this.initControllers(e),this.initOrContinue()}static getInstance(){return this.instance}async open(e){await this.initOrContinue(),gr.open(e)}async close(){await this.initOrContinue(),gr.close()}setLoading(e){gr.setLoading(e)}getError(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getError)==null?void 0:r.call(e)}getChainId(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getChainId)==null?void 0:r.call(e)}getAddress(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getAddress)==null?void 0:r.call(e)}switchNetwork(e){var r,n;return(n=(r=this.adapter)==null?void 0:r.switchNetwork)==null?void 0:n.call(r,e)}getIsConnected(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getIsConnected)==null?void 0:r.call(e)}getWalletProvider(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getWalletProvider)==null?void 0:r.call(e)}getWalletProviderType(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getWalletProviderType)==null?void 0:r.call(e)}subscribeProvider(e){var r,n;return(n=(r=this.adapter)==null?void 0:r.subscribeProvider)==null?void 0:n.call(r,e)}getThemeMode(){return Ui.state.themeMode}getThemeVariables(){return Ui.state.themeVariables}setThemeMode(e){Ui.setThemeMode(e),ywe(Ui.state.themeMode)}setThemeVariables(e){Ui.setThemeVariables(e),oht(Ui.state.themeVariables)}subscribeTheme(e){return Ui.subscribe(e)}getWalletInfo(){return Je.state.connectedWalletInfo}subscribeWalletInfo(e){return Je.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){Je.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){Ct.subscribeKey("caipNetwork",e)}getState(){return c1.state}subscribeState(e){return c1.subscribe(e)}showErrorMessage(e){nr.showError(e)}showSuccessMessage(e){nr.showSuccess(e)}getEvent(){return{...Ht.state}}subscribeEvents(e){return Ht.subscribe(e)}replace(e){Ve.replace(e)}redirect(e){Ve.push(e)}popTransactionStack(e){Ve.popTransactionStack(e)}isOpen(){return gr.state.open}isTransactionStackEmpty(){return Ve.state.transactionStack.length===0}isTransactionShouldReplaceView(){var e;return(e=Ve.state.transactionStack[Ve.state.transactionStack.length-1])==null?void 0:e.replace}async initControllers(e){var n,i;if(zt.setProjectId(e.projectId),zt.setSdkVersion(e.sdkVersion),It.initialize(e.adapters||[]),(n=e.adapters)==null||n.forEach(s=>{var a;(a=s.construct)==null||a.call(s,this,e),Ct.setAllowUnsupportedChain(e.allowUnsupportedChain,s.chain),Ct.setDefaultCaipNetwork(e.defaultChain)}),zt.setAllWallets(e.allWallets),zt.setIncludeWalletIds(e.includeWalletIds),zt.setExcludeWalletIds(e.excludeWalletIds),zt.setFeaturedWalletIds(e.featuredWalletIds),zt.setTokens(e.tokens),zt.setTermsConditionsUrl(e.termsConditionsUrl),zt.setPrivacyPolicyUrl(e.privacyPolicyUrl),zt.setCustomWallets(e.customWallets),zt.setEnableAnalytics(e.enableAnalytics),zt.setOnrampEnabled(e.enableOnramp!==!1),zt.setEnableSwaps(e.enableSwaps!==!1),e.metadata&&zt.setMetadata(e.metadata),e.themeMode&&Ui.setThemeMode(e.themeMode),e.themeVariables&&Ui.setThemeVariables(e.themeVariables),e.disableAppend&&zt.setDisableAppend(!!e.disableAppend),((i=e.adapters)==null?void 0:i.find(s=>s.chain===zn.CHAIN.EVM))&&e.siweConfig){const{SIWEController:s}=await Ya(async()=>{const{SIWEController:a}=await import("./index-DV5_LVti.js");return{SIWEController:a}},[]);s.setSIWEClient(e.siweConfig)}}async initOrContinue(){return!this.initPromise&&!_ue&&Ot.isClient()&&(_ue=!0,this.initPromise=new Promise(async e=>{await Promise.all([Ya(()=>import("./index-CF82IQ3b.js"),[]),Ya(()=>import("./w3m-modal-BZ0C38WO.js"),[])]);const r=document.createElement("w3m-modal");zt.state.disableAppend||document.body.insertAdjacentElement("beforeend",r),e()})),this.initPromise}}/** +`;var Qwe=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let LR=class extends Ft{constructor(){super(...arguments),this.text=""}render(){return Ke`${this.template()}`}template(){return this.text?Ke`${this.text}`:null}};LR.styles=[Gt,S2t];Qwe([xe()],LR.prototype,"text",void 0);LR=Qwe([We("wui-separator")],LR);const OS={interpolate(t,e,r){if(t.length!==2||e.length!==2)throw new Error("inputRange and outputRange must be an array of length 2");const n=t[0]||0,i=t[1]||0,s=e[0]||0,a=e[1]||0;return ri?a:(a-s)/(i-n)*(r-n)+s}},T2t=3,I2t=["receive","deposit","borrow","claim"],R2t=["withdraw","repay","burn"],A2={getMonthName(t){const e=new Date;return e.setMonth(t),e.toLocaleString("en-US",{month:"long"})},getTransactionGroupTitle(t,e){const r=sQ.getYear(),n=this.getMonthName(e);return t===r?n:`${n} ${t}`},getTransactionImages(t){const[e,r]=t,n=!!e&&(t==null?void 0:t.every(a=>!!a.nft_info)),i=(t==null?void 0:t.length)>1;return(t==null?void 0:t.length)===2&&!n?[this.getTransactionImage(e),this.getTransactionImage(r)]:i?t.map(a=>this.getTransactionImage(a)):[this.getTransactionImage(e)]},getTransactionImage(t){return{type:A2.getTransactionTransferTokenType(t),url:A2.getTransactionImageURL(t)}},getTransactionImageURL(t){var i,s,a,o,f;let e;const r=!!(t!=null&&t.nft_info),n=!!(t!=null&&t.fungible_info);return t&&r?e=(a=(s=(i=t==null?void 0:t.nft_info)==null?void 0:i.content)==null?void 0:s.preview)==null?void 0:a.url:t&&n&&(e=(f=(o=t==null?void 0:t.fungible_info)==null?void 0:o.icon)==null?void 0:f.url),e},getTransactionTransferTokenType(t){if(t!=null&&t.fungible_info)return"FUNGIBLE";if(t!=null&&t.nft_info)return"NFT"},getTransactionDescriptions(t){var p,g,x;const e=(p=t==null?void 0:t.metadata)==null?void 0:p.operationType,r=t==null?void 0:t.transfers,n=((g=t==null?void 0:t.transfers)==null?void 0:g.length)>0,i=((x=t==null?void 0:t.transfers)==null?void 0:x.length)>1,s=n&&(r==null?void 0:r.every(S=>!!(S!=null&&S.fungible_info))),[a,o]=r;let f=this.getTransferDescription(a),c=this.getTransferDescription(o);if(!n)return(e==="send"||e==="receive")&&s?(f=ur.getTruncateString({string:t==null?void 0:t.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),c=ur.getTruncateString({string:t==null?void 0:t.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"}),[f,c]):[t.metadata.status];if(i)return r.map(S=>this.getTransferDescription(S));let d="";return I2t.includes(e)?d="+":R2t.includes(e)&&(d="-"),f=d.concat(f),[f]},getTransferDescription(t){var r;let e="";return t&&(t!=null&&t.nft_info?e=((r=t==null?void 0:t.nft_info)==null?void 0:r.name)||"-":t!=null&&t.fungible_info&&(e=this.getFungibleTransferDescription(t)||"-")),e},getFungibleTransferDescription(t){var n;return t?[this.getQuantityFixedValue(t==null?void 0:t.quantity.numeric),(n=t==null?void 0:t.fungible_info)==null?void 0:n.symbol].join(" ").trim():null},getQuantityFixedValue(t){return t?parseFloat(t).toFixed(T2t):null}};let _ue=!1;class M2t{constructor(e){var r;this.initPromise=void 0,this.setIsConnected=(n,i)=>{Je.setIsConnected(n,i)},this.getIsConnectedState=()=>Je.state.isConnected,this.setAllAccounts=(n,i)=>{Je.setAllAccounts(n,i),zt.setHasMultipleAddresses((n==null?void 0:n.length)>1)},this.addAddressLabel=(n,i,s)=>{Je.addAddressLabel(n,i,s)},this.removeAddressLabel=(n,i)=>{Je.removeAddressLabel(n,i)},this.getCaipAddress=()=>Je.state.caipAddress,this.setCaipAddress=(n,i)=>{Je.setCaipAddress(n,i)},this.setBalance=(n,i,s)=>{Je.setBalance(n,i,s)},this.setProfileName=(n,i)=>{Je.setProfileName(n,i)},this.setProfileImage=(n,i)=>{Je.setProfileImage(n,i)},this.resetAccount=n=>{Je.resetAccount(n)},this.setCaipNetwork=n=>{Ct.setCaipNetwork(n)},this.getCaipNetwork=()=>Ct.state.caipNetwork,this.setRequestedCaipNetworks=(n,i)=>{Ct.setRequestedCaipNetworks(n,i)},this.getApprovedCaipNetworkIds=()=>Ct.getApprovedCaipNetworkIds(),this.setApprovedCaipNetworksData=n=>Ct.setApprovedCaipNetworksData(n),this.resetNetwork=()=>{Ct.resetNetwork()},this.setConnectors=n=>{Zt.setConnectors(n)},this.addConnector=n=>{Zt.addConnector(n)},this.getConnectors=()=>Zt.getConnectors(),this.resetWcConnection=()=>{hr.resetWcConnection()},this.fetchIdentity=n=>gi.fetchIdentity(n),this.setAddressExplorerUrl=(n,i)=>{Je.setAddressExplorerUrl(n,i)},this.setSmartAccountDeployed=(n,i)=>{Je.setSmartAccountDeployed(n,i)},this.setConnectedWalletInfo=(n,i)=>{Je.setConnectedWalletInfo(n,i)},this.setSmartAccountEnabledNetworks=(n,i)=>{Ct.setSmartAccountEnabledNetworks(n,i)},this.setPreferredAccountType=(n,i)=>{Je.setPreferredAccountType(n,i)},this.getWalletConnectName=n=>yl.getNamesForAddress(n),this.resolveWalletConnectName=async n=>{var o;const i=n.replace(zn.WC_NAME_SUFFIX,""),s=await yl.resolveName(i);return((o=(Object.values(s==null?void 0:s.addresses)||[])[0])==null?void 0:o.address)||!1},this.setEIP6963Enabled=n=>{zt.setEIP6963Enabled(n)},this.setClientId=n=>{gi.setClientId(n)},this.getConnectorImage=n=>nn.getConnectorImage(n),this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.isTransactionShouldReplaceView()?this.replace("ApproveTransaction"):this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.adapter=(r=e.adapters)==null?void 0:r[0],this.initControllers(e),this.initOrContinue()}static getInstance(){return this.instance}async open(e){await this.initOrContinue(),gr.open(e)}async close(){await this.initOrContinue(),gr.close()}setLoading(e){gr.setLoading(e)}getError(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getError)==null?void 0:r.call(e)}getChainId(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getChainId)==null?void 0:r.call(e)}getAddress(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getAddress)==null?void 0:r.call(e)}switchNetwork(e){var r,n;return(n=(r=this.adapter)==null?void 0:r.switchNetwork)==null?void 0:n.call(r,e)}getIsConnected(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getIsConnected)==null?void 0:r.call(e)}getWalletProvider(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getWalletProvider)==null?void 0:r.call(e)}getWalletProviderType(){var e,r;return(r=(e=this.adapter)==null?void 0:e.getWalletProviderType)==null?void 0:r.call(e)}subscribeProvider(e){var r,n;return(n=(r=this.adapter)==null?void 0:r.subscribeProvider)==null?void 0:n.call(r,e)}getThemeMode(){return Ui.state.themeMode}getThemeVariables(){return Ui.state.themeVariables}setThemeMode(e){Ui.setThemeMode(e),ywe(Ui.state.themeMode)}setThemeVariables(e){Ui.setThemeVariables(e),oht(Ui.state.themeVariables)}subscribeTheme(e){return Ui.subscribe(e)}getWalletInfo(){return Je.state.connectedWalletInfo}subscribeWalletInfo(e){return Je.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){Je.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){Ct.subscribeKey("caipNetwork",e)}getState(){return c1.state}subscribeState(e){return c1.subscribe(e)}showErrorMessage(e){nr.showError(e)}showSuccessMessage(e){nr.showSuccess(e)}getEvent(){return{...Ht.state}}subscribeEvents(e){return Ht.subscribe(e)}replace(e){Ve.replace(e)}redirect(e){Ve.push(e)}popTransactionStack(e){Ve.popTransactionStack(e)}isOpen(){return gr.state.open}isTransactionStackEmpty(){return Ve.state.transactionStack.length===0}isTransactionShouldReplaceView(){var e;return(e=Ve.state.transactionStack[Ve.state.transactionStack.length-1])==null?void 0:e.replace}async initControllers(e){var n,i;if(zt.setProjectId(e.projectId),zt.setSdkVersion(e.sdkVersion),It.initialize(e.adapters||[]),(n=e.adapters)==null||n.forEach(s=>{var a;(a=s.construct)==null||a.call(s,this,e),Ct.setAllowUnsupportedChain(e.allowUnsupportedChain,s.chain),Ct.setDefaultCaipNetwork(e.defaultChain)}),zt.setAllWallets(e.allWallets),zt.setIncludeWalletIds(e.includeWalletIds),zt.setExcludeWalletIds(e.excludeWalletIds),zt.setFeaturedWalletIds(e.featuredWalletIds),zt.setTokens(e.tokens),zt.setTermsConditionsUrl(e.termsConditionsUrl),zt.setPrivacyPolicyUrl(e.privacyPolicyUrl),zt.setCustomWallets(e.customWallets),zt.setEnableAnalytics(e.enableAnalytics),zt.setOnrampEnabled(e.enableOnramp!==!1),zt.setEnableSwaps(e.enableSwaps!==!1),e.metadata&&zt.setMetadata(e.metadata),e.themeMode&&Ui.setThemeMode(e.themeMode),e.themeVariables&&Ui.setThemeVariables(e.themeVariables),e.disableAppend&&zt.setDisableAppend(!!e.disableAppend),((i=e.adapters)==null?void 0:i.find(s=>s.chain===zn.CHAIN.EVM))&&e.siweConfig){const{SIWEController:s}=await Ya(async()=>{const{SIWEController:a}=await import("./index-DNfjtiM6.js");return{SIWEController:a}},[]);s.setSIWEClient(e.siweConfig)}}async initOrContinue(){return!this.initPromise&&!_ue&&Ot.isClient()&&(_ue=!0,this.initPromise=new Promise(async e=>{await Promise.all([Ya(()=>import("./index-BfEgo1H2.js"),[]),Ya(()=>import("./w3m-modal-CS4WeCLM.js"),[])]);const r=document.createElement("w3m-modal");zt.state.disableAppend||document.body.insertAdjacentElement("beforeend",r),e()})),this.initPromise}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause @@ -6734,7 +6734,7 @@ Minimum version required to store current data is: `+s+`. `)}onConnector(e){var n,i;It.setActiveChain(e.chain);const r=(i=(n=this.activeConnector)==null?void 0:n.providers)==null?void 0:i.find(s=>s.chain===e.chain);if(!r){nr.showError("Failed to find connector");return}r.type==="WALLET_CONNECT"?Ot.isMobile()?Ve.push("AllWallets"):Ve.push("ConnectingWalletConnect"):Ve.push("ConnectingExternal",{connector:r})}};qR.styles=umt;n4e([Se()],qR.prototype,"activeConnector",void 0);qR=n4e([We("w3m-connecting-multi-chain-view")],qR);var WQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let HR=class extends Tt{constructor(){var e;super(),this.interval=void 0,this.lastRetry=Date.now(),this.wallet=(e=Ve.state.data)==null?void 0:e.wallet,this.platform=void 0,this.platforms=[],this.initializeConnection(),this.interval=setInterval(this.initializeConnection.bind(this),S0.TEN_SEC_MS)}disconnectedCallback(){clearTimeout(this.interval)}render(){return this.wallet?(this.determinePlatforms(),ce` ${this.headerTemplate()}
${this.platformTemplate()}
- `):ce``}async initializeConnection(e=!1){try{const{wcPairingExpiry:r}=hr.state;if(e||Ot.isPairingExpired(r))if(await hr.connectWalletConnect(),this.finalizeConnection(),En.getConnectedConnector()==="AUTH"&&zt.state.hasMultipleAddresses)Ve.push("SelectAddresses");else if(zt.state.isSiweEnabled){const{SIWEController:n}=await Ya(async()=>{const{SIWEController:i}=await import("./index-DV5_LVti.js");return{SIWEController:i}},[]);n.state.status==="success"?gr.close():Ve.push("ConnectingSiwe")}else gr.close()}catch(r){Ht.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(r==null?void 0:r.message)??"Unknown"}}),hr.setWcError(!0),Ot.isAllowedRetry(this.lastRetry)&&(nr.showError("Declined"),this.lastRetry=Date.now(),this.initializeConnection(!0))}}finalizeConnection(){var n;const{wcLinking:e,recentWallet:r}=hr.state;e&&En.setWalletConnectDeepLink(e),r&&En.setWeb3ModalRecent(r),Ht.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:e?"mobile":"qrcode",name:((n=this.wallet)==null?void 0:n.name)||"Unknown"}})}determinePlatforms(){if(!this.wallet)throw new Error("w3m-connecting-wc-view:determinePlatforms No wallet");if(this.platform)return;const{mobile_link:e,desktop_link:r,webapp_link:n,injected:i,rdns:s}=this.wallet,a=i==null?void 0:i.map(({injected_id:S})=>S).filter(Boolean),o=s?[s]:a??[],f=zt.state.isUniversalProvider?!1:o.length,c=e,d=n,p=hr.checkInstalled(o),g=f&&p,x=r&&!Ot.isMobile();g&&this.platforms.push("browser"),c&&this.platforms.push(Ot.isMobile()?"mobile":"qrcode"),d&&this.platforms.push("web"),x&&this.platforms.push("desktop"),!g&&f&&this.platforms.push("unsupported"),this.platform=this.platforms[0]}platformTemplate(){switch(this.platform){case"browser":return ce``;case"desktop":return ce` + `):ce``}async initializeConnection(e=!1){try{const{wcPairingExpiry:r}=hr.state;if(e||Ot.isPairingExpired(r))if(await hr.connectWalletConnect(),this.finalizeConnection(),En.getConnectedConnector()==="AUTH"&&zt.state.hasMultipleAddresses)Ve.push("SelectAddresses");else if(zt.state.isSiweEnabled){const{SIWEController:n}=await Ya(async()=>{const{SIWEController:i}=await import("./index-DNfjtiM6.js");return{SIWEController:i}},[]);n.state.status==="success"?gr.close():Ve.push("ConnectingSiwe")}else gr.close()}catch(r){Ht.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(r==null?void 0:r.message)??"Unknown"}}),hr.setWcError(!0),Ot.isAllowedRetry(this.lastRetry)&&(nr.showError("Declined"),this.lastRetry=Date.now(),this.initializeConnection(!0))}}finalizeConnection(){var n;const{wcLinking:e,recentWallet:r}=hr.state;e&&En.setWalletConnectDeepLink(e),r&&En.setWeb3ModalRecent(r),Ht.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:e?"mobile":"qrcode",name:((n=this.wallet)==null?void 0:n.name)||"Unknown"}})}determinePlatforms(){if(!this.wallet)throw new Error("w3m-connecting-wc-view:determinePlatforms No wallet");if(this.platform)return;const{mobile_link:e,desktop_link:r,webapp_link:n,injected:i,rdns:s}=this.wallet,a=i==null?void 0:i.map(({injected_id:S})=>S).filter(Boolean),o=s?[s]:a??[],f=zt.state.isUniversalProvider?!1:o.length,c=e,d=n,p=hr.checkInstalled(o),g=f&&p,x=r&&!Ot.isMobile();g&&this.platforms.push("browser"),c&&this.platforms.push(Ot.isMobile()?"mobile":"qrcode"),d&&this.platforms.push("web"),x&&this.platforms.push("desktop"),!g&&f&&this.platforms.push("unsupported"),this.platform=this.platforms[0]}platformTemplate(){switch(this.platform){case"browser":return ce``;case"desktop":return ce` this.initializeConnection(!0)}> `;case"web":return ce` @@ -7062,7 +7062,7 @@ Minimum version required to store current data is: `+s+`. display: block; opacity: 1; } -`,GQ={onNetworkChange:async()=>{var t,e;if(zt.state.isSiweEnabled){const{SIWEController:r}=await Ya(async()=>{const{SIWEController:n}=await import("./index-DV5_LVti.js");return{SIWEController:n}},[]);(e=(t=r.state._client)==null?void 0:t.options)!=null&&e.signOutOnNetworkChange?await r.signOut():NH.navigateAfterNetworkSwitch()}else NH.navigateAfterNetworkSwitch()}};var KQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let uA=class extends Tt{constructor(){var e;super(),this.network=(e=Ve.state.data)==null?void 0:e.network,this.unsubscribe=[],this.showRetry=!1,this.error=!1}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){this.onSwitchNetwork()}render(){if(!this.network)throw new Error("w3m-network-switch-view: No network provided");this.onShowRetry();const e=this.getLabel(),r=this.getSubLabel();return ce` +`,GQ={onNetworkChange:async()=>{var t,e;if(zt.state.isSiweEnabled){const{SIWEController:r}=await Ya(async()=>{const{SIWEController:n}=await import("./index-DNfjtiM6.js");return{SIWEController:n}},[]);(e=(t=r.state._client)==null?void 0:t.options)!=null&&e.signOutOnNetworkChange?await r.signOut():NH.navigateAfterNetworkSwitch()}else NH.navigateAfterNetworkSwitch()}};var KQ=function(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,r,s):a(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};let uA=class extends Tt{constructor(){var e;super(),this.network=(e=Ve.state.data)==null?void 0:e.network,this.unsubscribe=[],this.showRetry=!1,this.error=!1}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){this.onSwitchNetwork()}render(){if(!this.network)throw new Error("w3m-network-switch-view: No network provided");this.onShowRetry();const e=this.getLabel(),r=this.getSubLabel();return ce` ${this.dynamicButtonTemplate()} ${this.titleTemplate()} ${this.closeButtonTemplate()} - `}onWalletHelp(){Ht.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),Ve.push("WhatIsAWallet")}async onClose(){if(this.isSiweEnabled){const{SIWEController:e}=await Ya(async()=>{const{SIWEController:i}=await import("./index-DV5_LVti.js");return{SIWEController:i}},[]),r=Ve.state.view==="ApproveTransaction";e.state.status!=="success"&&r?Ve.popTransactionStack(!0):gr.close()}else gr.close()}closeButtonTemplate(){const e=Ve.state.view==="ConnectingSiwe";return this.isSiweEnabled&&e?ce`
`:ce` + `}onWalletHelp(){Ht.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),Ve.push("WhatIsAWallet")}async onClose(){if(this.isSiweEnabled){const{SIWEController:e}=await Ya(async()=>{const{SIWEController:i}=await import("./index-DNfjtiM6.js");return{SIWEController:i}},[]),r=Ve.state.view==="ApproveTransaction";e.state.status!=="success"&&r?Ve.popTransactionStack(!0):gr.close()}else gr.close()}closeButtonTemplate(){const e=Ve.state.view==="ConnectingSiwe";return this.isSiweEnabled&&e?ce`
`:ce` +import{b as a}from"./index-BSVOad49.js";import{d as e,T as n,U as o,t as L,u as W,v as l,am as r,ar as M,as as Z,w as V,g as d,y as p,x as H,z as c,ap as m,aq as k,B as _,D as h,F as g,G as I,H as B,I as v,J as T,aC as b,aD as w,h as f,K as S,ay as x,L as A,j as D,av as N,P as E,Q as P,V as U,X as G,ah as z,ax as j,az as q,ai as y,au as F,Y as O,aj as Q,aA as J,at as K,$ as X,ak as Y,k as $,l as R,m as a1,a1 as i1,a0 as s1,a2 as C1,a3 as u1,ag as t1,a4 as e1,aw as n1,an as o1,ao as L1,al as W1,a5 as l1,a6 as r1,aB as M1,aE as Z1,n as V1,a7 as d1,a8 as p1,aa as H1,o as c1,a9 as m1,ac as k1,ab as _1,Z as h1,_ as g1,ad as I1,q as B1,ae as v1,af as T1,c as b1,i as w1,e as f1,f as S1}from"./index-BSVOad49.js";const s=a` i.map(i=>d[i]); -import{p as u,a as h,aX as R,aJ as V}from"./index-CFrD00kt.js";const n=u({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),x={state:n,subscribe(e){return h(n,()=>e(n))},push(e,t){e!==n.view&&(n.view=e,t&&(n.data=t),n.history.push(e))},reset(e){n.view=e,n.history=[e]},replace(e){n.history.length>1&&(n.history[n.history.length-1]=e,n.view=e)},goBack(){if(n.history.length>1){n.history.pop();const[e]=n.history.slice(-1);n.view=e}},setData(e){n.data=e}},r={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 r.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return r.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(r.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let o=e;o.includes("://")||(o=e.replaceAll("/","").replaceAll(":",""),o=`${o}://`),o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);const i=encodeURIComponent(t);return`${o}wc?uri=${i}`},formatUniversalUrl(e,t,s){if(!r.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let o=e;o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);const i=encodeURIComponent(t);return`${o}wc?uri=${i}`},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(r.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(r.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(r.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(r.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=x.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},H=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),a=u({enabled:H,userSessionId:"",events:[],connectedWalletId:void 0}),B={state:a,subscribe(e){return h(a.events,()=>e(R(a.events[a.events.length-1])))},initialize(){a.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(a.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){a.connectedWalletId=e},click(e){if(a.enabled){const t={type:"CLICK",name:e.name,userSessionId:a.userSessionId,timestamp:Date.now(),data:e};a.events.push(t)}},track(e){if(a.enabled){const t={type:"TRACK",name:e.name,userSessionId:a.userSessionId,timestamp:Date.now(),data:e};a.events.push(t)}},view(e){if(a.enabled){const t={type:"VIEW",name:e.name,userSessionId:a.userSessionId,timestamp:Date.now(),data:e};a.events.push(t)}}},d=u({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),c={state:d,subscribe(e){return h(d,()=>e(d))},setChains(e){d.chains=e},setWalletConnectUri(e){d.walletConnectUri=e},setIsCustomDesktop(e){d.isCustomDesktop=e},setIsCustomMobile(e){d.isCustomMobile=e},setIsDataLoaded(e){d.isDataLoaded=e},setIsUiLoaded(e){d.isUiLoaded=e},setIsAuth(e){d.isAuth=e}},w=u({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}),v={state:w,subscribe(e){return h(w,()=>e(w))},setConfig(e){var t,s;B.initialize(),c.setChains(e.chains),c.setIsAuth(!!e.enableAuthMode),c.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),c.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),r.setModalVersionInStorage(),Object.assign(w,e)}};var K=Object.defineProperty,j=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,D=(e,t,s)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,X=(e,t)=>{for(var s in t||(t={}))z.call(t,s)&&D(e,s,t[s]);if(j)for(var s of j(t))J.call(t,s)&&D(e,s,t[s]);return e};const E="https://explorer-api.walletconnect.com",O="wcm",A="js-2.6.2";async function W(e,t){const s=X({sdkType:O,sdkVersion:A},t),o=new URL(e,E);return o.searchParams.append("projectId",v.state.projectId),Object.entries(s).forEach(([i,l])=>{l&&o.searchParams.append(i,String(l))}),(await fetch(o)).json()}const m={async getDesktopListings(e){return W("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return W("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return W("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return W("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${E}/w3m/v1/getWalletImage/${e}?projectId=${v.state.projectId}&sdkType=${O}&sdkVersion=${A}`},getAssetImageUrl(e){return`${E}/w3m/v1/getAssetImage/${e}?projectId=${v.state.projectId}&sdkType=${O}&sdkVersion=${A}`}};var q=Object.defineProperty,k=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,_=(e,t,s)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Q=(e,t)=>{for(var s in t||(t={}))F.call(t,s)&&_(e,s,t[s]);if(k)for(var s of k(t))G.call(t,s)&&_(e,s,t[s]);return e};const S=r.isMobile(),p=u({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ae={state:p,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=v.state;if(e==="NONE"||t==="ALL"&&!e)return p.recomendedWallets;if(r.isArray(e)){const s={recommendedIds:e.join(",")},{listings:o}=await m.getAllListings(s),i=Object.values(o);i.sort((l,b)=>{const y=e.indexOf(l.id),C=e.indexOf(b.id);return y-C}),p.recomendedWallets=i}else{const{chains:s,isAuth:o}=c.state,i=s==null?void 0:s.join(","),l=r.isArray(t),b={page:1,sdks:o?"auth_v1":void 0,entries:r.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:l?t.join(","):void 0},{listings:y}=S?await m.getMobileListings(b):await m.getDesktopListings(b);p.recomendedWallets=Object.values(y)}return p.recomendedWallets},async getWallets(e){const t=Q({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:o}=v.state,{recomendedWallets:i}=p;if(o==="ALL")return p.wallets;i.length?t.excludedIds=i.map($=>$.id).join(","):r.isArray(s)&&(t.excludedIds=s.join(",")),r.isArray(o)&&(t.excludedIds=[t.excludedIds,o].filter(Boolean).join(",")),c.state.isAuth&&(t.sdks="auth_v1");const{page:l,search:b}=e,{listings:y,total:C}=S?await m.getMobileListings(t):await m.getDesktopListings(t),U=Object.values(y),M=b?"search":"wallets";return p[M]={listings:[...p[M].listings,...U],total:C,page:l??1},{listings:U,total:C}},getWalletImageUrl(e){return m.getWalletImageUrl(e)},getAssetImageUrl(e){return m.getAssetImageUrl(e)},resetSearch(){p.search={listings:[],total:0,page:1}}},I=u({open:!1}),L={state:I,subscribe(e){return h(I,()=>e(I))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:o}=c.state;if(r.removeWalletConnectDeepLink(),c.setWalletConnectUri(e==null?void 0:e.uri),c.setChains(e==null?void 0:e.chains),x.reset("ConnectWallet"),s&&o)I.open=!0,t();else{const i=setInterval(()=>{const l=c.state;l.isUiLoaded&&l.isDataLoaded&&(clearInterval(i),I.open=!0,t())},200)}})},close(){I.open=!1}};var Y=Object.defineProperty,N=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,T=(e,t,s)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,te=(e,t)=>{for(var s in t||(t={}))Z.call(t,s)&&T(e,s,t[s]);if(N)for(var s of N(t))ee.call(t,s)&&T(e,s,t[s]);return e};function se(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const f=u({themeMode:se()?"dark":"light"}),P={state:f,subscribe(e){return h(f,()=>e(f))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(f.themeMode=t),s&&(f.themeVariables=te({},s))}},g=u({open:!1,message:"",variant:"success"}),re={state:g,subscribe(e){return h(g,()=>e(g))},openToast(e,t){g.open=!0,g.message=e,g.variant=t},closeToast(){g.open=!1}};class oe{constructor(t){this.openModal=L.open,this.closeModal=L.close,this.subscribeModal=L.subscribe,this.setTheme=P.setThemeConfig,P.setThemeConfig(t),v.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await V(()=>import("./index-DuLR7yxj.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),c.setIsUiLoaded(!0)}}}const ie=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:oe},Symbol.toStringTag,{value:"Module"}));export{B as R,x as T,r as a,ie as i,P as n,re as o,c as p,L as s,ae as t,v as y}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CW3SPSK3.js","assets/index-BSVOad49.js","assets/index-CAumgMRP.css"])))=>i.map(i=>d[i]); +import{p as u,a as h,aX as R,aJ as V}from"./index-BSVOad49.js";const n=u({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),x={state:n,subscribe(e){return h(n,()=>e(n))},push(e,t){e!==n.view&&(n.view=e,t&&(n.data=t),n.history.push(e))},reset(e){n.view=e,n.history=[e]},replace(e){n.history.length>1&&(n.history[n.history.length-1]=e,n.view=e)},goBack(){if(n.history.length>1){n.history.pop();const[e]=n.history.slice(-1);n.view=e}},setData(e){n.data=e}},r={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 r.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return r.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(r.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let o=e;o.includes("://")||(o=e.replaceAll("/","").replaceAll(":",""),o=`${o}://`),o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);const i=encodeURIComponent(t);return`${o}wc?uri=${i}`},formatUniversalUrl(e,t,s){if(!r.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let o=e;o.endsWith("/")||(o=`${o}/`),this.setWalletConnectDeepLink(o,s);const i=encodeURIComponent(t);return`${o}wc?uri=${i}`},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(r.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(r.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(r.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(r.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=x.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},H=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),a=u({enabled:H,userSessionId:"",events:[],connectedWalletId:void 0}),B={state:a,subscribe(e){return h(a.events,()=>e(R(a.events[a.events.length-1])))},initialize(){a.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(a.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){a.connectedWalletId=e},click(e){if(a.enabled){const t={type:"CLICK",name:e.name,userSessionId:a.userSessionId,timestamp:Date.now(),data:e};a.events.push(t)}},track(e){if(a.enabled){const t={type:"TRACK",name:e.name,userSessionId:a.userSessionId,timestamp:Date.now(),data:e};a.events.push(t)}},view(e){if(a.enabled){const t={type:"VIEW",name:e.name,userSessionId:a.userSessionId,timestamp:Date.now(),data:e};a.events.push(t)}}},d=u({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),c={state:d,subscribe(e){return h(d,()=>e(d))},setChains(e){d.chains=e},setWalletConnectUri(e){d.walletConnectUri=e},setIsCustomDesktop(e){d.isCustomDesktop=e},setIsCustomMobile(e){d.isCustomMobile=e},setIsDataLoaded(e){d.isDataLoaded=e},setIsUiLoaded(e){d.isUiLoaded=e},setIsAuth(e){d.isAuth=e}},w=u({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}),v={state:w,subscribe(e){return h(w,()=>e(w))},setConfig(e){var t,s;B.initialize(),c.setChains(e.chains),c.setIsAuth(!!e.enableAuthMode),c.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),c.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),r.setModalVersionInStorage(),Object.assign(w,e)}};var K=Object.defineProperty,j=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,D=(e,t,s)=>t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,X=(e,t)=>{for(var s in t||(t={}))z.call(t,s)&&D(e,s,t[s]);if(j)for(var s of j(t))J.call(t,s)&&D(e,s,t[s]);return e};const E="https://explorer-api.walletconnect.com",O="wcm",A="js-2.6.2";async function W(e,t){const s=X({sdkType:O,sdkVersion:A},t),o=new URL(e,E);return o.searchParams.append("projectId",v.state.projectId),Object.entries(s).forEach(([i,l])=>{l&&o.searchParams.append(i,String(l))}),(await fetch(o)).json()}const m={async getDesktopListings(e){return W("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return W("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return W("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return W("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${E}/w3m/v1/getWalletImage/${e}?projectId=${v.state.projectId}&sdkType=${O}&sdkVersion=${A}`},getAssetImageUrl(e){return`${E}/w3m/v1/getAssetImage/${e}?projectId=${v.state.projectId}&sdkType=${O}&sdkVersion=${A}`}};var q=Object.defineProperty,k=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,_=(e,t,s)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Q=(e,t)=>{for(var s in t||(t={}))F.call(t,s)&&_(e,s,t[s]);if(k)for(var s of k(t))G.call(t,s)&&_(e,s,t[s]);return e};const S=r.isMobile(),p=u({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ae={state:p,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=v.state;if(e==="NONE"||t==="ALL"&&!e)return p.recomendedWallets;if(r.isArray(e)){const s={recommendedIds:e.join(",")},{listings:o}=await m.getAllListings(s),i=Object.values(o);i.sort((l,b)=>{const y=e.indexOf(l.id),C=e.indexOf(b.id);return y-C}),p.recomendedWallets=i}else{const{chains:s,isAuth:o}=c.state,i=s==null?void 0:s.join(","),l=r.isArray(t),b={page:1,sdks:o?"auth_v1":void 0,entries:r.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:l?t.join(","):void 0},{listings:y}=S?await m.getMobileListings(b):await m.getDesktopListings(b);p.recomendedWallets=Object.values(y)}return p.recomendedWallets},async getWallets(e){const t=Q({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:o}=v.state,{recomendedWallets:i}=p;if(o==="ALL")return p.wallets;i.length?t.excludedIds=i.map($=>$.id).join(","):r.isArray(s)&&(t.excludedIds=s.join(",")),r.isArray(o)&&(t.excludedIds=[t.excludedIds,o].filter(Boolean).join(",")),c.state.isAuth&&(t.sdks="auth_v1");const{page:l,search:b}=e,{listings:y,total:C}=S?await m.getMobileListings(t):await m.getDesktopListings(t),U=Object.values(y),M=b?"search":"wallets";return p[M]={listings:[...p[M].listings,...U],total:C,page:l??1},{listings:U,total:C}},getWalletImageUrl(e){return m.getWalletImageUrl(e)},getAssetImageUrl(e){return m.getAssetImageUrl(e)},resetSearch(){p.search={listings:[],total:0,page:1}}},I=u({open:!1}),L={state:I,subscribe(e){return h(I,()=>e(I))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:o}=c.state;if(r.removeWalletConnectDeepLink(),c.setWalletConnectUri(e==null?void 0:e.uri),c.setChains(e==null?void 0:e.chains),x.reset("ConnectWallet"),s&&o)I.open=!0,t();else{const i=setInterval(()=>{const l=c.state;l.isUiLoaded&&l.isDataLoaded&&(clearInterval(i),I.open=!0,t())},200)}})},close(){I.open=!1}};var Y=Object.defineProperty,N=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,T=(e,t,s)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,te=(e,t)=>{for(var s in t||(t={}))Z.call(t,s)&&T(e,s,t[s]);if(N)for(var s of N(t))ee.call(t,s)&&T(e,s,t[s]);return e};function se(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const f=u({themeMode:se()?"dark":"light"}),P={state:f,subscribe(e){return h(f,()=>e(f))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(f.themeMode=t),s&&(f.themeVariables=te({},s))}},g=u({open:!1,message:"",variant:"success"}),re={state:g,subscribe(e){return h(g,()=>e(g))},openToast(e,t){g.open=!0,g.message=e,g.variant=t},closeToast(){g.open=!1}};class oe{constructor(t){this.openModal=L.open,this.closeModal=L.close,this.subscribeModal=L.subscribe,this.setTheme=P.setThemeConfig,P.setThemeConfig(t),v.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await V(()=>import("./index-CW3SPSK3.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),c.setIsUiLoaded(!0)}}}const ie=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:oe},Symbol.toStringTag,{value:"Module"}));export{B as R,x as T,r as a,ie as i,P as n,re as o,c as p,L as s,ae as t,v as y}; diff --git a/assets/index-DV5_LVti.js b/assets/index-DNfjtiM6.js similarity index 99% rename from assets/index-DV5_LVti.js rename to assets/index-DNfjtiM6.js index 1e13383..83cfeaf 100644 --- a/assets/index-DV5_LVti.js +++ b/assets/index-DNfjtiM6.js @@ -1,4 +1,4 @@ -import{p as Xn,s as $n,a as Zn,r as ts,O as Mi,c as ln,A as Ke,M as Ri,E as yr,N as br,W as Mr,S as Ti,C as es,R as rs}from"./index-CFrD00kt.js";const Lt=Xn({status:"uninitialized"}),sr={state:Lt,subscribeKey(e,t){return $n(Lt,e,t)},subscribe(e){return Zn(Lt,()=>e(Lt))},_getClient(){if(!Lt._client)throw new Error("SIWEController client not set");return Lt._client},async getNonce(e){const r=await this._getClient().getNonce(e);return this.setNonce(r),r},async getSession(){try{const t=await this._getClient().getSession();return t&&(this.setSession(t),this.setStatus("success")),t}catch{return}},createMessage(e){const r=this._getClient().createMessage(e);return this.setMessage(r),r},async verifyMessage(e){return await this._getClient().verifyMessage(e)},async signIn(){return await this._getClient().signIn()},async signOut(){var t;const e=this._getClient();await e.signOut(),this.setStatus("ready"),this.setSession(void 0),(t=e.onSignOut)==null||t.call(e)},onSignIn(e){var r;const t=this._getClient();(r=t.onSignIn)==null||r.call(t,e)},onSignOut(){var t;const e=this._getClient();(t=e.onSignOut)==null||t.call(e)},setSIWEClient(e){Lt._client=ts(e),Lt.status="ready",Mi.setIsSiweEnabled(e.options.enabled)},setNonce(e){Lt.nonce=e},setStatus(e){Lt.status=e},setMessage(e){Lt.message=e},setSession(e){Lt.session=e,Lt.status=e?"success":"ready"}};var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function is(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}),r}var ns={exports:{}};/** +import{p as Xn,s as $n,a as Zn,r as ts,O as Mi,c as ln,A as Ke,M as Ri,E as yr,N as br,W as Mr,S as Ti,C as es,R as rs}from"./index-BSVOad49.js";const Lt=Xn({status:"uninitialized"}),sr={state:Lt,subscribeKey(e,t){return $n(Lt,e,t)},subscribe(e){return Zn(Lt,()=>e(Lt))},_getClient(){if(!Lt._client)throw new Error("SIWEController client not set");return Lt._client},async getNonce(e){const r=await this._getClient().getNonce(e);return this.setNonce(r),r},async getSession(){try{const t=await this._getClient().getSession();return t&&(this.setSession(t),this.setStatus("success")),t}catch{return}},createMessage(e){const r=this._getClient().createMessage(e);return this.setMessage(r),r},async verifyMessage(e){return await this._getClient().verifyMessage(e)},async signIn(){return await this._getClient().signIn()},async signOut(){var t;const e=this._getClient();await e.signOut(),this.setStatus("ready"),this.setSession(void 0),(t=e.onSignOut)==null||t.call(e)},onSignIn(e){var r;const t=this._getClient();(r=t.onSignIn)==null||r.call(t,e)},onSignOut(){var t;const e=this._getClient();(t=e.onSignOut)==null||t.call(e)},setSIWEClient(e){Lt._client=ts(e),Lt.status="ready",Mi.setIsSiweEnabled(e.options.enabled)},setNonce(e){Lt.nonce=e},setStatus(e){Lt.status=e},setMessage(e){Lt.message=e},setSession(e){Lt.session=e,Lt.status=e?"success":"ready"}};var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function is(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:function(){return e[i]}})}),r}var ns={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 diff --git a/assets/index-Dp7JVq_m.js b/assets/index-DethetlS.js similarity index 99% rename from assets/index-Dp7JVq_m.js rename to assets/index-DethetlS.js index 56cec3d..a9fab0c 100644 --- a/assets/index-Dp7JVq_m.js +++ b/assets/index-DethetlS.js @@ -1,4 +1,4 @@ -import{aN as I,aP as _r,aQ as Ti,aR as la,aS as jn,aO as ua}from"./index-CFrD00kt.js";import{s as da,a as ae,b as vr,r as Bt,j as ha,c as fa}from"./hooks.module-DHPNJ6uk.js";var Pi={},$t={},Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.walletLogo=void 0;const ga=(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 `}};Sr.walletLogo=ga;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.LINK_API_URL=void 0;Cr.LINK_API_URL="https://www.walletlink.org";var y={},Ft={},xe={};Object.defineProperty(xe,"__esModule",{value:!0});xe.errorValues=xe.standardErrorCodes=void 0;xe.standardErrorCodes={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,unsupportedChain:4902}};xe.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."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var kr={},Rr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.getErrorCode=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=xe,r="Unspecified error message.";t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(h,f=r){if(h&&Number.isInteger(h)){const g=h.toString();if(u(e.errorValues,g))return e.errorValues[g].message;if(l(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return f}t.getMessageFromCode=n;function s(h){if(!Number.isInteger(h))return!1;const f=h.toString();return!!(e.errorValues[f]||l(h))}t.isValidCode=s;function i(h){var f;if(typeof h=="number")return h;if(o(h))return(f=h.code)!==null&&f!==void 0?f:h.errorCode}t.getErrorCode=i;function o(h){return typeof h=="object"&&h!==null&&(typeof h.code=="number"||typeof h.errorCode=="number")}function a(h,{shouldIncludeStack:f=!1}={}){const g={};if(h&&typeof h=="object"&&!Array.isArray(h)&&u(h,"code")&&s(h.code)){const E=h;g.code=E.code,E.message&&typeof E.message=="string"?(g.message=E.message,u(E,"data")&&(g.data=E.data)):(g.message=n(g.code),g.data={originalError:c(h)})}else g.code=e.standardErrorCodes.rpc.internal,g.message=d(h,"message")?h.message:r,g.data={originalError:c(h)};return f&&(g.stack=d(h,"stack")?h.stack:void 0),g}t.serialize=a;function l(h){return h>=-32099&&h<=-32e3}function c(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function u(h,f){return Object.prototype.hasOwnProperty.call(h,f)}function d(h,f){return typeof h=="object"&&h!==null&&f in h&&typeof h[f]=="string"}})(Rr);Object.defineProperty(kr,"__esModule",{value:!0});kr.standardErrors=void 0;const Y=xe,$i=Rr;kr.standardErrors={rpc:{parse:t=>pe(Y.standardErrorCodes.rpc.parse,t),invalidRequest:t=>pe(Y.standardErrorCodes.rpc.invalidRequest,t),invalidParams:t=>pe(Y.standardErrorCodes.rpc.invalidParams,t),methodNotFound:t=>pe(Y.standardErrorCodes.rpc.methodNotFound,t),internal:t=>pe(Y.standardErrorCodes.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 pe(e,t)},invalidInput:t=>pe(Y.standardErrorCodes.rpc.invalidInput,t),resourceNotFound:t=>pe(Y.standardErrorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>pe(Y.standardErrorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>pe(Y.standardErrorCodes.rpc.transactionRejected,t),methodNotSupported:t=>pe(Y.standardErrorCodes.rpc.methodNotSupported,t),limitExceeded:t=>pe(Y.standardErrorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>nt(Y.standardErrorCodes.provider.userRejectedRequest,t),unauthorized:t=>nt(Y.standardErrorCodes.provider.unauthorized,t),unsupportedMethod:t=>nt(Y.standardErrorCodes.provider.unsupportedMethod,t),disconnected:t=>nt(Y.standardErrorCodes.provider.disconnected,t),chainDisconnected:t=>nt(Y.standardErrorCodes.provider.chainDisconnected,t),unsupportedChain:t=>nt(Y.standardErrorCodes.provider.unsupportedChain,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 Bi(e,r,n)}}};function pe(t,e){const[r,n]=Oi(e);return new xi(t,r||(0,$i.getMessageFromCode)(t),n)}function nt(t,e){const[r,n]=Oi(e);return new Bi(t,r||(0,$i.getMessageFromCode)(t),n)}function Oi(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[]}let xi=class extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}},Bi=class extends xi{constructor(e,r,n){if(!pa(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}};function pa(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}var Ir={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});_t.isErrorResponse=void 0;function ma(t){return t.errorMessage!==void 0}_t.isErrorResponse=ma;var vt={};Object.defineProperty(vt,"__esModule",{value:!0});vt.LIB_VERSION=void 0;vt.LIB_VERSION="3.9.3";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.serializeError=void 0;const ba=_t,wa=vt,ya=xe,Ea=Rr;function _a(t,e){const r=(0,Ea.serialize)(va(t),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",wa.LIB_VERSION),n.searchParams.set("code",r.code.toString());const s=Sa(r.data,e);return s&&n.searchParams.set("method",s),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}Ir.serializeError=_a;function va(t){return typeof t=="string"?{message:t,code:ya.standardErrorCodes.rpc.internal}:(0,ba.isErrorResponse)(t)?Object.assign(Object.assign({},t),{message:t.errorMessage,code:t.errorCode,data:{method:t.method}}):t}function Sa(t,e){const r=t==null?void 0:t.method;if(r)return r;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.standardErrors=t.standardErrorCodes=t.serializeError=t.getMessageFromCode=t.getErrorCode=void 0;const e=xe;Object.defineProperty(t,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});const r=kr;Object.defineProperty(t,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=Ir;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const s=Rr;Object.defineProperty(t,"getErrorCode",{enumerable:!0,get:function(){return s.getErrorCode}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return s.getMessageFromCode}})})(Ft);var G={};Object.defineProperty(G,"__esModule",{value:!0});G.ProviderType=G.RegExpString=G.IntNumber=G.BigIntString=G.AddressString=G.HexString=G.OpaqueType=void 0;function jt(){return t=>t}G.OpaqueType=jt;G.HexString=jt();G.AddressString=jt();G.BigIntString=jt();function Ca(t){return Math.floor(t)}G.IntNumber=Ca;G.RegExpString=jt();var _s;(function(t){t.CoinbaseWallet="CoinbaseWallet",t.MetaMask="MetaMask",t.Unselected=""})(_s||(G.ProviderType=_s={}));var ka=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(y,"__esModule",{value:!0});y.isMobileWeb=y.getLocation=y.isInIFrame=y.createQrUrl=y.getFavicon=y.range=y.isBigNumber=y.ensureParsedJSONObject=y.ensureBN=y.ensureRegExpString=y.ensureIntNumber=y.ensureBuffer=y.ensureAddressString=y.ensureEvenLengthHexString=y.ensureHexString=y.isHexString=y.prepend0x=y.strip0x=y.has0xPrefix=y.hexStringFromIntNumber=y.intNumberFromHexString=y.bigIntStringFromBN=y.hexStringFromBuffer=y.hexStringToUint8Array=y.uint8ArrayToHex=y.randomBytesHex=void 0;const je=ka(_r),et=Ft,ye=G,Fi=/^[0-9]*$/,ji=/^[a-f0-9]*$/;function Ra(t){return Di(crypto.getRandomValues(new Uint8Array(t)))}y.randomBytesHex=Ra;function Di(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}y.uint8ArrayToHex=Di;function Ia(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}y.hexStringToUint8Array=Ia;function Aa(t,e=!1){const r=t.toString("hex");return(0,ye.HexString)(e?`0x${r}`:r)}y.hexStringFromBuffer=Aa;function Na(t){return(0,ye.BigIntString)(t.toString(10))}y.bigIntStringFromBN=Na;function Ma(t){return(0,ye.IntNumber)(new je.default(Ht(t,!1),16).toNumber())}y.intNumberFromHexString=Ma;function La(t){return(0,ye.HexString)(`0x${new je.default(t).toString(16)}`)}y.hexStringFromIntNumber=La;function Dn(t){return t.startsWith("0x")||t.startsWith("0X")}y.has0xPrefix=Dn;function Ar(t){return Dn(t)?t.slice(2):t}y.strip0x=Ar;function Hi(t){return Dn(t)?`0x${t.slice(2)}`:`0x${t}`}y.prepend0x=Hi;function Dt(t){if(typeof t!="string")return!1;const e=Ar(t).toLowerCase();return ji.test(e)}y.isHexString=Dt;function Ui(t,e=!1){if(typeof t=="string"){const r=Ar(t).toLowerCase();if(ji.test(r))return(0,ye.HexString)(e?`0x${r}`:r)}throw et.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}y.ensureHexString=Ui;function Ht(t,e=!1){let r=Ui(t,!1);return r.length%2===1&&(r=(0,ye.HexString)(`0${r}`)),e?(0,ye.HexString)(`0x${r}`):r}y.ensureEvenLengthHexString=Ht;function Ta(t){if(typeof t=="string"){const e=Ar(t).toLowerCase();if(Dt(e)&&e.length===40)return(0,ye.AddressString)(Hi(e))}throw et.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}y.ensureAddressString=Ta;function Pa(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(Dt(t)){const e=Ht(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw et.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}y.ensureBuffer=Pa;function Vi(t){if(typeof t=="number"&&Number.isInteger(t))return(0,ye.IntNumber)(t);if(typeof t=="string"){if(Fi.test(t))return(0,ye.IntNumber)(Number(t));if(Dt(t))return(0,ye.IntNumber)(new je.default(Ht(t,!1),16).toNumber())}throw et.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}y.ensureIntNumber=Vi;function $a(t){if(t instanceof RegExp)return(0,ye.RegExpString)(t.toString());throw et.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}y.ensureRegExpString=$a;function Oa(t){if(t!==null&&(je.default.isBN(t)||Wi(t)))return new je.default(t.toString(10),10);if(typeof t=="number")return new je.default(Vi(t));if(typeof t=="string"){if(Fi.test(t))return new je.default(t,10);if(Dt(t))return new je.default(Ht(t,!1),16)}throw et.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}y.ensureBN=Oa;function xa(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw et.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}y.ensureParsedJSONObject=xa;function Wi(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}y.isBigNumber=Wi;function Ba(t,e){return Array.from({length:e-t},(r,n)=>t+n)}y.range=Ba;function Fa(){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:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}y.getFavicon=Fa;function ja(t,e,r,n,s,i){const o=n?"parent-id":"id",a=new URLSearchParams({[o]:t,secret:e,server:r,v:s,chainId:i.toString()}).toString();return`${r}/#/link?${a}`}y.createQrUrl=ja;function zi(){try{return window.frameElement!==null}catch{return!1}}y.isInIFrame=zi;function Da(){try{return zi()&&window.top?window.top.location:window.location}catch{return window.location}}y.getLocation=Da;function Ha(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}y.isMobileWeb=Ha;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ScopedLocalStorage=void 0;class Ua{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}`}}Nr.ScopedLocalStorage=Ua;var pt={},Ut={},Vt={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.EVENTS=void 0;St.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var we={};Object.defineProperty(we,"__esModule",{value:!0});we.RelayAbstract=we.APP_VERSION_KEY=we.LOCAL_STORAGE_ADDRESSES_KEY=we.WALLET_USER_NAME_KEY=void 0;const vs=Ft;we.WALLET_USER_NAME_KEY="walletUsername";we.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";we.APP_VERSION_KEY="AppVersion";class Va{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 vs.standardErrors.rpc.parse({});const s=n,{error:i}=s;if(i)throw(0,vs.serializeError)(i,e.method);return s})}}we.RelayAbstract=Va;var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.Session=void 0;const Ss=da,Cs=y,ks="session:id",Rs="session:secret",Is="session:linked";class Hn{constructor(e,r,n,s){this._storage=e,this._id=r||(0,Cs.randomBytesHex)(16),this._secret=n||(0,Cs.randomBytesHex)(32),this._key=new Ss.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const r=e.getItem(ks),n=e.getItem(Is),s=e.getItem(Rs);return r&&s?new Hn(e,r,s,n==="1"):null}static hash(e){return new Ss.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(ks,this._id),this._storage.setItem(Rs,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Is,this._linked?"1":"0")}}Ct.Session=Hn;var Mr={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.Cipher=void 0;const ir=y;class Wa{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,ir.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},s,i.encode(e)),a=16,l=o.slice(o.byteLength-a),c=o.slice(0,o.byteLength-a),u=new Uint8Array(l),d=new Uint8Array(c),h=new Uint8Array([...n,...u,...d]);return(0,ir.uint8ArrayToHex)(h)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,ir.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=(0,ir.hexStringToUint8Array)(e),a=o.slice(0,12),l=o.slice(12,28),c=o.slice(28),u=new Uint8Array([...c,...l]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const h=await window.crypto.subtle.decrypt(d,i,u),f=new TextDecoder;n(f.decode(h))}catch(h){s(h)}})()})}}Lr.Cipher=Wa;var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.WalletLinkHTTP=void 0;class za{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const s=`${r}:${n}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:s}=await r.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${r.status}`)}}Tr.WalletLinkHTTP=za;var mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.WalletLinkWebSocket=mt.ConnectionState=void 0;var ut;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(ut||(mt.ConnectionState=ut={}));class Ja{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){r(i);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,ut.CONNECTING),s.onclose=i=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${i.code}: ${i.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,ut.DISCONNECTED)},s.onopen=i=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,ut.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(l=>this.sendData(l)),this.pendingData=[])},s.onmessage=i=>{var o,a;if(i.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const l=JSON.parse(i.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,l)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,ut.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}mt.WalletLinkWebSocket=Ja;Object.defineProperty(Mr,"__esModule",{value:!0});Mr.WalletLinkConnection=void 0;const st=G,qa=Lr,ke=St,As=we,it=Ct,Ga=Tr,or=mt,Ns=1e4,Za=6e4;class Qa{constructor({session:e,linkAPIUrl:r,listener:n,diagnostic:s,WebSocketClass:i=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,st.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,u)=>{const d=a[u];d!==void 0&&c(d)})},this.handleDestroyed=a=>{var l,c;a==="1"&&((l=this.listener)===null||l===void 0||l.resetAndReload(),(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:it.Session.hash(this.session.id)}))},this.handleAccountUpdated=async a=>{var l,c;try{const u=await this.cipher.decrypt(a);(l=this.listener)===null||l===void 0||l.accountUpdated(u)}catch{(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,d)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:a})}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(As.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(As.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(a),h=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.chainUpdated(d,h)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new qa.Cipher(e.secret),this.diagnostic=s,this.listener=n;const o=new or.WalletLinkWebSocket(`${r}/rpc`,i);o.setConnectionStateListener(async a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ke.EVENTS.CONNECTED_STATE_CHANGE,{state:a,sessionIdHash:it.Session.hash(e.id)});let c=!1;switch(a){case or.ConnectionState.DISCONNECTED:if(!this.destroyed){const u=async()=>{await new Promise(d=>setTimeout(d,5e3)),this.destroyed||o.connect().catch(()=>{u()})};u()}break;case or.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),c=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Ns),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case or.ConnectionState.CONNECTING:break}this.connected!==c&&(this.connected=c)}),o.setIncomingDataListener(a=>{var l,c,u;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const d=a.type==="IsLinkedOK"?a.linked:void 0;(l=this.diagnostic)===null||l===void 0||l.log(ke.EVENTS.LINKED,{sessionIdHash:it.Session.hash(e.id),linked:d,type:a.type,onlineGuests:a.onlineGuests}),this.linked=d||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:it.Session.hash(e.id),metadata_keys:a&&a.metadata?Object.keys(a.metadata):void 0}),this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((u=this.requestResolutions.get(a.id))===null||u===void 0||u(a))}),this.ws=o,this.http=new Ga.WalletLinkHTTP(r,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");(e=this.diagnostic)===null||e===void 0||e.log(ke.EVENTS.STARTED_CONNECTING,{sessionIdHash:it.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),(e=this.diagnostic)===null||e===void 0||e.log(ke.EVENTS.DISCONNECTED,{sessionIdHash:it.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var r,n;this._connected=e,e&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(e)}setOnceConnected(e){return new Promise(r=>{this.connected?e().then(r):this.onceConnected=()=>{e().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r,n;if(!(e.type!=="Event"||e.event!=="Web3Response"))try{const s=await this.cipher.decrypt(e.data),i=JSON.parse(s);if(i.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(i)}catch{(n=this.diagnostic)===null||n===void 0||n.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(e,r){const n={type:"SetSessionConfig",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:r}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(n);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,r,n=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(i);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Ns*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r=Za){const n=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,o)=>{s=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r)}),new Promise(i=>{this.requestResolutions.set(n,o=>{clearTimeout(s),i(o),this.requestResolutions.delete(n)})})])}async authenticate(){const e={type:"HostSession",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(e);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Mr.WalletLinkConnection=Qa;var Wt={},zt={},Un={};Object.defineProperty(Un,"__esModule",{value:!0});Un.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var Ka=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zt,"__esModule",{value:!0});zt.injectCssReset=void 0;const Xa=Ka(Un);function Ya(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Xa.default)),document.documentElement.appendChild(t)}zt.injectCssReset=Ya;var Pr={},$r={},bt={},Or={};Object.defineProperty(Or,"__esModule",{value:!0});Or.CloseIcon=void 0;const Ms=ae;function ec(t){return(0,Ms.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ms.h)("path",{d:"M13.7677 13L12.3535 14.4142L18.3535 20.4142L12.3535 26.4142L13.7677 27.8284L19.7677 21.8284L25.7677 27.8284L27.1819 26.4142L21.1819 20.4142L27.1819 14.4142L25.7677 13L19.7677 19L13.7677 13Z"}))}Or.CloseIcon=ec;var xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.CoinbaseWalletRound=void 0;const ar=ae;function tc(t){return(0,ar.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,ar.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,ar.h)("path",{d:"M23.8521 14.0003C23.8521 19.455 19.455 23.8521 14.0003 23.8521C8.54559 23.8521 4.14844 19.455 4.14844 14.0003C4.14844 8.54559 8.54559 4.14844 14.0003 4.14844C19.455 4.14844 23.8521 8.54559 23.8521 14.0003Z",fill:"white"}),(0,ar.h)("path",{d:"M11.1855 12.5042C11.1855 12.0477 11.1855 11.7942 11.2835 11.642C11.3814 11.4899 11.4793 11.3377 11.6261 11.287C11.8219 11.1855 12.0178 11.1855 12.5073 11.1855H15.4934C15.983 11.1855 16.1788 11.1855 16.3746 11.287C16.5215 11.3884 16.6683 11.4899 16.7173 11.642C16.8152 11.8449 16.8152 12.0477 16.8152 12.5042V15.4965C16.8152 15.953 16.8152 16.2066 16.7173 16.3587C16.6194 16.5109 16.5215 16.663 16.3746 16.7137C16.1788 16.8152 15.983 16.8152 15.4934 16.8152H12.5073C12.0178 16.8152 11.8219 16.8152 11.6261 16.7137C11.4793 16.6123 11.3324 16.5109 11.2835 16.3587C11.1855 16.1558 11.1855 15.953 11.1855 15.4965V12.5042Z",fill:"#0052FF"}))}xr.CoinbaseWalletRound=tc;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.QRCodeIcon=void 0;const Nt=ae;function rc(t){return(0,Nt.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t),(0,Nt.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,Nt.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,Nt.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,Nt.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))}Br.QRCodeIcon=rc;var Fr={};function Ji(t){this.mode=he.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e65536?(n[0]=240|(s&1835008)>>>18,n[1]=128|(s&258048)>>>12,n[2]=128|(s&4032)>>>6,n[3]=128|s&63):s>2048?(n[0]=224|(s&61440)>>>12,n[1]=128|(s&4032)>>>6,n[2]=128|s&63):s>128?(n[0]=192|(s&1984)>>>6,n[1]=128|s&63):n[0]=s,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}Ji.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Le.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=U.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e},createMovieClip:function(t,e,r){var n=t.createEmptyMovieClip(e,r),s=1;this.make();for(var i=0;i>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=U.getBCHTypeInfo(r),s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<6?this.modules[s][8]=i:s<8?this.modules[s+1][8]=i:this.modules[this.moduleCount-15+s][8]=i}for(var s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=i:s<9?this.modules[8][15-s-1+1]=i:this.modules[8][15-s-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,n=this.moduleCount-1,s=7,i=0,o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(var a=0;a<2;a++)if(this.modules[n][o-a]==null){var l=!1;i>>s&1)==1);var c=U.getMask(e,n,o-a);c&&(l=!l),this.modules[n][o-a]=l,s--,s==-1&&(i++,s=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};Le.PAD0=236;Le.PAD1=17;Le.createData=function(t,e,r){for(var n=Me.getRSBlocks(t,e),s=new qi,i=0;ia*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(Le.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Le.PAD1,8);return Le.createBytes(s,n)};Le.createBytes=function(t,e){for(var r=0,n=0,s=0,i=new Array(e.length),o=new Array(e.length),a=0;a=0?f.get(g):0}}for(var E=0,u=0;u=0;)e^=U.G15<=0;)e^=U.G18<>>=1;return e},getPatternPosition:function(t){return U.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case Be.PATTERN000:return(e+r)%2==0;case Be.PATTERN001:return e%2==0;case Be.PATTERN010:return r%3==0;case Be.PATTERN011:return(e+r)%3==0;case Be.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case Be.PATTERN101:return e*r%2+e*r%3==0;case Be.PATTERN110:return(e*r%2+e*r%3)%2==0;case Be.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new dt([1],0),r=0;r5&&(r+=3+i-5)}for(var n=0;n=256;)t-=255;return X.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var ee=0;ee<8;ee++)X.EXP_TABLE[ee]=1<>>7-t%8&1)==1},put:function(t,e){for(var r=0;r>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var fn=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Gi(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof t=="string"&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(l){switch(l){case"L":return De.L;case"M":return De.M;case"Q":return De.Q;case"H":return De.H;default:throw new Error("Unknwon error correction level: "+l)}}function n(l,c){for(var u=s(l),d=1,h=0,f=0,g=fn.length;f<=g;f++){var E=fn[f];if(!E)throw new Error("Content too long: expected "+h+" but got "+u);switch(c){case"L":h=E[0];break;case"M":h=E[1];break;case"Q":h=E[2];break;case"H":h=E[3];break;default:throw new Error("Unknwon error correction level: "+c)}if(u<=h)break;d++}if(d>fn.length)throw new Error("Content too long");return d}function s(l){var c=encodeURI(l).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return c.length+(c.length!=l?3:0)}var i=this.options.content,o=n(i,this.options.ecl),a=r(this.options.ecl);this.qrcode=new Le(o,a),this.qrcode.addData(i),this.qrcode.make()}Gi.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;typeof t>"u"&&(t={container:e.container||"svg"});for(var n=typeof e.pretty<"u"?!!e.pretty:!0,s=n?" ":"",i=n?`\r +import{aN as I,aP as _r,aQ as Ti,aR as la,aS as jn,aO as ua}from"./index-BSVOad49.js";import{s as da,a as ae,b as vr,r as Bt,j as ha,c as fa}from"./hooks.module-Cnm_IKFt.js";var Pi={},$t={},Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.walletLogo=void 0;const ga=(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 `}};Sr.walletLogo=ga;var Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.LINK_API_URL=void 0;Cr.LINK_API_URL="https://www.walletlink.org";var y={},Ft={},xe={};Object.defineProperty(xe,"__esModule",{value:!0});xe.errorValues=xe.standardErrorCodes=void 0;xe.standardErrorCodes={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,unsupportedChain:4902}};xe.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."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var kr={},Rr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.getErrorCode=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=xe,r="Unspecified error message.";t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(h,f=r){if(h&&Number.isInteger(h)){const g=h.toString();if(u(e.errorValues,g))return e.errorValues[g].message;if(l(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return f}t.getMessageFromCode=n;function s(h){if(!Number.isInteger(h))return!1;const f=h.toString();return!!(e.errorValues[f]||l(h))}t.isValidCode=s;function i(h){var f;if(typeof h=="number")return h;if(o(h))return(f=h.code)!==null&&f!==void 0?f:h.errorCode}t.getErrorCode=i;function o(h){return typeof h=="object"&&h!==null&&(typeof h.code=="number"||typeof h.errorCode=="number")}function a(h,{shouldIncludeStack:f=!1}={}){const g={};if(h&&typeof h=="object"&&!Array.isArray(h)&&u(h,"code")&&s(h.code)){const E=h;g.code=E.code,E.message&&typeof E.message=="string"?(g.message=E.message,u(E,"data")&&(g.data=E.data)):(g.message=n(g.code),g.data={originalError:c(h)})}else g.code=e.standardErrorCodes.rpc.internal,g.message=d(h,"message")?h.message:r,g.data={originalError:c(h)};return f&&(g.stack=d(h,"stack")?h.stack:void 0),g}t.serialize=a;function l(h){return h>=-32099&&h<=-32e3}function c(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function u(h,f){return Object.prototype.hasOwnProperty.call(h,f)}function d(h,f){return typeof h=="object"&&h!==null&&f in h&&typeof h[f]=="string"}})(Rr);Object.defineProperty(kr,"__esModule",{value:!0});kr.standardErrors=void 0;const Y=xe,$i=Rr;kr.standardErrors={rpc:{parse:t=>pe(Y.standardErrorCodes.rpc.parse,t),invalidRequest:t=>pe(Y.standardErrorCodes.rpc.invalidRequest,t),invalidParams:t=>pe(Y.standardErrorCodes.rpc.invalidParams,t),methodNotFound:t=>pe(Y.standardErrorCodes.rpc.methodNotFound,t),internal:t=>pe(Y.standardErrorCodes.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 pe(e,t)},invalidInput:t=>pe(Y.standardErrorCodes.rpc.invalidInput,t),resourceNotFound:t=>pe(Y.standardErrorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>pe(Y.standardErrorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>pe(Y.standardErrorCodes.rpc.transactionRejected,t),methodNotSupported:t=>pe(Y.standardErrorCodes.rpc.methodNotSupported,t),limitExceeded:t=>pe(Y.standardErrorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>nt(Y.standardErrorCodes.provider.userRejectedRequest,t),unauthorized:t=>nt(Y.standardErrorCodes.provider.unauthorized,t),unsupportedMethod:t=>nt(Y.standardErrorCodes.provider.unsupportedMethod,t),disconnected:t=>nt(Y.standardErrorCodes.provider.disconnected,t),chainDisconnected:t=>nt(Y.standardErrorCodes.provider.chainDisconnected,t),unsupportedChain:t=>nt(Y.standardErrorCodes.provider.unsupportedChain,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 Bi(e,r,n)}}};function pe(t,e){const[r,n]=Oi(e);return new xi(t,r||(0,$i.getMessageFromCode)(t),n)}function nt(t,e){const[r,n]=Oi(e);return new Bi(t,r||(0,$i.getMessageFromCode)(t),n)}function Oi(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[]}let xi=class extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}},Bi=class extends xi{constructor(e,r,n){if(!pa(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}};function pa(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}var Ir={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});_t.isErrorResponse=void 0;function ma(t){return t.errorMessage!==void 0}_t.isErrorResponse=ma;var vt={};Object.defineProperty(vt,"__esModule",{value:!0});vt.LIB_VERSION=void 0;vt.LIB_VERSION="3.9.3";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.serializeError=void 0;const ba=_t,wa=vt,ya=xe,Ea=Rr;function _a(t,e){const r=(0,Ea.serialize)(va(t),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",wa.LIB_VERSION),n.searchParams.set("code",r.code.toString());const s=Sa(r.data,e);return s&&n.searchParams.set("method",s),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}Ir.serializeError=_a;function va(t){return typeof t=="string"?{message:t,code:ya.standardErrorCodes.rpc.internal}:(0,ba.isErrorResponse)(t)?Object.assign(Object.assign({},t),{message:t.errorMessage,code:t.errorCode,data:{method:t.method}}):t}function Sa(t,e){const r=t==null?void 0:t.method;if(r)return r;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.standardErrors=t.standardErrorCodes=t.serializeError=t.getMessageFromCode=t.getErrorCode=void 0;const e=xe;Object.defineProperty(t,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});const r=kr;Object.defineProperty(t,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=Ir;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const s=Rr;Object.defineProperty(t,"getErrorCode",{enumerable:!0,get:function(){return s.getErrorCode}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return s.getMessageFromCode}})})(Ft);var G={};Object.defineProperty(G,"__esModule",{value:!0});G.ProviderType=G.RegExpString=G.IntNumber=G.BigIntString=G.AddressString=G.HexString=G.OpaqueType=void 0;function jt(){return t=>t}G.OpaqueType=jt;G.HexString=jt();G.AddressString=jt();G.BigIntString=jt();function Ca(t){return Math.floor(t)}G.IntNumber=Ca;G.RegExpString=jt();var _s;(function(t){t.CoinbaseWallet="CoinbaseWallet",t.MetaMask="MetaMask",t.Unselected=""})(_s||(G.ProviderType=_s={}));var ka=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(y,"__esModule",{value:!0});y.isMobileWeb=y.getLocation=y.isInIFrame=y.createQrUrl=y.getFavicon=y.range=y.isBigNumber=y.ensureParsedJSONObject=y.ensureBN=y.ensureRegExpString=y.ensureIntNumber=y.ensureBuffer=y.ensureAddressString=y.ensureEvenLengthHexString=y.ensureHexString=y.isHexString=y.prepend0x=y.strip0x=y.has0xPrefix=y.hexStringFromIntNumber=y.intNumberFromHexString=y.bigIntStringFromBN=y.hexStringFromBuffer=y.hexStringToUint8Array=y.uint8ArrayToHex=y.randomBytesHex=void 0;const je=ka(_r),et=Ft,ye=G,Fi=/^[0-9]*$/,ji=/^[a-f0-9]*$/;function Ra(t){return Di(crypto.getRandomValues(new Uint8Array(t)))}y.randomBytesHex=Ra;function Di(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}y.uint8ArrayToHex=Di;function Ia(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}y.hexStringToUint8Array=Ia;function Aa(t,e=!1){const r=t.toString("hex");return(0,ye.HexString)(e?`0x${r}`:r)}y.hexStringFromBuffer=Aa;function Na(t){return(0,ye.BigIntString)(t.toString(10))}y.bigIntStringFromBN=Na;function Ma(t){return(0,ye.IntNumber)(new je.default(Ht(t,!1),16).toNumber())}y.intNumberFromHexString=Ma;function La(t){return(0,ye.HexString)(`0x${new je.default(t).toString(16)}`)}y.hexStringFromIntNumber=La;function Dn(t){return t.startsWith("0x")||t.startsWith("0X")}y.has0xPrefix=Dn;function Ar(t){return Dn(t)?t.slice(2):t}y.strip0x=Ar;function Hi(t){return Dn(t)?`0x${t.slice(2)}`:`0x${t}`}y.prepend0x=Hi;function Dt(t){if(typeof t!="string")return!1;const e=Ar(t).toLowerCase();return ji.test(e)}y.isHexString=Dt;function Ui(t,e=!1){if(typeof t=="string"){const r=Ar(t).toLowerCase();if(ji.test(r))return(0,ye.HexString)(e?`0x${r}`:r)}throw et.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}y.ensureHexString=Ui;function Ht(t,e=!1){let r=Ui(t,!1);return r.length%2===1&&(r=(0,ye.HexString)(`0${r}`)),e?(0,ye.HexString)(`0x${r}`):r}y.ensureEvenLengthHexString=Ht;function Ta(t){if(typeof t=="string"){const e=Ar(t).toLowerCase();if(Dt(e)&&e.length===40)return(0,ye.AddressString)(Hi(e))}throw et.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}y.ensureAddressString=Ta;function Pa(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(Dt(t)){const e=Ht(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw et.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}y.ensureBuffer=Pa;function Vi(t){if(typeof t=="number"&&Number.isInteger(t))return(0,ye.IntNumber)(t);if(typeof t=="string"){if(Fi.test(t))return(0,ye.IntNumber)(Number(t));if(Dt(t))return(0,ye.IntNumber)(new je.default(Ht(t,!1),16).toNumber())}throw et.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}y.ensureIntNumber=Vi;function $a(t){if(t instanceof RegExp)return(0,ye.RegExpString)(t.toString());throw et.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}y.ensureRegExpString=$a;function Oa(t){if(t!==null&&(je.default.isBN(t)||Wi(t)))return new je.default(t.toString(10),10);if(typeof t=="number")return new je.default(Vi(t));if(typeof t=="string"){if(Fi.test(t))return new je.default(t,10);if(Dt(t))return new je.default(Ht(t,!1),16)}throw et.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}y.ensureBN=Oa;function xa(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw et.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}y.ensureParsedJSONObject=xa;function Wi(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}y.isBigNumber=Wi;function Ba(t,e){return Array.from({length:e-t},(r,n)=>t+n)}y.range=Ba;function Fa(){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:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}y.getFavicon=Fa;function ja(t,e,r,n,s,i){const o=n?"parent-id":"id",a=new URLSearchParams({[o]:t,secret:e,server:r,v:s,chainId:i.toString()}).toString();return`${r}/#/link?${a}`}y.createQrUrl=ja;function zi(){try{return window.frameElement!==null}catch{return!1}}y.isInIFrame=zi;function Da(){try{return zi()&&window.top?window.top.location:window.location}catch{return window.location}}y.getLocation=Da;function Ha(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}y.isMobileWeb=Ha;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ScopedLocalStorage=void 0;class Ua{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}`}}Nr.ScopedLocalStorage=Ua;var pt={},Ut={},Vt={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.EVENTS=void 0;St.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var we={};Object.defineProperty(we,"__esModule",{value:!0});we.RelayAbstract=we.APP_VERSION_KEY=we.LOCAL_STORAGE_ADDRESSES_KEY=we.WALLET_USER_NAME_KEY=void 0;const vs=Ft;we.WALLET_USER_NAME_KEY="walletUsername";we.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";we.APP_VERSION_KEY="AppVersion";class Va{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 vs.standardErrors.rpc.parse({});const s=n,{error:i}=s;if(i)throw(0,vs.serializeError)(i,e.method);return s})}}we.RelayAbstract=Va;var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.Session=void 0;const Ss=da,Cs=y,ks="session:id",Rs="session:secret",Is="session:linked";class Hn{constructor(e,r,n,s){this._storage=e,this._id=r||(0,Cs.randomBytesHex)(16),this._secret=n||(0,Cs.randomBytesHex)(32),this._key=new Ss.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const r=e.getItem(ks),n=e.getItem(Is),s=e.getItem(Rs);return r&&s?new Hn(e,r,s,n==="1"):null}static hash(e){return new Ss.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(ks,this._id),this._storage.setItem(Rs,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Is,this._linked?"1":"0")}}Ct.Session=Hn;var Mr={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.Cipher=void 0;const ir=y;class Wa{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,ir.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},s,i.encode(e)),a=16,l=o.slice(o.byteLength-a),c=o.slice(0,o.byteLength-a),u=new Uint8Array(l),d=new Uint8Array(c),h=new Uint8Array([...n,...u,...d]);return(0,ir.uint8ArrayToHex)(h)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,ir.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=(0,ir.hexStringToUint8Array)(e),a=o.slice(0,12),l=o.slice(12,28),c=o.slice(28),u=new Uint8Array([...c,...l]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const h=await window.crypto.subtle.decrypt(d,i,u),f=new TextDecoder;n(f.decode(h))}catch(h){s(h)}})()})}}Lr.Cipher=Wa;var Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.WalletLinkHTTP=void 0;class za{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const s=`${r}:${n}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:s}=await r.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${r.status}`)}}Tr.WalletLinkHTTP=za;var mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.WalletLinkWebSocket=mt.ConnectionState=void 0;var ut;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(ut||(mt.ConnectionState=ut={}));class Ja{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){r(i);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,ut.CONNECTING),s.onclose=i=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${i.code}: ${i.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,ut.DISCONNECTED)},s.onopen=i=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,ut.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(l=>this.sendData(l)),this.pendingData=[])},s.onmessage=i=>{var o,a;if(i.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const l=JSON.parse(i.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,l)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,ut.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}mt.WalletLinkWebSocket=Ja;Object.defineProperty(Mr,"__esModule",{value:!0});Mr.WalletLinkConnection=void 0;const st=G,qa=Lr,ke=St,As=we,it=Ct,Ga=Tr,or=mt,Ns=1e4,Za=6e4;class Qa{constructor({session:e,linkAPIUrl:r,listener:n,diagnostic:s,WebSocketClass:i=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,st.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,u)=>{const d=a[u];d!==void 0&&c(d)})},this.handleDestroyed=a=>{var l,c;a==="1"&&((l=this.listener)===null||l===void 0||l.resetAndReload(),(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:it.Session.hash(this.session.id)}))},this.handleAccountUpdated=async a=>{var l,c;try{const u=await this.cipher.decrypt(a);(l=this.listener)===null||l===void 0||l.accountUpdated(u)}catch{(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,d)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:a})}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(As.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(As.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(a),h=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.chainUpdated(d,h)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new qa.Cipher(e.secret),this.diagnostic=s,this.listener=n;const o=new or.WalletLinkWebSocket(`${r}/rpc`,i);o.setConnectionStateListener(async a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ke.EVENTS.CONNECTED_STATE_CHANGE,{state:a,sessionIdHash:it.Session.hash(e.id)});let c=!1;switch(a){case or.ConnectionState.DISCONNECTED:if(!this.destroyed){const u=async()=>{await new Promise(d=>setTimeout(d,5e3)),this.destroyed||o.connect().catch(()=>{u()})};u()}break;case or.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),c=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Ns),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case or.ConnectionState.CONNECTING:break}this.connected!==c&&(this.connected=c)}),o.setIncomingDataListener(a=>{var l,c,u;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const d=a.type==="IsLinkedOK"?a.linked:void 0;(l=this.diagnostic)===null||l===void 0||l.log(ke.EVENTS.LINKED,{sessionIdHash:it.Session.hash(e.id),linked:d,type:a.type,onlineGuests:a.onlineGuests}),this.linked=d||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(c=this.diagnostic)===null||c===void 0||c.log(ke.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:it.Session.hash(e.id),metadata_keys:a&&a.metadata?Object.keys(a.metadata):void 0}),this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((u=this.requestResolutions.get(a.id))===null||u===void 0||u(a))}),this.ws=o,this.http=new Ga.WalletLinkHTTP(r,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");(e=this.diagnostic)===null||e===void 0||e.log(ke.EVENTS.STARTED_CONNECTING,{sessionIdHash:it.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),(e=this.diagnostic)===null||e===void 0||e.log(ke.EVENTS.DISCONNECTED,{sessionIdHash:it.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var r,n;this._connected=e,e&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(e)}setOnceConnected(e){return new Promise(r=>{this.connected?e().then(r):this.onceConnected=()=>{e().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r,n;if(!(e.type!=="Event"||e.event!=="Web3Response"))try{const s=await this.cipher.decrypt(e.data),i=JSON.parse(s);if(i.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(i)}catch{(n=this.diagnostic)===null||n===void 0||n.log(ke.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(e,r){const n={type:"SetSessionConfig",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:r}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(n);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,r,n=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(i);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Ns*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r=Za){const n=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,o)=>{s=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r)}),new Promise(i=>{this.requestResolutions.set(n,o=>{clearTimeout(s),i(o),this.requestResolutions.delete(n)})})])}async authenticate(){const e={type:"HostSession",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(e);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,st.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Mr.WalletLinkConnection=Qa;var Wt={},zt={},Un={};Object.defineProperty(Un,"__esModule",{value:!0});Un.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var Ka=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zt,"__esModule",{value:!0});zt.injectCssReset=void 0;const Xa=Ka(Un);function Ya(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Xa.default)),document.documentElement.appendChild(t)}zt.injectCssReset=Ya;var Pr={},$r={},bt={},Or={};Object.defineProperty(Or,"__esModule",{value:!0});Or.CloseIcon=void 0;const Ms=ae;function ec(t){return(0,Ms.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ms.h)("path",{d:"M13.7677 13L12.3535 14.4142L18.3535 20.4142L12.3535 26.4142L13.7677 27.8284L19.7677 21.8284L25.7677 27.8284L27.1819 26.4142L21.1819 20.4142L27.1819 14.4142L25.7677 13L19.7677 19L13.7677 13Z"}))}Or.CloseIcon=ec;var xr={};Object.defineProperty(xr,"__esModule",{value:!0});xr.CoinbaseWalletRound=void 0;const ar=ae;function tc(t){return(0,ar.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,ar.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,ar.h)("path",{d:"M23.8521 14.0003C23.8521 19.455 19.455 23.8521 14.0003 23.8521C8.54559 23.8521 4.14844 19.455 4.14844 14.0003C4.14844 8.54559 8.54559 4.14844 14.0003 4.14844C19.455 4.14844 23.8521 8.54559 23.8521 14.0003Z",fill:"white"}),(0,ar.h)("path",{d:"M11.1855 12.5042C11.1855 12.0477 11.1855 11.7942 11.2835 11.642C11.3814 11.4899 11.4793 11.3377 11.6261 11.287C11.8219 11.1855 12.0178 11.1855 12.5073 11.1855H15.4934C15.983 11.1855 16.1788 11.1855 16.3746 11.287C16.5215 11.3884 16.6683 11.4899 16.7173 11.642C16.8152 11.8449 16.8152 12.0477 16.8152 12.5042V15.4965C16.8152 15.953 16.8152 16.2066 16.7173 16.3587C16.6194 16.5109 16.5215 16.663 16.3746 16.7137C16.1788 16.8152 15.983 16.8152 15.4934 16.8152H12.5073C12.0178 16.8152 11.8219 16.8152 11.6261 16.7137C11.4793 16.6123 11.3324 16.5109 11.2835 16.3587C11.1855 16.1558 11.1855 15.953 11.1855 15.4965V12.5042Z",fill:"#0052FF"}))}xr.CoinbaseWalletRound=tc;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.QRCodeIcon=void 0;const Nt=ae;function rc(t){return(0,Nt.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t),(0,Nt.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,Nt.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,Nt.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,Nt.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))}Br.QRCodeIcon=rc;var Fr={};function Ji(t){this.mode=he.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e65536?(n[0]=240|(s&1835008)>>>18,n[1]=128|(s&258048)>>>12,n[2]=128|(s&4032)>>>6,n[3]=128|s&63):s>2048?(n[0]=224|(s&61440)>>>12,n[1]=128|(s&4032)>>>6,n[2]=128|s&63):s>128?(n[0]=192|(s&1984)>>>6,n[1]=128|s&63):n[0]=s,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}Ji.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Le.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=U.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e},createMovieClip:function(t,e,r){var n=t.createEmptyMovieClip(e,r),s=1;this.make();for(var i=0;i>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=U.getBCHTypeInfo(r),s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<6?this.modules[s][8]=i:s<8?this.modules[s+1][8]=i:this.modules[this.moduleCount-15+s][8]=i}for(var s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=i:s<9?this.modules[8][15-s-1+1]=i:this.modules[8][15-s-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,n=this.moduleCount-1,s=7,i=0,o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(var a=0;a<2;a++)if(this.modules[n][o-a]==null){var l=!1;i>>s&1)==1);var c=U.getMask(e,n,o-a);c&&(l=!l),this.modules[n][o-a]=l,s--,s==-1&&(i++,s=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};Le.PAD0=236;Le.PAD1=17;Le.createData=function(t,e,r){for(var n=Me.getRSBlocks(t,e),s=new qi,i=0;ia*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put(Le.PAD0,8),s.getLengthInBits()>=a*8));)s.put(Le.PAD1,8);return Le.createBytes(s,n)};Le.createBytes=function(t,e){for(var r=0,n=0,s=0,i=new Array(e.length),o=new Array(e.length),a=0;a=0?f.get(g):0}}for(var E=0,u=0;u=0;)e^=U.G15<=0;)e^=U.G18<>>=1;return e},getPatternPosition:function(t){return U.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case Be.PATTERN000:return(e+r)%2==0;case Be.PATTERN001:return e%2==0;case Be.PATTERN010:return r%3==0;case Be.PATTERN011:return(e+r)%3==0;case Be.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case Be.PATTERN101:return e*r%2+e*r%3==0;case Be.PATTERN110:return(e*r%2+e*r%3)%2==0;case Be.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new dt([1],0),r=0;r5&&(r+=3+i-5)}for(var n=0;n=256;)t-=255;return X.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var ee=0;ee<8;ee++)X.EXP_TABLE[ee]=1<>>7-t%8&1)==1},put:function(t,e){for(var r=0;r>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var fn=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Gi(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof t=="string"&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(l){switch(l){case"L":return De.L;case"M":return De.M;case"Q":return De.Q;case"H":return De.H;default:throw new Error("Unknwon error correction level: "+l)}}function n(l,c){for(var u=s(l),d=1,h=0,f=0,g=fn.length;f<=g;f++){var E=fn[f];if(!E)throw new Error("Content too long: expected "+h+" but got "+u);switch(c){case"L":h=E[0];break;case"M":h=E[1];break;case"Q":h=E[2];break;case"H":h=E[3];break;default:throw new Error("Unknwon error correction level: "+c)}if(u<=h)break;d++}if(d>fn.length)throw new Error("Content too long");return d}function s(l){var c=encodeURI(l).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return c.length+(c.length!=l?3:0)}var i=this.options.content,o=n(i,this.options.ecl),a=r(this.options.ecl);this.qrcode=new Le(o,a),this.qrcode.addData(i),this.qrcode.make()}Gi.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;typeof t>"u"&&(t={container:e.container||"svg"});for(var n=typeof e.pretty<"u"?!!e.pretty:!0,s=n?" ":"",i=n?`\r `:"",o=e.width,a=e.height,l=r.length,c=o/(l+2*e.padding),u=a/(l+2*e.padding),d=typeof e.join<"u"?!!e.join:!1,h=typeof e.swap<"u"?!!e.swap:!1,f=typeof e.xmlDeclaration<"u"?!!e.xmlDeclaration:!0,g=typeof e.predefined<"u"?!!e.predefined:!1,E=g?s+''+i:"",_=s+''+i,k="",v="",p=0;p'+i:k+=s+''+i}}d&&(k=s+'');let ge="";if(this.options.image!==void 0&&this.options.image.svg){const sr=o*this.options.image.width/100,b=a*this.options.image.height/100,m=o/2-sr/2,R=a/2-b/2;ge+=``,ge+=this.options.image.svg+i,ge+=""}var K="";switch(t.container){case"svg":f&&(K+=''+i),K+=''+i,K+=E+_+k,K+=ge,K+="";break;case"svg-viewbox":f&&(K+=''+i),K+=''+i,K+=E+_+k,K+=ge,K+="";break;case"g":K+=''+i,K+=E+_+k,K+=ge,K+="";break;default:K+=(E+_+k+ge).replace(/^\s+/,"");break}return K};var nc=Gi,sc=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.QRCode=void 0;const ic=ae,Ls=vr,oc=sc(nc),ac=t=>{const[e,r]=(0,Ls.useState)("");return(0,Ls.useEffect)(()=>{var n,s;const i=new oc.default({content:t.content,background:t.bgColor||"#ffffff",color:t.fgColor||"#000000",container:"svg",ecl:"M",width:(n=t.width)!==null&&n!==void 0?n:256,height:(s=t.height)!==null&&s!==void 0?s:256,padding:0,image:t.image}),o=Buffer.from(i.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${o}`)},[t.bgColor,t.content,t.fgColor,t.height,t.image,t.width]),e?(0,ic.h)("img",{src:e,alt:"QR Code"}):null};Fr.QRCode=ac;var jr={},Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.default=".-cbwsdk-css-reset .-cbwsdk-spinner{display:inline-block}.-cbwsdk-css-reset .-cbwsdk-spinner svg{display:inline-block;animation:2s linear infinite -cbwsdk-spinner-svg}.-cbwsdk-css-reset .-cbwsdk-spinner svg circle{animation:1.9s ease-in-out infinite both -cbwsdk-spinner-circle;display:block;fill:rgba(0,0,0,0);stroke-dasharray:283;stroke-dashoffset:280;stroke-linecap:round;stroke-width:10px;transform-origin:50% 50%}@keyframes -cbwsdk-spinner-svg{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}@keyframes -cbwsdk-spinner-circle{0%,25%{stroke-dashoffset:280;transform:rotate(0)}50%,75%{stroke-dashoffset:75;transform:rotate(45deg)}100%{stroke-dashoffset:280;transform:rotate(360deg)}}";var cc=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(jr,"__esModule",{value:!0});jr.Spinner=void 0;const cr=ae,lc=cc(Vn),uc=t=>{var e;const r=(e=t.size)!==null&&e!==void 0?e:64,n=t.color||"#000";return(0,cr.h)("div",{class:"-cbwsdk-spinner"},(0,cr.h)("style",null,lc.default),(0,cr.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,cr.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};jr.Spinner=uc;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.default=".-cbwsdk-css-reset .-cbwsdk-connect-content{height:430px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-connect-content.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 30px}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading{font-style:normal;font-weight:500;font-size:28px;line-height:36px;margin:0}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-layout{display:flex;flex-direction:row}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-left{margin-right:30px;display:flex;flex-direction:column;justify-content:space-between}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-right{flex:25%;margin-right:34px}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-wrapper{width:220px;height:220px;border-radius:12px;display:flex;justify-content:center;align-items:center;background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light{background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light>p{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark{background-color:rgba(10,11,13,.9)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark>p{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting>p{font-size:12px;font-weight:bold;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app{border-radius:8px;font-size:14px;line-height:20px;padding:12px;width:339px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.light{background:#eef0f3;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.dark{background:#1e2025;color:#8a919e}.-cbwsdk-css-reset .-cbwsdk-cancel-button{-webkit-appearance:none;border:none;background:none;cursor:pointer;padding:0;margin:0}.-cbwsdk-css-reset .-cbwsdk-cancel-button-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-wallet-steps{padding:0 0 0 16px;margin:0;width:100%;list-style:decimal}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item{list-style-type:decimal;display:list-item;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin-top:20px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item-wrapper{display:flex;align-items:center}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-pad-left{margin-left:6px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon{display:flex;border-radius:50%;height:24px;width:24px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.light{background:#0052ff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.dark{background:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item{align-items:center;display:flex;flex-direction:row;padding:16px 24px;gap:12px;cursor:pointer;border-radius:100px;font-weight:600}.-cbwsdk-css-reset .-cbwsdk-connect-item.light{background:#f5f8ff;color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-connect-item.dark{background:#001033;color:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item-copy-wrapper{margin:0 4px 0 8px}.-cbwsdk-css-reset .-cbwsdk-connect-item-title{margin:0 0 0;font-size:16px;line-height:24px;font-weight:500}.-cbwsdk-css-reset .-cbwsdk-connect-item-description{font-weight:400;font-size:14px;line-height:20px;margin:0}";var Zi=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bt,"__esModule",{value:!0});bt.CoinbaseWalletSteps=bt.ConnectContent=void 0;const Ke=Zi(Bt),x=ae,dc=y,hc=vt,fc=Or,gc=xr,pc=Br,mc=Fr,bc=jr,wc=Zi(Wn),gn={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Qi},yc=t=>t==="light"?"#FFFFFF":"#0A0B0D";function Ec(t){const{theme:e}=t,r=(0,dc.createQrUrl)(t.sessionId,t.sessionSecret,t.linkAPIUrl,t.isParentConnection,t.version,t.chainId),n=gn.steps;return(0,x.h)("div",{"data-testid":"connect-content",className:(0,Ke.default)("-cbwsdk-connect-content",e)},(0,x.h)("style",null,wc.default),(0,x.h)("div",{className:"-cbwsdk-connect-content-header"},(0,x.h)("h2",{className:(0,Ke.default)("-cbwsdk-connect-content-heading",e)},"Scan to connect with our mobile app"),t.onCancel&&(0,x.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:t.onCancel},(0,x.h)(fc.CloseIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,x.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,x.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,x.h)(_c,{title:gn.title,description:gn.description,theme:e})),(0,x.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,x.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,x.h)(mc.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,x.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:hc.LIB_VERSION}),(0,x.h)("input",{type:"hidden",value:r})),(0,x.h)(n,{theme:e}),!t.isConnected&&(0,x.h)("div",{"data-testid":"connecting-spinner",className:(0,Ke.default)("-cbwsdk-connect-content-qr-connecting",e)},(0,x.h)(bc.Spinner,{size:36,color:e==="dark"?"#FFF":"#000"}),(0,x.h)("p",null,"Connecting...")))))}bt.ConnectContent=Ec;function _c({title:t,description:e,theme:r}){return(0,x.h)("div",{className:(0,Ke.default)("-cbwsdk-connect-item",r)},(0,x.h)("div",null,(0,x.h)(gc.CoinbaseWalletRound,null)),(0,x.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,x.h)("h3",{className:"-cbwsdk-connect-item-title"},t),(0,x.h)("p",{className:"-cbwsdk-connect-item-description"},e)))}function Qi({theme:t}){return(0,x.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,x.h)("li",{className:(0,Ke.default)("-cbwsdk-wallet-steps-item",t)},(0,x.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,x.h)("li",{className:(0,Ke.default)("-cbwsdk-wallet-steps-item",t)},(0,x.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,x.h)("span",null,"Tap ",(0,x.h)("strong",null,"Scan")," "),(0,x.h)("span",{className:(0,Ke.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",t)},(0,x.h)(pc.QRCodeIcon,{fill:yc(t)})))))}bt.CoinbaseWalletSteps=Qi;var Dr={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.ArrowLeftIcon=void 0;const Ts=ae;function vc(t){return(0,Ts.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ts.h)("path",{d:"M8.60675 0.155884L7.37816 1.28209L12.7723 7.16662H0V8.83328H12.6548L6.82149 14.6666L8 15.8451L15.8201 8.02501L8.60675 0.155884Z"}))}Hr.ArrowLeftIcon=vc;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.LaptopIcon=void 0;const pn=ae;function Sc(t){return(0,pn.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,pn.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,pn.h)("path",{d:"M13.4001 10.2002H0.600098C0.600098 11.0838 1.31644 11.8002 2.2001 11.8002H11.8001C12.6838 11.8002 13.4001 11.0838 13.4001 10.2002Z"}))}Ur.LaptopIcon=Sc;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.SafeIcon=void 0;const Ps=ae;function Cc(t){return(0,Ps.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ps.h)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.600098 0.600098V11.8001H13.4001V0.600098H0.600098ZM7.0001 9.2001C5.3441 9.2001 4.0001 7.8561 4.0001 6.2001C4.0001 4.5441 5.3441 3.2001 7.0001 3.2001C8.6561 3.2001 10.0001 4.5441 10.0001 6.2001C10.0001 7.8561 8.6561 9.2001 7.0001 9.2001ZM0.600098 12.6001H3.8001V13.4001H0.600098V12.6001ZM10.2001 12.6001H13.4001V13.4001H10.2001V12.6001ZM8.8001 6.2001C8.8001 7.19421 7.99421 8.0001 7.0001 8.0001C6.00598 8.0001 5.2001 7.19421 5.2001 6.2001C5.2001 5.20598 6.00598 4.4001 7.0001 4.4001C7.99421 4.4001 8.8001 5.20598 8.8001 6.2001Z"}))}Vr.SafeIcon=Cc;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});zn.default=".-cbwsdk-css-reset .-cbwsdk-try-extension{display:flex;margin-top:12px;height:202px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-try-extension.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-column-half{flex:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading{font-style:normal;font-weight:500;font-size:25px;line-height:32px;margin:0;max-width:204px}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta{appearance:none;border:none;background:none;color:#0052ff;cursor:pointer;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.light{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.dark{color:#588af5}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-wrapper{display:flex;align-items:center;margin-top:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-icon{display:block;margin-left:4px;height:14px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list{display:flex;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:0;list-style:none;height:100%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item{display:flex;align-items:center;flex-flow:nowrap;margin-top:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item:first-of-type{margin-top:0}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon-wrapper{display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon{display:flex;height:32px;width:32px;border-radius:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.light{background:#eef0f3}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.dark{background:#1e2025}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy{display:block;font-weight:400;font-size:14px;line-height:20px;padding-left:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.light{color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.dark{color:#8a919e}";var Ki=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TryExtensionContent=void 0;const Ve=Ki(Bt),q=ae,mn=vr,kc=Hr,Rc=Ur,Ic=Vr,Ac=Ki(zn);function Nc({theme:t}){const[e,r]=(0,mn.useState)(!1),n=(0,mn.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),s=(0,mn.useCallback)(()=>{e?window.location.reload():(n(),r(!0))},[n,e]);return(0,q.h)("div",{class:(0,Ve.default)("-cbwsdk-try-extension",t)},(0,q.h)("style",null,Ac.default),(0,q.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,q.h)("h3",{class:(0,Ve.default)("-cbwsdk-try-extension-heading",t)},"Or try the Coinbase Wallet browser extension"),(0,q.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,q.h)("button",{class:(0,Ve.default)("-cbwsdk-try-extension-cta",t),onClick:s},e?"Refresh":"Install"),(0,q.h)("div",null,!e&&(0,q.h)(kc.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:t==="light"?"#0052FF":"#588AF5"})))),(0,q.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,q.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,q.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,q.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,q.h)("span",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,q.h)(Rc.LaptopIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,q.h)("div",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-copy",t)},"Connect with dapps with just one click on your desktop browser")),(0,q.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,q.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,q.h)("span",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,q.h)(Ic.SafeIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,q.h)("div",{class:(0,Ve.default)("-cbwsdk-try-extension-list-item-copy",t)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Dr.TryExtensionContent=Nc;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.default=".-cbwsdk-css-reset .-cbwsdk-connect-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.light{background-color:rgba(0,0,0,.5)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.dark{background-color:rgba(50,53,61,.4)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box{display:flex;position:relative;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container-hidden{display:none}";var Xi=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($r,"__esModule",{value:!0});$r.ConnectDialog=void 0;const bn=Xi(Bt),We=ae,wn=vr,Mc=bt,Lc=Dr,Tc=Xi(Jn),Pc=t=>{const{isOpen:e,darkMode:r}=t,[n,s]=(0,wn.useState)(!e),[i,o]=(0,wn.useState)(!e);(0,wn.useEffect)(()=>{const l=[window.setTimeout(()=>{o(!e)},10)];return e?s(!1):l.push(window.setTimeout(()=>{s(!0)},360)),()=>{l.forEach(window.clearTimeout)}},[e]);const a=r?"dark":"light";return(0,We.h)("div",{class:(0,bn.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,We.h)("style",null,Tc.default),(0,We.h)("div",{class:(0,bn.default)("-cbwsdk-connect-dialog-backdrop",a,i&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,We.h)("div",{class:"-cbwsdk-connect-dialog"},(0,We.h)("div",{class:(0,bn.default)("-cbwsdk-connect-dialog-box",i&&"-cbwsdk-connect-dialog-box-hidden")},t.connectDisabled?null:(0,We.h)(Mc.ConnectContent,{theme:a,version:t.version,sessionId:t.sessionId,sessionSecret:t.sessionSecret,linkAPIUrl:t.linkAPIUrl,isConnected:t.isConnected,isParentConnection:t.isParentConnection,chainId:t.chainId,onCancel:t.onCancel}),(0,We.h)(Lc.TryExtensionContent,{theme:a}))))};$r.ConnectDialog=Pc;Object.defineProperty(Pr,"__esModule",{value:!0});Pr.LinkFlow=void 0;const yn=ae,$c=$r;class Oc{constructor(e){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=e.darkMode,this.version=e.version,this.sessionId=e.sessionId,this.sessionSecret=e.sessionSecret,this.linkAPIUrl=e.linkAPIUrl,this.isParentConnection=e.isParentConnection}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",e.appendChild(this.root),this.render()}setConnected(e){this.connected!==e&&(this.connected=e,this.render())}setChainId(e){this.chainId!==e&&(this.chainId=e,this.render())}detach(){var e;this.root&&((0,yn.render)(null,this.root),(e=this.root.parentElement)===null||e===void 0||e.removeChild(this.root))}setConnectDisabled(e){this.connectDisabled=e}open(e){this.isOpen=!0,this.onCancel=e.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,yn.render)((0,yn.h)($c.ConnectDialog,{darkMode:this.darkMode,version:this.version,sessionId:this.sessionId,sessionSecret:this.sessionSecret,linkAPIUrl:this.linkAPIUrl,isOpen:this.isOpen,isConnected:this.connected,isParentConnection:this.isParentConnection,chainId:this.chainId,onCancel:this.onCancel,connectDisabled:this.connectDisabled}),this.root)}}Pr.LinkFlow=Oc;var qn={},Gn={};Object.defineProperty(Gn,"__esModule",{value:!0});Gn.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(t){var e=I&&I.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=e(Bt),n=ae,s=vr,i=e(Gn),o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class l{constructor(h){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=h.darkMode}attach(h){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",h.appendChild(this.root),this.render()}presentItem(h){const f=this.nextItemKey++;return this.items.set(f,h),this.render(),()=>{this.items.delete(f),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([h,f])=>(0,n.h)(t.SnackbarInstance,Object.assign({},f,{key:h}))))),this.root)}}t.Snackbar=l;const c=d=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,i.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},d.children));t.SnackbarContainer=c;const u=({autoExpand:d,message:h,menuItems:f})=>{const[g,E]=(0,s.useState)(!0),[_,k]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const p=[window.setTimeout(()=>{E(!1)},1),window.setTimeout(()=>{k(!0)},1e4)];return()=>{p.forEach(window.clearTimeout)}});const v=()=>{k(!_)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",g&&"-cbwsdk-snackbar-instance-hidden",_&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:v},(0,n.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},h),(0,n.h)("div",{class:"-gear-container"},!_&&(0,n.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,n.h)("img",{src:a,class:"-gear-icon",title:"Expand"}))),f&&f.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},f.map((p,F)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",p.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:p.onClick,key:F},(0,n.h)("svg",{width:p.svgWidth,height:p.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":p.defaultFillRule,"clip-rule":p.defaultClipRule,d:p.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",p.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},p.info)))))};t.SnackbarInstance=u})(qn);Object.defineProperty(Wt,"__esModule",{value:!0});Wt.WalletLinkRelayUI=void 0;const xc=zt,Bc=Pr,Fc=qn;class jc{constructor(e){this.standalone=null,this.attached=!1,this.snackbar=new Fc.Snackbar({darkMode:e.darkMode}),this.linkFlow=new Bc.LinkFlow({darkMode:e.darkMode,version:e.version,sessionId:e.session.id,sessionSecret:e.session.secret,linkAPIUrl:e.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,xc.injectCssReset)()}setConnected(e){this.linkFlow.setConnected(e)}setChainId(e){this.linkFlow.setChainId(e)}setConnectDisabled(e){this.linkFlow.setConnectDisabled(e)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(e){this.linkFlow.open({onCancel:e.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(e){this.standalone=e}isStandalone(){var e;return(e=this.standalone)!==null&&e!==void 0?e:!1}}Wt.WalletLinkRelayUI=jc;Object.defineProperty(Vt,"__esModule",{value:!0});Vt.WalletLinkRelay=void 0;const ot=Ft,Dc=G,H=y,ze=St,$s=we,Fe=Ct,Hc=Mr,Je=_t,Uc=Wt;class Oe extends $s.RelayAbstract{constructor(e){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=o=>{var a;this.isLinked=o;const l=this.storage.getItem($s.LOCAL_STORAGE_ADDRESSES_KEY);if(o&&(this.session.linked=o),this.isUnlinkedErrorState=!1,l){const c=l.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";if(c[0]!==""&&!o&&this.session.linked&&!u){this.isUnlinkedErrorState=!0;const d=this.getSessionIdHash();(a=this.diagnostic)===null||a===void 0||a.log(ze.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:d})}}},this.metadataUpdated=(o,a)=>{this.storage.setItem(o,a)},this.chainUpdated=(o,a)=>{this.chainCallbackParams.chainId===o&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:o,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(o,a))},this.accountUpdated=o=>{this.accountsCallback&&this.accountsCallback([o]),Oe.accountRequestCallbackIds.size>0&&(Array.from(Oe.accountRequestCallbackIds.values()).forEach(a=>{const l={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[o]}};this.invokeCallback(Object.assign(Object.assign({},l),{id:a}))}),Oe.accountRequestCallbackIds.clear())},this.connectedUpdated=o=>{this.ui.setConnected(o)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.options=e;const{session:n,ui:s,connection:i}=this.subscribe();this._session=n,this.connection=i,this.relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this._reloadOnDisconnect=(r=e.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=s}subscribe(){const e=Fe.Session.load(this.storage)||new Fe.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,s=new Hc.WalletLinkConnection({session:e,linkAPIUrl:r,diagnostic:n,listener:this}),{version:i,darkMode:o}=this.options,a=this.options.uiConstructor({linkAPIUrl:r,version:i,darkMode:o,session:e});return s.connect(),{session:e,ui:a,connection:s}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{var e,r;const n=this.ui.isStandalone();(e=this.diagnostic)===null||e===void 0||e.log(ze.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const s=Fe.Session.load(this.storage);if((s==null?void 0:s.id)===this._session.id?this.storage.clear():s&&((r=this.diagnostic)===null||r===void 0||r.log(ze.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Fe.Session.hash(s.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:i,ui:o,connection:a}=this.subscribe();this._session=i,this.connection=a,this.ui=o,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(e=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(ze.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${e}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(e,r){this.appName=e,this.appLogoUrl=r}getStorageItem(e){return this.storage.getItem(e)}get session(){return this._session}setStorageItem(e,r){this.storage.setItem(e,r)}signEthereumMessage(e,r,n,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,H.hexStringFromBuffer)(e,!0),address:r,addPrefix:n,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,H.hexStringFromBuffer)(e,!0),signature:(0,H.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,H.bigIntStringFromBN)(e.weiValue),data:(0,H.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,H.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,H.bigIntStringFromBN)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,H.bigIntStringFromBN)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,H.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,H.bigIntStringFromBN)(e.weiValue),data:(0,H.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,H.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,H.bigIntStringFromBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,H.bigIntStringFromBN)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,H.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,H.hexStringFromBuffer)(e,!0),chainId:r}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getQRCodeUrl(){return(0,H.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(e,r){return this.sendRequest({method:"generic",params:{action:r,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let r=null;const n=(0,H.randomBytesHex)(8),s=o=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,o),r==null||r()};return{promise:new Promise((o,a)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,l=>{if(r==null||r(),(0,Je.isErrorResponse)(l))return a(new Error(l.errorMessage));o(l)}),this.ui.isStandalone()?this.sendRequestStandalone(n,e):this.publishWeb3RequestEvent(n,e)}),cancel:s}}setConnectDisabled(e){this.ui.setConnectDisabled(e)}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e,this.ui instanceof Uc.WalletLinkRelayUI&&this.ui.setChainId(e)}publishWeb3RequestEvent(e,r){var n;const s={type:"WEB3_REQUEST",id:e,request:r},i=Fe.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(ze.EVENTS.WEB3_REQUEST,{eventId:s.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?Fe.Session.hash(i.id):"",isSessionMismatched:((i==null?void 0:i.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",s,!0).then(o=>{var a;(a=this.diagnostic)===null||a===void 0||a.log(ze.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:s.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?Fe.Session.hash(i.id):"",isSessionMismatched:((i==null?void 0:i.id)!==this._session.id).toString()})}).catch(o=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s.id,response:{method:r.method,errorMessage:o.message}})})}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e){var r;const{response:n}=e;if((r=this.diagnostic)===null||r===void 0||r.log(ze.EVENTS.WEB3_RESPONSE,{eventId:e.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){Oe.accountRequestCallbackIds.forEach(s=>this.invokeCallback(Object.assign(Object.assign({},e),{id:s}))),Oe.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,r,n,s){var i;const o=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:(0,ot.getMessageFromCode)(s);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:r,errorMessage:o,errorCode:s}})}invokeCallback(e){const r=this.relayEventManager.callbacks.get(e.id);r&&(r(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,H.randomBytesHex)(8),n=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i)};return{promise:new Promise((i,o)=>{if(this.relayEventManager.callbacks.set(r,a=>{if(this.ui.hideRequestEthereumAccounts(),(0,Je.isErrorResponse)(a))return o(new Error(a.errorMessage));i(a)}),this.ui.inlineAccountsResponse()){const a=l=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:l}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:a})}else{const a=ot.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(a)})}Oe.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,e)}),cancel:n}}selectProvider(e){const r={method:"selectProvider",params:{providerOptions:e}},n=(0,H.randomBytesHex)(8),s=o=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,o)},i=new Promise((o,a)=>{this.relayEventManager.callbacks.set(n,u=>{if((0,Je.isErrorResponse)(u))return a(new Error(u.errorMessage));o(u)});const l=u=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:Dc.ProviderType.Unselected}})},c=u=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:u}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:c,onCancel:l,providerOptions:e})});return{cancel:s,promise:i}}watchAsset(e,r,n,s,i,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:s,image:i},chainId:o}};let l=null;const c=(0,H.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,h),l==null||l()};this.ui.inlineWatchAsset()||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload}));const d=new Promise((h,f)=>{this.relayEventManager.callbacks.set(c,_=>{if(l==null||l(),(0,Je.isErrorResponse)(_))return f(new Error(_.errorMessage));h(_)});const g=_=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!1}})},E=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:E,onCancel:g,type:e,address:r,symbol:n,decimals:s,image:i,chainId:o}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(c,a)});return{cancel:u,promise:d}}addEthereumChain(e,r,n,s,i,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:s,chainName:i,iconUrls:n,nativeCurrency:o}};let l=null;const c=(0,H.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,h),l==null||l()};return this.ui.inlineAddEthereumChain(e)||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload})),{promise:new Promise((h,f)=>{this.relayEventManager.callbacks.set(c,_=>{if(l==null||l(),(0,Je.isErrorResponse)(_))return f(new Error(_.errorMessage));h(_)});const g=_=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},E=_=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:_}}})};this.ui.inlineAddEthereumChain(e)&&this.ui.addEthereumChain({onCancel:g,onApprove:E,chainId:a.params.chainId,rpcUrls:a.params.rpcUrls,blockExplorerUrls:a.params.blockExplorerUrls,chainName:a.params.chainName,iconUrls:a.params.iconUrls,nativeCurrency:a.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(e)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(c,a)}),cancel:u}}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})},s=(0,H.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a)};return{promise:new Promise((a,l)=>{this.relayEventManager.callbacks.set(s,d=>{if((0,Je.isErrorResponse)(d)&&d.errorCode)return l(ot.standardErrors.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Je.isErrorResponse)(d))return l(new Error(d.errorMessage));a(d)});const c=d=>{var h;if(d){const f=(h=(0,ot.getErrorCode)(d))!==null&&h!==void 0?h:ot.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(s,"switchEthereumChain",d instanceof Error?d:ot.standardErrors.provider.unsupportedChain(e),f)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},u=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:d}}})};this.ui.switchEthereumChain({onCancel:c,onApprove:u,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(s,n)}),cancel:i}}inlineAddEthereumChain(e){return this.ui.inlineAddEthereumChain(e)}getSessionIdHash(){return Fe.Session.hash(this._session.id)}sendRequestStandalone(e,r){const n=i=>{this.handleErrorResponse(e,r.method,i)},s=i=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:i})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:s,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:s,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:s,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:s});break;default:n();break}}}Vt.WalletLinkRelay=Oe;Oe.accountRequestCallbackIds=new Set;var Jt={},Wr={},Yi={};(function(t){var e=I&&I.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=I&&I.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(qn,t)})(Yi);var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var eo=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.RedirectDialog=void 0;const Vc=eo(Bt),Ne=ae,Wc=zt,zc=Yi,Jc=eo(Zn);class qc{constructor(){this.root=null}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Wc.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Ne.render)(null,this.root),e&&(0,Ne.render)((0,Ne.h)(Gc,Object.assign({},e,{onDismiss:()=>{this.clear()}})),this.root))}}Wr.RedirectDialog=qc;const Gc=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:s})=>{const i=r?"dark":"light";return(0,Ne.h)(zc.SnackbarContainer,{darkMode:r},(0,Ne.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Ne.h)("style",null,Jc.default),(0,Ne.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,Ne.h)("div",{class:(0,Vc.default)("-cbwsdk-redirect-dialog-box",i)},(0,Ne.h)("p",null,t),(0,Ne.h)("button",{onClick:n},e))))};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.MobileRelayUI=void 0;const Zc=Wr;class Qc{constructor(e){this.attached=!1,this.darkMode=!1,this.redirectDialog=new Zc.RedirectDialog,this.darkMode=e.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(e){}redirectToCoinbaseWallet(e){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}Jt.MobileRelayUI=Qc;Object.defineProperty(Ut,"__esModule",{value:!0});Ut.MobileRelay=void 0;const Kc=y,Xc=Vt,Yc=Jt;class el extends Xc.WalletLinkRelay{constructor(e){var r;super(e),this._enableMobileWalletLink=(r=e.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const e=(0,Kc.getLocation)();e.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(e.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(e,r){if(super.publishWeb3RequestEvent(e,r),!(this._enableMobileWalletLink&&this.ui instanceof Yc.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(e){super.handleWeb3ResponseMessage(e)}connectAndSignIn(e){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:e.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:e.statement,resources:e.resources}})}}Ut.MobileRelay=el;const tl=ha,rl=_r;function to(t){return Buffer.allocUnsafe(t).fill(0)}function ro(t,e,r){const n=to(e);return t=zr(t),r?t.length"u")throw new Error("Not an array?");if(r=ao(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);s=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(Ae(t,e[i]));if(r==="dynamic"){var o=Ae("uint256",e.length);s.unshift(o)}return Buffer.concat(s)}else{if(t==="bytes")return e=new Buffer(e),s=Buffer.concat([Ae("uint256",e.length),e]),e.length%32!==0&&(s=Buffer.concat([s,Xe.zeros(32-e.length%32)])),s;if(t.startsWith("bytes")){if(r=ht(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return Xe.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=ht(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=qe(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=ht(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=qe(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=Os(t),n=qe(e),n<0)throw new Error("Supplied ufixed is negative");return Ae("uint256",n.mul(new Ze(2).pow(new Ze(r[1]))))}else if(t.startsWith("fixed"))return r=Os(t),Ae("int256",qe(e).mul(new Ze(2).pow(new Ze(r[1]))))}throw new Error("Unsupported or invalid type: "+t)}function al(t){return t==="string"||t==="bytes"||ao(t)==="dynamic"}function cl(t){return t.lastIndexOf("]")===t.length-1}function ll(t,e){var r=[],n=[],s=32*t.length;for(var i in t){var o=oo(t[i]),a=e[i],l=Ae(o,a);al(o)?(r.push(Ae("uint256",s)),n.push(l),s+=l.length):r.push(l)}return Buffer.concat(r.concat(n))}function co(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,s=[],i=0;i32)throw new Error("Invalid bytes width: "+r);s.push(Xe.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=ht(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=qe(a),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());s.push(n.toArrayLike(Buffer,"be",r/8))}else if(o.startsWith("int")){if(r=ht(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=qe(a),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());s.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(s)}function ul(t,e){return Xe.keccak(co(t,e))}var dl={rawEncode:ll,solidityPack:co,soliditySHA3:ul};const ve=io,Pt=dl,lo={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"]},En={encodeData(t,e,r,n=!0){const s=["bytes32"],i=[this.hashType(t,r)];if(n){const o=(a,l,c)=>{if(r[l]!==void 0)return["bytes32",c==null?"0x0000000000000000000000000000000000000000000000000000000000000000":ve.keccak(this.encodeData(l,c,r,n))];if(c===void 0)throw new Error(`missing value for field ${a} of type ${l}`);if(l==="bytes")return["bytes32",ve.keccak(c)];if(l==="string")return typeof c=="string"&&(c=Buffer.from(c,"utf8")),["bytes32",ve.keccak(c)];if(l.lastIndexOf("]")===l.length-1){const u=l.slice(0,l.lastIndexOf("[")),d=c.map(h=>o(a,u,h));return["bytes32",ve.keccak(Pt.rawEncode(d.map(([h])=>h),d.map(([,h])=>h)))]}return[l,c]};for(const a of r[t]){const[l,c]=o(a.name,a.type,e[a.name]);s.push(l),i.push(c)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")s.push("bytes32"),a=ve.keccak(a),i.push(a);else if(o.type==="string")s.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=ve.keccak(a),i.push(a);else if(r[o.type]!==void 0)s.push("bytes32"),a=ve.keccak(this.encodeData(o.type,a,r,n)),i.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(o.type),i.push(a)}}return Pt.rawEncode(s,i)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(s=>s!==t);n=[t].concat(n.sort());for(const s of n){if(!e[s])throw new Error("No type definition specified: "+s);r+=s+"("+e[s].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 s of this.findTypeDependencies(n.type,e,r))!r.includes(s)&&r.push(s);return r},hashStruct(t,e,r,n=!0){return ve.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return ve.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in lo.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)),ve.keccak(Buffer.concat(n))}};var hl={TYPED_MESSAGE_SCHEMA:lo,TypedDataUtils:En,hashForSignTypedDataLegacy:function(t){return fl(t.data)},hashForSignTypedData_v3:function(t){return En.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return En.hash(t.data)}};function fl(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(i){return i.type==="bytes"?ve.toBuffer(i.value):i.value}),n=t.map(function(i){return i.type}),s=t.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return Pt.soliditySHA3(["bytes32","bytes32"],[Pt.soliditySHA3(new Array(t.length).fill("string"),s),Pt.soliditySHA3(n,r)])}var wt={};Object.defineProperty(wt,"__esModule",{value:!0});wt.filterFromParam=wt.FilterPolyfill=void 0;const lt=G,se=y,gl=5*60*1e3,Ge={jsonrpc:"2.0",id:0};class pl{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,lt.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=e}async newFilter(e){const r=uo(e),n=this.makeFilterId(),s=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",s),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,se.hexStringFromIntNumber)(n)}async newBlockFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.blockFilters.add(e),this.setFilterTimeout(e),(0,se.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,se.hexStringFromIntNumber)(e)}uninstallFilter(e){const r=(0,se.intNumberFromHexString)(e);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(e){const r=(0,se.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(lr())}async getFilterLogs(e){const r=(0,se.intNumberFromHexString)(e),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},Ge),{method:"eth_getLogs",params:[xs(n)]})):lr()}makeFilterId(){return(0,lt.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise((r,n)=>{this.provider.sendAsync(e,(s,i)=>{if(s)return n(s);if(Array.isArray(i)||i==null)return n(new Error(`unexpected response received: ${JSON.stringify(i)}`));r(i)})})}deleteFilter(e){console.info(`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 lr();const s=await this.getCurrentBlockHeight(),i=r.toBlock==="latest"?s:r.toBlock;if(n>s||n>Number(r.toBlock))return ur();console.info(`Fetching logs from ${n} to ${i} for filter ${e}`);const o=await this.sendAsyncPromise(Object.assign(Object.assign({},Ge),{method:"eth_getLogs",params:[xs(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:i}))]}));if(Array.isArray(o.result)){const a=o.result.map(c=>(0,se.intNumberFromHexString)(c.blockNumber||"0x0")),l=Math.max(...a);if(l&&l>n){const c=(0,lt.IntNumber)(l+1);console.info(`Moving cursor position for filter (${e}) from ${n} to ${c}`),this.cursors.set(e,c)}}return o}async getBlockFilterChanges(e){const r=this.cursors.get(e);if(!r)return lr();const n=await this.getCurrentBlockHeight();if(r>n)return ur();console.info(`Fetching blocks from ${r} to ${n} for filter (${e})`);const s=(await Promise.all((0,se.range)(r,n+1).map(o=>this.getBlockHashByNumber((0,lt.IntNumber)(o))))).filter(o=>!!o),i=(0,lt.IntNumber)(r+s.length);return console.info(`Moving cursor position for filter (${e}) from ${r} to ${i}`),this.cursors.set(e,i),Object.assign(Object.assign({},Ge),{result:s})}async getPendingTransactionFilterChanges(e){return Promise.resolve(ur())}async setInitialCursorPosition(e,r){const n=await this.getCurrentBlockHeight(),s=typeof r=="number"&&r>n?r:n;return this.cursors.set(e,s),s}setFilterTimeout(e){const r=this.timeouts.get(e);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${e}) timed out`),this.deleteFilter(e)},gl);this.timeouts.set(e,n)}async getCurrentBlockHeight(){const e=new Date;if(e.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=e;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},Ge),{method:"eth_blockNumber",params:[]}));return(0,se.intNumberFromHexString)((0,se.ensureHexString)(e))}async getBlockHashByNumber(e){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},Ge),{method:"eth_getBlockByNumber",params:[(0,se.hexStringFromIntNumber)(e),!1]}));return r.result&&typeof r.result.hash=="string"?(0,se.ensureHexString)(r.result.hash):null}}wt.FilterPolyfill=pl;function uo(t){return{fromBlock:Bs(t.fromBlock),toBlock:Bs(t.toBlock),addresses:t.address===void 0?null:Array.isArray(t.address)?t.address:[t.address],topics:t.topics||[]}}wt.filterFromParam=uo;function xs(t){const e={fromBlock:Fs(t.fromBlock),toBlock:Fs(t.toBlock),topics:t.topics};return t.addresses!==null&&(e.address=t.addresses),e}function Bs(t){if(t===void 0||t==="latest"||t==="pending")return"latest";if(t==="earliest")return(0,lt.IntNumber)(0);if((0,se.isHexString)(t))return(0,se.intNumberFromHexString)(t);throw new Error(`Invalid block option: ${String(t)}`)}function Fs(t){return t==="latest"?t:(0,se.hexStringFromIntNumber)(t)}function lr(){return Object.assign(Object.assign({},Ge),{error:{code:-32e3,message:"filter not found"}})}function ur(){return Object.assign(Object.assign({},Ge),{result:[]})}var Jr={},ho={},qr={},Qn=ml;function ml(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 js=(t,e)=>function(){const r=e.promiseModule,n=new Array(arguments.length);for(let s=0;s{e.errorFirst?n.push(function(o,a){if(e.multiArgs){const l=new Array(arguments.length-1);for(let c=1;c{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const r=s=>{const i=o=>typeof o=="string"?s===o:o.test(s);return e.include?e.include.some(i):!e.exclude.some(i)};let n;typeof t=="function"?n=function(){return e.excludeMain?t.apply(this,arguments):js(t,e).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(t));for(const s in t){const i=t[s];n[s]=typeof i=="function"&&r(s)?js(i,e):i}return n},qt={},Gt={};Object.defineProperty(Gt,"__esModule",{value:!0});const wl=Ti;function Ds(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function yl(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 i=s[e];if(i===void 0)return!1;if(typeof i=="function")Ds(i,this,r);else{const o=i.length,a=yl(i);for(let l=0;lt+e,Hs=["sync","latest"];class kl extends vl.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||20*Sl,this._usePastBlocks=e.usePastBlocks||!1,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){Hs.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 Hs.map(e=>this.listenerCount(e)).reduce(Cl)}_shouldUseNewBlock(e){const r=this._currentBlock;if(!r)return!0;const n=Us(e),s=Us(r);return this._usePastBlocks&&ns}_newPotentialLatest(e){this._shouldUseNewBlock(e)&&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}}qt.BaseBlockTracker=kl;function Us(t){return Number.parseInt(t,16)}var fo={},go={},te={};class po extends TypeError{constructor(e,r){let n;const{message:s,explanation:i,...o}=e,{path:a}=e,l=a.length===0?s:`At path: ${a.join(".")} -- ${s}`;super(i??l),i!=null&&(this.cause=l),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function Rl(t){return Ee(t)&&typeof t[Symbol.iterator]=="function"}function Ee(t){return typeof t=="object"&&t!=null}function Vs(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Z(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Il(t){const{done:e,value:r}=t.next();return e?void 0:r}function Al(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:s,branch:i}=e,{type:o}=r,{refinement:a,message:l=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${Z(n)}\``}=t;return{value:n,type:o,refinement:a,key:s[s.length-1],path:s,branch:i,...t,message:l}}function*Pn(t,e,r,n){Rl(t)||(t=[t]);for(const s of t){const i=Al(s,e,r,n);i&&(yield i)}}function*Kn(t,e,r={}){const{path:n=[],branch:s=[t],coerce:i=!1,mask:o=!1}=r,a={path:n,branch:s};if(i&&(t=e.coercer(t,a),o&&e.type!=="type"&&Ee(e.schema)&&Ee(t)&&!Array.isArray(t)))for(const c in t)e.schema[c]===void 0&&delete t[c];let l="valid";for(const c of e.validator(t,a))c.explanation=r.message,l="not_valid",yield[c,void 0];for(let[c,u,d]of e.entries(t,a)){const h=Kn(u,d,{path:c===void 0?n:[...n,c],branch:c===void 0?s:[...s,u],coerce:i,mask:o,message:r.message});for(const f of h)f[0]?(l=f[0].refinement!=null?"not_refined":"not_valid",yield[f[0],void 0]):i&&(u=f[1],c===void 0?t=u:t instanceof Map?t.set(c,u):t instanceof Set?t.add(u):Ee(t)&&(u!==void 0||c in t)&&(t[c]=u))}if(l!=="not_valid")for(const c of e.refiner(t,a))c.explanation=r.message,l="not_refined",yield[c,void 0];l==="valid"&&(yield[void 0,t])}class z{constructor(e){const{type:r,schema:n,validator:s,refiner:i,coercer:o=l=>l,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=o,s?this.validator=(l,c)=>{const u=s(l,c);return Pn(u,c,this,l)}:this.validator=()=>[],i?this.refiner=(l,c)=>{const u=i(l,c);return Pn(u,c,this,l)}:this.refiner=()=>[]}assert(e,r){return mo(e,this,r)}create(e,r){return bo(e,this,r)}is(e){return Xn(e,this)}mask(e,r){return wo(e,this,r)}validate(e,r={}){return kt(e,this,r)}}function mo(t,e,r){const n=kt(t,e,{message:r});if(n[0])throw n[0]}function bo(t,e,r){const n=kt(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function wo(t,e,r){const n=kt(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Xn(t,e){return!kt(t,e)[0]}function kt(t,e,r={}){const n=Kn(t,e,r),s=Il(n);return s[0]?[new po(s[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,s[1]]}function Nl(...t){const e=t[0].type==="type",r=t.map(s=>s.schema),n=Object.assign({},...r);return e?Qt(n):Zt(n)}function ce(t,e){return new z({type:t,schema:null,validator:e})}function Ml(t,e){return new z({...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 Ll(t){return new z({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 Tl(t){let e;return new z({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 Pl(t,e){const{schema:r}=t,n={...r};for(const s of e)delete n[s];switch(t.type){case"type":return Qt(n);default:return Zt(n)}}function $l(t){const e=t instanceof z,r=e?{...t.schema}:{...t};for(const n in r)r[n]=yo(r[n]);return e&&t.type==="type"?Qt(r):Zt(r)}function Ol(t,e){const{schema:r}=t,n={};for(const s of e)n[s]=r[s];switch(t.type){case"type":return Qt(n);default:return Zt(n)}}function xl(t,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),ce(t,e)}function Bl(){return ce("any",()=>!0)}function Fl(t){return new z({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: ${Z(e)}`}})}function jl(){return ce("bigint",t=>typeof t=="bigint")}function Dl(){return ce("boolean",t=>typeof t=="boolean")}function Hl(){return ce("date",t=>t instanceof Date&&!isNaN(t.getTime())||`Expected a valid \`Date\` object, but received: ${Z(t)}`)}function Ul(t){const e={},r=t.map(n=>Z(n)).join();for(const n of t)e[n]=n;return new z({type:"enums",schema:e,validator(n){return t.includes(n)||`Expected one of \`${r}\`, but received: ${Z(n)}`}})}function Vl(){return ce("func",t=>typeof t=="function"||`Expected a function, but received: ${Z(t)}`)}function Wl(t){return ce("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${Z(e)}`)}function zl(){return ce("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${Z(t)}`)}function Jl(t){return new z({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 ql(t){const e=Z(t),r=typeof t;return new z({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${Z(n)}`}})}function Gl(t,e){return new z({type:"map",schema:null,*entries(r){if(t&&e&&r instanceof Map)for(const[n,s]of r.entries())yield[n,n,t],yield[n,s,e]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Z(r)}`}})}function Yn(){return ce("never",()=>!1)}function Zl(t){return new z({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function Ql(){return ce("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Z(t)}`)}function Zt(t){const e=t?Object.keys(t):[],r=Yn();return new z({type:"object",schema:t||null,*entries(n){if(t&&Ee(n)){const s=new Set(Object.keys(n));for(const i of e)s.delete(i),yield[i,n[i],t[i]];for(const i of s)yield[i,n[i],r]}},validator(n){return Ee(n)||`Expected an object, but received: ${Z(n)}`},coercer(n){return Ee(n)?{...n}:n}})}function yo(t){return new z({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Kl(t,e){return new z({type:"record",schema:null,*entries(r){if(Ee(r))for(const n in r){const s=r[n];yield[n,n,t],yield[n,s,e]}},validator(r){return Ee(r)||`Expected an object, but received: ${Z(r)}`}})}function Xl(){return ce("regexp",t=>t instanceof RegExp)}function Yl(t){return new z({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: ${Z(e)}`}})}function Eo(){return ce("string",t=>typeof t=="string"||`Expected a string, but received: ${Z(t)}`)}function eu(t){const e=Yn();return new z({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let s=0;sr.type).join(" | ");return new z({type:"union",schema:null,coercer(r){for(const n of t){const[s,i]=n.validate(r,{coerce:!0});if(!s)return i}return r},validator(r,n){const s=[];for(const i of t){const[...o]=Kn(r,i,n),[a]=o;if(a[0])for(const[l]of o)l&&s.push(l);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Z(r)}`,...s]}})}function _o(){return ce("unknown",()=>!0)}function es(t,e,r){return new z({...t,coercer:(n,s)=>Xn(n,e)?t.coercer(r(n,s),s):t.coercer(n,s)})}function ru(t,e,r={}){return es(t,_o(),n=>{const s=typeof e=="function"?e():e;if(n===void 0)return s;if(!r.strict&&Vs(n)&&Vs(s)){const i={...n};let o=!1;for(const a in s)i[a]===void 0&&(i[a]=s[a],o=!0);if(o)return i}return n})}function nu(t){return es(t,Eo(),e=>e.trim())}function su(t){return tt(t,"empty",e=>{const r=vo(e);return r===0||`Expected an empty ${t.type} but received one with a size of \`${r}\``})}function vo(t){return t instanceof Map||t instanceof Set?t.size:t.length}function iu(t,e,r={}){const{exclusive:n}=r;return tt(t,"max",s=>n?sn?s>e:s>=e||`Expected a ${t.type} greater than ${n?"":"or equal to "}${e} but received \`${s}\``)}function au(t){return tt(t,"nonempty",e=>vo(e)>0||`Expected a nonempty ${t.type} but received an empty one`)}function cu(t,e){return tt(t,"pattern",r=>e.test(r)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${r}"`)}function lu(t,e,r=e){const n=`Expected a ${t.type}`,s=e===r?`of \`${e}\``:`between \`${e}\` and \`${r}\``;return tt(t,"size",i=>{if(typeof i=="number"||i instanceof Date)return e<=i&&i<=r||`${n} ${s} but received \`${i}\``;if(i instanceof Map||i instanceof Set){const{size:o}=i;return e<=o&&o<=r||`${n} with a size ${s} but received one with a size of \`${o}\``}else{const{length:o}=i;return e<=o&&o<=r||`${n} with a length ${s} but received one with a length of \`${o}\``}})}function tt(t,e,r){return new z({...t,*refiner(n,s){yield*t.refiner(n,s);const i=r(n,s),o=Pn(i,s,t,n);for(const a of o)yield{...a,refinement:e}}})}const uu=Object.freeze(Object.defineProperty({__proto__:null,Struct:z,StructError:po,any:Bl,array:Fl,assert:mo,assign:Nl,bigint:jl,boolean:Dl,coerce:es,create:bo,date:Hl,defaulted:ru,define:ce,deprecated:Ml,dynamic:Ll,empty:su,enums:Ul,func:Vl,instance:Wl,integer:zl,intersection:Jl,is:Xn,lazy:Tl,literal:ql,map:Gl,mask:wo,max:iu,min:ou,never:Yn,nonempty:au,nullable:Zl,number:Ql,object:Zt,omit:Pl,optional:yo,partial:$l,pattern:cu,pick:Ol,record:Kl,refine:tt,regexp:Xl,set:Yl,size:lu,string:Eo,struct:xl,trimmed:nu,tuple:eu,type:Qt,union:tu,unknown:_o,validate:kt},Symbol.toStringTag,{value:"Module"})),rt=la(uu);Object.defineProperty(te,"__esModule",{value:!0});te.assertExhaustive=te.assertStruct=te.assert=te.AssertionError=void 0;const du=rt;function hu(t){return typeof t=="object"&&t!==null&&"message"in t}function fu(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 gu(t){const e=hu(t)?t.message:String(t);return e.endsWith(".")?e.slice(0,-1):e}function So(t,e){return fu(t)?new t({message:e}):t({message:e})}class ts extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}te.AssertionError=ts;function pu(t,e="Assertion failed.",r=ts){if(!t)throw e instanceof Error?e:So(r,e)}te.assert=pu;function mu(t,e,r="Assertion failed",n=ts){try{(0,du.assert)(t,e)}catch(s){throw So(n,`${r}: ${gu(s)}.`)}}te.assertStruct=mu;function bu(t){throw new Error("Invalid branch reached. Should be detected during compilation.")}te.assertExhaustive=bu;var Kt={};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.base64=void 0;const wu=rt,yu=te,Eu=(t,e={})=>{var r,n;const s=(r=e.paddingRequired)!==null&&r!==void 0?r:!1,i=(n=e.characterSet)!==null&&n!==void 0?n:"base64";let o;i==="base64"?o=String.raw`[A-Za-z0-9+\/]`:((0,yu.assert)(i==="base64url"),o=String.raw`[-_A-Za-z0-9]`);let a;return s?a=new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):a=new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,wu.pattern)(t,a)};Kt.base64=Eu;var B={},Xt={};(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=rt,r=te;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(c){return(0,e.is)(c,t.HexStruct)}t.isHexString=n;function s(c){return(0,e.is)(c,t.StrictHexStruct)}t.isStrictHexString=s;function i(c){(0,r.assert)(n(c),"Value must be a hexadecimal string.")}t.assertIsHexString=i;function o(c){(0,r.assert)(s(c),'Value must be a hexadecimal string, starting with "0x".')}t.assertIsStrictHexString=o;function a(c){return c.startsWith("0x")?c:c.startsWith("0X")?`0x${c.substring(2)}`:`0x${c}`}t.add0x=a;function l(c){return c.startsWith("0x")||c.startsWith("0X")?c.substring(2):c}t.remove0x=l})(Xt);Object.defineProperty(B,"__esModule",{value:!0});B.createDataView=B.concatBytes=B.valueToBytes=B.stringToBytes=B.numberToBytes=B.signedBigIntToBytes=B.bigIntToBytes=B.hexToBytes=B.bytesToString=B.bytesToNumber=B.bytesToSignedBigInt=B.bytesToBigInt=B.bytesToHex=B.assertIsBytes=B.isBytes=void 0;const fe=te,$n=Xt,Ws=48,zs=58,Js=87;function _u(){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 vu=_u();function rs(t){return t instanceof Uint8Array}B.isBytes=rs;function Rt(t){(0,fe.assert)(rs(t),"Value must be a Uint8Array.")}B.assertIsBytes=Rt;function Co(t){if(Rt(t),t.length===0)return"0x";const e=vu(),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 Gr(e)}B.bigIntToBytes=Ro;function Ru(t,e){(0,fe.assert)(e>0);const r=t>>BigInt(31);return!((~t&r)+(t&~r)>>BigInt(e*8+-1))}function Iu(t,e){(0,fe.assert)(typeof t=="bigint","Value must be a bigint."),(0,fe.assert)(typeof e=="number","Byte length must be a number."),(0,fe.assert)(e>0,"Byte length must be greater than 0."),(0,fe.assert)(Ru(t,e),"Byte length is too small to represent the given value.");let r=t;const n=new Uint8Array(e);for(let s=0;s>=BigInt(8);return n.reverse()}B.signedBigIntToBytes=Iu;function Io(t){(0,fe.assert)(typeof t=="number","Value must be a number."),(0,fe.assert)(t>=0,"Value must be a non-negative number."),(0,fe.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToBytes` instead.");const e=t.toString(16);return Gr(e)}B.numberToBytes=Io;function Ao(t){return(0,fe.assert)(typeof t=="string","Value must be a string."),new TextEncoder().encode(t)}B.stringToBytes=Ao;function No(t){if(typeof t=="bigint")return Ro(t);if(typeof t=="number")return Io(t);if(typeof t=="string")return t.startsWith("0x")?Gr(t):Ao(t);if(rs(t))return t;throw new TypeError(`Unsupported value type: "${typeof t}".`)}B.valueToBytes=No;function Au(t){const e=new Array(t.length);let r=0;for(let s=0;se.call(r,n,s,this))}get(e){return ie(this,_e,"f").get(e)}has(e){return ie(this,_e,"f").has(e)}keys(){return ie(this,_e,"f").keys()}values(){return ie(this,_e,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,r])=>`${String(e)} => ${String(r)}`).join(", ")} `:""}}`}}yt.FrozenMap=ns;class ss{constructor(e){Re.set(this,void 0),To(this,Re,new Set(e),"f"),Object.freeze(this)}get size(){return ie(this,Re,"f").size}[(Re=new WeakMap,Symbol.iterator)](){return ie(this,Re,"f")[Symbol.iterator]()}entries(){return ie(this,Re,"f").entries()}forEach(e,r){return ie(this,Re,"f").forEach((n,s,i)=>e.call(r,n,s,this))}has(e){return ie(this,Re,"f").has(e)}keys(){return ie(this,Re,"f").keys()}values(){return ie(this,Re,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}}yt.FrozenSet=ss;Object.freeze(ns);Object.freeze(ns.prototype);Object.freeze(ss);Object.freeze(ss.prototype);var Po={};Object.defineProperty(Po,"__esModule",{value:!0});var $o={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),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.getJsonSize=t.isValidJson=t.JsonStruct=t.UnsafeJsonStruct=void 0;const e=rt,r=te,n=()=>(0,e.define)("finite number",w=>(0,e.is)(w,(0,e.number)())&&Number.isFinite(w));t.UnsafeJsonStruct=(0,e.union)([(0,e.literal)(null),(0,e.boolean)(),n(),(0,e.string)(),(0,e.array)((0,e.lazy)(()=>t.UnsafeJsonStruct)),(0,e.record)((0,e.string)(),(0,e.lazy)(()=>t.UnsafeJsonStruct))]),t.JsonStruct=(0,e.define)("Json",(w,M)=>{function W(re,le){const ge=[...le.validator(re,M)];return ge.length>0?ge:!0}try{const re=W(w,t.UnsafeJsonStruct);return re!==!0?re:W(JSON.parse(JSON.stringify(w)),t.UnsafeJsonStruct)}catch(re){return re instanceof RangeError?"Circular reference detected":!1}});function s(w){return(0,e.is)(w,t.JsonStruct)}t.isValidJson=s;function i(w){(0,r.assertStruct)(w,t.JsonStruct,"Invalid JSON value");const M=JSON.stringify(w);return new TextEncoder().encode(M).byteLength}t.getJsonSize=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 o(w){return(0,e.is)(w,t.JsonRpcNotificationStruct)}t.isJsonRpcNotification=o;function a(w,M){(0,r.assertStruct)(w,t.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",M)}t.assertIsJsonRpcNotification=a;function l(w){return(0,e.is)(w,t.JsonRpcRequestStruct)}t.isJsonRpcRequest=l;function c(w,M){(0,r.assertStruct)(w,t.JsonRpcRequestStruct,"Invalid JSON-RPC request",M)}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(w){return(0,e.is)(w,t.PendingJsonRpcResponseStruct)}t.isPendingJsonRpcResponse=u;function d(w,M){(0,r.assertStruct)(w,t.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",M)}t.assertIsPendingJsonRpcResponse=d;function h(w){return(0,e.is)(w,t.JsonRpcResponseStruct)}t.isJsonRpcResponse=h;function f(w,M){(0,r.assertStruct)(w,t.JsonRpcResponseStruct,"Invalid JSON-RPC response",M)}t.assertIsJsonRpcResponse=f;function g(w){return(0,e.is)(w,t.JsonRpcSuccessStruct)}t.isJsonRpcSuccess=g;function E(w,M){(0,r.assertStruct)(w,t.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",M)}t.assertIsJsonRpcSuccess=E;function _(w){return(0,e.is)(w,t.JsonRpcFailureStruct)}t.isJsonRpcFailure=_;function k(w,M){(0,r.assertStruct)(w,t.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",M)}t.assertIsJsonRpcFailure=k;function v(w){return(0,e.is)(w,t.JsonRpcErrorStruct)}t.isJsonRpcError=v;function p(w,M){(0,r.assertStruct)(w,t.JsonRpcErrorStruct,"Invalid JSON-RPC error",M)}t.assertIsJsonRpcError=p;function F(w){const{permitEmptyString:M,permitFractions:W,permitNull:re}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},w);return Q=>!!(typeof Q=="number"&&(W||Number.isInteger(Q))||typeof Q=="string"&&(M||Q.length>0)||re&&Q===null)}t.getJsonRpcIdValidator=F})($o);var Oo={};Object.defineProperty(Oo,"__esModule",{value:!0});var Et={},On={exports:{}},_n,Gs;function Du(){if(Gs)return _n;Gs=1;var t=1e3,e=t*60,r=e*60,n=r*24,s=n*7,i=n*365.25;_n=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return o(u);if(h==="number"&&isFinite(u))return d.long?l(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*i;case"weeks":case"week":case"w":return h*s;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(u){var d=Math.abs(u);return d>=n?Math.round(u/n)+"d":d>=r?Math.round(u/r)+"h":d>=e?Math.round(u/e)+"m":d>=t?Math.round(u/t)+"s":u+"ms"}function l(u){var d=Math.abs(u);return d>=n?c(u,d,n,"day"):d>=r?c(u,d,r,"hour"):d>=e?c(u,d,e,"minute"):d>=t?c(u,d,t,"second"):u+" ms"}function c(u,d,h,f){var g=d>=h*1.5;return Math.round(u/h)+" "+f+(g?"s":"")}return _n}function Hu(t){r.debug=r,r.default=r,r.coerce=l,r.disable=i,r.enable=s,r.enabled=o,r.humanize=Du(),r.destroy=c,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let d=0;for(let h=0;h{if(M==="%%")return"%";F++;const re=r.formatters[W];if(typeof re=="function"){const le=_[F];M=re.call(k,le),_.splice(F,1),F--}return M}),r.formatArgs.call(k,_),(k.log||r.log).apply(k,_)}return E.namespace=u,E.useColors=r.useColors(),E.color=r.selectColor(u),E.extend=n,E.destroy=r.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(f!==r.namespaces&&(f=r.namespaces,g=r.enabled(u)),g),set:_=>{h=_}}),typeof r.init=="function"&&r.init(E),E}function n(u,d){const h=r(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function s(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let d;const h=(typeof u=="string"?u:"").split(/[\s,]+/),f=h.length;for(d=0;d"-"+d)].join(",");return r.enable(""),u}function o(u){if(u[u.length-1]==="*")return!0;let d,h;for(d=0,h=r.skips.length;d{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 n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return 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&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(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 d=0,h=0;c[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(d++,f==="%c"&&(h=d))}),c.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=r.DEBUG),c}function a(){try{return localStorage}catch{}}t.exports=Uu(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(On,On.exports);var Vu=On.exports,Wu=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Et,"__esModule",{value:!0});Et.createModuleLogger=Et.createProjectLogger=void 0;const zu=Wu(Vu),Ju=(0,zu.default)("metamask");function qu(t){return Ju.extend(t)}Et.createProjectLogger=qu;function Gu(t,e){return t.extend(e)}Et.createModuleLogger=Gu;var xo={};(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(c){return Array.isArray(c)&&c.length>0}t.isNonEmptyArray=e;function r(c){return c==null}t.isNullOrUndefined=r;function n(c){return!!c&&typeof c=="object"&&!Array.isArray(c)}t.isObject=n;const s=(c,u)=>Object.hasOwnProperty.call(c,u);t.hasProperty=s,function(c){c[c.Null=4]="Null",c[c.Comma=1]="Comma",c[c.Wrapper=1]="Wrapper",c[c.True=4]="True",c[c.False=5]="False",c[c.Quote=1]="Quote",c[c.Colon=1]="Colon",c[c.Date=24]="Date"}(t.JsonSize||(t.JsonSize={})),t.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function i(c){if(typeof c!="object"||c===null)return!1;try{let u=c;for(;Object.getPrototypeOf(u)!==null;)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(c)===u}catch{return!1}}t.isPlainObject=i;function o(c){return c.charCodeAt(0)<=127}t.isASCII=o;function a(c){var u;return c.split("").reduce((h,f)=>o(f)?h+1:h+2,0)+((u=c.match(t.ESCAPE_CHARACTERS_REGEXP))!==null&&u!==void 0?u:[]).length}t.calculateStringSize=a;function l(c){return c.toString().length}t.calculateNumberSize=l})(xo);var Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.hexToBigInt=Pe.hexToNumber=Pe.bigIntToHex=Pe.numberToHex=void 0;const ft=te,Ot=Xt,Zu=t=>((0,ft.assert)(typeof t=="number","Value must be a number."),(0,ft.assert)(t>=0,"Value must be a non-negative number."),(0,ft.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Ot.add0x)(t.toString(16)));Pe.numberToHex=Zu;const Qu=t=>((0,ft.assert)(typeof t=="bigint","Value must be a bigint."),(0,ft.assert)(t>=0,"Value must be a non-negative bigint."),(0,Ot.add0x)(t.toString(16)));Pe.bigIntToHex=Qu;const Ku=t=>{(0,Ot.assertIsHexString)(t);const e=parseInt(t,16);return(0,ft.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `hexToBigInt` instead."),e};Pe.hexToNumber=Ku;const Xu=t=>((0,Ot.assertIsHexString)(t),BigInt((0,Ot.add0x)(t)));Pe.hexToBigInt=Xu;var Bo={};Object.defineProperty(Bo,"__esModule",{value:!0});var Fo={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.timeSince=t.inMilliseconds=t.Duration=void 0,function(i){i[i.Millisecond=1]="Millisecond",i[i.Second=1e3]="Second",i[i.Minute=6e4]="Minute",i[i.Hour=36e5]="Hour",i[i.Day=864e5]="Day",i[i.Week=6048e5]="Week",i[i.Year=31536e6]="Year"}(t.Duration||(t.Duration={}));const e=i=>Number.isInteger(i)&&i>=0,r=(i,o)=>{if(!e(i))throw new Error(`"${o}" must be a non-negative integer. Received: "${i}".`)};function n(i,o){return r(i,"count"),i*o}t.inMilliseconds=n;function s(i){return r(i,"timestamp"),Date.now()-i}t.timeSince=s})(Fo);var jo={};Object.defineProperty(jo,"__esModule",{value:!0});var Do={},xn={exports:{}};const Yu="2.0.0",Ho=256,ed=Number.MAX_SAFE_INTEGER||9007199254740991,td=16,rd=Ho-6,nd=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Kr={MAX_LENGTH:Ho,MAX_SAFE_COMPONENT_LENGTH:td,MAX_SAFE_BUILD_LENGTH:rd,MAX_SAFE_INTEGER:ed,RELEASE_TYPES:nd,SEMVER_SPEC_VERSION:Yu,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},vn={};const sd=typeof process=="object"&&vn&&vn.NODE_DEBUG&&/\bsemver\b/i.test(vn.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};var Xr=sd;(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Kr,i=Xr;e=t.exports={};const o=e.re=[],a=e.safeRe=[],l=e.src=[],c=e.t={};let u=0;const d="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",s],[d,n]],f=E=>{for(const[_,k]of h)E=E.split(`${_}*`).join(`${_}{0,${k}}`).split(`${_}+`).join(`${_}{1,${k}}`);return E},g=(E,_,k)=>{const v=f(_),p=u++;i(E,p,_),c[E]=p,l[p]=_,o[p]=new RegExp(_,k?"g":void 0),a[p]=new RegExp(v,k?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),g("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),g("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${d}+`),g("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),g("FULL",`^${l[c.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),g("LOOSE",`^${l[c.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),g("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),g("COERCE",`${l[c.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",l[c.COERCEPLAIN]+`(?:${l[c.PRERELEASE]})?(?:${l[c.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",l[c.COERCE],!0),g("COERCERTLFULL",l[c.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",g("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",g("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(xn,xn.exports);var Yt=xn.exports;const id=Object.freeze({loose:!0}),od=Object.freeze({}),ad=t=>t?typeof t!="object"?id:t:od;var is=ad;const Zs=/^[0-9]+$/,Uo=(t,e)=>{const r=Zs.test(t),n=Zs.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:tUo(e,t);var Vo={compareIdentifiers:Uo,rcompareIdentifiers:cd};const dr=Xr,{MAX_LENGTH:Qs,MAX_SAFE_INTEGER:hr}=Kr,{safeRe:Ks,t:Xs}=Yt,ld=is,{compareIdentifiers:at}=Vo;let ud=class Ie{constructor(e,r){if(r=ld(r),e instanceof Ie){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>Qs)throw new TypeError(`version is longer than ${Qs} characters`);dr("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=e.trim().match(r.loose?Ks[Xs.LOOSE]:Ks[Xs.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>hr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>hr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>hr||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const i=+s;if(i>=0&&i=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),at(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var oe=ud;const Ys=oe,dd=(t,e,r=!1)=>{if(t instanceof Ys)return t;try{return new Ys(t,e)}catch(n){if(!r)return null;throw n}};var It=dd;const hd=It,fd=(t,e)=>{const r=hd(t,e);return r?r.version:null};var gd=fd;const pd=It,md=(t,e)=>{const r=pd(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};var bd=md;const ei=oe,wd=(t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new ei(t instanceof ei?t.version:t,r).inc(e,n,s).version}catch{return null}};var yd=wd;const ti=It,Ed=(t,e)=>{const r=ti(t,null,!0),n=ti(e,null,!0),s=r.compare(n);if(s===0)return null;const i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l)return!a.patch&&!a.minor?"major":o.patch?"patch":o.minor?"minor":"major";const u=l?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};var _d=Ed;const vd=oe,Sd=(t,e)=>new vd(t,e).major;var Cd=Sd;const kd=oe,Rd=(t,e)=>new kd(t,e).minor;var Id=Rd;const Ad=oe,Nd=(t,e)=>new Ad(t,e).patch;var Md=Nd;const Ld=It,Td=(t,e)=>{const r=Ld(t,e);return r&&r.prerelease.length?r.prerelease:null};var Pd=Td;const ri=oe,$d=(t,e,r)=>new ri(t,r).compare(new ri(e,r));var Se=$d;const Od=Se,xd=(t,e,r)=>Od(e,t,r);var Bd=xd;const Fd=Se,jd=(t,e)=>Fd(t,e,!0);var Dd=jd;const ni=oe,Hd=(t,e,r)=>{const n=new ni(t,r),s=new ni(e,r);return n.compare(s)||n.compareBuild(s)};var os=Hd;const Ud=os,Vd=(t,e)=>t.sort((r,n)=>Ud(r,n,e));var Wd=Vd;const zd=os,Jd=(t,e)=>t.sort((r,n)=>zd(n,r,e));var qd=Jd;const Gd=Se,Zd=(t,e,r)=>Gd(t,e,r)>0;var Yr=Zd;const Qd=Se,Kd=(t,e,r)=>Qd(t,e,r)<0;var as=Kd;const Xd=Se,Yd=(t,e,r)=>Xd(t,e,r)===0;var Wo=Yd;const eh=Se,th=(t,e,r)=>eh(t,e,r)!==0;var zo=th;const rh=Se,nh=(t,e,r)=>rh(t,e,r)>=0;var cs=nh;const sh=Se,ih=(t,e,r)=>sh(t,e,r)<=0;var ls=ih;const oh=Wo,ah=zo,ch=Yr,lh=cs,uh=as,dh=ls,hh=(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 oh(t,r,n);case"!=":return ah(t,r,n);case">":return ch(t,r,n);case">=":return lh(t,r,n);case"<":return uh(t,r,n);case"<=":return dh(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var Jo=hh;const fh=oe,gh=It,{safeRe:fr,t:gr}=Yt,ph=(t,e)=>{if(t instanceof fh)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(e.includePrerelease?fr[gr.COERCEFULL]:fr[gr.COERCE]);else{const l=e.includePrerelease?fr[gr.COERCERTLFULL]:fr[gr.COERCERTL];let c;for(;(c=l.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),l.lastIndex=c.index+c[1].length+c[2].length;l.lastIndex=-1}if(r===null)return null;const n=r[2],s=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return gh(`${n}.${s}.${i}${o}${a}`,e)};var mh=ph;class bh{constructor(){this.max=1e3,this.map=new Map}get(e){const r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(e,r)}return this}}var wh=bh,Sn,si;function Ce(){if(si)return Sn;si=1;const t=/\s+/g;class e{constructor(m,R){if(R=s(R),m instanceof e)return m.loose===!!R.loose&&m.includePrerelease===!!R.includePrerelease?m:new e(m.raw,R);if(m instanceof i)return this.raw=m.value,this.set=[[m]],this.formatted=void 0,this;if(this.options=R,this.loose=!!R.loose,this.includePrerelease=!!R.includePrerelease,this.raw=m.trim().replace(t," "),this.set=this.raw.split("||").map(S=>this.parseRange(S.trim())).filter(S=>S.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const S=this.set[0];if(this.set=this.set.filter(A=>!E(A[0])),this.set.length===0)this.set=[S];else if(this.set.length>1){for(const A of this.set)if(A.length===1&&_(A[0])){this.set=[A];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let m=0;m0&&(this.formatted+="||");const R=this.set[m];for(let S=0;S0&&(this.formatted+=" "),this.formatted+=R[S].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(m){const S=((this.options.includePrerelease&&f)|(this.options.loose&&g))+":"+m,A=n.get(S);if(A)return A;const C=this.options.loose,L=C?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];m=m.replace(L,K(this.options.includePrerelease)),o("hyphen replace",m),m=m.replace(l[c.COMPARATORTRIM],u),o("comparator trim",m),m=m.replace(l[c.TILDETRIM],d),o("tilde trim",m),m=m.replace(l[c.CARETTRIM],h),o("caret trim",m);let j=m.split(" ").map(J=>v(J,this.options)).join(" ").split(/\s+/).map(J=>ge(J,this.options));C&&(j=j.filter(J=>(o("loose invalid filter",J,this.options),!!J.match(l[c.COMPARATORLOOSE])))),o("range list",j);const $=new Map,D=j.map(J=>new i(J,this.options));for(const J of D){if(E(J))return[J];$.set(J.value,J)}$.size>1&&$.has("")&&$.delete("");const ue=[...$.values()];return n.set(S,ue),ue}intersects(m,R){if(!(m instanceof e))throw new TypeError("a Range is required");return this.set.some(S=>k(S,R)&&m.set.some(A=>k(A,R)&&S.every(C=>A.every(L=>C.intersects(L,R)))))}test(m){if(!m)return!1;if(typeof m=="string")try{m=new a(m,this.options)}catch{return!1}for(let R=0;Rb.value==="<0.0.0-0",_=b=>b.value==="",k=(b,m)=>{let R=!0;const S=b.slice();let A=S.pop();for(;R&&S.length;)R=S.every(C=>A.intersects(C,m)),A=S.pop();return R},v=(b,m)=>(o("comp",b,m),b=M(b,m),o("caret",b),b=F(b,m),o("tildes",b),b=re(b,m),o("xrange",b),b=Q(b,m),o("stars",b),b),p=b=>!b||b.toLowerCase()==="x"||b==="*",F=(b,m)=>b.trim().split(/\s+/).map(R=>w(R,m)).join(" "),w=(b,m)=>{const R=m.loose?l[c.TILDELOOSE]:l[c.TILDE];return b.replace(R,(S,A,C,L,j)=>{o("tilde",b,S,A,C,L,j);let $;return p(A)?$="":p(C)?$=`>=${A}.0.0 <${+A+1}.0.0-0`:p(L)?$=`>=${A}.${C}.0 <${A}.${+C+1}.0-0`:j?(o("replaceTilde pr",j),$=`>=${A}.${C}.${L}-${j} <${A}.${+C+1}.0-0`):$=`>=${A}.${C}.${L} <${A}.${+C+1}.0-0`,o("tilde return",$),$})},M=(b,m)=>b.trim().split(/\s+/).map(R=>W(R,m)).join(" "),W=(b,m)=>{o("caret",b,m);const R=m.loose?l[c.CARETLOOSE]:l[c.CARET],S=m.includePrerelease?"-0":"";return b.replace(R,(A,C,L,j,$)=>{o("caret",b,A,C,L,j,$);let D;return p(C)?D="":p(L)?D=`>=${C}.0.0${S} <${+C+1}.0.0-0`:p(j)?C==="0"?D=`>=${C}.${L}.0${S} <${C}.${+L+1}.0-0`:D=`>=${C}.${L}.0${S} <${+C+1}.0.0-0`:$?(o("replaceCaret pr",$),C==="0"?L==="0"?D=`>=${C}.${L}.${j}-${$} <${C}.${L}.${+j+1}-0`:D=`>=${C}.${L}.${j}-${$} <${C}.${+L+1}.0-0`:D=`>=${C}.${L}.${j}-${$} <${+C+1}.0.0-0`):(o("no pr"),C==="0"?L==="0"?D=`>=${C}.${L}.${j}${S} <${C}.${L}.${+j+1}-0`:D=`>=${C}.${L}.${j}${S} <${C}.${+L+1}.0-0`:D=`>=${C}.${L}.${j} <${+C+1}.0.0-0`),o("caret return",D),D})},re=(b,m)=>(o("replaceXRanges",b,m),b.split(/\s+/).map(R=>le(R,m)).join(" ")),le=(b,m)=>{b=b.trim();const R=m.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return b.replace(R,(S,A,C,L,j,$)=>{o("xRange",b,S,A,C,L,j,$);const D=p(C),ue=D||p(L),J=ue||p(j),At=J;return A==="="&&At&&(A=""),$=m.includePrerelease?"-0":"",D?A===">"||A==="<"?S="<0.0.0-0":S="*":A&&At?(ue&&(L=0),j=0,A===">"?(A=">=",ue?(C=+C+1,L=0,j=0):(L=+L+1,j=0)):A==="<="&&(A="<",ue?C=+C+1:L=+L+1),A==="<"&&($="-0"),S=`${A+C}.${L}.${j}${$}`):ue?S=`>=${C}.0.0${$} <${+C+1}.0.0-0`:J&&(S=`>=${C}.${L}.0${$} <${C}.${+L+1}.0-0`),o("xRange return",S),S})},Q=(b,m)=>(o("replaceStars",b,m),b.trim().replace(l[c.STAR],"")),ge=(b,m)=>(o("replaceGTE0",b,m),b.trim().replace(l[m.includePrerelease?c.GTE0PRE:c.GTE0],"")),K=b=>(m,R,S,A,C,L,j,$,D,ue,J,At)=>(p(S)?R="":p(A)?R=`>=${S}.0.0${b?"-0":""}`:p(C)?R=`>=${S}.${A}.0${b?"-0":""}`:L?R=`>=${R}`:R=`>=${R}${b?"-0":""}`,p(D)?$="":p(ue)?$=`<${+D+1}.0.0-0`:p(J)?$=`<${D}.${+ue+1}.0-0`:At?$=`<=${D}.${ue}.${J}-${At}`:b?$=`<${D}.${ue}.${+J+1}-0`:$=`<=${$}`,`${R} ${$}`.trim()),sr=(b,m,R)=>{for(let S=0;S0){const A=b[S].semver;if(A.major===m.major&&A.minor===m.minor&&A.patch===m.patch)return!0}return!1}return!0};return Sn}var Cn,ii;function en(){if(ii)return Cn;ii=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(u,d){if(d=r(d),u instanceof e){if(u.loose===!!d.loose)return u;u=u.value}u=u.trim().split(/\s+/).join(" "),o("comparator",u,d),this.options=d,this.loose=!!d.loose,this.parse(u),this.semver===t?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(u){const d=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],h=u.match(d);if(!h)throw new TypeError(`Invalid comparator: ${u}`);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(u){if(o("Comparator.test",u,this.options.loose),this.semver===t||u===t)return!0;if(typeof u=="string")try{u=new a(u,this.options)}catch{return!1}return i(u,this.operator,this.semver,this.options)}intersects(u,d){if(!(u instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(u.value,d).test(this.value):u.operator===""?u.value===""?!0:new l(this.value,d).test(u.semver):(d=r(d),d.includePrerelease&&(this.value==="<0.0.0-0"||u.value==="<0.0.0-0")||!d.includePrerelease&&(this.value.startsWith("<0.0.0")||u.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&u.operator.startsWith(">")||this.operator.startsWith("<")&&u.operator.startsWith("<")||this.semver.version===u.semver.version&&this.operator.includes("=")&&u.operator.includes("=")||i(this.semver,"<",u.semver,d)&&this.operator.startsWith(">")&&u.operator.startsWith("<")||i(this.semver,">",u.semver,d)&&this.operator.startsWith("<")&&u.operator.startsWith(">")))}}Cn=e;const r=is,{safeRe:n,t:s}=Yt,i=Jo,o=Xr,a=oe,l=Ce();return Cn}const yh=Ce(),Eh=(t,e,r)=>{try{e=new yh(e,r)}catch{return!1}return e.test(t)};var tn=Eh;const _h=Ce(),vh=(t,e)=>new _h(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Sh=vh;const Ch=oe,kh=Ce(),Rh=(t,e,r)=>{let n=null,s=null,i=null;try{i=new kh(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new Ch(n,r))}),n};var Ih=Rh;const Ah=oe,Nh=Ce(),Mh=(t,e,r)=>{let n=null,s=null,i=null;try{i=new Nh(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new Ah(n,r))}),n};var Lh=Mh;const kn=oe,Th=Ce(),oi=Yr,Ph=(t,e)=>{t=new Th(t,e);let r=new kn("0.0.0");if(t.test(r)||(r=new kn("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{const a=new kn(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||oi(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||oi(r,i))&&(r=i)}return r&&t.test(r)?r:null};var $h=Ph;const Oh=Ce(),xh=(t,e)=>{try{return new Oh(t,e).range||"*"}catch{return null}};var Bh=xh;const Fh=oe,qo=en(),{ANY:jh}=qo,Dh=Ce(),Hh=tn,ai=Yr,ci=as,Uh=ls,Vh=cs,Wh=(t,e,r,n)=>{t=new Fh(t,n),e=new Dh(e,n);let s,i,o,a,l;switch(r){case">":s=ai,i=Uh,o=ci,a=">",l=">=";break;case"<":s=ci,i=Vh,o=ai,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Hh(t,e,n))return!1;for(let c=0;c{f.semver===jh&&(f=new qo(">=0.0.0")),d=d||f,h=h||f,s(f.semver,d.semver,n)?d=f:o(f.semver,h.semver,n)&&(h=f)}),d.operator===a||d.operator===l||(!h.operator||h.operator===a)&&i(t,h.semver))return!1;if(h.operator===l&&o(t,h.semver))return!1}return!0};var us=Wh;const zh=us,Jh=(t,e,r)=>zh(t,e,">",r);var qh=Jh;const Gh=us,Zh=(t,e,r)=>Gh(t,e,"<",r);var Qh=Zh;const li=Ce(),Kh=(t,e,r)=>(t=new li(t,r),e=new li(e,r),t.intersects(e,r));var Xh=Kh;const Yh=tn,ef=Se;var tf=(t,e,r)=>{const n=[];let s=null,i=null;const o=t.sort((u,d)=>ef(u,d,r));for(const u of o)Yh(u,e,r)?(i=u,s||(s=u)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);const a=[];for(const[u,d]of n)u===d?a.push(u):!d&&u===o[0]?a.push("*"):d?u===o[0]?a.push(`<=${d}`):a.push(`${u} - ${d}`):a.push(`>=${u}`);const l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length{if(t===e)return!0;t=new ui(t,r),e=new ui(e,r);let n=!1;e:for(const s of t.set){for(const i of e.set){const o=sf(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},nf=[new ds(">=0.0.0-0")],di=[new ds(">=0.0.0")],sf=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Rn){if(e.length===1&&e[0].semver===Rn)return!0;r.includePrerelease?t=nf:t=di}if(e.length===1&&e[0].semver===Rn){if(r.includePrerelease)return!0;e=di}const n=new Set;let s,i;for(const f of t)f.operator===">"||f.operator===">="?s=hi(s,f,r):f.operator==="<"||f.operator==="<="?i=fi(i,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(s&&i){if(o=hs(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(const f of n){if(s&&!Mt(f,String(s),r)||i&&!Mt(f,String(i),r))return null;for(const g of e)if(!Mt(f,String(g),r))return!1;return!0}let a,l,c,u,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(const f of e){if(u=u||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator===">"||f.operator===">="){if(a=hi(s,f,r),a===f&&a!==s)return!1}else if(s.operator===">="&&!Mt(s.semver,String(f),r))return!1}if(i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator==="<"||f.operator==="<="){if(l=fi(i,f,r),l===f&&l!==i)return!1}else if(i.operator==="<="&&!Mt(i.semver,String(f),r))return!1}if(!f.operator&&(i||s)&&o!==0)return!1}return!(s&&c&&!i&&o!==0||i&&u&&!s&&o!==0||h||d)},hi=(t,e,r)=>{if(!t)return e;const n=hs(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},fi=(t,e,r)=>{if(!t)return e;const n=hs(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};var of=rf;const In=Yt,gi=Kr,af=oe,pi=Vo,cf=It,lf=gd,uf=bd,df=yd,hf=_d,ff=Cd,gf=Id,pf=Md,mf=Pd,bf=Se,wf=Bd,yf=Dd,Ef=os,_f=Wd,vf=qd,Sf=Yr,Cf=as,kf=Wo,Rf=zo,If=cs,Af=ls,Nf=Jo,Mf=mh,Lf=en(),Tf=Ce(),Pf=tn,$f=Sh,Of=Ih,xf=Lh,Bf=$h,Ff=Bh,jf=us,Df=qh,Hf=Qh,Uf=Xh,Vf=tf,Wf=of;var zf={parse:cf,valid:lf,clean:uf,inc:df,diff:hf,major:ff,minor:gf,patch:pf,prerelease:mf,compare:bf,rcompare:wf,compareLoose:yf,compareBuild:Ef,sort:_f,rsort:vf,gt:Sf,lt:Cf,eq:kf,neq:Rf,gte:If,lte:Af,cmp:Nf,coerce:Mf,Comparator:Lf,Range:Tf,satisfies:Pf,toComparators:$f,maxSatisfying:Of,minSatisfying:xf,minVersion:Bf,validRange:Ff,outside:jf,gtr:Df,ltr:Hf,intersects:Uf,simplifyRange:Vf,subset:Wf,SemVer:af,re:In.re,src:In.src,tokens:In.t,SEMVER_SPEC_VERSION:gi.SEMVER_SPEC_VERSION,RELEASE_TYPES:gi.RELEASE_TYPES,compareIdentifiers:pi.compareIdentifiers,rcompareIdentifiers:pi.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=zf,r=rt,n=te;t.VersionStruct=(0,r.refine)((0,r.string)(),"Version",d=>(0,e.valid)(d)===null?`Expected SemVer version, got "${d}"`:!0),t.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",d=>(0,e.validRange)(d)===null?`Expected SemVer range, got "${d}"`:!0);function s(d){return(0,r.is)(d,t.VersionStruct)}t.isValidSemVerVersion=s;function i(d){return(0,r.is)(d,t.VersionRangeStruct)}t.isValidSemVerRange=i;function o(d){(0,n.assertStruct)(d,t.VersionStruct)}t.assertIsSemVerVersion=o;function a(d){(0,n.assertStruct)(d,t.VersionRangeStruct)}t.assertIsSemVerRange=a;function l(d,h){return(0,e.gt)(d,h)}t.gtVersion=l;function c(d,h){return(0,e.gtr)(d,h)}t.gtRange=c;function u(d,h){return(0,e.satisfies)(d,h,{includePrerelease:!0})}t.satisfiesVersionRange=u})(Do);(function(t){var e=I&&I.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=I&&I.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(te,t),r(Kt,t),r(B,t),r(Zr,t),r(Te,t),r(yt,t),r(Po,t),r(Xt,t),r($o,t),r(Oo,t),r(Et,t),r(xo,t),r(Pe,t),r(Bo,t),r(Fo,t),r(jo,t),r(Do,t)})(go);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createModuleLogger=t.projectLogger=void 0;const e=go;Object.defineProperty(t,"createModuleLogger",{enumerable:!0,get:function(){return e.createModuleLogger}}),t.projectLogger=(0,e.createProjectLogger)("eth-block-tracker")})(fo);var Go=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qr,"__esModule",{value:!0});qr.PollingBlockTracker=void 0;const Jf=Go(Qn),qf=Go(bl),Gf=qt,mi=fo,bi=(0,mi.createModuleLogger)(mi.projectLogger,"polling-block-tracker"),Zf=(0,Jf.default)(),Qf=1e3;class Kf extends Gf.BaseBlockTracker{constructor(e={}){var r;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},e),{blockResetDuration:(r=e.blockResetDuration)!==null&&r!==void 0?r:e.pollingInterval})),this._provider=e.provider,this._pollingInterval=e.pollingInterval||20*Qf,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=wi(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: ${(e=r.stack)!==null&&e!==void 0?e:r}`);try{this.emit("error",n)}catch{console.error(n)}const s=wi(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await s}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:Zf(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),bi("Making request",e);const r=await(0,qf.default)(n=>this._provider.sendAsync(e,n))();if(bi("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block: ${r.error.message}`);return r.result}}qr.PollingBlockTracker=Kf;function wi(t,e){return new Promise(r=>{const n=setTimeout(r,t);n.unref&&e&&n.unref()})}var rn={},Xf=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.SubscribeBlockTracker=void 0;const Yf=Xf(Qn),e0=qt,t0=(0,Yf.default)();class r0 extends e0.BaseBlockTracker{constructor(e={}){if(!e.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(e),this._provider=e.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const e=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(e)}catch(e){this.emit("error",e)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(e){this.emit("error",e)}}_call(e,...r){return new Promise((n,s)=>{this._provider.sendAsync({id:t0(),method:e,params:r,jsonrpc:"2.0"},(i,o)=>{i?s(i):n(o.result)})})}_handleSubData(e,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}rn.SubscribeBlockTracker=r0;(function(t){var e=I&&I.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i),Object.defineProperty(n,o,{enumerable:!0,get:function(){return s[i]}})}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=I&&I.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(qr,t),r(rn,t)})(ho);var fs={},nn={},er={};Object.defineProperty(er,"__esModule",{value:!0});er.getUniqueId=void 0;const Zo=4294967295;let An=Math.floor(Math.random()*Zo);function n0(){return An=(An+1)%Zo,An}er.getUniqueId=n0;Object.defineProperty(nn,"__esModule",{value:!0});nn.createIdRemapMiddleware=void 0;const s0=er;function i0(){return(t,e,r,n)=>{const s=t.id,i=s0.getUniqueId();t.id=i,e.id=i,r(o=>{t.id=s,e.id=s,o()})}}nn.createIdRemapMiddleware=i0;var sn={};Object.defineProperty(sn,"__esModule",{value:!0});sn.createAsyncMiddleware=void 0;function o0(t){return async(e,r,n,s)=>{let i;const o=new Promise(u=>{i=u});let a=null,l=!1;const c=async()=>{l=!0,n(u=>{a=u,i()}),await o};try{await t(e,r,c),l?(await o,a(null)):s(null)}catch(u){a?a(u):s(u)}}}sn.createAsyncMiddleware=o0;var on={};Object.defineProperty(on,"__esModule",{value:!0});on.createScaffoldMiddleware=void 0;function a0(t){return(e,r,n,s)=>{const i=t[e.method];return i===void 0?n():typeof i=="function"?i(e,r,n,s):(r.result=i,s())}}on.createScaffoldMiddleware=a0;var tr={},gs={};Object.defineProperty(gs,"__esModule",{value:!0});const c0=Ti;function yi(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function l0(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 i=s[e];if(i===void 0)return!1;if(typeof i=="function")yi(i,this,r);else{const o=i.length,a=l0(i);for(let l=0;l"u"&&(n=Xo()),Bn(t,"",0,[],void 0,0,n);var s;try{Qe.length===0?s=JSON.stringify(t,e,r):s=JSON.stringify(t,ea(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ye.length!==0;){var i=Ye.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return s}function gt(t,e,r,n){var s=Object.getOwnPropertyDescriptor(n,r);s.get!==void 0?s.configurable?(Object.defineProperty(n,r,{value:t}),Ye.push([n,r,e,s])):Qe.push([e,r,t]):(n[r]=t,Ye.push([n,r,e]))}function Bn(t,e,r,n,s,i,o){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){gt(yr,t,e,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){gt(yr,t,e,s);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function Yo(t,e,r,n){typeof n>"u"&&(n=Xo());var s=Fn(t,"",0,[],void 0,0,n)||t,i;try{Qe.length===0?i=JSON.stringify(s,e,r):i=JSON.stringify(s,ea(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ye.length!==0;){var o=Ye.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function Fn(t,e,r,n,s,i,o){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){gt(yr,t,e,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){gt(yr,t,e,s);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function m0(t,e){if(e!=="[Circular]")return e}var ps={},Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.errorValues=Ue.errorCodes=void 0;Ue.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}};Ue.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=Ue,r=He,n=e.errorCodes.rpc.internal,s="Unspecified error message. This is a bug, please report it.",i={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(h,f=s){if(Number.isInteger(h)){const g=h.toString();if(d(e.errorValues,g))return e.errorValues[g].message;if(c(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return f}t.getMessageFromCode=o;function a(h){if(!Number.isInteger(h))return!1;const f=h.toString();return!!(e.errorValues[f]||c(h))}t.isValidCode=a;function l(h,{fallbackError:f=i,shouldIncludeStack:g=!1}={}){var E,_;if(!f||!Number.isInteger(f.code)||typeof f.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 k={};if(h&&typeof h=="object"&&!Array.isArray(h)&&d(h,"code")&&a(h.code)){const p=h;k.code=p.code,p.message&&typeof p.message=="string"?(k.message=p.message,d(p,"data")&&(k.data=p.data)):(k.message=o(k.code),k.data={originalError:u(h)})}else{k.code=f.code;const p=(E=h)===null||E===void 0?void 0:E.message;k.message=p&&typeof p=="string"?p:f.message,k.data={originalError:u(h)}}const v=(_=h)===null||_===void 0?void 0:_.stack;return g&&h&&v&&typeof v=="string"&&(k.stack=v),k}t.serializeError=l;function c(h){return h>=-32099&&h<=-32e3}function u(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function d(h,f){return Object.prototype.hasOwnProperty.call(h,f)}})(ps);var an={};Object.defineProperty(an,"__esModule",{value:!0});an.ethErrors=void 0;const ms=He,ra=ps,ne=Ue;an.ethErrors={rpc:{parse:t=>me(ne.errorCodes.rpc.parse,t),invalidRequest:t=>me(ne.errorCodes.rpc.invalidRequest,t),invalidParams:t=>me(ne.errorCodes.rpc.invalidParams,t),methodNotFound:t=>me(ne.errorCodes.rpc.methodNotFound,t),internal:t=>me(ne.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 me(e,t)},invalidInput:t=>me(ne.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>me(ne.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>me(ne.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>me(ne.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>me(ne.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>me(ne.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Lt(ne.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>Lt(ne.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>Lt(ne.errorCodes.provider.unsupportedMethod,t),disconnected:t=>Lt(ne.errorCodes.provider.disconnected,t),chainDisconnected:t=>Lt(ne.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 ms.EthereumProviderError(e,r,n)}}};function me(t,e){const[r,n]=na(e);return new ms.EthereumRpcError(t,r||ra.getMessageFromCode(t),n)}function Lt(t,e){const[r,n]=na(e);return new ms.EthereumProviderError(t,r||ra.getMessageFromCode(t),n)}function na(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=He;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=ps;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=an;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const s=Ue;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})})(Qo);var b0=I&&I.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tr,"__esModule",{value:!0});tr.JsonRpcEngine=void 0;const w0=b0(gs),be=Qo;class $e extends w0.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?r?this._handleBatch(e,r):this._handleBatch(e):r?this._handle(e,r):this._promiseHandle(e)}asMiddleware(){return async(e,r,n,s)=>{try{const[i,o,a]=await $e._runAllMiddleware(e,r,this._middleware);return o?(await $e._runReturnHandlers(a),s(i)):n(async l=>{try{await $e._runReturnHandlers(a)}catch(c){return l(c)}return l()})}catch(i){return s(i)}}}async _handleBatch(e,r){try{const n=await Promise.all(e.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(e){return new Promise(r=>{this._handle(e,(n,s)=>{r(s)})})}async _handle(e,r){if(!e||Array.isArray(e)||typeof e!="object"){const o=new be.EthereumRpcError(be.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof e}`,{request:e});return r(o,{id:void 0,jsonrpc:"2.0",error:o})}if(typeof e.method!="string"){const o=new be.EthereumRpcError(be.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof e.method}`,{request:e});return r(o,{id:e.id,jsonrpc:"2.0",error:o})}const n=Object.assign({},e),s={id:n.id,jsonrpc:n.jsonrpc};let i=null;try{await this._processRequest(n,s)}catch(o){i=o}return i&&(delete s.result,s.error||(s.error=be.serializeError(i))),r(i,s)}async _processRequest(e,r){const[n,s,i]=await $e._runAllMiddleware(e,r,this._middleware);if($e._checkForCompletion(e,r,s),await $e._runReturnHandlers(i),n)throw n}static async _runAllMiddleware(e,r,n){const s=[];let i=null,o=!1;for(const a of n)if([i,o]=await $e._runMiddleware(e,r,a,s),o)break;return[i,o,s.reverse()]}static _runMiddleware(e,r,n,s){return new Promise(i=>{const o=l=>{const c=l||r.error;c&&(r.error=be.serializeError(c)),i([c,!0])},a=l=>{r.error?o(r.error):(l&&(typeof l!="function"&&o(new be.EthereumRpcError(be.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof l}" for request: diff --git a/assets/index-CbiTlW7Y.js b/assets/index-IoMmGEzv.js similarity index 99% rename from assets/index-CbiTlW7Y.js rename to assets/index-IoMmGEzv.js index f13f92f..08d1a43 100644 --- a/assets/index-CbiTlW7Y.js +++ b/assets/index-IoMmGEzv.js @@ -1 +1 @@ -import{aN as M,aO as nn}from"./index-CFrD00kt.js";import{j as rn,s as sn,r as vt,a as _t,b as an,c as on}from"./hooks.module-DHPNJ6uk.js";var Et={},te={},me={};Object.defineProperty(me,"__esModule",{value:!0});me.walletLogo=void 0;const cn=(n,e)=>{let t;switch(n){case"standard":return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 `}};me.walletLogo=cn;var be={},j={},U={};Object.defineProperty(U,"__esModule",{value:!0});U.errorValues=U.standardErrorCodes=void 0;U.standardErrorCodes={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,unsupportedChain:4902}};U.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."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var ye={},$e={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.serialize=n.getErrorCode=n.isValidCode=n.getMessageFromCode=n.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=U,t="Unspecified error message.";n.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function r(d,p=t){if(d&&Number.isInteger(d)){const m=d.toString();if(h(e.errorValues,m))return e.errorValues[m].message;if(c(d))return n.JSON_RPC_SERVER_ERROR_MESSAGE}return p}n.getMessageFromCode=r;function s(d){if(!Number.isInteger(d))return!1;const p=d.toString();return!!(e.errorValues[p]||c(d))}n.isValidCode=s;function i(d){var p;if(typeof d=="number")return d;if(a(d))return(p=d.code)!==null&&p!==void 0?p:d.errorCode}n.getErrorCode=i;function a(d){return typeof d=="object"&&d!==null&&(typeof d.code=="number"||typeof d.errorCode=="number")}function o(d,{shouldIncludeStack:p=!1}={}){const m={};if(d&&typeof d=="object"&&!Array.isArray(d)&&h(d,"code")&&s(d.code)){const B=d;m.code=B.code,B.message&&typeof B.message=="string"?(m.message=B.message,h(B,"data")&&(m.data=B.data)):(m.message=r(m.code),m.data={originalError:l(d)})}else m.code=e.standardErrorCodes.rpc.internal,m.message=f(d,"message")?d.message:t,m.data={originalError:l(d)};return p&&(m.stack=f(d,"stack")?d.stack:void 0),m}n.serialize=o;function c(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function h(d,p){return Object.prototype.hasOwnProperty.call(d,p)}function f(d,p){return typeof d=="object"&&d!==null&&p in d&&typeof d[p]=="string"}})($e);Object.defineProperty(ye,"__esModule",{value:!0});ye.standardErrors=void 0;const v=U,St=$e;ye.standardErrors={rpc:{parse:n=>C(v.standardErrorCodes.rpc.parse,n),invalidRequest:n=>C(v.standardErrorCodes.rpc.invalidRequest,n),invalidParams:n=>C(v.standardErrorCodes.rpc.invalidParams,n),methodNotFound:n=>C(v.standardErrorCodes.rpc.methodNotFound,n),internal:n=>C(v.standardErrorCodes.rpc.internal,n),server:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=n;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return C(e,n)},invalidInput:n=>C(v.standardErrorCodes.rpc.invalidInput,n),resourceNotFound:n=>C(v.standardErrorCodes.rpc.resourceNotFound,n),resourceUnavailable:n=>C(v.standardErrorCodes.rpc.resourceUnavailable,n),transactionRejected:n=>C(v.standardErrorCodes.rpc.transactionRejected,n),methodNotSupported:n=>C(v.standardErrorCodes.rpc.methodNotSupported,n),limitExceeded:n=>C(v.standardErrorCodes.rpc.limitExceeded,n)},provider:{userRejectedRequest:n=>$(v.standardErrorCodes.provider.userRejectedRequest,n),unauthorized:n=>$(v.standardErrorCodes.provider.unauthorized,n),unsupportedMethod:n=>$(v.standardErrorCodes.provider.unsupportedMethod,n),disconnected:n=>$(v.standardErrorCodes.provider.disconnected,n),chainDisconnected:n=>$(v.standardErrorCodes.provider.chainDisconnected,n),unsupportedChain:n=>$(v.standardErrorCodes.provider.unsupportedChain,n),custom:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:t,data:r}=n;if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string');return new It(e,t,r)}}};function C(n,e){const[t,r]=Ct(e);return new kt(n,t||(0,St.getMessageFromCode)(n),r)}function $(n,e){const[t,r]=Ct(e);return new It(n,t||(0,St.getMessageFromCode)(n),r)}function Ct(n){if(n){if(typeof n=="string")return[n];if(typeof n=="object"&&!Array.isArray(n)){const{message:e,data:t}=n;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,t]}}return[]}class kt extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string.');super(t),this.code=e,r!==void 0&&(this.data=r)}}class It extends kt{constructor(e,t,r){if(!dn(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function dn(n){return Number.isInteger(n)&&n>=1e3&&n<=4999}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.standardErrors=n.standardErrorCodes=void 0;var e=U;Object.defineProperty(n,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});var t=ye;Object.defineProperty(n,"standardErrors",{enumerable:!0,get:function(){return t.standardErrors}})})(j);var we={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.isErrorResponse=void 0;function ln(n){return n.errorMessage!==void 0}Q.isErrorResponse=ln;var K={};Object.defineProperty(K,"__esModule",{value:!0});K.LIB_VERSION=void 0;K.LIB_VERSION="4.0.4";Object.defineProperty(we,"__esModule",{value:!0});we.serializeError=void 0;const un=Q,hn=K,gn=U,pn=$e;function fn(n,e){const t=(0,pn.serialize)(mn(n),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",hn.LIB_VERSION),r.searchParams.set("code",t.code.toString());const s=bn(t.data,e);return s&&r.searchParams.set("method",s),r.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:r.href})}we.serializeError=fn;function mn(n){return typeof n=="string"?{message:n,code:gn.standardErrorCodes.rpc.internal}:(0,un.isErrorResponse)(n)?Object.assign(Object.assign({},n),{message:n.errorMessage,code:n.errorCode,data:{method:n.method}}):n}function bn(n,e){const t=n==null?void 0:n.method;if(t)return t;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}var _={};Object.defineProperty(_,"__esModule",{value:!0});_.RegExpString=_.IntNumber=_.BigIntString=_.AddressString=_.HexString=_.OpaqueType=void 0;function ne(){return n=>n}_.OpaqueType=ne;_.HexString=ne();_.AddressString=ne();_.BigIntString=ne();function yn(n){return Math.floor(n)}_.IntNumber=yn;_.RegExpString=ne();var u={};Object.defineProperty(u,"__esModule",{value:!0});u.areAddressArraysEqual=u.getFavicon=u.range=u.isBigNumber=u.ensureParsedJSONObject=u.ensureBigInt=u.ensureRegExpString=u.ensureIntNumber=u.ensureBuffer=u.ensureAddressString=u.ensureEvenLengthHexString=u.ensureHexString=u.isHexString=u.prepend0x=u.strip0x=u.has0xPrefix=u.hexStringFromIntNumber=u.intNumberFromHexString=u.bigIntStringFromBigInt=u.hexStringFromBuffer=u.hexStringToUint8Array=u.uint8ArrayToHex=u.randomBytesHex=void 0;const q=j,I=_,Mt=/^[0-9]*$/,Lt=/^[a-f0-9]*$/;function wn(n){return At(crypto.getRandomValues(new Uint8Array(n)))}u.randomBytesHex=wn;function At(n){return[...n].map(e=>e.toString(16).padStart(2,"0")).join("")}u.uint8ArrayToHex=At;function vn(n){return new Uint8Array(n.match(/.{1,2}/g).map(e=>parseInt(e,16)))}u.hexStringToUint8Array=vn;function _n(n,e=!1){const t=n.toString("hex");return(0,I.HexString)(e?`0x${t}`:t)}u.hexStringFromBuffer=_n;function En(n){return(0,I.BigIntString)(n.toString(10))}u.bigIntStringFromBigInt=En;function Sn(n){return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}u.intNumberFromHexString=Sn;function Cn(n){return(0,I.HexString)(`0x${BigInt(n).toString(16)}`)}u.hexStringFromIntNumber=Cn;function Fe(n){return n.startsWith("0x")||n.startsWith("0X")}u.has0xPrefix=Fe;function ve(n){return Fe(n)?n.slice(2):n}u.strip0x=ve;function Rt(n){return Fe(n)?`0x${n.slice(2)}`:`0x${n}`}u.prepend0x=Rt;function re(n){if(typeof n!="string")return!1;const e=ve(n).toLowerCase();return Lt.test(e)}u.isHexString=re;function xt(n,e=!1){if(typeof n=="string"){const t=ve(n).toLowerCase();if(Lt.test(t))return(0,I.HexString)(e?`0x${t}`:t)}throw q.standardErrors.rpc.invalidParams(`"${String(n)}" is not a hexadecimal string`)}u.ensureHexString=xt;function se(n,e=!1){let t=xt(n,!1);return t.length%2===1&&(t=(0,I.HexString)(`0${t}`)),e?(0,I.HexString)(`0x${t}`):t}u.ensureEvenLengthHexString=se;function kn(n){if(typeof n=="string"){const e=ve(n).toLowerCase();if(re(e)&&e.length===40)return(0,I.AddressString)(Rt(e))}throw q.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(n)}`)}u.ensureAddressString=kn;function In(n){if(Buffer.isBuffer(n))return n;if(typeof n=="string"){if(re(n)){const e=se(n,!1);return Buffer.from(e,"hex")}return Buffer.from(n,"utf8")}throw q.standardErrors.rpc.invalidParams(`Not binary data: ${String(n)}`)}u.ensureBuffer=In;function Pt(n){if(typeof n=="number"&&Number.isInteger(n))return(0,I.IntNumber)(n);if(typeof n=="string"){if(Mt.test(n))return(0,I.IntNumber)(Number(n));if(re(n))return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureIntNumber=Pt;function Mn(n){if(n instanceof RegExp)return(0,I.RegExpString)(n.toString());throw q.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(n)}`)}u.ensureRegExpString=Mn;function Ln(n){if(n!==null&&(typeof n=="bigint"||Nt(n)))return BigInt(n.toString(10));if(typeof n=="number")return BigInt(Pt(n));if(typeof n=="string"){if(Mt.test(n))return BigInt(n);if(re(n))return BigInt(se(n,!0))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureBigInt=Ln;function An(n){if(typeof n=="string")return JSON.parse(n);if(typeof n=="object")return n;throw q.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(n)}`)}u.ensureParsedJSONObject=An;function Nt(n){if(n==null||typeof n.constructor!="function")return!1;const{constructor:e}=n;return typeof e.config=="function"&&typeof e.EUCLID=="number"}u.isBigNumber=Nt;function Rn(n,e){return Array.from({length:e-n},(t,r)=>n+r)}u.range=Rn;function xn(){const n=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:t}=document.location,r=n?n.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?e+r:`${e}//${t}${r}`}u.getFavicon=xn;function Pn(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}u.areAddressArraysEqual=Pn;var P={},_e={},Ee={},y={};Object.defineProperty(y,"__esModule",{value:!0});y.decryptContent=y.encryptContent=y.importKeyFromHexString=y.exportKeyToHexString=y.decrypt=y.encrypt=y.deriveSharedSecret=y.generateKeyPair=void 0;const Tt=u;async function Nn(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}y.generateKeyPair=Nn;async function Tn(n,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}y.deriveSharedSecret=Tn;async function jt(n,e){const t=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},n,new TextEncoder().encode(e));return{iv:t,cipherText:r}}y.encrypt=jt;async function Ot(n,{iv:e,cipherText:t}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},n,t);return new TextDecoder().decode(r)}y.decrypt=Ot;function Dt(n){switch(n){case"public":return"spki";case"private":return"pkcs8"}}async function jn(n,e){const t=Dt(n),r=await crypto.subtle.exportKey(t,e);return(0,Tt.uint8ArrayToHex)(new Uint8Array(r))}y.exportKeyToHexString=jn;async function On(n,e){const t=Dt(n),r=(0,Tt.hexStringToUint8Array)(e).buffer;return await crypto.subtle.importKey(t,r,{name:"ECDH",namedCurve:"P-256"},!0,n==="private"?["deriveKey"]:[])}y.importKeyFromHexString=On;async function Dn(n,e){const t=JSON.stringify(n,(r,s)=>{if(!(s instanceof Error))return s;const i=s;return Object.assign(Object.assign({},i.code?{code:i.code}:{}),{message:i.message})});return jt(e,t)}y.encryptContent=Dn;async function Wn(n,e){return JSON.parse(await Ot(e,n))}y.decryptContent=Wn;var O={};Object.defineProperty(O,"__esModule",{value:!0});O.ScopedLocalStorage=void 0;class fe{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;rlocalStorage.removeItem(r))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new fe("CBWSDK").clear(),new fe("walletlink").clear()}}O.ScopedLocalStorage=fe;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.SCWKeyManager=void 0;const oe=y,Un=O,De={storageKey:"ownPrivateKey",keyType:"private"},We={storageKey:"ownPublicKey",keyType:"public"},Ue={storageKey:"peerPublicKey",keyType:"public"};class Bn{constructor(){this.storage=new Un.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(Ue,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(We.storageKey),this.storage.removeItem(De.storageKey),this.storage.removeItem(Ue.storageKey)}async generateKeyPair(){const e=await(0,oe.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(De,e.privateKey),await this.storeKey(We,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(De)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(We)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Ue)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,oe.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,oe.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const r=await(0,oe.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,r)}}Ee.SCWKeyManager=Bn;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.SCWStateManager=void 0;const Hn=O,Qe="accounts",Xe="activeChain",et="availableChains",tt="walletCapabilities";class Kn{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,r;this.storage=new Hn.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(et),this._walletCapabilities=this.loadItemFromStorage(tt);const s=this.loadItemFromStorage(Qe),i=this.loadItemFromStorage(Xe);s&&this.updateListener.onAccountsUpdate({accounts:s,source:"storage"}),i&&this.updateListener.onChainUpdate({chain:i,source:"storage"}),this._accounts=s||[],this._activeChain=i||{id:(r=(t=e.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(Qe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const r=(t=this.availableChains)===null||t===void 0?void 0:t.find(s=>s.id===e);return r?(r===this._activeChain||(this._activeChain=r,this.storeItemToStorage(Xe,r),this.updateListener.onChainUpdate({chain:r,source:"wallet"})),!0):!1}updateAvailableChains(e){if(!e||Object.keys(e).length===0)return;const t=Object.entries(e).map(([r,s])=>({id:Number(r),rpcUrl:s}));this.availableChains=t,this.storeItemToStorage(et,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(tt,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}}Se.SCWStateManager=Kn;Object.defineProperty(_e,"__esModule",{value:!0});_e.SCWSigner=void 0;const qn=Ee,$n=Se,ce=j,nt=u,de=y;class Fn{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new qn.SCWKeyManager,this.stateManager=new $n.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const r=await(0,de.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(r);const s=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},s);const i=s.result;if("error"in i)throw i.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(t!==void 0){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const r=await this.sendEncryptedRequest(e),s=await this.decryptResponseMessage(r);this.updateInternalState(e,s);const i=s.result;if("error"in i)throw i.error;return i.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const r=e.params;if(!r||!(!((t=r[0])===null||t===void 0)&&t.chainId))throw ce.standardErrors.rpc.invalidParams();const s=(0,nt.ensureIntNumber)(r[0].chainId);return this.stateManager.switchChain(s)?null:void 0}case"wallet_getCapabilities":{const r=this.stateManager.walletCapabilities;if(!r)throw ce.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return r}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw ce.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const r=await(0,de.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),s=await this.createRequestMessage({encrypted:r});return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(e){const t=await(0,de.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw ce.standardErrors.provider.unauthorized("Invalid session");return(0,de.decryptContent)(t.encrypted,r)}updateInternalState(e,t){var r,s;const i=(r=t.data)===null||r===void 0?void 0:r.chains;i&&this.stateManager.updateAvailableChains(i);const a=(s=t.data)===null||s===void 0?void 0:s.capabilities;a&&this.stateManager.updateWalletCapabilities(a);const o=t.result;if(!("error"in o))switch(e.method){case"eth_requestAccounts":{const c=o.value;this.stateManager.updateAccounts(c);break}case"wallet_switchEthereumChain":{if(o.value!==null)return;const c=e.params,l=(0,nt.ensureIntNumber)(c[0].chainId);this.stateManager.switchChain(l);break}}}}_e.SCWSigner=Fn;var Ce={};const Vn=rn;function Wt(n){return Buffer.allocUnsafe(n).fill(0)}function zn(n){return n.toString(2).length}function Ut(n,e){let t=n.toString(16);t.length%2!==0&&(t="0"+t);const r=t.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;r.length"u")throw new Error("Not an array?");if(t=Ft(n),t!=="dynamic"&&t!==0&&e.length>t)throw new Error("Elements exceed array size: "+t);s=[],n=n.slice(0,n.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(R(n,e[i]));if(t==="dynamic"){var a=R("uint256",e.length);s.unshift(a)}return Buffer.concat(s)}else{if(n==="bytes")return e=new Buffer(e),s=Buffer.concat([R("uint256",e.length),e]),e.length%32!==0&&(s=Buffer.concat([s,E.zeros(32-e.length%32)])),s;if(n.startsWith("bytes")){if(t=G(n),t<1||t>32)throw new Error("Invalid bytes width: "+t);return E.setLengthRight(e,32)}else if(n.startsWith("uint")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return E.bufferBEFromBigInt(r,32)}else if(n.startsWith("int")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied int exceeds width: "+t+" vs "+o);const c=E.twosFromBigInt(r,256);return E.bufferBEFromBigInt(c,32)}else if(n.startsWith("ufixed")){if(t=rt(n),r=H(e),r<0)throw new Error("Supplied ufixed is negative");return R("uint256",r*BigInt(2)**BigInt(t[1]))}else if(n.startsWith("fixed"))return t=rt(n),R("int256",H(e)*BigInt(2)**BigInt(t[1]))}throw new Error("Unsupported or invalid type: "+n)}function Xn(n){return n==="string"||n==="bytes"||Ft(n)==="dynamic"}function er(n){return n.lastIndexOf("]")===n.length-1}function tr(n,e){var t=[],r=[],s=32*n.length;for(var i in n){var a=$t(n[i]),o=e[i],c=R(a,o);Xn(a)?(t.push(R("uint256",s)),r.push(c),s+=c.length):t.push(c)}return Buffer.concat(t.concat(r))}function Vt(n,e){if(n.length!==e.length)throw new Error("Number of types are not matching the values");for(var t,r,s=[],i=0;i32)throw new Error("Invalid bytes width: "+t);s.push(E.setLengthRight(o,t))}else if(a.startsWith("uint")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+c);s.push(E.bufferBEFromBigInt(r,t/8))}else if(a.startsWith("int")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied int exceeds width: "+t+" vs "+c);const l=E.twosFromBigInt(r,t);s.push(E.bufferBEFromBigInt(l,t/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(s)}function nr(n,e){return E.keccak(Vt(n,e))}var rr={rawEncode:tr,solidityPack:Vt,soliditySHA3:nr};const A=qt,ee=rr,zt={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"]},Be={encodeData(n,e,t,r=!0){const s=["bytes32"],i=[this.hashType(n,t)];if(r){const a=(o,c,l)=>{if(t[c]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":A.keccak(this.encodeData(c,l,t,r))];if(l===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",A.keccak(l)];if(c==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",A.keccak(l)];if(c.lastIndexOf("]")===c.length-1){const h=c.slice(0,c.lastIndexOf("[")),f=l.map(d=>a(o,h,d));return["bytes32",A.keccak(ee.rawEncode(f.map(([d])=>d),f.map(([,d])=>d)))]}return[c,l]};for(const o of t[n]){const[c,l]=a(o.name,o.type,e[o.name]);s.push(c),i.push(l)}}else for(const a of t[n]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")s.push("bytes32"),o=A.keccak(o),i.push(o);else if(a.type==="string")s.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=A.keccak(o),i.push(o);else if(t[a.type]!==void 0)s.push("bytes32"),o=A.keccak(this.encodeData(a.type,o,t,r)),i.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(a.type),i.push(o)}}return ee.rawEncode(s,i)},encodeType(n,e){let t="",r=this.findTypeDependencies(n,e).filter(s=>s!==n);r=[n].concat(r.sort());for(const s of r){if(!e[s])throw new Error("No type definition specified: "+s);t+=s+"("+e[s].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return t},findTypeDependencies(n,e,t=[]){if(n=n.match(/^\w*/)[0],t.includes(n)||e[n]===void 0)return t;t.push(n);for(const r of e[n])for(const s of this.findTypeDependencies(r.type,e,t))!t.includes(s)&&t.push(s);return t},hashStruct(n,e,t,r=!0){return A.keccak(this.encodeData(n,e,t,r))},hashType(n,e){return A.keccak(this.encodeType(n,e))},sanitizeData(n){const e={};for(const t in zt.properties)n[t]&&(e[t]=n[t]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(n,e=!0){const t=this.sanitizeData(n),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",t.domain,t.types,e)),t.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(t.primaryType,t.message,t.types,e)),A.keccak(Buffer.concat(r))}};var sr={TYPED_MESSAGE_SCHEMA:zt,TypedDataUtils:Be,hashForSignTypedDataLegacy:function(n){return ir(n.data)},hashForSignTypedData_v3:function(n){return Be.hash(n.data,!1)},hashForSignTypedData_v4:function(n){return Be.hash(n.data)}};function ir(n){const e=new Error("Expect argument to be non-empty array");if(typeof n!="object"||!n.length)throw e;const t=n.map(function(i){return i.type==="bytes"?A.toBuffer(i.value):i.value}),r=n.map(function(i){return i.type}),s=n.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return ee.soliditySHA3(["bytes32","bytes32"],[ee.soliditySHA3(new Array(n.length).fill("string"),s),ee.soliditySHA3(r,t)])}var N={};Object.defineProperty(N,"__esModule",{value:!0});N.APP_VERSION_KEY=N.LOCAL_STORAGE_ADDRESSES_KEY=N.WALLET_USER_NAME_KEY=void 0;N.WALLET_USER_NAME_KEY="walletUsername";N.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";N.APP_VERSION_KEY="AppVersion";var ie={};Object.defineProperty(ie,"__esModule",{value:!0});ie.RelayEventManager=void 0;const ar=u;class or{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,ar.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}ie.RelayEventManager=or;var Ie={},Me={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.WalletLinkCipher=void 0;const le=u;class cr{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},s,i.encode(e)),o=16,c=a.slice(a.byteLength-o),l=a.slice(0,a.byteLength-o),h=new Uint8Array(c),f=new Uint8Array(l),d=new Uint8Array([...r,...h,...f]);return(0,le.uint8ArrayToHex)(d)}async decrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");return new Promise((r,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,le.hexStringToUint8Array)(e),o=a.slice(0,12),c=a.slice(12,28),l=a.slice(28),h=new Uint8Array([...l,...c]),f={name:"AES-GCM",iv:new Uint8Array(o)};try{const d=await window.crypto.subtle.decrypt(f,i,h),p=new TextDecoder;r(p.decode(d))}catch(d){s(d)}})()})}}Le.WalletLinkCipher=cr;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.WalletLinkHTTP=void 0;class dr{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const s=`${t}:${r}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(t=>fetch(`${this.linkAPIUrl}/events/${t.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(t=>console.error("Unabled to mark event as failed:",t))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:s}=await t.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=r==null?void 0:r.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}}Ae.WalletLinkHTTP=dr;var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.WalletLinkWebSocket=Y.ConnectionState=void 0;var Z;(function(n){n[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED"})(Z||(Y.ConnectionState=Z={}));class lr{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,t)=>{var r;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){t(i);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,Z.CONNECTING),s.onclose=i=>{var a;this.clearWebSocket(),t(new Error(`websocket error ${i.code}: ${i.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.DISCONNECTED)},s.onopen=i=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},s.onmessage=i=>{var a,o;if(i.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(i.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Z.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch{}}}sendData(e){const{webSocket:t}=this;if(!t){this.pendingData.push(e),this.connect();return}t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}Y.WalletLinkWebSocket=lr;Object.defineProperty(Me,"__esModule",{value:!0});Me.WalletLinkConnection=void 0;const st=N,ur=Le,hr=Ae,ue=Y,F=_,it=1e4,gr=6e4;class pr{constructor({session:e,linkAPIUrl:t,listener:r,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,F.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,l)=>{const h=a[l];h!==void 0&&c(h)})},this.handleDestroyed=a=>{var o;a==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async a=>{var o;{const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.accountUpdated(c)}},this.handleMetadataUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,l)}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(st.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(st.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(a),h=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.chainUpdated(l,h)}},this.session=e,this.cipher=new ur.WalletLinkCipher(e.secret),this.listener=r;const i=new ue.WalletLinkWebSocket(`${t}/rpc`,s);i.setConnectionStateListener(async a=>{let o=!1;switch(a){case ue.ConnectionState.DISCONNECTED:if(!this.destroyed){const c=async()=>{await new Promise(l=>setTimeout(l,5e3)),this.destroyed||i.connect().catch(()=>{c()})};c()}break;case ue.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),o=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},it),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case ue.ConnectionState.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(a=>{var o;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const c=a.type==="IsLinkedOK"?a.linked:void 0;this.linked=c||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((o=this.requestResolutions.get(a.id))===null||o===void 0||o(a))}),this.ws=i,this.http=new hr.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&((t=this.onceConnected)===null||t===void 0||t.call(this))}setOnceConnected(e){return new Promise(t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&((t=this.onceLinked)===null||t===void 0||t.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(e)}setOnceLinked(e){return new Promise(t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}})}async handleIncomingEvent(e){var t;if(!(e.type!=="Event"||e.event!=="Web3Response")){const r=await this.cipher.decrypt(e.data),s=JSON.parse(r);if(s.type!=="WEB3_RESPONSE")return;(t=this.listener)===null||t===void 0||t.handleWeb3ResponseMessage(s)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(t=>this.handleIncomingEvent(t))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(r);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,t,r=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:r};return this.setOnceLinked(async()=>{const a=await this.makeRequest(i);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>it*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,t=gr){const r=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${r} timed out`))},t)}),new Promise(i=>{this.requestResolutions.set(r,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(r)})})])}async authenticate(){const e={type:"HostSession",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if(t.type==="Fail")throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Me.WalletLinkConnection=pr;var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.WalletLinkSession=void 0;const fr=sn,at=u,ot="session:id",ct="session:secret",dt="session:linked";class Ve{constructor(e,t,r,s){this._storage=e,this._id=t||(0,at.randomBytesHex)(16),this._secret=r||(0,at.randomBytesHex)(32),this._key=new fr.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const t=e.getItem(ot),r=e.getItem(dt),s=e.getItem(ct);return t&&s?new Ve(e,t,s,r==="1"):null}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(ot,this._id),this._storage.setItem(ct,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(dt,this._linked?"1":"0")}}Re.WalletLinkSession=Ve;var S={};Object.defineProperty(S,"__esModule",{value:!0});S.isDarkMode=S.isMobileWeb=S.getLocation=S.createQrUrl=void 0;function mr(n,e,t,r,s,i){const a=r?"parent-id":"id",o=new URLSearchParams({[a]:n,secret:e,server:t,v:s,chainId:i.toString()}).toString();return`${t}/#/link?${o}`}S.createQrUrl=mr;function br(){try{return window.frameElement!==null}catch{return!1}}function yr(){try{return br()&&window.top?window.top.location:window.location}catch{return window.location}}S.getLocation=yr;function wr(){var n;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((n=window==null?void 0:window.navigator)===null||n===void 0?void 0:n.userAgent)}S.isMobileWeb=wr;function vr(){var n,e;return(e=(n=window==null?void 0:window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}S.isDarkMode=vr;var xe={},ae={},ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var _r=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ae,"__esModule",{value:!0});ae.injectCssReset=void 0;const Er=_r(ze);function Sr(){const n=document.createElement("style");n.type="text/css",n.appendChild(document.createTextNode(Er.default)),document.documentElement.appendChild(n)}ae.injectCssReset=Sr;var Ze={},Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(n){var e=M&&M.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(n,"__esModule",{value:!0}),n.SnackbarInstance=n.SnackbarContainer=n.Snackbar=void 0;const t=e(vt),r=_t,s=an,i=S,a=e(Ge),o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",c="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class l{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,i.isDarkMode)()}attach(p){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",p.appendChild(this.root),this.render()}presentItem(p){const m=this.nextItemKey++;return this.items.set(m,p),this.render(),()=>{this.items.delete(m),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,r.render)((0,r.h)("div",null,(0,r.h)(n.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([p,m])=>(0,r.h)(n.SnackbarInstance,Object.assign({},m,{key:p}))))),this.root)}}n.Snackbar=l;const h=d=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-container")},(0,r.h)("style",null,a.default),(0,r.h)("div",{class:"-cbwsdk-snackbar"},d.children));n.SnackbarContainer=h;const f=({autoExpand:d,message:p,menuItems:m})=>{const[B,Xt]=(0,s.useState)(!0),[Oe,Je]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const L=[window.setTimeout(()=>{Xt(!1)},1),window.setTimeout(()=>{Je(!0)},1e4)];return()=>{L.forEach(window.clearTimeout)}});const en=()=>{Je(!Oe)};return(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance",B&&"-cbwsdk-snackbar-instance-hidden",Oe&&"-cbwsdk-snackbar-instance-expanded")},(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:en},(0,r.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},p),(0,r.h)("div",{class:"-gear-container"},!Oe&&(0,r.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,r.h)("img",{src:c,class:"-gear-icon",title:"Expand"}))),m&&m.length>0&&(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},m.map((L,tn)=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:L.onClick,key:tn},(0,r.h)("svg",{width:L.svgWidth,height:L.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("path",{"fill-rule":L.defaultFillRule,"clip-rule":L.defaultClipRule,d:L.path,fill:"#AAAAAA"})),(0,r.h)("span",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item-info",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},L.info)))))};n.SnackbarInstance=f})(Ze);Object.defineProperty(xe,"__esModule",{value:!0});xe.WalletLinkRelayUI=void 0;const Cr=ae,kr=Ze;class Ir{constructor(){this.attached=!1,this.snackbar=new kr.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,Cr.injectCssReset)()}showConnecting(e){let t;return e.isUnlinkedErrorState?t={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:t={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}}xe.WalletLinkRelayUI=Ir;var Pe={},Ne={},Ye={};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var Zt=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.RedirectDialog=void 0;const Mr=Zt(vt),x=_t,Lr=ae,Ar=Ze,Rr=S,xr=Zt(Ye);class Pr{constructor(){this.root=null,this.darkMode=(0,Rr.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Lr.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,x.render)(null,this.root),e&&(0,x.render)((0,x.h)(Nr,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}Ne.RedirectDialog=Pr;const Nr=({title:n,buttonText:e,darkMode:t,onButtonClick:r,onDismiss:s})=>{const i=t?"dark":"light";return(0,x.h)(Ar.SnackbarContainer,{darkMode:t},(0,x.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,x.h)("style",null,xr.default),(0,x.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,x.h)("div",{class:(0,Mr.default)("-cbwsdk-redirect-dialog-box",i)},(0,x.h)("p",null,n),(0,x.h)("button",{onClick:r},e))))};var T={};Object.defineProperty(T,"__esModule",{value:!0});T.CBW_MOBILE_DEEPLINK_URL=T.WALLETLINK_URL=T.CB_KEYS_URL=void 0;T.CB_KEYS_URL="https://keys.coinbase.com/connect";T.WALLETLINK_URL="https://www.walletlink.org";T.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.WLMobileRelayUI=void 0;const Tr=Ne,jr=S,Or=T;class Dr{constructor(){this.attached=!1,this.redirectDialog=new Tr.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL(Or.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,jr.getLocation)().href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}Pe.WLMobileRelayUI=Dr;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.WalletLinkRelay=void 0;const Wr=Me,Ur=N,Br=ie,He=Re,V=Q,Hr=S,Kr=xe,lt=Pe,qr=j,b=u,$r=O;class W{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,Hr.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(Ur.LOCAL_STORAGE_ADDRESSES_KEY);if(i&&(this._session.linked=i),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!i&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(i,a)=>{this.storage.setItem(i,a)},this.chainUpdated=(i,a)=>{this.chainCallbackParams.chainId===i&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:i,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(i,a))},this.accountUpdated=i=>{this.accountsCallback&&this.accountsCallback([i]),W.accountRequestCallbackIds.size>0&&(Array.from(W.accountRequestCallbackIds.values()).forEach(a=>{const o={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[i]}};this.invokeCallback(Object.assign(Object.assign({},o),{id:a}))}),W.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:r,connection:s}=this.subscribe();this._session=t,this.connection=s,this.relayEventManager=new Br.RelayEventManager,this.ui=r}subscribe(){const e=He.WalletLinkSession.load(this.storage)||new He.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,r=new Wr.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),s=this.isMobileWeb?new lt.WLMobileRelayUI:new Kr.WalletLinkRelayUI;return r.connect(),{session:e,ui:s,connection:r}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{this.connection.destroy();const e=He.WalletLinkSession.load(this.storage);(e==null?void 0:e.id)===this._session.id&&$r.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(e=>{})}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,r,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),signature:(0,b.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,b.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,b.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,b.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const r=(0,b.randomBytesHex)(8),s=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i),t==null||t()};return new Promise((i,a)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(t==null||t(),(0,V.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(r,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const r={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",r,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r.id,response:{method:t.method,errorMessage:s.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof lt.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e){const{response:t}=e;if(t.method==="requestEthereumAccounts"){W.accountRequestCallbackIds.forEach(r=>this.invokeCallback(Object.assign(Object.assign({},e),{id:r}))),W.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,r){var s;const i=(s=r==null?void 0:r.message)!==null&&s!==void 0?s:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,b.randomBytesHex)(8);return new Promise((r,s)=>{this.relayEventManager.callbacks.set(t,i=>{if((0,V.isErrorResponse)(i))return s(new Error(i.errorMessage));r(i)}),W.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,r,s,i,a){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:s,image:i},chainId:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,V.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}addEthereumChain(e,t,r,s,i,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:s,chainName:i,iconUrls:r,nativeCurrency:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,V.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},s=(0,b.randomBytesHex)(8);return new Promise((i,a)=>{this.relayEventManager.callbacks.set(s,o=>{if((0,V.isErrorResponse)(o)&&o.errorCode)return a(qr.standardErrors.provider.custom({code:o.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,V.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(s,r)})}}Ie.WalletLinkRelay=W;W.accountRequestCallbackIds=new Set;var Fr=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.WalletLinkSigner=void 0;const Ke=Fr(sr),ut=N,Vr=ie,D=Q,zr=Ie,ht=T,w=j,g=u,Zr=O,qe="DefaultChainId",gt="DefaultJsonRpcUrl";class Gr{constructor(e){var t,r;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:s,appLogoUrl:i}=e.metadata;this._appName=s,this._appLogoUrl=i,this._storage=new Zr.ScopedLocalStorage("walletlink",ht.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Vr.RelayEventManager,this._jsonRpcUrlFromOpts="";const a=this._storage.getItem(ut.LOCAL_STORAGE_ADDRESSES_KEY);if(a){const c=a.split(" ");c[0]!==""&&(this._addresses=c.map(l=>(0,g.ensureAddressString)(l)),(t=this.updateListener)===null||t===void 0||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(qe)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:r}=e.getWalletLinkSession();return{id:t,secret:r}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(gt))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(gt,e)}updateProviderInfo(e,t){var r;this.jsonRpcUrl=e;const s=this.getChainId();this._storage.setItem(qe,t.toString(10)),((0,g.ensureIntNumber)(t)!==s||!this.hasMadeFirstChainChangedEmission)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,s,i,a){const c=await this.initializeRelay().watchAsset(e,t,r,s,i,a==null?void 0:a.toString());return(0,D.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(e,t,r,s,i,a){var o,c;if((0,g.ensureIntNumber)(e)===this.getChainId())return!1;const l=this.initializeRelay();this._isAuthorized()||await l.requestEthereumAccounts();const h=await l.addEthereumChain(e.toString(),t,i,r,s,a);return(0,D.isErrorResponse)(h)?!1:(((o=h.result)===null||o===void 0?void 0:o.isApproved)===!0&&this.updateProviderInfo(t[0],e),((c=h.result)===null||c===void 0?void 0:c.isApproved)===!0)}async switchEthereumChain(e){const r=await this.initializeRelay().switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,D.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===w.standardErrorCodes.provider.unsupportedChain?w.standardErrors.provider.unsupportedChain():w.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const s=r.result;s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch(t=>{throw t})}catch(t){return Promise.reject(t)}}async _request(e){if(!e||typeof e!="object"||Array.isArray(e))throw w.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if(typeof t!="string"||t.length===0)throw w.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw w.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=r===void 0?[]:r,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:s,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var r;if(!Array.isArray(e))throw new Error("addresses is not an array");const s=e.map(i=>(0,g.ensureAddressString)(i));JSON.stringify(s)!==JSON.stringify(this._addresses)&&(this._addresses=s,(r=this.updateListener)===null||r===void 0||r.onAccountsUpdate({accounts:s,source:"wallet"}),this._storage.setItem(ut.LOCAL_STORAGE_ADDRESSES_KEY,s.join(" ")))}_sendRequestAsync(e){return new Promise((t,r)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return t({jsonrpc:"2.0",id:e.id,result:s})}catch(s){return r(s)}this._handleAsynchronousMethods(e).then(s=>s&&t(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>r(s))})}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(e){try{const t=(0,g.ensureAddressString)(e);return this._addresses.map(s=>(0,g.ensureAddressString)(s)).includes(t)}catch{}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,g.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);const r=e.to?(0,g.ensureAddressString)(e.to):null,s=e.value!=null?(0,g.ensureBigInt)(e.value):BigInt(0),i=e.data?(0,g.ensureBuffer)(e.data):Buffer.alloc(0),a=e.nonce!=null?(0,g.ensureIntNumber)(e.nonce):null,o=e.gasPrice!=null?(0,g.ensureBigInt)(e.gasPrice):null,c=e.maxFeePerGas!=null?(0,g.ensureBigInt)(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?(0,g.ensureBigInt)(e.maxPriorityFeePerGas):null,h=e.gas!=null?(0,g.ensureBigInt)(e.gas):null,f=e.chainId?(0,g.ensureIntNumber)(e.chainId):this.getChainId();return{fromAddress:t,toAddress:r,weiValue:s,data:i,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:l,gasLimit:h,chainId:f}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw w.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw w.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,s){this._ensureKnownAddress(t);try{const a=await this.initializeRelay().signEthereumMessage(e,t,r,s);if((0,D.isErrorResponse)(a))throw new Error(a.errorMessage);return{jsonrpc:"2.0",id:0,result:a.result}}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied message signature"):i}}async _ethereumAddressFromSignedMessage(e,t,r){const i=await this.initializeRelay().ethereumAddressFromSignedMessage(e,t,r);if((0,D.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,g.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(qe);if(!e)return(0,g.ensureIntNumber)(1);const t=parseInt(e,10);return(0,g.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{if(e=await this.initializeRelay().requestEthereumAccounts(),(0,D.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(t){throw typeof t.message=="string"&&t.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied account authorization"):t}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_sendRawTransaction(e){const t=(0,g.ensureBuffer)(e[0]),s=await this.initializeRelay().submitEthereumTransaction(t,this.getChainId());if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signAndSubmitEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,g.ensureParsedJSONObject)(e[0]),r=(0,g.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const s=Ke.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(s,r,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v3({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v4({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _wallet_addEthereumChain(e){var t,r,s,i;const a=e[0];if(((t=a.rpcUrls)===null||t===void 0?void 0:t.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!a.chainName||a.chainName.trim()==="")throw w.standardErrors.rpc.invalidParams("chainName is a required field");if(!a.nativeCurrency)throw w.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(a.chainId,16);return await this.addEthereumChain(o,(r=a.rpcUrls)!==null&&r!==void 0?r:[],(s=a.blockExplorerUrls)!==null&&s!==void 0?s:[],a.chainName,(i=a.iconUrls)!==null&&i!==void 0?i:[],a.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw w.standardErrors.rpc.invalidParams("Type is required");if((t==null?void 0:t.type)!=="ERC20")throw w.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(t!=null&&t.options))throw w.standardErrors.rpc.invalidParams("Options are required");if(!(t!=null&&t.options.address))throw w.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:s,symbol:i,image:a,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,s,i,o,a,r)}}initializeRelay(){if(!this._relay){const e=new zr.WalletLinkRelay({linkAPIUrl:ht.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((t,r)=>this._setAddresses(t,r)),e.setChainCallback((t,r)=>{this.updateProviderInfo(r,parseInt(t,10))}),this._relay=e}return this._relay}}Ce.WalletLinkSigner=Gr;var k={};Object.defineProperty(k,"__esModule",{value:!0});k.checkErrorForInvalidRequestArgs=k.getCoinbaseInjectedProvider=k.getCoinbaseInjectedSigner=k.fetchRPCRequest=void 0;const Yr=K,pe=j;async function Jr(n,e){if(!e.rpcUrl)throw pe.standardErrors.rpc.internal("No RPC URL set for chain");const t=Object.assign(Object.assign({},n),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(e.rpcUrl,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Yr.LIB_VERSION}})).json()).result}k.fetchRPCRequest=Jr;function Gt(){return globalThis.coinbaseWalletSigner}k.getCoinbaseInjectedSigner=Gt;function Qr(){return globalThis.coinbaseWalletExtension}function Xr(){var n,e;try{const t=globalThis;return(n=t.ethereum)!==null&&n!==void 0?n:(e=t.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function es({metadata:n,preference:e}){var t;if(e.options!=="smartWalletOnly"){if(Gt())return;const i=Qr();if(i){const{appName:a,appLogoUrl:o,appChainIds:c}=n;return(t=i.setAppInfo)===null||t===void 0||t.call(i,a,o,c),i}}const r=Xr();if(r!=null&&r.isCoinbaseBrowser)return r}k.getCoinbaseInjectedProvider=es;function ts(n){if(!n||typeof n!="object"||Array.isArray(n))return pe.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:n});const{method:e,params:t}=n;if(typeof e!="string"||e.length===0)return pe.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:n});if(t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null))return pe.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:n})}k.checkErrorForInvalidRequestArgs=ts;Object.defineProperty(P,"__esModule",{value:!0});P.createSigner=P.fetchSignerType=P.storeSignerType=P.loadSignerType=void 0;const ns=_e,Yt=Ce,rs=j,ss=k,is=O,Jt="SignerType",Qt=new is.ScopedLocalStorage("CBWSDK","SignerConfigurator");function as(){return Qt.getItem(Jt)}P.loadSignerType=as;function os(n){Qt.setItem(Jt,n)}P.storeSignerType=os;async function cs(n){const{communicator:e,metadata:t}=n;ls(e,t).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:n.preference},{data:s}=await e.postRequestAndWaitForResponse(r);return s}P.fetchSignerType=cs;function ds(n){const{signerType:e,metadata:t,communicator:r,updateListener:s}=n;switch(e){case"scw":return new ns.SCWSigner({metadata:t,updateListener:s,communicator:r});case"walletlink":return new Yt.WalletLinkSigner({metadata:t,updateListener:s});case"extension":{const i=(0,ss.getCoinbaseInjectedSigner)();if(!i)throw rs.standardErrors.rpc.internal("injected signer not found");return i}}}P.createSigner=ds;async function ls(n,e){await n.onMessage(({event:r})=>r==="WalletLinkSessionRequest");const t=new Yt.WalletLinkSigner({metadata:e});n.postMessage({event:"WalletLinkUpdate",data:{session:t.getSession()}}),await t.handshake(),n.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Te={},J={};Object.defineProperty(J,"__esModule",{value:!0});J.closePopup=J.openPopup=void 0;const us=j,pt=420,ft=540;function hs(n){const e=(window.innerWidth-pt)/2+window.screenX,t=(window.innerHeight-ft)/2+window.screenY,r=window.open(n,"Smart Wallet",`width=${pt}, height=${ft}, left=${e}, top=${t}`);if(r==null||r.focus(),!r)throw us.standardErrors.rpc.internal("Pop up window failed to open");return r}J.openPopup=hs;function gs(n){n&&!n.closed&&n.close()}J.closePopup=gs;Object.defineProperty(Te,"__esModule",{value:!0});Te.Communicator=void 0;const ps=K,mt=J,fs=T,bt=j;class ms{constructor(e=fs.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async t=>{(await this.waitForPopupLoaded()).postMessage(t,this.url.origin)},this.postRequestAndWaitForResponse=async t=>{const r=this.onMessage(({requestId:s})=>s===t.id);return this.postMessage(t),await r},this.onMessage=async t=>new Promise((r,s)=>{const i=a=>{if(a.origin!==this.url.origin)return;const o=a.data;t(o)&&(r(o),window.removeEventListener("message",i),this.listeners.delete(i))};window.addEventListener("message",i),this.listeners.set(i,{reject:s})}),this.disconnect=()=>{(0,mt.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:t},r)=>{t(bt.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,mt.openPopup)(this.url),this.onMessage(({event:t})=>t==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:t})=>t==="PopupLoaded").then(t=>{this.postMessage({requestId:t.id,data:{version:ps.LIB_VERSION}})}).then(()=>{if(!this.popup)throw bt.standardErrors.rpc.internal();return this.popup})),this.url=new URL(e)}}Te.Communicator=ms;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.determineMethodCategory=void 0;const yt={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};function bs(n){for(const e in yt){const t=e;if(yt[t].includes(n))return t}}je.determineMethodCategory=bs;var ys=M&&M.__rest||function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s{try{if(this.connected)return this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),this.accounts;const h=await this.requestSignerSelection(),f=this.initSigner(h),d=await f.handshake();return this.signer=f,(0,ge.storeSignerType)(h),this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),d}catch(h){throw this.handleUnauthorizedError(h),h}},sign:async l=>{if(!this.connected||!this.signer)throw z.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(l)}catch(h){throw this.handleUnauthorizedError(h),h}},fetch:l=>(0,wt.fetchRPCRequest)(l,this.chain),state:l=>{const h=()=>{if(this.connected)return this.accounts;throw z.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(l.method){case"eth_chainId":return(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return h();case"eth_coinbase":return h()[0];default:return this.handlers.unsupported(l)}},deprecated:({method:l})=>{throw z.standardErrors.rpc.methodNotSupported(`Method ${l} is deprecated.`)},unsupported:({method:l})=>{throw z.standardErrors.rpc.methodNotSupported(`Method ${l} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:l,source:h})=>{(0,X.areAddressArraysEqual)(this.accounts,l)||(this.accounts=l,h!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:l,source:h})=>{l.id===this.chain.id&&l.rpcUrl===this.chain.rpcUrl||(this.chain=l,h!=="storage"&&this.emit("chainChanged",(0,X.hexStringFromIntNumber)((0,he.IntNumber)(l.id))))}},this.metadata=s,this.preference=o,this.communicator=new Es.Communicator(a),this.chain={id:(r=(t=s.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1};const c=(0,ge.loadSignerType)();this.signer=c?this.initSigner(c):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const r=(0,wt.checkErrorForInvalidRequestArgs)(e);if(r)throw r;const s=(t=(0,Ss.determineMethodCategory)(e.method))!==null&&t!==void 0?t:"fetch";return this.handlers[s](e)}catch(r){return Promise.reject((0,_s.serializeError)(r,e.method))}}handleUnauthorizedError(e){e.code===z.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},Cs.ScopedLocalStorage.clearAll(),this.emit("disconnect",z.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,ge.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,ge.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}be.CoinbaseWalletProvider=ks;Object.defineProperty(te,"__esModule",{value:!0});te.CoinbaseWalletSDK=void 0;const Is=me,Ms=be,Ls=O,As=K,Rs=u,xs=k;class Ps{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,Rs.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;const r={metadata:this.metadata,preference:e};return(t=(0,xs.getCoinbaseInjectedProvider)(r))!==null&&t!==void 0?t:new Ms.CoinbaseWalletProvider(r)}getCoinbaseWalletLogo(e,t=240){return(0,Is.walletLogo)(e,t)}storeLatestVersion(){new Ls.ScopedLocalStorage("CBWSDK").setItem("VERSION",As.LIB_VERSION)}}te.CoinbaseWalletSDK=Ps;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.CoinbaseWalletSDK=void 0;const e=te;n.default=e.CoinbaseWalletSDK;var t=te;Object.defineProperty(n,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return t.CoinbaseWalletSDK}})})(Et);const Ns=nn(Et),Os=Object.freeze(Object.defineProperty({__proto__:null,default:Ns},Symbol.toStringTag,{value:"Module"}));export{Os as i}; +import{aN as M,aO as nn}from"./index-BSVOad49.js";import{j as rn,s as sn,r as vt,a as _t,b as an,c as on}from"./hooks.module-Cnm_IKFt.js";var Et={},te={},me={};Object.defineProperty(me,"__esModule",{value:!0});me.walletLogo=void 0;const cn=(n,e)=>{let t;switch(n){case"standard":return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 `}};me.walletLogo=cn;var be={},j={},U={};Object.defineProperty(U,"__esModule",{value:!0});U.errorValues=U.standardErrorCodes=void 0;U.standardErrorCodes={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,unsupportedChain:4902}};U.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."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var ye={},$e={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.serialize=n.getErrorCode=n.isValidCode=n.getMessageFromCode=n.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=U,t="Unspecified error message.";n.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function r(d,p=t){if(d&&Number.isInteger(d)){const m=d.toString();if(h(e.errorValues,m))return e.errorValues[m].message;if(c(d))return n.JSON_RPC_SERVER_ERROR_MESSAGE}return p}n.getMessageFromCode=r;function s(d){if(!Number.isInteger(d))return!1;const p=d.toString();return!!(e.errorValues[p]||c(d))}n.isValidCode=s;function i(d){var p;if(typeof d=="number")return d;if(a(d))return(p=d.code)!==null&&p!==void 0?p:d.errorCode}n.getErrorCode=i;function a(d){return typeof d=="object"&&d!==null&&(typeof d.code=="number"||typeof d.errorCode=="number")}function o(d,{shouldIncludeStack:p=!1}={}){const m={};if(d&&typeof d=="object"&&!Array.isArray(d)&&h(d,"code")&&s(d.code)){const B=d;m.code=B.code,B.message&&typeof B.message=="string"?(m.message=B.message,h(B,"data")&&(m.data=B.data)):(m.message=r(m.code),m.data={originalError:l(d)})}else m.code=e.standardErrorCodes.rpc.internal,m.message=f(d,"message")?d.message:t,m.data={originalError:l(d)};return p&&(m.stack=f(d,"stack")?d.stack:void 0),m}n.serialize=o;function c(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function h(d,p){return Object.prototype.hasOwnProperty.call(d,p)}function f(d,p){return typeof d=="object"&&d!==null&&p in d&&typeof d[p]=="string"}})($e);Object.defineProperty(ye,"__esModule",{value:!0});ye.standardErrors=void 0;const v=U,St=$e;ye.standardErrors={rpc:{parse:n=>C(v.standardErrorCodes.rpc.parse,n),invalidRequest:n=>C(v.standardErrorCodes.rpc.invalidRequest,n),invalidParams:n=>C(v.standardErrorCodes.rpc.invalidParams,n),methodNotFound:n=>C(v.standardErrorCodes.rpc.methodNotFound,n),internal:n=>C(v.standardErrorCodes.rpc.internal,n),server:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=n;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return C(e,n)},invalidInput:n=>C(v.standardErrorCodes.rpc.invalidInput,n),resourceNotFound:n=>C(v.standardErrorCodes.rpc.resourceNotFound,n),resourceUnavailable:n=>C(v.standardErrorCodes.rpc.resourceUnavailable,n),transactionRejected:n=>C(v.standardErrorCodes.rpc.transactionRejected,n),methodNotSupported:n=>C(v.standardErrorCodes.rpc.methodNotSupported,n),limitExceeded:n=>C(v.standardErrorCodes.rpc.limitExceeded,n)},provider:{userRejectedRequest:n=>$(v.standardErrorCodes.provider.userRejectedRequest,n),unauthorized:n=>$(v.standardErrorCodes.provider.unauthorized,n),unsupportedMethod:n=>$(v.standardErrorCodes.provider.unsupportedMethod,n),disconnected:n=>$(v.standardErrorCodes.provider.disconnected,n),chainDisconnected:n=>$(v.standardErrorCodes.provider.chainDisconnected,n),unsupportedChain:n=>$(v.standardErrorCodes.provider.unsupportedChain,n),custom:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:t,data:r}=n;if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string');return new It(e,t,r)}}};function C(n,e){const[t,r]=Ct(e);return new kt(n,t||(0,St.getMessageFromCode)(n),r)}function $(n,e){const[t,r]=Ct(e);return new It(n,t||(0,St.getMessageFromCode)(n),r)}function Ct(n){if(n){if(typeof n=="string")return[n];if(typeof n=="object"&&!Array.isArray(n)){const{message:e,data:t}=n;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,t]}}return[]}class kt extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string.');super(t),this.code=e,r!==void 0&&(this.data=r)}}class It extends kt{constructor(e,t,r){if(!dn(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function dn(n){return Number.isInteger(n)&&n>=1e3&&n<=4999}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.standardErrors=n.standardErrorCodes=void 0;var e=U;Object.defineProperty(n,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});var t=ye;Object.defineProperty(n,"standardErrors",{enumerable:!0,get:function(){return t.standardErrors}})})(j);var we={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.isErrorResponse=void 0;function ln(n){return n.errorMessage!==void 0}Q.isErrorResponse=ln;var K={};Object.defineProperty(K,"__esModule",{value:!0});K.LIB_VERSION=void 0;K.LIB_VERSION="4.0.4";Object.defineProperty(we,"__esModule",{value:!0});we.serializeError=void 0;const un=Q,hn=K,gn=U,pn=$e;function fn(n,e){const t=(0,pn.serialize)(mn(n),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",hn.LIB_VERSION),r.searchParams.set("code",t.code.toString());const s=bn(t.data,e);return s&&r.searchParams.set("method",s),r.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:r.href})}we.serializeError=fn;function mn(n){return typeof n=="string"?{message:n,code:gn.standardErrorCodes.rpc.internal}:(0,un.isErrorResponse)(n)?Object.assign(Object.assign({},n),{message:n.errorMessage,code:n.errorCode,data:{method:n.method}}):n}function bn(n,e){const t=n==null?void 0:n.method;if(t)return t;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}var _={};Object.defineProperty(_,"__esModule",{value:!0});_.RegExpString=_.IntNumber=_.BigIntString=_.AddressString=_.HexString=_.OpaqueType=void 0;function ne(){return n=>n}_.OpaqueType=ne;_.HexString=ne();_.AddressString=ne();_.BigIntString=ne();function yn(n){return Math.floor(n)}_.IntNumber=yn;_.RegExpString=ne();var u={};Object.defineProperty(u,"__esModule",{value:!0});u.areAddressArraysEqual=u.getFavicon=u.range=u.isBigNumber=u.ensureParsedJSONObject=u.ensureBigInt=u.ensureRegExpString=u.ensureIntNumber=u.ensureBuffer=u.ensureAddressString=u.ensureEvenLengthHexString=u.ensureHexString=u.isHexString=u.prepend0x=u.strip0x=u.has0xPrefix=u.hexStringFromIntNumber=u.intNumberFromHexString=u.bigIntStringFromBigInt=u.hexStringFromBuffer=u.hexStringToUint8Array=u.uint8ArrayToHex=u.randomBytesHex=void 0;const q=j,I=_,Mt=/^[0-9]*$/,Lt=/^[a-f0-9]*$/;function wn(n){return At(crypto.getRandomValues(new Uint8Array(n)))}u.randomBytesHex=wn;function At(n){return[...n].map(e=>e.toString(16).padStart(2,"0")).join("")}u.uint8ArrayToHex=At;function vn(n){return new Uint8Array(n.match(/.{1,2}/g).map(e=>parseInt(e,16)))}u.hexStringToUint8Array=vn;function _n(n,e=!1){const t=n.toString("hex");return(0,I.HexString)(e?`0x${t}`:t)}u.hexStringFromBuffer=_n;function En(n){return(0,I.BigIntString)(n.toString(10))}u.bigIntStringFromBigInt=En;function Sn(n){return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}u.intNumberFromHexString=Sn;function Cn(n){return(0,I.HexString)(`0x${BigInt(n).toString(16)}`)}u.hexStringFromIntNumber=Cn;function Fe(n){return n.startsWith("0x")||n.startsWith("0X")}u.has0xPrefix=Fe;function ve(n){return Fe(n)?n.slice(2):n}u.strip0x=ve;function Rt(n){return Fe(n)?`0x${n.slice(2)}`:`0x${n}`}u.prepend0x=Rt;function re(n){if(typeof n!="string")return!1;const e=ve(n).toLowerCase();return Lt.test(e)}u.isHexString=re;function xt(n,e=!1){if(typeof n=="string"){const t=ve(n).toLowerCase();if(Lt.test(t))return(0,I.HexString)(e?`0x${t}`:t)}throw q.standardErrors.rpc.invalidParams(`"${String(n)}" is not a hexadecimal string`)}u.ensureHexString=xt;function se(n,e=!1){let t=xt(n,!1);return t.length%2===1&&(t=(0,I.HexString)(`0${t}`)),e?(0,I.HexString)(`0x${t}`):t}u.ensureEvenLengthHexString=se;function kn(n){if(typeof n=="string"){const e=ve(n).toLowerCase();if(re(e)&&e.length===40)return(0,I.AddressString)(Rt(e))}throw q.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(n)}`)}u.ensureAddressString=kn;function In(n){if(Buffer.isBuffer(n))return n;if(typeof n=="string"){if(re(n)){const e=se(n,!1);return Buffer.from(e,"hex")}return Buffer.from(n,"utf8")}throw q.standardErrors.rpc.invalidParams(`Not binary data: ${String(n)}`)}u.ensureBuffer=In;function Pt(n){if(typeof n=="number"&&Number.isInteger(n))return(0,I.IntNumber)(n);if(typeof n=="string"){if(Mt.test(n))return(0,I.IntNumber)(Number(n));if(re(n))return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureIntNumber=Pt;function Mn(n){if(n instanceof RegExp)return(0,I.RegExpString)(n.toString());throw q.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(n)}`)}u.ensureRegExpString=Mn;function Ln(n){if(n!==null&&(typeof n=="bigint"||Nt(n)))return BigInt(n.toString(10));if(typeof n=="number")return BigInt(Pt(n));if(typeof n=="string"){if(Mt.test(n))return BigInt(n);if(re(n))return BigInt(se(n,!0))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureBigInt=Ln;function An(n){if(typeof n=="string")return JSON.parse(n);if(typeof n=="object")return n;throw q.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(n)}`)}u.ensureParsedJSONObject=An;function Nt(n){if(n==null||typeof n.constructor!="function")return!1;const{constructor:e}=n;return typeof e.config=="function"&&typeof e.EUCLID=="number"}u.isBigNumber=Nt;function Rn(n,e){return Array.from({length:e-n},(t,r)=>n+r)}u.range=Rn;function xn(){const n=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:t}=document.location,r=n?n.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?e+r:`${e}//${t}${r}`}u.getFavicon=xn;function Pn(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}u.areAddressArraysEqual=Pn;var P={},_e={},Ee={},y={};Object.defineProperty(y,"__esModule",{value:!0});y.decryptContent=y.encryptContent=y.importKeyFromHexString=y.exportKeyToHexString=y.decrypt=y.encrypt=y.deriveSharedSecret=y.generateKeyPair=void 0;const Tt=u;async function Nn(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}y.generateKeyPair=Nn;async function Tn(n,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}y.deriveSharedSecret=Tn;async function jt(n,e){const t=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},n,new TextEncoder().encode(e));return{iv:t,cipherText:r}}y.encrypt=jt;async function Ot(n,{iv:e,cipherText:t}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},n,t);return new TextDecoder().decode(r)}y.decrypt=Ot;function Dt(n){switch(n){case"public":return"spki";case"private":return"pkcs8"}}async function jn(n,e){const t=Dt(n),r=await crypto.subtle.exportKey(t,e);return(0,Tt.uint8ArrayToHex)(new Uint8Array(r))}y.exportKeyToHexString=jn;async function On(n,e){const t=Dt(n),r=(0,Tt.hexStringToUint8Array)(e).buffer;return await crypto.subtle.importKey(t,r,{name:"ECDH",namedCurve:"P-256"},!0,n==="private"?["deriveKey"]:[])}y.importKeyFromHexString=On;async function Dn(n,e){const t=JSON.stringify(n,(r,s)=>{if(!(s instanceof Error))return s;const i=s;return Object.assign(Object.assign({},i.code?{code:i.code}:{}),{message:i.message})});return jt(e,t)}y.encryptContent=Dn;async function Wn(n,e){return JSON.parse(await Ot(e,n))}y.decryptContent=Wn;var O={};Object.defineProperty(O,"__esModule",{value:!0});O.ScopedLocalStorage=void 0;class fe{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;rlocalStorage.removeItem(r))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new fe("CBWSDK").clear(),new fe("walletlink").clear()}}O.ScopedLocalStorage=fe;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.SCWKeyManager=void 0;const oe=y,Un=O,De={storageKey:"ownPrivateKey",keyType:"private"},We={storageKey:"ownPublicKey",keyType:"public"},Ue={storageKey:"peerPublicKey",keyType:"public"};class Bn{constructor(){this.storage=new Un.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(Ue,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(We.storageKey),this.storage.removeItem(De.storageKey),this.storage.removeItem(Ue.storageKey)}async generateKeyPair(){const e=await(0,oe.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(De,e.privateKey),await this.storeKey(We,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(De)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(We)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Ue)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,oe.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,oe.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const r=await(0,oe.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,r)}}Ee.SCWKeyManager=Bn;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.SCWStateManager=void 0;const Hn=O,Qe="accounts",Xe="activeChain",et="availableChains",tt="walletCapabilities";class Kn{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,r;this.storage=new Hn.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(et),this._walletCapabilities=this.loadItemFromStorage(tt);const s=this.loadItemFromStorage(Qe),i=this.loadItemFromStorage(Xe);s&&this.updateListener.onAccountsUpdate({accounts:s,source:"storage"}),i&&this.updateListener.onChainUpdate({chain:i,source:"storage"}),this._accounts=s||[],this._activeChain=i||{id:(r=(t=e.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(Qe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const r=(t=this.availableChains)===null||t===void 0?void 0:t.find(s=>s.id===e);return r?(r===this._activeChain||(this._activeChain=r,this.storeItemToStorage(Xe,r),this.updateListener.onChainUpdate({chain:r,source:"wallet"})),!0):!1}updateAvailableChains(e){if(!e||Object.keys(e).length===0)return;const t=Object.entries(e).map(([r,s])=>({id:Number(r),rpcUrl:s}));this.availableChains=t,this.storeItemToStorage(et,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(tt,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}}Se.SCWStateManager=Kn;Object.defineProperty(_e,"__esModule",{value:!0});_e.SCWSigner=void 0;const qn=Ee,$n=Se,ce=j,nt=u,de=y;class Fn{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new qn.SCWKeyManager,this.stateManager=new $n.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const r=await(0,de.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(r);const s=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},s);const i=s.result;if("error"in i)throw i.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(t!==void 0){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const r=await this.sendEncryptedRequest(e),s=await this.decryptResponseMessage(r);this.updateInternalState(e,s);const i=s.result;if("error"in i)throw i.error;return i.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const r=e.params;if(!r||!(!((t=r[0])===null||t===void 0)&&t.chainId))throw ce.standardErrors.rpc.invalidParams();const s=(0,nt.ensureIntNumber)(r[0].chainId);return this.stateManager.switchChain(s)?null:void 0}case"wallet_getCapabilities":{const r=this.stateManager.walletCapabilities;if(!r)throw ce.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return r}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw ce.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const r=await(0,de.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),s=await this.createRequestMessage({encrypted:r});return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(e){const t=await(0,de.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw ce.standardErrors.provider.unauthorized("Invalid session");return(0,de.decryptContent)(t.encrypted,r)}updateInternalState(e,t){var r,s;const i=(r=t.data)===null||r===void 0?void 0:r.chains;i&&this.stateManager.updateAvailableChains(i);const a=(s=t.data)===null||s===void 0?void 0:s.capabilities;a&&this.stateManager.updateWalletCapabilities(a);const o=t.result;if(!("error"in o))switch(e.method){case"eth_requestAccounts":{const c=o.value;this.stateManager.updateAccounts(c);break}case"wallet_switchEthereumChain":{if(o.value!==null)return;const c=e.params,l=(0,nt.ensureIntNumber)(c[0].chainId);this.stateManager.switchChain(l);break}}}}_e.SCWSigner=Fn;var Ce={};const Vn=rn;function Wt(n){return Buffer.allocUnsafe(n).fill(0)}function zn(n){return n.toString(2).length}function Ut(n,e){let t=n.toString(16);t.length%2!==0&&(t="0"+t);const r=t.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;r.length"u")throw new Error("Not an array?");if(t=Ft(n),t!=="dynamic"&&t!==0&&e.length>t)throw new Error("Elements exceed array size: "+t);s=[],n=n.slice(0,n.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(R(n,e[i]));if(t==="dynamic"){var a=R("uint256",e.length);s.unshift(a)}return Buffer.concat(s)}else{if(n==="bytes")return e=new Buffer(e),s=Buffer.concat([R("uint256",e.length),e]),e.length%32!==0&&(s=Buffer.concat([s,E.zeros(32-e.length%32)])),s;if(n.startsWith("bytes")){if(t=G(n),t<1||t>32)throw new Error("Invalid bytes width: "+t);return E.setLengthRight(e,32)}else if(n.startsWith("uint")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return E.bufferBEFromBigInt(r,32)}else if(n.startsWith("int")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied int exceeds width: "+t+" vs "+o);const c=E.twosFromBigInt(r,256);return E.bufferBEFromBigInt(c,32)}else if(n.startsWith("ufixed")){if(t=rt(n),r=H(e),r<0)throw new Error("Supplied ufixed is negative");return R("uint256",r*BigInt(2)**BigInt(t[1]))}else if(n.startsWith("fixed"))return t=rt(n),R("int256",H(e)*BigInt(2)**BigInt(t[1]))}throw new Error("Unsupported or invalid type: "+n)}function Xn(n){return n==="string"||n==="bytes"||Ft(n)==="dynamic"}function er(n){return n.lastIndexOf("]")===n.length-1}function tr(n,e){var t=[],r=[],s=32*n.length;for(var i in n){var a=$t(n[i]),o=e[i],c=R(a,o);Xn(a)?(t.push(R("uint256",s)),r.push(c),s+=c.length):t.push(c)}return Buffer.concat(t.concat(r))}function Vt(n,e){if(n.length!==e.length)throw new Error("Number of types are not matching the values");for(var t,r,s=[],i=0;i32)throw new Error("Invalid bytes width: "+t);s.push(E.setLengthRight(o,t))}else if(a.startsWith("uint")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+c);s.push(E.bufferBEFromBigInt(r,t/8))}else if(a.startsWith("int")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied int exceeds width: "+t+" vs "+c);const l=E.twosFromBigInt(r,t);s.push(E.bufferBEFromBigInt(l,t/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(s)}function nr(n,e){return E.keccak(Vt(n,e))}var rr={rawEncode:tr,solidityPack:Vt,soliditySHA3:nr};const A=qt,ee=rr,zt={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"]},Be={encodeData(n,e,t,r=!0){const s=["bytes32"],i=[this.hashType(n,t)];if(r){const a=(o,c,l)=>{if(t[c]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":A.keccak(this.encodeData(c,l,t,r))];if(l===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",A.keccak(l)];if(c==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",A.keccak(l)];if(c.lastIndexOf("]")===c.length-1){const h=c.slice(0,c.lastIndexOf("[")),f=l.map(d=>a(o,h,d));return["bytes32",A.keccak(ee.rawEncode(f.map(([d])=>d),f.map(([,d])=>d)))]}return[c,l]};for(const o of t[n]){const[c,l]=a(o.name,o.type,e[o.name]);s.push(c),i.push(l)}}else for(const a of t[n]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")s.push("bytes32"),o=A.keccak(o),i.push(o);else if(a.type==="string")s.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=A.keccak(o),i.push(o);else if(t[a.type]!==void 0)s.push("bytes32"),o=A.keccak(this.encodeData(a.type,o,t,r)),i.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(a.type),i.push(o)}}return ee.rawEncode(s,i)},encodeType(n,e){let t="",r=this.findTypeDependencies(n,e).filter(s=>s!==n);r=[n].concat(r.sort());for(const s of r){if(!e[s])throw new Error("No type definition specified: "+s);t+=s+"("+e[s].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return t},findTypeDependencies(n,e,t=[]){if(n=n.match(/^\w*/)[0],t.includes(n)||e[n]===void 0)return t;t.push(n);for(const r of e[n])for(const s of this.findTypeDependencies(r.type,e,t))!t.includes(s)&&t.push(s);return t},hashStruct(n,e,t,r=!0){return A.keccak(this.encodeData(n,e,t,r))},hashType(n,e){return A.keccak(this.encodeType(n,e))},sanitizeData(n){const e={};for(const t in zt.properties)n[t]&&(e[t]=n[t]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(n,e=!0){const t=this.sanitizeData(n),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",t.domain,t.types,e)),t.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(t.primaryType,t.message,t.types,e)),A.keccak(Buffer.concat(r))}};var sr={TYPED_MESSAGE_SCHEMA:zt,TypedDataUtils:Be,hashForSignTypedDataLegacy:function(n){return ir(n.data)},hashForSignTypedData_v3:function(n){return Be.hash(n.data,!1)},hashForSignTypedData_v4:function(n){return Be.hash(n.data)}};function ir(n){const e=new Error("Expect argument to be non-empty array");if(typeof n!="object"||!n.length)throw e;const t=n.map(function(i){return i.type==="bytes"?A.toBuffer(i.value):i.value}),r=n.map(function(i){return i.type}),s=n.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return ee.soliditySHA3(["bytes32","bytes32"],[ee.soliditySHA3(new Array(n.length).fill("string"),s),ee.soliditySHA3(r,t)])}var N={};Object.defineProperty(N,"__esModule",{value:!0});N.APP_VERSION_KEY=N.LOCAL_STORAGE_ADDRESSES_KEY=N.WALLET_USER_NAME_KEY=void 0;N.WALLET_USER_NAME_KEY="walletUsername";N.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";N.APP_VERSION_KEY="AppVersion";var ie={};Object.defineProperty(ie,"__esModule",{value:!0});ie.RelayEventManager=void 0;const ar=u;class or{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,ar.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}ie.RelayEventManager=or;var Ie={},Me={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.WalletLinkCipher=void 0;const le=u;class cr{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},s,i.encode(e)),o=16,c=a.slice(a.byteLength-o),l=a.slice(0,a.byteLength-o),h=new Uint8Array(c),f=new Uint8Array(l),d=new Uint8Array([...r,...h,...f]);return(0,le.uint8ArrayToHex)(d)}async decrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");return new Promise((r,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,le.hexStringToUint8Array)(e),o=a.slice(0,12),c=a.slice(12,28),l=a.slice(28),h=new Uint8Array([...l,...c]),f={name:"AES-GCM",iv:new Uint8Array(o)};try{const d=await window.crypto.subtle.decrypt(f,i,h),p=new TextDecoder;r(p.decode(d))}catch(d){s(d)}})()})}}Le.WalletLinkCipher=cr;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.WalletLinkHTTP=void 0;class dr{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const s=`${t}:${r}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(t=>fetch(`${this.linkAPIUrl}/events/${t.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(t=>console.error("Unabled to mark event as failed:",t))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:s}=await t.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=r==null?void 0:r.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}}Ae.WalletLinkHTTP=dr;var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.WalletLinkWebSocket=Y.ConnectionState=void 0;var Z;(function(n){n[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED"})(Z||(Y.ConnectionState=Z={}));class lr{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,t)=>{var r;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){t(i);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,Z.CONNECTING),s.onclose=i=>{var a;this.clearWebSocket(),t(new Error(`websocket error ${i.code}: ${i.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.DISCONNECTED)},s.onopen=i=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},s.onmessage=i=>{var a,o;if(i.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(i.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Z.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch{}}}sendData(e){const{webSocket:t}=this;if(!t){this.pendingData.push(e),this.connect();return}t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}Y.WalletLinkWebSocket=lr;Object.defineProperty(Me,"__esModule",{value:!0});Me.WalletLinkConnection=void 0;const st=N,ur=Le,hr=Ae,ue=Y,F=_,it=1e4,gr=6e4;class pr{constructor({session:e,linkAPIUrl:t,listener:r,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,F.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,l)=>{const h=a[l];h!==void 0&&c(h)})},this.handleDestroyed=a=>{var o;a==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async a=>{var o;{const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.accountUpdated(c)}},this.handleMetadataUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,l)}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(st.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(st.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(a),h=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.chainUpdated(l,h)}},this.session=e,this.cipher=new ur.WalletLinkCipher(e.secret),this.listener=r;const i=new ue.WalletLinkWebSocket(`${t}/rpc`,s);i.setConnectionStateListener(async a=>{let o=!1;switch(a){case ue.ConnectionState.DISCONNECTED:if(!this.destroyed){const c=async()=>{await new Promise(l=>setTimeout(l,5e3)),this.destroyed||i.connect().catch(()=>{c()})};c()}break;case ue.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),o=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},it),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case ue.ConnectionState.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(a=>{var o;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const c=a.type==="IsLinkedOK"?a.linked:void 0;this.linked=c||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((o=this.requestResolutions.get(a.id))===null||o===void 0||o(a))}),this.ws=i,this.http=new hr.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&((t=this.onceConnected)===null||t===void 0||t.call(this))}setOnceConnected(e){return new Promise(t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&((t=this.onceLinked)===null||t===void 0||t.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(e)}setOnceLinked(e){return new Promise(t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}})}async handleIncomingEvent(e){var t;if(!(e.type!=="Event"||e.event!=="Web3Response")){const r=await this.cipher.decrypt(e.data),s=JSON.parse(r);if(s.type!=="WEB3_RESPONSE")return;(t=this.listener)===null||t===void 0||t.handleWeb3ResponseMessage(s)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(t=>this.handleIncomingEvent(t))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(r);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,t,r=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:r};return this.setOnceLinked(async()=>{const a=await this.makeRequest(i);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>it*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,t=gr){const r=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${r} timed out`))},t)}),new Promise(i=>{this.requestResolutions.set(r,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(r)})})])}async authenticate(){const e={type:"HostSession",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if(t.type==="Fail")throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Me.WalletLinkConnection=pr;var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.WalletLinkSession=void 0;const fr=sn,at=u,ot="session:id",ct="session:secret",dt="session:linked";class Ve{constructor(e,t,r,s){this._storage=e,this._id=t||(0,at.randomBytesHex)(16),this._secret=r||(0,at.randomBytesHex)(32),this._key=new fr.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const t=e.getItem(ot),r=e.getItem(dt),s=e.getItem(ct);return t&&s?new Ve(e,t,s,r==="1"):null}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(ot,this._id),this._storage.setItem(ct,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(dt,this._linked?"1":"0")}}Re.WalletLinkSession=Ve;var S={};Object.defineProperty(S,"__esModule",{value:!0});S.isDarkMode=S.isMobileWeb=S.getLocation=S.createQrUrl=void 0;function mr(n,e,t,r,s,i){const a=r?"parent-id":"id",o=new URLSearchParams({[a]:n,secret:e,server:t,v:s,chainId:i.toString()}).toString();return`${t}/#/link?${o}`}S.createQrUrl=mr;function br(){try{return window.frameElement!==null}catch{return!1}}function yr(){try{return br()&&window.top?window.top.location:window.location}catch{return window.location}}S.getLocation=yr;function wr(){var n;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((n=window==null?void 0:window.navigator)===null||n===void 0?void 0:n.userAgent)}S.isMobileWeb=wr;function vr(){var n,e;return(e=(n=window==null?void 0:window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}S.isDarkMode=vr;var xe={},ae={},ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var _r=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ae,"__esModule",{value:!0});ae.injectCssReset=void 0;const Er=_r(ze);function Sr(){const n=document.createElement("style");n.type="text/css",n.appendChild(document.createTextNode(Er.default)),document.documentElement.appendChild(n)}ae.injectCssReset=Sr;var Ze={},Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(n){var e=M&&M.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(n,"__esModule",{value:!0}),n.SnackbarInstance=n.SnackbarContainer=n.Snackbar=void 0;const t=e(vt),r=_t,s=an,i=S,a=e(Ge),o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",c="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class l{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,i.isDarkMode)()}attach(p){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",p.appendChild(this.root),this.render()}presentItem(p){const m=this.nextItemKey++;return this.items.set(m,p),this.render(),()=>{this.items.delete(m),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,r.render)((0,r.h)("div",null,(0,r.h)(n.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([p,m])=>(0,r.h)(n.SnackbarInstance,Object.assign({},m,{key:p}))))),this.root)}}n.Snackbar=l;const h=d=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-container")},(0,r.h)("style",null,a.default),(0,r.h)("div",{class:"-cbwsdk-snackbar"},d.children));n.SnackbarContainer=h;const f=({autoExpand:d,message:p,menuItems:m})=>{const[B,Xt]=(0,s.useState)(!0),[Oe,Je]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const L=[window.setTimeout(()=>{Xt(!1)},1),window.setTimeout(()=>{Je(!0)},1e4)];return()=>{L.forEach(window.clearTimeout)}});const en=()=>{Je(!Oe)};return(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance",B&&"-cbwsdk-snackbar-instance-hidden",Oe&&"-cbwsdk-snackbar-instance-expanded")},(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:en},(0,r.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},p),(0,r.h)("div",{class:"-gear-container"},!Oe&&(0,r.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,r.h)("img",{src:c,class:"-gear-icon",title:"Expand"}))),m&&m.length>0&&(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},m.map((L,tn)=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:L.onClick,key:tn},(0,r.h)("svg",{width:L.svgWidth,height:L.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("path",{"fill-rule":L.defaultFillRule,"clip-rule":L.defaultClipRule,d:L.path,fill:"#AAAAAA"})),(0,r.h)("span",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item-info",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},L.info)))))};n.SnackbarInstance=f})(Ze);Object.defineProperty(xe,"__esModule",{value:!0});xe.WalletLinkRelayUI=void 0;const Cr=ae,kr=Ze;class Ir{constructor(){this.attached=!1,this.snackbar=new kr.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,Cr.injectCssReset)()}showConnecting(e){let t;return e.isUnlinkedErrorState?t={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:t={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}}xe.WalletLinkRelayUI=Ir;var Pe={},Ne={},Ye={};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var Zt=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.RedirectDialog=void 0;const Mr=Zt(vt),x=_t,Lr=ae,Ar=Ze,Rr=S,xr=Zt(Ye);class Pr{constructor(){this.root=null,this.darkMode=(0,Rr.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Lr.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,x.render)(null,this.root),e&&(0,x.render)((0,x.h)(Nr,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}Ne.RedirectDialog=Pr;const Nr=({title:n,buttonText:e,darkMode:t,onButtonClick:r,onDismiss:s})=>{const i=t?"dark":"light";return(0,x.h)(Ar.SnackbarContainer,{darkMode:t},(0,x.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,x.h)("style",null,xr.default),(0,x.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,x.h)("div",{class:(0,Mr.default)("-cbwsdk-redirect-dialog-box",i)},(0,x.h)("p",null,n),(0,x.h)("button",{onClick:r},e))))};var T={};Object.defineProperty(T,"__esModule",{value:!0});T.CBW_MOBILE_DEEPLINK_URL=T.WALLETLINK_URL=T.CB_KEYS_URL=void 0;T.CB_KEYS_URL="https://keys.coinbase.com/connect";T.WALLETLINK_URL="https://www.walletlink.org";T.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.WLMobileRelayUI=void 0;const Tr=Ne,jr=S,Or=T;class Dr{constructor(){this.attached=!1,this.redirectDialog=new Tr.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL(Or.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,jr.getLocation)().href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}Pe.WLMobileRelayUI=Dr;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.WalletLinkRelay=void 0;const Wr=Me,Ur=N,Br=ie,He=Re,V=Q,Hr=S,Kr=xe,lt=Pe,qr=j,b=u,$r=O;class W{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,Hr.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(Ur.LOCAL_STORAGE_ADDRESSES_KEY);if(i&&(this._session.linked=i),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!i&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(i,a)=>{this.storage.setItem(i,a)},this.chainUpdated=(i,a)=>{this.chainCallbackParams.chainId===i&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:i,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(i,a))},this.accountUpdated=i=>{this.accountsCallback&&this.accountsCallback([i]),W.accountRequestCallbackIds.size>0&&(Array.from(W.accountRequestCallbackIds.values()).forEach(a=>{const o={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[i]}};this.invokeCallback(Object.assign(Object.assign({},o),{id:a}))}),W.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:r,connection:s}=this.subscribe();this._session=t,this.connection=s,this.relayEventManager=new Br.RelayEventManager,this.ui=r}subscribe(){const e=He.WalletLinkSession.load(this.storage)||new He.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,r=new Wr.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),s=this.isMobileWeb?new lt.WLMobileRelayUI:new Kr.WalletLinkRelayUI;return r.connect(),{session:e,ui:s,connection:r}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{this.connection.destroy();const e=He.WalletLinkSession.load(this.storage);(e==null?void 0:e.id)===this._session.id&&$r.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(e=>{})}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,r,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),signature:(0,b.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,b.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,b.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,b.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const r=(0,b.randomBytesHex)(8),s=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i),t==null||t()};return new Promise((i,a)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(t==null||t(),(0,V.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(r,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const r={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",r,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r.id,response:{method:t.method,errorMessage:s.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof lt.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e){const{response:t}=e;if(t.method==="requestEthereumAccounts"){W.accountRequestCallbackIds.forEach(r=>this.invokeCallback(Object.assign(Object.assign({},e),{id:r}))),W.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,r){var s;const i=(s=r==null?void 0:r.message)!==null&&s!==void 0?s:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,b.randomBytesHex)(8);return new Promise((r,s)=>{this.relayEventManager.callbacks.set(t,i=>{if((0,V.isErrorResponse)(i))return s(new Error(i.errorMessage));r(i)}),W.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,r,s,i,a){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:s,image:i},chainId:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,V.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}addEthereumChain(e,t,r,s,i,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:s,chainName:i,iconUrls:r,nativeCurrency:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,V.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},s=(0,b.randomBytesHex)(8);return new Promise((i,a)=>{this.relayEventManager.callbacks.set(s,o=>{if((0,V.isErrorResponse)(o)&&o.errorCode)return a(qr.standardErrors.provider.custom({code:o.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,V.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(s,r)})}}Ie.WalletLinkRelay=W;W.accountRequestCallbackIds=new Set;var Fr=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.WalletLinkSigner=void 0;const Ke=Fr(sr),ut=N,Vr=ie,D=Q,zr=Ie,ht=T,w=j,g=u,Zr=O,qe="DefaultChainId",gt="DefaultJsonRpcUrl";class Gr{constructor(e){var t,r;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:s,appLogoUrl:i}=e.metadata;this._appName=s,this._appLogoUrl=i,this._storage=new Zr.ScopedLocalStorage("walletlink",ht.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Vr.RelayEventManager,this._jsonRpcUrlFromOpts="";const a=this._storage.getItem(ut.LOCAL_STORAGE_ADDRESSES_KEY);if(a){const c=a.split(" ");c[0]!==""&&(this._addresses=c.map(l=>(0,g.ensureAddressString)(l)),(t=this.updateListener)===null||t===void 0||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(qe)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:r}=e.getWalletLinkSession();return{id:t,secret:r}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(gt))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(gt,e)}updateProviderInfo(e,t){var r;this.jsonRpcUrl=e;const s=this.getChainId();this._storage.setItem(qe,t.toString(10)),((0,g.ensureIntNumber)(t)!==s||!this.hasMadeFirstChainChangedEmission)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,s,i,a){const c=await this.initializeRelay().watchAsset(e,t,r,s,i,a==null?void 0:a.toString());return(0,D.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(e,t,r,s,i,a){var o,c;if((0,g.ensureIntNumber)(e)===this.getChainId())return!1;const l=this.initializeRelay();this._isAuthorized()||await l.requestEthereumAccounts();const h=await l.addEthereumChain(e.toString(),t,i,r,s,a);return(0,D.isErrorResponse)(h)?!1:(((o=h.result)===null||o===void 0?void 0:o.isApproved)===!0&&this.updateProviderInfo(t[0],e),((c=h.result)===null||c===void 0?void 0:c.isApproved)===!0)}async switchEthereumChain(e){const r=await this.initializeRelay().switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,D.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===w.standardErrorCodes.provider.unsupportedChain?w.standardErrors.provider.unsupportedChain():w.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const s=r.result;s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch(t=>{throw t})}catch(t){return Promise.reject(t)}}async _request(e){if(!e||typeof e!="object"||Array.isArray(e))throw w.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if(typeof t!="string"||t.length===0)throw w.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw w.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=r===void 0?[]:r,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:s,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var r;if(!Array.isArray(e))throw new Error("addresses is not an array");const s=e.map(i=>(0,g.ensureAddressString)(i));JSON.stringify(s)!==JSON.stringify(this._addresses)&&(this._addresses=s,(r=this.updateListener)===null||r===void 0||r.onAccountsUpdate({accounts:s,source:"wallet"}),this._storage.setItem(ut.LOCAL_STORAGE_ADDRESSES_KEY,s.join(" ")))}_sendRequestAsync(e){return new Promise((t,r)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return t({jsonrpc:"2.0",id:e.id,result:s})}catch(s){return r(s)}this._handleAsynchronousMethods(e).then(s=>s&&t(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>r(s))})}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(e){try{const t=(0,g.ensureAddressString)(e);return this._addresses.map(s=>(0,g.ensureAddressString)(s)).includes(t)}catch{}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,g.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);const r=e.to?(0,g.ensureAddressString)(e.to):null,s=e.value!=null?(0,g.ensureBigInt)(e.value):BigInt(0),i=e.data?(0,g.ensureBuffer)(e.data):Buffer.alloc(0),a=e.nonce!=null?(0,g.ensureIntNumber)(e.nonce):null,o=e.gasPrice!=null?(0,g.ensureBigInt)(e.gasPrice):null,c=e.maxFeePerGas!=null?(0,g.ensureBigInt)(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?(0,g.ensureBigInt)(e.maxPriorityFeePerGas):null,h=e.gas!=null?(0,g.ensureBigInt)(e.gas):null,f=e.chainId?(0,g.ensureIntNumber)(e.chainId):this.getChainId();return{fromAddress:t,toAddress:r,weiValue:s,data:i,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:l,gasLimit:h,chainId:f}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw w.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw w.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,s){this._ensureKnownAddress(t);try{const a=await this.initializeRelay().signEthereumMessage(e,t,r,s);if((0,D.isErrorResponse)(a))throw new Error(a.errorMessage);return{jsonrpc:"2.0",id:0,result:a.result}}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied message signature"):i}}async _ethereumAddressFromSignedMessage(e,t,r){const i=await this.initializeRelay().ethereumAddressFromSignedMessage(e,t,r);if((0,D.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,g.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(qe);if(!e)return(0,g.ensureIntNumber)(1);const t=parseInt(e,10);return(0,g.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{if(e=await this.initializeRelay().requestEthereumAccounts(),(0,D.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(t){throw typeof t.message=="string"&&t.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied account authorization"):t}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_sendRawTransaction(e){const t=(0,g.ensureBuffer)(e[0]),s=await this.initializeRelay().submitEthereumTransaction(t,this.getChainId());if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signAndSubmitEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,g.ensureParsedJSONObject)(e[0]),r=(0,g.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const s=Ke.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(s,r,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v3({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v4({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _wallet_addEthereumChain(e){var t,r,s,i;const a=e[0];if(((t=a.rpcUrls)===null||t===void 0?void 0:t.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!a.chainName||a.chainName.trim()==="")throw w.standardErrors.rpc.invalidParams("chainName is a required field");if(!a.nativeCurrency)throw w.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(a.chainId,16);return await this.addEthereumChain(o,(r=a.rpcUrls)!==null&&r!==void 0?r:[],(s=a.blockExplorerUrls)!==null&&s!==void 0?s:[],a.chainName,(i=a.iconUrls)!==null&&i!==void 0?i:[],a.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw w.standardErrors.rpc.invalidParams("Type is required");if((t==null?void 0:t.type)!=="ERC20")throw w.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(t!=null&&t.options))throw w.standardErrors.rpc.invalidParams("Options are required");if(!(t!=null&&t.options.address))throw w.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:s,symbol:i,image:a,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,s,i,o,a,r)}}initializeRelay(){if(!this._relay){const e=new zr.WalletLinkRelay({linkAPIUrl:ht.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((t,r)=>this._setAddresses(t,r)),e.setChainCallback((t,r)=>{this.updateProviderInfo(r,parseInt(t,10))}),this._relay=e}return this._relay}}Ce.WalletLinkSigner=Gr;var k={};Object.defineProperty(k,"__esModule",{value:!0});k.checkErrorForInvalidRequestArgs=k.getCoinbaseInjectedProvider=k.getCoinbaseInjectedSigner=k.fetchRPCRequest=void 0;const Yr=K,pe=j;async function Jr(n,e){if(!e.rpcUrl)throw pe.standardErrors.rpc.internal("No RPC URL set for chain");const t=Object.assign(Object.assign({},n),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(e.rpcUrl,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Yr.LIB_VERSION}})).json()).result}k.fetchRPCRequest=Jr;function Gt(){return globalThis.coinbaseWalletSigner}k.getCoinbaseInjectedSigner=Gt;function Qr(){return globalThis.coinbaseWalletExtension}function Xr(){var n,e;try{const t=globalThis;return(n=t.ethereum)!==null&&n!==void 0?n:(e=t.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function es({metadata:n,preference:e}){var t;if(e.options!=="smartWalletOnly"){if(Gt())return;const i=Qr();if(i){const{appName:a,appLogoUrl:o,appChainIds:c}=n;return(t=i.setAppInfo)===null||t===void 0||t.call(i,a,o,c),i}}const r=Xr();if(r!=null&&r.isCoinbaseBrowser)return r}k.getCoinbaseInjectedProvider=es;function ts(n){if(!n||typeof n!="object"||Array.isArray(n))return pe.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:n});const{method:e,params:t}=n;if(typeof e!="string"||e.length===0)return pe.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:n});if(t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null))return pe.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:n})}k.checkErrorForInvalidRequestArgs=ts;Object.defineProperty(P,"__esModule",{value:!0});P.createSigner=P.fetchSignerType=P.storeSignerType=P.loadSignerType=void 0;const ns=_e,Yt=Ce,rs=j,ss=k,is=O,Jt="SignerType",Qt=new is.ScopedLocalStorage("CBWSDK","SignerConfigurator");function as(){return Qt.getItem(Jt)}P.loadSignerType=as;function os(n){Qt.setItem(Jt,n)}P.storeSignerType=os;async function cs(n){const{communicator:e,metadata:t}=n;ls(e,t).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:n.preference},{data:s}=await e.postRequestAndWaitForResponse(r);return s}P.fetchSignerType=cs;function ds(n){const{signerType:e,metadata:t,communicator:r,updateListener:s}=n;switch(e){case"scw":return new ns.SCWSigner({metadata:t,updateListener:s,communicator:r});case"walletlink":return new Yt.WalletLinkSigner({metadata:t,updateListener:s});case"extension":{const i=(0,ss.getCoinbaseInjectedSigner)();if(!i)throw rs.standardErrors.rpc.internal("injected signer not found");return i}}}P.createSigner=ds;async function ls(n,e){await n.onMessage(({event:r})=>r==="WalletLinkSessionRequest");const t=new Yt.WalletLinkSigner({metadata:e});n.postMessage({event:"WalletLinkUpdate",data:{session:t.getSession()}}),await t.handshake(),n.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Te={},J={};Object.defineProperty(J,"__esModule",{value:!0});J.closePopup=J.openPopup=void 0;const us=j,pt=420,ft=540;function hs(n){const e=(window.innerWidth-pt)/2+window.screenX,t=(window.innerHeight-ft)/2+window.screenY,r=window.open(n,"Smart Wallet",`width=${pt}, height=${ft}, left=${e}, top=${t}`);if(r==null||r.focus(),!r)throw us.standardErrors.rpc.internal("Pop up window failed to open");return r}J.openPopup=hs;function gs(n){n&&!n.closed&&n.close()}J.closePopup=gs;Object.defineProperty(Te,"__esModule",{value:!0});Te.Communicator=void 0;const ps=K,mt=J,fs=T,bt=j;class ms{constructor(e=fs.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async t=>{(await this.waitForPopupLoaded()).postMessage(t,this.url.origin)},this.postRequestAndWaitForResponse=async t=>{const r=this.onMessage(({requestId:s})=>s===t.id);return this.postMessage(t),await r},this.onMessage=async t=>new Promise((r,s)=>{const i=a=>{if(a.origin!==this.url.origin)return;const o=a.data;t(o)&&(r(o),window.removeEventListener("message",i),this.listeners.delete(i))};window.addEventListener("message",i),this.listeners.set(i,{reject:s})}),this.disconnect=()=>{(0,mt.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:t},r)=>{t(bt.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,mt.openPopup)(this.url),this.onMessage(({event:t})=>t==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:t})=>t==="PopupLoaded").then(t=>{this.postMessage({requestId:t.id,data:{version:ps.LIB_VERSION}})}).then(()=>{if(!this.popup)throw bt.standardErrors.rpc.internal();return this.popup})),this.url=new URL(e)}}Te.Communicator=ms;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.determineMethodCategory=void 0;const yt={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};function bs(n){for(const e in yt){const t=e;if(yt[t].includes(n))return t}}je.determineMethodCategory=bs;var ys=M&&M.__rest||function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s{try{if(this.connected)return this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),this.accounts;const h=await this.requestSignerSelection(),f=this.initSigner(h),d=await f.handshake();return this.signer=f,(0,ge.storeSignerType)(h),this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),d}catch(h){throw this.handleUnauthorizedError(h),h}},sign:async l=>{if(!this.connected||!this.signer)throw z.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(l)}catch(h){throw this.handleUnauthorizedError(h),h}},fetch:l=>(0,wt.fetchRPCRequest)(l,this.chain),state:l=>{const h=()=>{if(this.connected)return this.accounts;throw z.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(l.method){case"eth_chainId":return(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return h();case"eth_coinbase":return h()[0];default:return this.handlers.unsupported(l)}},deprecated:({method:l})=>{throw z.standardErrors.rpc.methodNotSupported(`Method ${l} is deprecated.`)},unsupported:({method:l})=>{throw z.standardErrors.rpc.methodNotSupported(`Method ${l} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:l,source:h})=>{(0,X.areAddressArraysEqual)(this.accounts,l)||(this.accounts=l,h!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:l,source:h})=>{l.id===this.chain.id&&l.rpcUrl===this.chain.rpcUrl||(this.chain=l,h!=="storage"&&this.emit("chainChanged",(0,X.hexStringFromIntNumber)((0,he.IntNumber)(l.id))))}},this.metadata=s,this.preference=o,this.communicator=new Es.Communicator(a),this.chain={id:(r=(t=s.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1};const c=(0,ge.loadSignerType)();this.signer=c?this.initSigner(c):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const r=(0,wt.checkErrorForInvalidRequestArgs)(e);if(r)throw r;const s=(t=(0,Ss.determineMethodCategory)(e.method))!==null&&t!==void 0?t:"fetch";return this.handlers[s](e)}catch(r){return Promise.reject((0,_s.serializeError)(r,e.method))}}handleUnauthorizedError(e){e.code===z.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},Cs.ScopedLocalStorage.clearAll(),this.emit("disconnect",z.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,ge.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,ge.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}be.CoinbaseWalletProvider=ks;Object.defineProperty(te,"__esModule",{value:!0});te.CoinbaseWalletSDK=void 0;const Is=me,Ms=be,Ls=O,As=K,Rs=u,xs=k;class Ps{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,Rs.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;const r={metadata:this.metadata,preference:e};return(t=(0,xs.getCoinbaseInjectedProvider)(r))!==null&&t!==void 0?t:new Ms.CoinbaseWalletProvider(r)}getCoinbaseWalletLogo(e,t=240){return(0,Is.walletLogo)(e,t)}storeLatestVersion(){new Ls.ScopedLocalStorage("CBWSDK").setItem("VERSION",As.LIB_VERSION)}}te.CoinbaseWalletSDK=Ps;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.CoinbaseWalletSDK=void 0;const e=te;n.default=e.CoinbaseWalletSDK;var t=te;Object.defineProperty(n,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return t.CoinbaseWalletSDK}})})(Et);const Ns=nn(Et),Os=Object.freeze(Object.defineProperty({__proto__:null,default:Ns},Symbol.toStringTag,{value:"Module"}));export{Os as i}; diff --git a/assets/secp256k1-z3WGfxvh.js b/assets/secp256k1-Db0UiqTi.js similarity index 99% rename from assets/secp256k1-z3WGfxvh.js rename to assets/secp256k1-Db0UiqTi.js index dcc6d11..e94f6dc 100644 --- a/assets/secp256k1-z3WGfxvh.js +++ b/assets/secp256k1-Db0UiqTi.js @@ -1 +1 @@ -import{b7 as Pt,b8 as Ft,b9 as Gt,ba as Ot,bb as Wt,bc as Xt,bd as Dt,be as Qt}from"./index-CFrD00kt.js";/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ut=BigInt(0),ht=BigInt(1),Jt=BigInt(2);function nt(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function lt(e){if(!nt(e))throw new Error("Uint8Array expected")}const te=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function st(e){lt(e);let n="";for(let t=0;t=P._0&&e<=P._9)return e-P._0;if(e>=P._A&&e<=P._F)return e-(P._A-10);if(e>=P._a&&e<=P._f)return e-(P._a-10)}function ct(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const n=e.length,t=n/2;if(n%2)throw new Error("padded hex string expected, got unpadded hex of length "+n);const r=new Uint8Array(t);for(let s=0,i=0;sUt;e>>=ht,n+=1);return n}function ie(e,n){return e>>BigInt(n)&ht}function se(e,n,t){return e|(t?ht:Ut)<(Jt<new Uint8Array(e),_t=e=>Uint8Array.from(e);function Ct(e,n,t){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof n!="number"||n<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=wt(e),s=wt(e),i=0;const l=()=>{r.fill(1),s.fill(0),i=0},c=(...w)=>t(s,r,...w),o=(w=wt())=>{s=c(_t([0]),w),r=c(),w.length!==0&&(s=c(_t([1]),w),r=c())},a=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let w=0;const q=[];for(;w{l(),o(w);let T;for(;!(T=q(a()));)o();return l(),T}}const ce={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||nt(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,n)=>n.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function dt(e,n,t={}){const r=(s,i,l)=>{const c=ce[i];if(typeof c!="function")throw new Error(`Invalid validator "${i}", expected function`);const o=e[s];if(!(l&&o===void 0)&&!c(o,e))throw new Error(`Invalid param ${String(s)}=${o} (${typeof o}), expected ${i}`)};for(const[s,i]of Object.entries(n))r(s,i,!1);for(const[s,i]of Object.entries(t))r(s,i,!0);return e}const fe=Object.freeze(Object.defineProperty({__proto__:null,abytes:lt,bitGet:ie,bitLen:oe,bitMask:It,bitSet:se,bytesToHex:st,bytesToNumberBE:et,bytesToNumberLE:xt,concatBytes:ut,createHmacDrbg:Ct,ensureBytes:M,equalBytes:ne,hexToBytes:ct,hexToNumber:Bt,isBytes:nt,numberToBytesBE:ft,numberToBytesLE:vt,numberToHexUnpadded:Rt,numberToVarBytesBE:ee,utf8ToBytes:re,validateObject:dt},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const L=BigInt(0),$=BigInt(1),J=BigInt(2),ae=BigInt(3),yt=BigInt(4),Tt=BigInt(5),$t=BigInt(8);BigInt(9);BigInt(16);function R(e,n){const t=e%n;return t>=L?t:n+t}function ue(e,n,t){if(t<=L||n 0");if(t===$)return L;let r=$;for(;n>L;)n&$&&(r=r*e%t),e=e*e%t,n>>=$;return r}function V(e,n,t){let r=e;for(;n-- >L;)r*=r,r%=t;return r}function bt(e,n){if(e===L||n<=L)throw new Error(`invert: expected positive integers, got n=${e} mod=${n}`);let t=R(e,n),r=n,s=L,i=$;for(;t!==L;){const c=r/t,o=r%t,a=s-i*c;r=t,t=o,s=i,i=a}if(r!==$)throw new Error("invert: does not exist");return R(s,n)}function le(e){const n=(e-$)/J;let t,r,s;for(t=e-$,r=0;t%J===L;t/=J,r++);for(s=J;s(r[s]="function",r),n);return dt(e,t)}function we(e,n,t){if(t 0");if(t===L)return e.ONE;if(t===$)return n;let r=e.ONE,s=n;for(;t>L;)t&$&&(r=e.mul(r,s)),s=e.sqr(s),t>>=$;return r}function pe(e,n){const t=new Array(n.length),r=n.reduce((i,l,c)=>e.is0(l)?i:(t[c]=i,e.mul(i,l)),e.ONE),s=e.inv(r);return n.reduceRight((i,l,c)=>e.is0(l)?i:(t[c]=e.mul(i,t[c]),e.mul(i,l)),s),t}function zt(e,n){const t=n!==void 0?n:e.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function ye(e,n,t=!1,r={}){if(e<=L)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:i}=zt(e,n);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const l=de(e),c=Object.freeze({ORDER:e,BITS:s,BYTES:i,MASK:It(s),ZERO:L,ONE:$,create:o=>R(o,e),isValid:o=>{if(typeof o!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof o}`);return L<=o&&oo===L,isOdd:o=>(o&$)===$,neg:o=>R(-o,e),eql:(o,a)=>o===a,sqr:o=>R(o*o,e),add:(o,a)=>R(o+a,e),sub:(o,a)=>R(o-a,e),mul:(o,a)=>R(o*a,e),pow:(o,a)=>we(c,o,a),div:(o,a)=>R(o*bt(a,e),e),sqrN:o=>o*o,addN:(o,a)=>o+a,subN:(o,a)=>o-a,mulN:(o,a)=>o*a,inv:o=>bt(o,e),sqrt:r.sqrt||(o=>l(c,o)),invertBatch:o=>pe(c,o),cmov:(o,a,y)=>y?a:o,toBytes:o=>t?vt(o,i):ft(o,i),fromBytes:o=>{if(o.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${o.length}`);return t?xt(o):et(o)}});return Object.freeze(c)}function kt(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const n=e.toString(2).length;return Math.ceil(n/8)}function Vt(e){const n=kt(e);return n+Math.ceil(n/2)}function be(e,n,t=!1){const r=e.length,s=kt(n),i=Vt(n);if(r<16||r1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const l=t?et(e):xt(e),c=R(l,n-$)+$;return t?vt(c,s):ft(c,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const me=BigInt(0),pt=BigInt(1);function Ee(e,n){const t=(s,i)=>{const l=i.negate();return s?l:i},r=s=>{const i=Math.ceil(n/s)+1,l=2**(s-1);return{windows:i,windowSize:l}};return{constTimeNegate:t,unsafeLadder(s,i){let l=e.ZERO,c=s;for(;i>me;)i&pt&&(l=l.add(c)),c=c.double(),i>>=pt;return l},precomputeWindow(s,i){const{windows:l,windowSize:c}=r(i),o=[];let a=s,y=a;for(let w=0;w>=T,d>o&&(d-=q,l+=pt);const h=f,m=f+Math.abs(d)-1,B=b%2!==0,S=d<0;d===0?y=y.add(t(B,i[h])):a=a.add(t(S,i[m]))}return{p:a,f:y}},wNAFCached(s,i,l,c){const o=s._WINDOW_SIZE||1;let a=i.get(s);return a||(a=this.precomputeWindow(s,o),o!==1&&i.set(s,c(a))),this.wNAF(o,a,l)}}}function jt(e){return ge(e.Fp),dt(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...zt(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Be(e){const n=jt(e);dt(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:s}=n;if(t){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}const{bytesToNumberBE:xe,hexToBytes:ve}=fe,tt={Err:class extends Error{constructor(n=""){super(n)}},_parseInt(e){const{Err:n}=tt;if(e.length<2||e[0]!==2)throw new n("Invalid signature integer tag");const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new n("Invalid signature integer: wrong length");if(r[0]&128)throw new n("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new n("Invalid signature integer: unnecessary leading zero");return{d:xe(r),l:e.subarray(t+2)}},toSig(e){const{Err:n}=tt,t=typeof e=="string"?ve(e):e;lt(t);let r=t.length;if(r<2||t[0]!=48)throw new n("Invalid signature tag");if(t[1]!==r-2)throw new n("Invalid signature: incorrect length");const{d:s,l:i}=tt._parseInt(t.subarray(2)),{d:l,l:c}=tt._parseInt(i);if(c.length)throw new n("Invalid signature: left bytes after parsing");return{r:s,s:l}},hexFromSig(e){const n=a=>Number.parseInt(a[0],16)&8?"00"+a:a,t=a=>{const y=a.toString(16);return y.length&1?`0${y}`:y},r=n(t(e.s)),s=n(t(e.r)),i=r.length/2,l=s.length/2,c=t(i),o=t(l);return`30${t(l+i+4)}02${o}${s}02${c}${r}`}},F=BigInt(0),j=BigInt(1);BigInt(2);const Ht=BigInt(3);BigInt(4);function Ie(e){const n=Be(e),{Fp:t}=n,r=n.toBytes||((b,f,d)=>{const h=f.toAffine();return ut(Uint8Array.from([4]),t.toBytes(h.x),t.toBytes(h.y))}),s=n.fromBytes||(b=>{const f=b.subarray(1),d=t.fromBytes(f.subarray(0,t.BYTES)),h=t.fromBytes(f.subarray(t.BYTES,2*t.BYTES));return{x:d,y:h}});function i(b){const{a:f,b:d}=n,h=t.sqr(b),m=t.mul(h,b);return t.add(t.add(m,t.mul(b,f)),d)}if(!t.eql(t.sqr(n.Gy),i(n.Gx)))throw new Error("bad generator point: equation left != right");function l(b){return typeof b=="bigint"&&Ft.eql(B,t.ZERO);return m(d)&&m(h)?w.ZERO:new w(d,h,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(f){const d=t.invertBatch(f.map(h=>h.pz));return f.map((h,m)=>h.toAffine(d[m])).map(w.fromAffine)}static fromHex(f){const d=w.fromAffine(s(M("pointHex",f)));return d.assertValidity(),d}static fromPrivateKey(f){return w.BASE.multiply(o(f))}_setWindowSize(f){this._WINDOW_SIZE=f,a.delete(this)}assertValidity(){if(this.is0()){if(n.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:f,y:d}=this.toAffine();if(!t.isValid(f)||!t.isValid(d))throw new Error("bad point: x or y not FE");const h=t.sqr(d),m=i(f);if(!t.eql(h,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:f}=this.toAffine();if(t.isOdd)return!t.isOdd(f);throw new Error("Field doesn't support isOdd")}equals(f){y(f);const{px:d,py:h,pz:m}=this,{px:B,py:S,pz:I}=f,p=t.eql(t.mul(d,I),t.mul(B,m)),E=t.eql(t.mul(h,I),t.mul(S,m));return p&&E}negate(){return new w(this.px,t.neg(this.py),this.pz)}double(){const{a:f,b:d}=n,h=t.mul(d,Ht),{px:m,py:B,pz:S}=this;let I=t.ZERO,p=t.ZERO,E=t.ZERO,v=t.mul(m,m),k=t.mul(B,B),_=t.mul(S,S),A=t.mul(m,B);return A=t.add(A,A),E=t.mul(m,S),E=t.add(E,E),I=t.mul(f,E),p=t.mul(h,_),p=t.add(I,p),I=t.sub(k,p),p=t.add(k,p),p=t.mul(I,p),I=t.mul(A,I),E=t.mul(h,E),_=t.mul(f,_),A=t.sub(v,_),A=t.mul(f,A),A=t.add(A,E),E=t.add(v,v),v=t.add(E,v),v=t.add(v,_),v=t.mul(v,A),p=t.add(p,v),_=t.mul(B,S),_=t.add(_,_),v=t.mul(_,A),I=t.sub(I,v),E=t.mul(_,k),E=t.add(E,E),E=t.add(E,E),new w(I,p,E)}add(f){y(f);const{px:d,py:h,pz:m}=this,{px:B,py:S,pz:I}=f;let p=t.ZERO,E=t.ZERO,v=t.ZERO;const k=n.a,_=t.mul(n.b,Ht);let A=t.mul(d,B),C=t.mul(h,S),z=t.mul(m,I),G=t.add(d,h),u=t.add(B,S);G=t.mul(G,u),u=t.add(A,C),G=t.sub(G,u),u=t.add(d,m);let g=t.add(B,I);return u=t.mul(u,g),g=t.add(A,z),u=t.sub(u,g),g=t.add(h,m),p=t.add(S,I),g=t.mul(g,p),p=t.add(C,z),g=t.sub(g,p),v=t.mul(k,u),p=t.mul(_,z),v=t.add(p,v),p=t.sub(C,v),v=t.add(C,v),E=t.mul(p,v),C=t.add(A,A),C=t.add(C,A),z=t.mul(k,z),u=t.mul(_,u),C=t.add(C,z),z=t.sub(A,z),z=t.mul(k,z),u=t.add(u,z),A=t.mul(C,u),E=t.add(E,A),A=t.mul(g,u),p=t.mul(G,p),p=t.sub(p,A),A=t.mul(G,C),v=t.mul(g,v),v=t.add(v,A),new w(p,E,v)}subtract(f){return this.add(f.negate())}is0(){return this.equals(w.ZERO)}wNAF(f){return T.wNAFCached(this,a,f,d=>{const h=t.invertBatch(d.map(m=>m.pz));return d.map((m,B)=>m.toAffine(h[B])).map(w.fromAffine)})}multiplyUnsafe(f){const d=w.ZERO;if(f===F)return d;if(c(f),f===j)return this;const{endo:h}=n;if(!h)return T.unsafeLadder(this,f);let{k1neg:m,k1:B,k2neg:S,k2:I}=h.splitScalar(f),p=d,E=d,v=this;for(;B>F||I>F;)B&j&&(p=p.add(v)),I&j&&(E=E.add(v)),v=v.double(),B>>=j,I>>=j;return m&&(p=p.negate()),S&&(E=E.negate()),E=new w(t.mul(E.px,h.beta),E.py,E.pz),p.add(E)}multiply(f){c(f);let d=f,h,m;const{endo:B}=n;if(B){const{k1neg:S,k1:I,k2neg:p,k2:E}=B.splitScalar(d);let{p:v,f:k}=this.wNAF(I),{p:_,f:A}=this.wNAF(E);v=T.constTimeNegate(S,v),_=T.constTimeNegate(p,_),_=new w(t.mul(_.px,B.beta),_.py,_.pz),h=v.add(_),m=k.add(A)}else{const{p:S,f:I}=this.wNAF(d);h=S,m=I}return w.normalizeZ([h,m])[0]}multiplyAndAddUnsafe(f,d,h){const m=w.BASE,B=(I,p)=>p===F||p===j||!I.equals(m)?I.multiplyUnsafe(p):I.multiply(p),S=B(this,d).add(B(f,h));return S.is0()?void 0:S}toAffine(f){const{px:d,py:h,pz:m}=this,B=this.is0();f==null&&(f=B?t.ONE:t.inv(m));const S=t.mul(d,f),I=t.mul(h,f),p=t.mul(m,f);if(B)return{x:t.ZERO,y:t.ZERO};if(!t.eql(p,t.ONE))throw new Error("invZ was invalid");return{x:S,y:I}}isTorsionFree(){const{h:f,isTorsionFree:d}=n;if(f===j)return!0;if(d)return d(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:f,clearCofactor:d}=n;return f===j?this:d?d(w,this):this.multiplyUnsafe(n.h)}toRawBytes(f=!0){return this.assertValidity(),r(w,this,f)}toHex(f=!0){return st(this.toRawBytes(f))}}w.BASE=new w(n.Gx,n.Gy,t.ONE),w.ZERO=new w(t.ZERO,t.ONE,t.ZERO);const q=n.nBitLength,T=Ee(w,n.endo?Math.ceil(q/2):q);return{CURVE:n,ProjectivePoint:w,normPrivateKeyToScalar:o,weierstrassEquation:i,isWithinCurveOrder:l}}function Se(e){const n=jt(e);return dt(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}function Ae(e){const n=Se(e),{Fp:t,n:r}=n,s=t.BYTES+1,i=2*t.BYTES+1;function l(u){return Fst(ft(u,n.nByteLength));function b(u){const g=r>>j;return u>g}function f(u){return b(u)?c(-u):u}const d=(u,g,x)=>et(u.slice(g,x));class h{constructor(g,x,N){this.r=g,this.s=x,this.recovery=N,this.assertValidity()}static fromCompact(g){const x=n.nByteLength;return g=M("compactSignature",g,x*2),new h(d(g,0,x),d(g,x,2*x))}static fromDER(g){const{r:x,s:N}=tt.toSig(M("DER",g));return new h(x,N)}assertValidity(){if(!q(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!q(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(g){return new h(this.r,this.s,g)}recoverPublicKey(g){const{r:x,s:N,recovery:O}=this,H=E(M("msgHash",g));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const Z=O===2||O===3?x+n.n:x;if(Z>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const U=O&1?"03":"02",W=a.fromHex(U+T(Z)),Y=o(Z),X=c(-H*Y),at=c(N*Y),D=a.BASE.multiplyAndAddUnsafe(W,X,at);if(!D)throw new Error("point at infinify");return D.assertValidity(),D}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new h(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return ct(this.toDERHex())}toDERHex(){return tt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ct(this.toCompactHex())}toCompactHex(){return T(this.r)+T(this.s)}}const m={isValidPrivateKey(u){try{return y(u),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{const u=Vt(n.n);return be(n.randomBytes(u),n.n)},precompute(u=8,g=a.BASE){return g._setWindowSize(u),g.multiply(BigInt(3)),g}};function B(u,g=!0){return a.fromPrivateKey(u).toRawBytes(g)}function S(u){const g=nt(u),x=typeof u=="string",N=(g||x)&&u.length;return g?N===s||N===i:x?N===2*s||N===2*i:u instanceof a}function I(u,g,x=!0){if(S(u))throw new Error("first arg must be private key");if(!S(g))throw new Error("second arg must be public key");return a.fromHex(g).multiply(y(u)).toRawBytes(x)}const p=n.bits2int||function(u){const g=et(u),x=u.length*8-n.nBitLength;return x>0?g>>BigInt(x):g},E=n.bits2int_modN||function(u){return c(p(u))},v=It(n.nBitLength);function k(u){if(typeof u!="bigint")throw new Error("bigint expected");if(!(F<=u&&uQ in x))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:O}=n;let{lowS:H,prehash:Z,extraEntropy:U}=x;H==null&&(H=!0),u=M("msgHash",u),Z&&(u=M("prehashed msgHash",N(u)));const W=E(u),Y=y(g),X=[k(Y),k(W)];if(U!=null&&U!==!1){const Q=U===!0?O(t.BYTES):U;X.push(M("extraEntropy",Q))}const at=ut(...X),D=W;function gt(Q){const rt=p(Q);if(!q(rt))return;const St=o(rt),ot=a.BASE.multiply(rt).toAffine(),K=c(ot.x);if(K===F)return;const it=c(St*c(D+K*Y));if(it===F)return;let At=(ot.x===K?0:2)|Number(ot.y&j),qt=it;return H&&b(it)&&(qt=f(it),At^=1),new h(K,qt,At)}return{seed:at,k2sig:gt}}const A={lowS:n.lowS,prehash:!1},C={lowS:n.lowS,prehash:!1};function z(u,g,x=A){const{seed:N,k2sig:O}=_(u,g,x),H=n;return Ct(H.hash.outputLen,H.nByteLength,H.hmac)(N,O)}a.BASE._setWindowSize(8);function G(u,g,x,N=C){var ot;const O=u;if(g=M("msgHash",g),x=M("publicKey",x),"strict"in N)throw new Error("options.strict was renamed to lowS");const{lowS:H,prehash:Z}=N;let U,W;try{if(typeof O=="string"||nt(O))try{U=h.fromDER(O)}catch(K){if(!(K instanceof tt.Err))throw K;U=h.fromCompact(O)}else if(typeof O=="object"&&typeof O.r=="bigint"&&typeof O.s=="bigint"){const{r:K,s:it}=O;U=new h(K,it)}else throw new Error("PARSE");W=a.fromHex(x)}catch(K){if(K.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(H&&U.hasHighS())return!1;Z&&(g=n.hash(g));const{r:Y,s:X}=U,at=E(g),D=o(X),gt=c(at*D),Q=c(Y*D),rt=(ot=a.BASE.multiplyAndAddUnsafe(W,gt,Q))==null?void 0:ot.toAffine();return rt?c(rt.x)===Y:!1}return{CURVE:n,getPublicKey:B,getSharedSecret:I,sign:z,verify:G,ProjectivePoint:a,Signature:h,utils:m}}class Yt extends Pt{constructor(n,t){super(),this.finished=!1,this.destroyed=!1,Ft(n);const r=Gt(t);if(this.iHash=n.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?n.create().update(r).digest():r);for(let l=0;lnew Yt(e,n).update(t).digest();Kt.create=(e,n)=>new Yt(e,n);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qe(e){return{hash:e,hmac:(n,...t)=>Kt(e,n,Xt(...t)),randomBytes:Dt}}function Oe(e,n){const t=r=>Ae({...e,...qe(r)});return Object.freeze({...t(n),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mt=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Lt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ne=BigInt(1),mt=BigInt(2),Zt=(e,n)=>(e+n/mt)/n;function _e(e){const n=Mt,t=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),l=BigInt(23),c=BigInt(44),o=BigInt(88),a=e*e*e%n,y=a*a*e%n,w=V(y,t,n)*y%n,q=V(w,t,n)*y%n,T=V(q,mt,n)*a%n,b=V(T,s,n)*T%n,f=V(b,i,n)*b%n,d=V(f,c,n)*f%n,h=V(d,o,n)*d%n,m=V(h,c,n)*f%n,B=V(m,t,n)*y%n,S=V(B,l,n)*b%n,I=V(S,r,n)*a%n,p=V(I,mt,n);if(!Et.eql(Et.sqr(p),e))throw new Error("Cannot find square root");return p}const Et=ye(Mt,void 0,void 0,{sqrt:_e}),Te=Oe({a:BigInt(0),b:BigInt(7),Fp:Et,n:Lt,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const n=Lt,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ne*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,l=BigInt("0x100000000000000000000000000000000"),c=Zt(i*e,n),o=Zt(-r*e,n);let a=R(e-c*t-o*s,n),y=R(-c*r-o*i,n);const w=a>l,q=y>l;if(w&&(a=n-a),q&&(y=n-y),a>l||y>l)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:w,k1:a,k2neg:q,k2:y}}}},Qt);BigInt(0);Te.ProjectivePoint;export{Te as secp256k1}; +import{b7 as Pt,b8 as Ft,b9 as Gt,ba as Ot,bb as Wt,bc as Xt,bd as Dt,be as Qt}from"./index-BSVOad49.js";/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ut=BigInt(0),ht=BigInt(1),Jt=BigInt(2);function nt(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function lt(e){if(!nt(e))throw new Error("Uint8Array expected")}const te=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function st(e){lt(e);let n="";for(let t=0;t=P._0&&e<=P._9)return e-P._0;if(e>=P._A&&e<=P._F)return e-(P._A-10);if(e>=P._a&&e<=P._f)return e-(P._a-10)}function ct(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const n=e.length,t=n/2;if(n%2)throw new Error("padded hex string expected, got unpadded hex of length "+n);const r=new Uint8Array(t);for(let s=0,i=0;sUt;e>>=ht,n+=1);return n}function ie(e,n){return e>>BigInt(n)&ht}function se(e,n,t){return e|(t?ht:Ut)<(Jt<new Uint8Array(e),_t=e=>Uint8Array.from(e);function Ct(e,n,t){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof n!="number"||n<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=wt(e),s=wt(e),i=0;const l=()=>{r.fill(1),s.fill(0),i=0},c=(...w)=>t(s,r,...w),o=(w=wt())=>{s=c(_t([0]),w),r=c(),w.length!==0&&(s=c(_t([1]),w),r=c())},a=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let w=0;const q=[];for(;w{l(),o(w);let T;for(;!(T=q(a()));)o();return l(),T}}const ce={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||nt(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,n)=>n.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function dt(e,n,t={}){const r=(s,i,l)=>{const c=ce[i];if(typeof c!="function")throw new Error(`Invalid validator "${i}", expected function`);const o=e[s];if(!(l&&o===void 0)&&!c(o,e))throw new Error(`Invalid param ${String(s)}=${o} (${typeof o}), expected ${i}`)};for(const[s,i]of Object.entries(n))r(s,i,!1);for(const[s,i]of Object.entries(t))r(s,i,!0);return e}const fe=Object.freeze(Object.defineProperty({__proto__:null,abytes:lt,bitGet:ie,bitLen:oe,bitMask:It,bitSet:se,bytesToHex:st,bytesToNumberBE:et,bytesToNumberLE:xt,concatBytes:ut,createHmacDrbg:Ct,ensureBytes:M,equalBytes:ne,hexToBytes:ct,hexToNumber:Bt,isBytes:nt,numberToBytesBE:ft,numberToBytesLE:vt,numberToHexUnpadded:Rt,numberToVarBytesBE:ee,utf8ToBytes:re,validateObject:dt},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const L=BigInt(0),$=BigInt(1),J=BigInt(2),ae=BigInt(3),yt=BigInt(4),Tt=BigInt(5),$t=BigInt(8);BigInt(9);BigInt(16);function R(e,n){const t=e%n;return t>=L?t:n+t}function ue(e,n,t){if(t<=L||n 0");if(t===$)return L;let r=$;for(;n>L;)n&$&&(r=r*e%t),e=e*e%t,n>>=$;return r}function V(e,n,t){let r=e;for(;n-- >L;)r*=r,r%=t;return r}function bt(e,n){if(e===L||n<=L)throw new Error(`invert: expected positive integers, got n=${e} mod=${n}`);let t=R(e,n),r=n,s=L,i=$;for(;t!==L;){const c=r/t,o=r%t,a=s-i*c;r=t,t=o,s=i,i=a}if(r!==$)throw new Error("invert: does not exist");return R(s,n)}function le(e){const n=(e-$)/J;let t,r,s;for(t=e-$,r=0;t%J===L;t/=J,r++);for(s=J;s(r[s]="function",r),n);return dt(e,t)}function we(e,n,t){if(t 0");if(t===L)return e.ONE;if(t===$)return n;let r=e.ONE,s=n;for(;t>L;)t&$&&(r=e.mul(r,s)),s=e.sqr(s),t>>=$;return r}function pe(e,n){const t=new Array(n.length),r=n.reduce((i,l,c)=>e.is0(l)?i:(t[c]=i,e.mul(i,l)),e.ONE),s=e.inv(r);return n.reduceRight((i,l,c)=>e.is0(l)?i:(t[c]=e.mul(i,t[c]),e.mul(i,l)),s),t}function zt(e,n){const t=n!==void 0?n:e.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function ye(e,n,t=!1,r={}){if(e<=L)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:i}=zt(e,n);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const l=de(e),c=Object.freeze({ORDER:e,BITS:s,BYTES:i,MASK:It(s),ZERO:L,ONE:$,create:o=>R(o,e),isValid:o=>{if(typeof o!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof o}`);return L<=o&&oo===L,isOdd:o=>(o&$)===$,neg:o=>R(-o,e),eql:(o,a)=>o===a,sqr:o=>R(o*o,e),add:(o,a)=>R(o+a,e),sub:(o,a)=>R(o-a,e),mul:(o,a)=>R(o*a,e),pow:(o,a)=>we(c,o,a),div:(o,a)=>R(o*bt(a,e),e),sqrN:o=>o*o,addN:(o,a)=>o+a,subN:(o,a)=>o-a,mulN:(o,a)=>o*a,inv:o=>bt(o,e),sqrt:r.sqrt||(o=>l(c,o)),invertBatch:o=>pe(c,o),cmov:(o,a,y)=>y?a:o,toBytes:o=>t?vt(o,i):ft(o,i),fromBytes:o=>{if(o.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${o.length}`);return t?xt(o):et(o)}});return Object.freeze(c)}function kt(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const n=e.toString(2).length;return Math.ceil(n/8)}function Vt(e){const n=kt(e);return n+Math.ceil(n/2)}function be(e,n,t=!1){const r=e.length,s=kt(n),i=Vt(n);if(r<16||r1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const l=t?et(e):xt(e),c=R(l,n-$)+$;return t?vt(c,s):ft(c,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const me=BigInt(0),pt=BigInt(1);function Ee(e,n){const t=(s,i)=>{const l=i.negate();return s?l:i},r=s=>{const i=Math.ceil(n/s)+1,l=2**(s-1);return{windows:i,windowSize:l}};return{constTimeNegate:t,unsafeLadder(s,i){let l=e.ZERO,c=s;for(;i>me;)i&pt&&(l=l.add(c)),c=c.double(),i>>=pt;return l},precomputeWindow(s,i){const{windows:l,windowSize:c}=r(i),o=[];let a=s,y=a;for(let w=0;w>=T,d>o&&(d-=q,l+=pt);const h=f,m=f+Math.abs(d)-1,B=b%2!==0,S=d<0;d===0?y=y.add(t(B,i[h])):a=a.add(t(S,i[m]))}return{p:a,f:y}},wNAFCached(s,i,l,c){const o=s._WINDOW_SIZE||1;let a=i.get(s);return a||(a=this.precomputeWindow(s,o),o!==1&&i.set(s,c(a))),this.wNAF(o,a,l)}}}function jt(e){return ge(e.Fp),dt(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...zt(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Be(e){const n=jt(e);dt(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:s}=n;if(t){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}const{bytesToNumberBE:xe,hexToBytes:ve}=fe,tt={Err:class extends Error{constructor(n=""){super(n)}},_parseInt(e){const{Err:n}=tt;if(e.length<2||e[0]!==2)throw new n("Invalid signature integer tag");const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new n("Invalid signature integer: wrong length");if(r[0]&128)throw new n("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new n("Invalid signature integer: unnecessary leading zero");return{d:xe(r),l:e.subarray(t+2)}},toSig(e){const{Err:n}=tt,t=typeof e=="string"?ve(e):e;lt(t);let r=t.length;if(r<2||t[0]!=48)throw new n("Invalid signature tag");if(t[1]!==r-2)throw new n("Invalid signature: incorrect length");const{d:s,l:i}=tt._parseInt(t.subarray(2)),{d:l,l:c}=tt._parseInt(i);if(c.length)throw new n("Invalid signature: left bytes after parsing");return{r:s,s:l}},hexFromSig(e){const n=a=>Number.parseInt(a[0],16)&8?"00"+a:a,t=a=>{const y=a.toString(16);return y.length&1?`0${y}`:y},r=n(t(e.s)),s=n(t(e.r)),i=r.length/2,l=s.length/2,c=t(i),o=t(l);return`30${t(l+i+4)}02${o}${s}02${c}${r}`}},F=BigInt(0),j=BigInt(1);BigInt(2);const Ht=BigInt(3);BigInt(4);function Ie(e){const n=Be(e),{Fp:t}=n,r=n.toBytes||((b,f,d)=>{const h=f.toAffine();return ut(Uint8Array.from([4]),t.toBytes(h.x),t.toBytes(h.y))}),s=n.fromBytes||(b=>{const f=b.subarray(1),d=t.fromBytes(f.subarray(0,t.BYTES)),h=t.fromBytes(f.subarray(t.BYTES,2*t.BYTES));return{x:d,y:h}});function i(b){const{a:f,b:d}=n,h=t.sqr(b),m=t.mul(h,b);return t.add(t.add(m,t.mul(b,f)),d)}if(!t.eql(t.sqr(n.Gy),i(n.Gx)))throw new Error("bad generator point: equation left != right");function l(b){return typeof b=="bigint"&&Ft.eql(B,t.ZERO);return m(d)&&m(h)?w.ZERO:new w(d,h,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(f){const d=t.invertBatch(f.map(h=>h.pz));return f.map((h,m)=>h.toAffine(d[m])).map(w.fromAffine)}static fromHex(f){const d=w.fromAffine(s(M("pointHex",f)));return d.assertValidity(),d}static fromPrivateKey(f){return w.BASE.multiply(o(f))}_setWindowSize(f){this._WINDOW_SIZE=f,a.delete(this)}assertValidity(){if(this.is0()){if(n.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:f,y:d}=this.toAffine();if(!t.isValid(f)||!t.isValid(d))throw new Error("bad point: x or y not FE");const h=t.sqr(d),m=i(f);if(!t.eql(h,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:f}=this.toAffine();if(t.isOdd)return!t.isOdd(f);throw new Error("Field doesn't support isOdd")}equals(f){y(f);const{px:d,py:h,pz:m}=this,{px:B,py:S,pz:I}=f,p=t.eql(t.mul(d,I),t.mul(B,m)),E=t.eql(t.mul(h,I),t.mul(S,m));return p&&E}negate(){return new w(this.px,t.neg(this.py),this.pz)}double(){const{a:f,b:d}=n,h=t.mul(d,Ht),{px:m,py:B,pz:S}=this;let I=t.ZERO,p=t.ZERO,E=t.ZERO,v=t.mul(m,m),k=t.mul(B,B),_=t.mul(S,S),A=t.mul(m,B);return A=t.add(A,A),E=t.mul(m,S),E=t.add(E,E),I=t.mul(f,E),p=t.mul(h,_),p=t.add(I,p),I=t.sub(k,p),p=t.add(k,p),p=t.mul(I,p),I=t.mul(A,I),E=t.mul(h,E),_=t.mul(f,_),A=t.sub(v,_),A=t.mul(f,A),A=t.add(A,E),E=t.add(v,v),v=t.add(E,v),v=t.add(v,_),v=t.mul(v,A),p=t.add(p,v),_=t.mul(B,S),_=t.add(_,_),v=t.mul(_,A),I=t.sub(I,v),E=t.mul(_,k),E=t.add(E,E),E=t.add(E,E),new w(I,p,E)}add(f){y(f);const{px:d,py:h,pz:m}=this,{px:B,py:S,pz:I}=f;let p=t.ZERO,E=t.ZERO,v=t.ZERO;const k=n.a,_=t.mul(n.b,Ht);let A=t.mul(d,B),C=t.mul(h,S),z=t.mul(m,I),G=t.add(d,h),u=t.add(B,S);G=t.mul(G,u),u=t.add(A,C),G=t.sub(G,u),u=t.add(d,m);let g=t.add(B,I);return u=t.mul(u,g),g=t.add(A,z),u=t.sub(u,g),g=t.add(h,m),p=t.add(S,I),g=t.mul(g,p),p=t.add(C,z),g=t.sub(g,p),v=t.mul(k,u),p=t.mul(_,z),v=t.add(p,v),p=t.sub(C,v),v=t.add(C,v),E=t.mul(p,v),C=t.add(A,A),C=t.add(C,A),z=t.mul(k,z),u=t.mul(_,u),C=t.add(C,z),z=t.sub(A,z),z=t.mul(k,z),u=t.add(u,z),A=t.mul(C,u),E=t.add(E,A),A=t.mul(g,u),p=t.mul(G,p),p=t.sub(p,A),A=t.mul(G,C),v=t.mul(g,v),v=t.add(v,A),new w(p,E,v)}subtract(f){return this.add(f.negate())}is0(){return this.equals(w.ZERO)}wNAF(f){return T.wNAFCached(this,a,f,d=>{const h=t.invertBatch(d.map(m=>m.pz));return d.map((m,B)=>m.toAffine(h[B])).map(w.fromAffine)})}multiplyUnsafe(f){const d=w.ZERO;if(f===F)return d;if(c(f),f===j)return this;const{endo:h}=n;if(!h)return T.unsafeLadder(this,f);let{k1neg:m,k1:B,k2neg:S,k2:I}=h.splitScalar(f),p=d,E=d,v=this;for(;B>F||I>F;)B&j&&(p=p.add(v)),I&j&&(E=E.add(v)),v=v.double(),B>>=j,I>>=j;return m&&(p=p.negate()),S&&(E=E.negate()),E=new w(t.mul(E.px,h.beta),E.py,E.pz),p.add(E)}multiply(f){c(f);let d=f,h,m;const{endo:B}=n;if(B){const{k1neg:S,k1:I,k2neg:p,k2:E}=B.splitScalar(d);let{p:v,f:k}=this.wNAF(I),{p:_,f:A}=this.wNAF(E);v=T.constTimeNegate(S,v),_=T.constTimeNegate(p,_),_=new w(t.mul(_.px,B.beta),_.py,_.pz),h=v.add(_),m=k.add(A)}else{const{p:S,f:I}=this.wNAF(d);h=S,m=I}return w.normalizeZ([h,m])[0]}multiplyAndAddUnsafe(f,d,h){const m=w.BASE,B=(I,p)=>p===F||p===j||!I.equals(m)?I.multiplyUnsafe(p):I.multiply(p),S=B(this,d).add(B(f,h));return S.is0()?void 0:S}toAffine(f){const{px:d,py:h,pz:m}=this,B=this.is0();f==null&&(f=B?t.ONE:t.inv(m));const S=t.mul(d,f),I=t.mul(h,f),p=t.mul(m,f);if(B)return{x:t.ZERO,y:t.ZERO};if(!t.eql(p,t.ONE))throw new Error("invZ was invalid");return{x:S,y:I}}isTorsionFree(){const{h:f,isTorsionFree:d}=n;if(f===j)return!0;if(d)return d(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:f,clearCofactor:d}=n;return f===j?this:d?d(w,this):this.multiplyUnsafe(n.h)}toRawBytes(f=!0){return this.assertValidity(),r(w,this,f)}toHex(f=!0){return st(this.toRawBytes(f))}}w.BASE=new w(n.Gx,n.Gy,t.ONE),w.ZERO=new w(t.ZERO,t.ONE,t.ZERO);const q=n.nBitLength,T=Ee(w,n.endo?Math.ceil(q/2):q);return{CURVE:n,ProjectivePoint:w,normPrivateKeyToScalar:o,weierstrassEquation:i,isWithinCurveOrder:l}}function Se(e){const n=jt(e);return dt(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}function Ae(e){const n=Se(e),{Fp:t,n:r}=n,s=t.BYTES+1,i=2*t.BYTES+1;function l(u){return Fst(ft(u,n.nByteLength));function b(u){const g=r>>j;return u>g}function f(u){return b(u)?c(-u):u}const d=(u,g,x)=>et(u.slice(g,x));class h{constructor(g,x,N){this.r=g,this.s=x,this.recovery=N,this.assertValidity()}static fromCompact(g){const x=n.nByteLength;return g=M("compactSignature",g,x*2),new h(d(g,0,x),d(g,x,2*x))}static fromDER(g){const{r:x,s:N}=tt.toSig(M("DER",g));return new h(x,N)}assertValidity(){if(!q(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!q(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(g){return new h(this.r,this.s,g)}recoverPublicKey(g){const{r:x,s:N,recovery:O}=this,H=E(M("msgHash",g));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const Z=O===2||O===3?x+n.n:x;if(Z>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const U=O&1?"03":"02",W=a.fromHex(U+T(Z)),Y=o(Z),X=c(-H*Y),at=c(N*Y),D=a.BASE.multiplyAndAddUnsafe(W,X,at);if(!D)throw new Error("point at infinify");return D.assertValidity(),D}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new h(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return ct(this.toDERHex())}toDERHex(){return tt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ct(this.toCompactHex())}toCompactHex(){return T(this.r)+T(this.s)}}const m={isValidPrivateKey(u){try{return y(u),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{const u=Vt(n.n);return be(n.randomBytes(u),n.n)},precompute(u=8,g=a.BASE){return g._setWindowSize(u),g.multiply(BigInt(3)),g}};function B(u,g=!0){return a.fromPrivateKey(u).toRawBytes(g)}function S(u){const g=nt(u),x=typeof u=="string",N=(g||x)&&u.length;return g?N===s||N===i:x?N===2*s||N===2*i:u instanceof a}function I(u,g,x=!0){if(S(u))throw new Error("first arg must be private key");if(!S(g))throw new Error("second arg must be public key");return a.fromHex(g).multiply(y(u)).toRawBytes(x)}const p=n.bits2int||function(u){const g=et(u),x=u.length*8-n.nBitLength;return x>0?g>>BigInt(x):g},E=n.bits2int_modN||function(u){return c(p(u))},v=It(n.nBitLength);function k(u){if(typeof u!="bigint")throw new Error("bigint expected");if(!(F<=u&&uQ in x))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:O}=n;let{lowS:H,prehash:Z,extraEntropy:U}=x;H==null&&(H=!0),u=M("msgHash",u),Z&&(u=M("prehashed msgHash",N(u)));const W=E(u),Y=y(g),X=[k(Y),k(W)];if(U!=null&&U!==!1){const Q=U===!0?O(t.BYTES):U;X.push(M("extraEntropy",Q))}const at=ut(...X),D=W;function gt(Q){const rt=p(Q);if(!q(rt))return;const St=o(rt),ot=a.BASE.multiply(rt).toAffine(),K=c(ot.x);if(K===F)return;const it=c(St*c(D+K*Y));if(it===F)return;let At=(ot.x===K?0:2)|Number(ot.y&j),qt=it;return H&&b(it)&&(qt=f(it),At^=1),new h(K,qt,At)}return{seed:at,k2sig:gt}}const A={lowS:n.lowS,prehash:!1},C={lowS:n.lowS,prehash:!1};function z(u,g,x=A){const{seed:N,k2sig:O}=_(u,g,x),H=n;return Ct(H.hash.outputLen,H.nByteLength,H.hmac)(N,O)}a.BASE._setWindowSize(8);function G(u,g,x,N=C){var ot;const O=u;if(g=M("msgHash",g),x=M("publicKey",x),"strict"in N)throw new Error("options.strict was renamed to lowS");const{lowS:H,prehash:Z}=N;let U,W;try{if(typeof O=="string"||nt(O))try{U=h.fromDER(O)}catch(K){if(!(K instanceof tt.Err))throw K;U=h.fromCompact(O)}else if(typeof O=="object"&&typeof O.r=="bigint"&&typeof O.s=="bigint"){const{r:K,s:it}=O;U=new h(K,it)}else throw new Error("PARSE");W=a.fromHex(x)}catch(K){if(K.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(H&&U.hasHighS())return!1;Z&&(g=n.hash(g));const{r:Y,s:X}=U,at=E(g),D=o(X),gt=c(at*D),Q=c(Y*D),rt=(ot=a.BASE.multiplyAndAddUnsafe(W,gt,Q))==null?void 0:ot.toAffine();return rt?c(rt.x)===Y:!1}return{CURVE:n,getPublicKey:B,getSharedSecret:I,sign:z,verify:G,ProjectivePoint:a,Signature:h,utils:m}}class Yt extends Pt{constructor(n,t){super(),this.finished=!1,this.destroyed=!1,Ft(n);const r=Gt(t);if(this.iHash=n.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?n.create().update(r).digest():r);for(let l=0;lnew Yt(e,n).update(t).digest();Kt.create=(e,n)=>new Yt(e,n);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qe(e){return{hash:e,hmac:(n,...t)=>Kt(e,n,Xt(...t)),randomBytes:Dt}}function Oe(e,n){const t=r=>Ae({...e,...qe(r)});return Object.freeze({...t(n),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Mt=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Lt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ne=BigInt(1),mt=BigInt(2),Zt=(e,n)=>(e+n/mt)/n;function _e(e){const n=Mt,t=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),l=BigInt(23),c=BigInt(44),o=BigInt(88),a=e*e*e%n,y=a*a*e%n,w=V(y,t,n)*y%n,q=V(w,t,n)*y%n,T=V(q,mt,n)*a%n,b=V(T,s,n)*T%n,f=V(b,i,n)*b%n,d=V(f,c,n)*f%n,h=V(d,o,n)*d%n,m=V(h,c,n)*f%n,B=V(m,t,n)*y%n,S=V(B,l,n)*b%n,I=V(S,r,n)*a%n,p=V(I,mt,n);if(!Et.eql(Et.sqr(p),e))throw new Error("Cannot find square root");return p}const Et=ye(Mt,void 0,void 0,{sqrt:_e}),Te=Oe({a:BigInt(0),b:BigInt(7),Fp:Et,n:Lt,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const n=Lt,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ne*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,l=BigInt("0x100000000000000000000000000000000"),c=Zt(i*e,n),o=Zt(-r*e,n);let a=R(e-c*t-o*s,n),y=R(-c*r-o*i,n);const w=a>l,q=y>l;if(w&&(a=n-a),q&&(y=n-y),a>l||y>l)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:w,k1:a,k2neg:q,k2:y}}}},Qt);BigInt(0);Te.ProjectivePoint;export{Te as secp256k1}; diff --git a/assets/w3m-modal-BZ0C38WO.js b/assets/w3m-modal-CS4WeCLM.js similarity index 96% rename from assets/w3m-modal-BZ0C38WO.js rename to assets/w3m-modal-CS4WeCLM.js index c80c834..3ab0f87 100644 --- a/assets/w3m-modal-BZ0C38WO.js +++ b/assets/w3m-modal-CS4WeCLM.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DV5_LVti.js","assets/index-CFrD00kt.js","assets/index-CAumgMRP.css"])))=>i.map(i=>d[i]); -import{aF as k,aG as C,M as a,A as w,O as b,aH as S,E as x,aI as A,R as p,aJ as g,U as E,i as O,S as _,aK as m,aL as c,c as L,aM as K}from"./index-CFrD00kt.js";const N=k` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DNfjtiM6.js","assets/index-BSVOad49.js","assets/index-CAumgMRP.css"])))=>i.map(i=>d[i]); +import{aF as k,aG as C,M as a,A as w,O as b,aH as S,E as x,aI as A,R as p,aJ as g,U as E,i as O,S as _,aK as m,aL as c,c as L,aM as K}from"./index-BSVOad49.js";const N=k` :host { z-index: var(--w3m-z-index); display: block; @@ -138,7 +138,7 @@ import{aF as k,aG as C,M as a,A as w,O as b,aH as S,E as x,aI as A,R as p,aJ as - `:null}async onOverlayClick(e){e.target===e.currentTarget&&await this.handleClose()}async handleClose(){const e=p.state.view==="ConnectingSiwe",t=p.state.view==="ApproveTransaction";if(this.isSiweEnabled){const{SIWEController:o}=await g(async()=>{const{SIWEController:i}=await import("./index-DV5_LVti.js");return{SIWEController:i}},__vite__mapDeps([0,1,2]));o.state.status!=="success"&&(e||t)?a.shake():a.close()}else a.close()}initializeTheming(){const{themeVariables:e,themeMode:t}=K.state,o=E.getColorTheme(t);O(e,o)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),_.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=v,e.textContent=` + `:null}async onOverlayClick(e){e.target===e.currentTarget&&await this.handleClose()}async handleClose(){const e=p.state.view==="ConnectingSiwe",t=p.state.view==="ApproveTransaction";if(this.isSiweEnabled){const{SIWEController:o}=await g(async()=>{const{SIWEController:i}=await import("./index-DNfjtiM6.js");return{SIWEController:i}},__vite__mapDeps([0,1,2]));o.state.status!=="success"&&(e||t)?a.shake():a.close()}else a.close()}initializeTheming(){const{themeVariables:e,themeMode:t}=K.state,o=E.getColorTheme(t);O(e,o)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),_.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const e=document.createElement("style");e.dataset.w3m=v,e.textContent=` body { touch-action: none; overflow: hidden; @@ -147,4 +147,4 @@ import{aF as k,aG as C,M as a,A as w,O as b,aH as S,E as x,aI as A,R as p,aJ as w3m-modal { pointer-events: auto; } - `,document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${v}"]`);e&&e.remove()}onAddKeyboardListener(){var t;this.abortController=new AbortController;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("wui-card");e==null||e.focus(),window.addEventListener("keydown",o=>{if(o.key==="Escape")this.handleClose();else if(o.key==="Tab"){const{tagName:s}=o.target;s&&!s.includes("W3M-")&&!s.includes("WUI-")&&(e==null||e.focus())}},this.abortController)}onRemoveKeyboardListener(){var e;(e=this.abortController)==null||e.abort(),this.abortController=void 0}async onNewAddress(e){var r,d;if(!this.connected||this.loading)return;const t=m.getPlainAddress(this.caipAddress),o=m.getPlainAddress(e),s=m.getNetworkId(this.caipAddress),i=m.getNetworkId(e);if(this.caipAddress=e,this.isSiweEnabled){const{SIWEController:h}=await g(async()=>{const{SIWEController:y}=await import("./index-DV5_LVti.js");return{SIWEController:y}},__vite__mapDeps([0,1,2])),f=await h.getSession();if(f&&t&&o&&t!==o){(r=h.state._client)!=null&&r.options.signOutOnAccountChange&&(await h.signOut(),this.onSiweNavigation());return}if(f&&s&&i&&s!==i){(d=h.state._client)!=null&&d.options.signOutOnNetworkChange&&(await h.signOut(),this.onSiweNavigation());return}this.onSiweNavigation()}}onSiweNavigation(){this.open?p.push("ConnectingSiwe"):a.open({view:"ConnectingSiwe"})}};n.styles=N;l([c()],n.prototype,"open",void 0);l([c()],n.prototype,"caipAddress",void 0);l([c()],n.prototype,"isSiweEnabled",void 0);l([c()],n.prototype,"connected",void 0);l([c()],n.prototype,"loading",void 0);l([c()],n.prototype,"shake",void 0);n=l([L("w3m-modal")],n);export{n as W3mModal}; + `,document.head.appendChild(e)}onScrollUnlock(){const e=document.head.querySelector(`style[data-w3m="${v}"]`);e&&e.remove()}onAddKeyboardListener(){var t;this.abortController=new AbortController;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("wui-card");e==null||e.focus(),window.addEventListener("keydown",o=>{if(o.key==="Escape")this.handleClose();else if(o.key==="Tab"){const{tagName:s}=o.target;s&&!s.includes("W3M-")&&!s.includes("WUI-")&&(e==null||e.focus())}},this.abortController)}onRemoveKeyboardListener(){var e;(e=this.abortController)==null||e.abort(),this.abortController=void 0}async onNewAddress(e){var r,d;if(!this.connected||this.loading)return;const t=m.getPlainAddress(this.caipAddress),o=m.getPlainAddress(e),s=m.getNetworkId(this.caipAddress),i=m.getNetworkId(e);if(this.caipAddress=e,this.isSiweEnabled){const{SIWEController:h}=await g(async()=>{const{SIWEController:y}=await import("./index-DNfjtiM6.js");return{SIWEController:y}},__vite__mapDeps([0,1,2])),f=await h.getSession();if(f&&t&&o&&t!==o){(r=h.state._client)!=null&&r.options.signOutOnAccountChange&&(await h.signOut(),this.onSiweNavigation());return}if(f&&s&&i&&s!==i){(d=h.state._client)!=null&&d.options.signOutOnNetworkChange&&(await h.signOut(),this.onSiweNavigation());return}this.onSiweNavigation()}}onSiweNavigation(){this.open?p.push("ConnectingSiwe"):a.open({view:"ConnectingSiwe"})}};n.styles=N;l([c()],n.prototype,"open",void 0);l([c()],n.prototype,"caipAddress",void 0);l([c()],n.prototype,"isSiweEnabled",void 0);l([c()],n.prototype,"connected",void 0);l([c()],n.prototype,"loading",void 0);l([c()],n.prototype,"shake",void 0);n=l([L("w3m-modal")],n);export{n as W3mModal}; diff --git a/index.html b/index.html index 21c45fc..a481ac9 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,11 @@ - + Playbooks EAS Test - - + +