@spaceandtimelabs/dapp-mi-space-time 0.1.7-247 → 0.1.7-249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{ErdWrapper-6f30282e.js → ErdWrapper-0703c04e.js} +1 -1
- package/build/assets/{Queries-0042e20b.js → Queries-c78d2d28.js} +1 -1
- package/build/assets/QueryEditorWrapper-e2937745.js +1 -0
- package/build/assets/{index-a7652829.js → index-02b7c6d5.js} +2 -2
- package/build/assets/{index-07deec61.js → index-1ff95921.js} +1 -1
- package/build/assets/{index-e2aedefd.js → index-4c875d9b.js} +1 -1
- package/build/assets/{index-4c200733.js → index-66d897e7.js} +1 -1
- package/build/assets/{vendor-charts-e2320b7b.js → vendor-charts-16a52574.js} +2 -2
- package/build/assets/{vendor-editor-c5afc727.js → vendor-editor-417385df.js} +1 -1
- package/build/assets/{vendor-three-8db22a1b.js → vendor-three-b72fb709.js} +1 -1
- package/build/index.html +10 -21
- package/package.json +1 -1
- package/build/assets/QueryEditorWrapper-bbfb829b.js +0 -1
|
@@ -5688,7 +5688,7 @@ __p += '`),Ir&&(De+=`' +
|
|
|
5688
5688
|
function print() { __p += __j.call(arguments, '') }
|
|
5689
5689
|
`:`;
|
|
5690
5690
|
`)+De+`return __p
|
|
5691
|
-
}`;var fr=KO(function(){return Yr(ee,pt+"return "+De).apply(r,oe)});if(fr.source=De,HS(fr))throw fr;return fr}function $re(v){return Zr(v).toLowerCase()}function kre(v){return Zr(v).toUpperCase()}function Bre(v,_,P){if(v=Zr(v),v&&(P||_===r))return a6(v);if(!v||!(_=yo(_)))return v;var V=ps(v),j=ps(_),ee=o6(V,j),oe=s6(V,j)+1;return Uu(V,ee,oe).join("")}function Ure(v,_,P){if(v=Zr(v),v&&(P||_===r))return v.slice(0,u6(v)+1);if(!v||!(_=yo(_)))return v;var V=ps(v),j=s6(V,ps(_))+1;return Uu(V,0,j).join("")}function Fre(v,_,P){if(v=Zr(v),v&&(P||_===r))return v.replace(Wt,"");if(!v||!(_=yo(_)))return v;var V=ps(v),j=o6(V,ps(_));return Uu(V,j).join("")}function Hre(v,_){var P=I,V=$;if(Dn(_)){var j="separator"in _?_.separator:j;P="length"in _?ur(_.length):P,V="omission"in _?yo(_.omission):V}v=Zr(v);var ee=v.length;if(Hd(v)){var oe=ps(v);ee=oe.length}if(P>=ee)return v;var ue=P-Gd(V);if(ue<1)return V;var he=oe?Uu(oe,0,ue).join(""):v.slice(0,ue);if(j===r)return he+V;if(oe&&(ue+=he.length-ue),GS(j)){if(v.slice(ue).search(j)){var Ce,Re=he;for(j.global||(j=iS(j.source,Zr(Me.exec(j))+"g")),j.lastIndex=0;Ce=j.exec(Re);)var De=Ce.index;he=he.slice(0,De===r?ue:De)}}else if(v.indexOf(yo(j),ue)!=ue){var Je=he.lastIndexOf(j);Je>-1&&(he=he.slice(0,Je))}return he+V}function Gre(v){return v=Zr(v),v&&Bn.test(v)?v.replace(xt,mZ):v}var Vre=Xd(function(v,_,P){return v+(P?" ":"")+_.toUpperCase()}),jS=Z6("toUpperCase");function XO(v,_,P){return v=Zr(v),_=P?r:_,_===r?dZ(v)?bZ(v):nZ(v):v.match(_)||[]}var KO=hr(function(v,_){try{return Sa(v,r,_)}catch(P){return HS(P)?P:new tr(P)}}),Wre=Fl(function(v,_){return Vo(_,function(P){P=nl(P),Bl(v,P,US(v[P],v))}),v});function jre(v){var _=v==null?0:v.length,P=wt();return v=_?Rn(v,function(V){if(typeof V[1]!="function")throw new Wo(o);return[P(V[0]),V[1]]}):[],hr(function(V){for(var j=-1;++j<_;){var ee=v[j];if(Sa(ee[0],this,V))return Sa(ee[1],this,V)}})}function zre(v){return mQ(zo(v,f))}function zS(v){return function(){return v}}function Yre(v,_){return v==null||v!==v?_:v}var qre=J6(),Xre=J6(!0);function Ka(v){return v}function YS(v){return I6(typeof v=="function"?v:zo(v,f))}function Kre(v){return N6(zo(v,f))}function Zre(v,_){return L6(v,zo(_,f))}var Qre=hr(function(v,_){return function(P){return hp(P,v,_)}}),Jre=hr(function(v,_){return function(P){return hp(v,P,_)}});function qS(v,_,P){var V=Hi(_),j=dm(_,V);P==null&&!(Dn(_)&&(j.length||!V.length))&&(P=_,_=v,v=this,j=dm(_,Hi(_)));var ee=!(Dn(P)&&"chain"in P)||!!P.chain,oe=Gl(v);return Vo(j,function(ue){var he=_[ue];v[ue]=he,oe&&(v.prototype[ue]=function(){var Ce=this.__chain__;if(ee||Ce){var Re=v(this.__wrapped__),De=Re.__actions__=Ya(this.__actions__);return De.push({func:he,args:arguments,thisArg:v}),Re.__chain__=Ce,Re}return he.apply(v,Pu([this.value()],arguments))})}),v}function ene(){return _n._===this&&(_n._=CZ),this}function XS(){}function tne(v){return v=ur(v),hr(function(_){return P6(_,v)})}var rne=CS(Rn),nne=CS(e6),ine=CS(Z_);function ZO(v){return PS(v)?Q_(nl(v)):MQ(v)}function ane(v){return function(_){return v==null?r:sf(v,_)}}var one=tO(),sne=tO(!0);function KS(){return[]}function ZS(){return!1}function lne(){return{}}function une(){return""}function cne(){return!0}function fne(v,_){if(v=ur(v),v<1||v>k)return[];var P=B,V=da(v,B);_=wt(_),v-=B;for(var j=tS(V,_);++P<v;)_(P);return j}function dne(v){return rr(v)?Rn(v,nl):Eo(v)?[v]:Ya(mO(Zr(v)))}function hne(v){var _=++TZ;return Zr(v)+_}var pne=ym(function(v,_){return v+_},0),vne=RS("ceil"),gne=ym(function(v,_){return v/_},1),mne=RS("floor");function yne(v){return v&&v.length?fm(v,Ka,dS):r}function Ene(v,_){return v&&v.length?fm(v,wt(_,2),dS):r}function bne(v){return n6(v,Ka)}function _ne(v,_){return n6(v,wt(_,2))}function Sne(v){return v&&v.length?fm(v,Ka,gS):r}function wne(v,_){return v&&v.length?fm(v,wt(_,2),gS):r}var Tne=ym(function(v,_){return v*_},1),Ane=RS("round"),Cne=ym(function(v,_){return v-_},0);function Rne(v){return v&&v.length?eS(v,Ka):0}function xne(v,_){return v&&v.length?eS(v,wt(_,2)):0}return Z.after=Kee,Z.ary=xO,Z.assign=kte,Z.assignIn=GO,Z.assignInWith=Nm,Z.assignWith=Bte,Z.at=Ute,Z.before=IO,Z.bind=US,Z.bindAll=Wre,Z.bindKey=OO,Z.castArray=lte,Z.chain=AO,Z.chunk=mJ,Z.compact=yJ,Z.concat=EJ,Z.cond=jre,Z.conforms=zre,Z.constant=zS,Z.countBy=Ree,Z.create=Fte,Z.curry=NO,Z.curryRight=LO,Z.debounce=PO,Z.defaults=Hte,Z.defaultsDeep=Gte,Z.defer=Zee,Z.delay=Qee,Z.difference=bJ,Z.differenceBy=_J,Z.differenceWith=SJ,Z.drop=wJ,Z.dropRight=TJ,Z.dropRightWhile=AJ,Z.dropWhile=CJ,Z.fill=RJ,Z.filter=Iee,Z.flatMap=Lee,Z.flatMapDeep=Pee,Z.flatMapDepth=Mee,Z.flatten=_O,Z.flattenDeep=xJ,Z.flattenDepth=IJ,Z.flip=Jee,Z.flow=qre,Z.flowRight=Xre,Z.fromPairs=OJ,Z.functions=Xte,Z.functionsIn=Kte,Z.groupBy=Dee,Z.initial=LJ,Z.intersection=PJ,Z.intersectionBy=MJ,Z.intersectionWith=DJ,Z.invert=Qte,Z.invertBy=Jte,Z.invokeMap=kee,Z.iteratee=YS,Z.keyBy=Bee,Z.keys=Hi,Z.keysIn=Xa,Z.map=Am,Z.mapKeys=tre,Z.mapValues=rre,Z.matches=Kre,Z.matchesProperty=Zre,Z.memoize=Rm,Z.merge=nre,Z.mergeWith=VO,Z.method=Qre,Z.methodOf=Jre,Z.mixin=qS,Z.negate=xm,Z.nthArg=tne,Z.omit=ire,Z.omitBy=are,Z.once=ete,Z.orderBy=Uee,Z.over=rne,Z.overArgs=tte,Z.overEvery=nne,Z.overSome=ine,Z.partial=FS,Z.partialRight=MO,Z.partition=Fee,Z.pick=ore,Z.pickBy=WO,Z.property=ZO,Z.propertyOf=ane,Z.pull=UJ,Z.pullAll=wO,Z.pullAllBy=FJ,Z.pullAllWith=HJ,Z.pullAt=GJ,Z.range=one,Z.rangeRight=sne,Z.rearg=rte,Z.reject=Vee,Z.remove=VJ,Z.rest=nte,Z.reverse=kS,Z.sampleSize=jee,Z.set=lre,Z.setWith=ure,Z.shuffle=zee,Z.slice=WJ,Z.sortBy=Xee,Z.sortedUniq=ZJ,Z.sortedUniqBy=QJ,Z.split=Lre,Z.spread=ite,Z.tail=JJ,Z.take=eee,Z.takeRight=tee,Z.takeRightWhile=ree,Z.takeWhile=nee,Z.tap=yee,Z.throttle=ate,Z.thru=Tm,Z.toArray=UO,Z.toPairs=jO,Z.toPairsIn=zO,Z.toPath=dne,Z.toPlainObject=HO,Z.transform=cre,Z.unary=ote,Z.union=iee,Z.unionBy=aee,Z.unionWith=oee,Z.uniq=see,Z.uniqBy=lee,Z.uniqWith=uee,Z.unset=fre,Z.unzip=BS,Z.unzipWith=TO,Z.update=dre,Z.updateWith=hre,Z.values=Qd,Z.valuesIn=pre,Z.without=cee,Z.words=XO,Z.wrap=ste,Z.xor=fee,Z.xorBy=dee,Z.xorWith=hee,Z.zip=pee,Z.zipObject=vee,Z.zipObjectDeep=gee,Z.zipWith=mee,Z.entries=jO,Z.entriesIn=zO,Z.extend=GO,Z.extendWith=Nm,qS(Z,Z),Z.add=pne,Z.attempt=KO,Z.camelCase=yre,Z.capitalize=YO,Z.ceil=vne,Z.clamp=vre,Z.clone=ute,Z.cloneDeep=fte,Z.cloneDeepWith=dte,Z.cloneWith=cte,Z.conformsTo=hte,Z.deburr=qO,Z.defaultTo=Yre,Z.divide=gne,Z.endsWith=Ere,Z.eq=gs,Z.escape=bre,Z.escapeRegExp=_re,Z.every=xee,Z.find=Oee,Z.findIndex=EO,Z.findKey=Vte,Z.findLast=Nee,Z.findLastIndex=bO,Z.findLastKey=Wte,Z.floor=mne,Z.forEach=CO,Z.forEachRight=RO,Z.forIn=jte,Z.forInRight=zte,Z.forOwn=Yte,Z.forOwnRight=qte,Z.get=VS,Z.gt=pte,Z.gte=vte,Z.has=Zte,Z.hasIn=WS,Z.head=SO,Z.identity=Ka,Z.includes=$ee,Z.indexOf=NJ,Z.inRange=gre,Z.invoke=ere,Z.isArguments=cf,Z.isArray=rr,Z.isArrayBuffer=gte,Z.isArrayLike=qa,Z.isArrayLikeObject=Qn,Z.isBoolean=mte,Z.isBuffer=Fu,Z.isDate=yte,Z.isElement=Ete,Z.isEmpty=bte,Z.isEqual=_te,Z.isEqualWith=Ste,Z.isError=HS,Z.isFinite=wte,Z.isFunction=Gl,Z.isInteger=DO,Z.isLength=Im,Z.isMap=$O,Z.isMatch=Tte,Z.isMatchWith=Ate,Z.isNaN=Cte,Z.isNative=Rte,Z.isNil=Ite,Z.isNull=xte,Z.isNumber=kO,Z.isObject=Dn,Z.isObjectLike=Wn,Z.isPlainObject=Ep,Z.isRegExp=GS,Z.isSafeInteger=Ote,Z.isSet=BO,Z.isString=Om,Z.isSymbol=Eo,Z.isTypedArray=Zd,Z.isUndefined=Nte,Z.isWeakMap=Lte,Z.isWeakSet=Pte,Z.join=$J,Z.kebabCase=Sre,Z.last=qo,Z.lastIndexOf=kJ,Z.lowerCase=wre,Z.lowerFirst=Tre,Z.lt=Mte,Z.lte=Dte,Z.max=yne,Z.maxBy=Ene,Z.mean=bne,Z.meanBy=_ne,Z.min=Sne,Z.minBy=wne,Z.stubArray=KS,Z.stubFalse=ZS,Z.stubObject=lne,Z.stubString=une,Z.stubTrue=cne,Z.multiply=Tne,Z.nth=BJ,Z.noConflict=ene,Z.noop=XS,Z.now=Cm,Z.pad=Are,Z.padEnd=Cre,Z.padStart=Rre,Z.parseInt=xre,Z.random=mre,Z.reduce=Hee,Z.reduceRight=Gee,Z.repeat=Ire,Z.replace=Ore,Z.result=sre,Z.round=Ane,Z.runInContext=de,Z.sample=Wee,Z.size=Yee,Z.snakeCase=Nre,Z.some=qee,Z.sortedIndex=jJ,Z.sortedIndexBy=zJ,Z.sortedIndexOf=YJ,Z.sortedLastIndex=qJ,Z.sortedLastIndexBy=XJ,Z.sortedLastIndexOf=KJ,Z.startCase=Pre,Z.startsWith=Mre,Z.subtract=Cne,Z.sum=Rne,Z.sumBy=xne,Z.template=Dre,Z.times=fne,Z.toFinite=Vl,Z.toInteger=ur,Z.toLength=FO,Z.toLower=$re,Z.toNumber=Xo,Z.toSafeInteger=$te,Z.toString=Zr,Z.toUpper=kre,Z.trim=Bre,Z.trimEnd=Ure,Z.trimStart=Fre,Z.truncate=Hre,Z.unescape=Gre,Z.uniqueId=hne,Z.upperCase=Vre,Z.upperFirst=jS,Z.each=CO,Z.eachRight=RO,Z.first=SO,qS(Z,function(){var v={};return tl(Z,function(_,P){rn.call(Z.prototype,P)||(v[P]=_)}),v}(),{chain:!1}),Z.VERSION=n,Vo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(v){Z[v].placeholder=Z}),Vo(["drop","take"],function(v,_){Ar.prototype[v]=function(P){P=P===r?1:xi(ur(P),0);var V=this.__filtered__&&!_?new Ar(this):this.clone();return V.__filtered__?V.__takeCount__=da(P,V.__takeCount__):V.__views__.push({size:da(P,B),type:v+(V.__dir__<0?"Right":"")}),V},Ar.prototype[v+"Right"]=function(P){return this.reverse()[v](P).reverse()}}),Vo(["filter","map","takeWhile"],function(v,_){var P=_+1,V=P==E||P==C;Ar.prototype[v]=function(j){var ee=this.clone();return ee.__iteratees__.push({iteratee:wt(j,3),type:P}),ee.__filtered__=ee.__filtered__||V,ee}}),Vo(["head","last"],function(v,_){var P="take"+(_?"Right":"");Ar.prototype[v]=function(){return this[P](1).value()[0]}}),Vo(["initial","tail"],function(v,_){var P="drop"+(_?"":"Right");Ar.prototype[v]=function(){return this.__filtered__?new Ar(this):this[P](1)}}),Ar.prototype.compact=function(){return this.filter(Ka)},Ar.prototype.find=function(v){return this.filter(v).head()},Ar.prototype.findLast=function(v){return this.reverse().find(v)},Ar.prototype.invokeMap=hr(function(v,_){return typeof v=="function"?new Ar(this):this.map(function(P){return hp(P,v,_)})}),Ar.prototype.reject=function(v){return this.filter(xm(wt(v)))},Ar.prototype.slice=function(v,_){v=ur(v);var P=this;return P.__filtered__&&(v>0||_<0)?new Ar(P):(v<0?P=P.takeRight(-v):v&&(P=P.drop(v)),_!==r&&(_=ur(_),P=_<0?P.dropRight(-_):P.take(_-v)),P)},Ar.prototype.takeRightWhile=function(v){return this.reverse().takeWhile(v).reverse()},Ar.prototype.toArray=function(){return this.take(B)},tl(Ar.prototype,function(v,_){var P=/^(?:filter|find|map|reject)|While$/.test(_),V=/^(?:head|last)$/.test(_),j=Z[V?"take"+(_=="last"?"Right":""):_],ee=V||/^find/.test(_);j&&(Z.prototype[_]=function(){var oe=this.__wrapped__,ue=V?[1]:arguments,he=oe instanceof Ar,Ce=ue[0],Re=he||rr(oe),De=function(Er){var Ir=j.apply(Z,Pu([Er],ue));return V&&Je?Ir[0]:Ir};Re&&P&&typeof Ce=="function"&&Ce.length!=1&&(he=Re=!1);var Je=this.__chain__,pt=!!this.__actions__.length,It=ee&&!Je,fr=he&&!pt;if(!ee&&Re){oe=fr?oe:new Ar(this);var Ot=v.apply(oe,ue);return Ot.__actions__.push({func:Tm,args:[De],thisArg:r}),new jo(Ot,Je)}return It&&fr?v.apply(this,ue):(Ot=this.thru(De),It?V?Ot.value()[0]:Ot.value():Ot)})}),Vo(["pop","push","shift","sort","splice","unshift"],function(v){var _=Kg[v],P=/^(?:push|sort|unshift)$/.test(v)?"tap":"thru",V=/^(?:pop|shift)$/.test(v);Z.prototype[v]=function(){var j=arguments;if(V&&!this.__chain__){var ee=this.value();return _.apply(rr(ee)?ee:[],j)}return this[P](function(oe){return _.apply(rr(oe)?oe:[],j)})}}),tl(Ar.prototype,function(v,_){var P=Z[_];if(P){var V=P.name+"";rn.call(zd,V)||(zd[V]=[]),zd[V].push({name:_,func:P})}}),zd[mm(r,y).name]=[{name:"wrapper",func:r}],Ar.prototype.clone=GZ,Ar.prototype.reverse=VZ,Ar.prototype.value=WZ,Z.prototype.at=Eee,Z.prototype.chain=bee,Z.prototype.commit=_ee,Z.prototype.next=See,Z.prototype.plant=Tee,Z.prototype.reverse=Aee,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=Cee,Z.prototype.first=Z.prototype.head,op&&(Z.prototype[op]=wee),Z},Vd=_Z();za?((za.exports=Vd)._=Vd,Oa._=Vd):_n._=Vd}).call(p8)})(whe,whe.exports);var L9t=Object.defineProperty,P9t=Object.defineProperties,M9t=Object.getOwnPropertyDescriptors,rRe=Object.getOwnPropertySymbols,D9t=Object.prototype.hasOwnProperty,$9t=Object.prototype.propertyIsEnumerable,nRe=(e,t,r)=>t in e?L9t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$$=(e,t)=>{for(var r in t||(t={}))D9t.call(t,r)&&nRe(e,r,t[r]);if(rRe)for(var r of rRe(t))$9t.call(t,r)&&nRe(e,r,t[r]);return e},k9t=(e,t)=>P9t(e,M9t(t));function Ob(e,t,r){var n;const i=D4t(e);return((n=t.rpcMap)==null?void 0:n[i.reference])||`${N9t}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function gA(e){return e.includes(":")?e.split(":")[1]:e}function EXe(e){return e.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function B9t(e,t){const r=Object.keys(t.namespaces).filter(i=>i.includes(e));if(!r.length)return[];const n=[];return r.forEach(i=>{const a=t.namespaces[i].accounts;n.push(...a)}),n}function U9t(e={},t={}){const r=iRe(e),n=iRe(t);return whe.exports.merge(r,n)}function iRe(e){var t,r,n,i;const a={};if(!n4(e))return a;for(const[o,s]of Object.entries(e)){const l=Xye(o)?[o]:s.chains,u=s.methods||[],c=s.events||[],f=s.rpcMap||{},d=nL(o);a[d]=k9t($$($$({},a[d]),s),{chains:nie(l,(t=a[d])==null?void 0:t.chains),methods:nie(u,(r=a[d])==null?void 0:r.methods),events:nie(c,(n=a[d])==null?void 0:n.events),rpcMap:$$($$({},f),(i=a[d])==null?void 0:i.rpcMap)})}return a}function F9t(e){return e.includes(":")?e.split(":")[2]:e}function H9t(e){const t={};for(const[r,n]of Object.entries(e)){const i=n.methods||[],a=n.events||[],o=n.accounts||[],s=Xye(r)?[r]:n.chains?n.chains:EXe(n.accounts);t[r]={chains:s,methods:i,events:a,accounts:o}}return t}function Tie(e){return typeof e=="number"?e:e.includes("0x")?parseInt(e,16):e.includes(":")?Number(e.split(":")[1]):Number(e)}const bXe={},us=e=>bXe[e],Aie=(e,t)=>{bXe[e]=t};let G9t=class{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}},V9t=class{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const n=r||Ob(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(gA(r));t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,n;let i=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const a=parseInt(i,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}};class W9t{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class j9t{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class z9t{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=gA(r);t[i]=this.createHttpProvider(i,n)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||this.getCardanoRPCUrl(t);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class Y9t{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class q9t{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class X9t{constructor(t){this.name="near",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const n=r||Ob(`${this.name}:${t}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,n)}this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;t[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace);return typeof n>"u"?void 0:new l2(new g_(n,us("disableProviderPing")))}}var K9t=Object.defineProperty,Z9t=Object.defineProperties,Q9t=Object.getOwnPropertyDescriptors,aRe=Object.getOwnPropertySymbols,J9t=Object.prototype.hasOwnProperty,ePt=Object.prototype.propertyIsEnumerable,oRe=(e,t,r)=>t in e?K9t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k$=(e,t)=>{for(var r in t||(t={}))J9t.call(t,r)&&oRe(e,r,t[r]);if(aRe)for(var r of aRe(t))ePt.call(t,r)&&oRe(e,r,t[r]);return e},Cie=(e,t)=>Z9t(e,Q9t(t));class f2e{constructor(t){this.events=new Bye,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Hj(Gj({level:(t==null?void 0:t.logger)||eRe})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new f2e(t);return await r.initialize(),r}async request(t,r){const[n,i]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:k$({},t),chainId:`${n}:${i}`,topic:this.session.topic})}sendAsync(t,r,n){const i=new Date().getTime();this.request(t,n).then(a=>r(null,Wj(i,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 t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Ws("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(a=>{this.session=a,this.namespaces||(this.namespaces=H9t(a.namespaces),this.persist("namespaces",this.namespaces))}).catch(a=>{if(a.message!==mXe)throw a;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[n,i]=this.validateChain(t);this.getProvider(n).setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(bg(r)){for(const n of r)t.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 t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await E9t.init({logger:this.providerOpts.logger||eRe,relayUrl:this.providerOpts.relayUrl||x9t,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>nL(r)))];Aie("client",this.client),Aie("events",this.events),Aie("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const n=B9t(r,this.session),i=EXe(n),a=U9t(this.namespaces,this.optionalNamespaces),o=Cie(k$({},a[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new V9t({namespace:o});break;case"solana":this.rpcProviders[r]=new W9t({namespace:o});break;case"cosmos":this.rpcProviders[r]=new j9t({namespace:o});break;case"polkadot":this.rpcProviders[r]=new G9t({namespace:o});break;case"cip34":this.rpcProviders[r]=new z9t({namespace:o});break;case"elrond":this.rpcProviders[r]=new Y9t({namespace:o});break;case"multiversx":this.rpcProviders[r]=new q9t({namespace:o});break;case"near":this.rpcProviders[r]=new X9t({namespace:o});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&bg(i)&&this.events.emit("accountsChanged",i.map(F9t))}else if(n.name==="chainChanged"){const i=r.chainId,a=r.event.data,o=nL(i),s=Tie(i)!==Tie(a)?`${o}:${Tie(a)}`:i;this.onChainChanged(s)}else this.events.emit(n.name,n.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var n;const{namespaces:i}=r,a=(n=this.client)==null?void 0:n.session.get(t);this.session=Cie(k$({},a),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",Cie(k$({},Ws("USER_DISCONNECTED")),{data:t.topic}))}),this.on(u2.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=t;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(t){const[r,n]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>nL(o)).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=nL(Object.keys(this.namespaces)[0]),a=this.rpcProviders[i].getDefaultChain();return[i,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var n;if(!this.namespaces)return;const[i,a]=this.validateChain(t);r||this.getProvider(i).setDefaultChain(a),((n=this.namespaces[i])!=null?n:this.namespaces[`${i}:${a}`]).defaultChain=a,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",a)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${tRe}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${tRe}/${t}`)}}const tPt=f2e,rPt="wc",nPt="ethereum_provider",iPt=`${rPt}@2:${nPt}:`,aPt="https://rpc.walletconnect.com/v1/",The=["eth_sendTransaction","personal_sign"],oPt=["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"],Ahe=["chainChanged","accountsChanged"],sPt=["chainChanged","accountsChanged","message","disconnect","connect"];var lPt=Object.defineProperty,uPt=Object.defineProperties,cPt=Object.getOwnPropertyDescriptors,sRe=Object.getOwnPropertySymbols,fPt=Object.prototype.hasOwnProperty,dPt=Object.prototype.propertyIsEnumerable,lRe=(e,t,r)=>t in e?lPt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aL=(e,t)=>{for(var r in t||(t={}))fPt.call(t,r)&&lRe(e,r,t[r]);if(sRe)for(var r of sRe(t))dPt.call(t,r)&&lRe(e,r,t[r]);return e},uRe=(e,t)=>uPt(e,cPt(t));function vG(e){return Number(e[0].split(":")[1])}function Rie(e){return`0x${e.toString(16)}`}function hPt(e){const{chains:t,optionalChains:r,methods:n,optionalMethods:i,events:a,optionalEvents:o,rpcMap:s}=e;if(!bg(t))throw new Error("Invalid chains");const l={chains:t,methods:n||The,events:a||Ahe,rpcMap:aL({},t.length?{[vG(t)]:s[vG(t)]}:{})},u=a==null?void 0:a.filter(h=>!Ahe.includes(h)),c=n==null?void 0:n.filter(h=>!The.includes(h));if(!r&&!o&&!i&&!(u!=null&&u.length)&&!(c!=null&&c.length))return{required:t.length?l:void 0};const f=(u==null?void 0:u.length)&&(c==null?void 0:c.length)||!r,d={chains:[...new Set(f?l.chains.concat(r||[]):r)],methods:[...new Set(l.methods.concat(i!=null&&i.length?i:oPt))],events:[...new Set(l.events.concat(o!=null&&o.length?o:sPt))],rpcMap:s};return{required:t.length?l:void 0,optional:r.length?d:void 0}}let pPt=class _Xe{constructor(){this.events=new Xc.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=iPt,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new _Xe;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:n}=hPt(this.rpc);try{const i=await new Promise(async(o,s)=>{var l;this.rpc.showQrModal&&((l=this.modal)==null||l.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),s(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(uRe(aL({namespaces:aL({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(u=>{o(u)}).catch(u=>{s(new Error(u.message))})});if(!i)return;const a=$4t(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Rie(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event: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",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",Rie(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",uRe(aL({},Ws("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",Rie(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,n,i]=t.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,n;const i=(r=t==null?void 0:t.chains)!=null?r:[],a=(n=t==null?void 0:t.optionalChains)!=null?n:[],o=i.concat(a);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const s=i.length?(t==null?void 0:t.methods)||The:[],l=i.length?(t==null?void 0:t.events)||Ahe:[],u=(t==null?void 0:t.optionalMethods)||[],c=(t==null?void 0:t.optionalEvents)||[],f=(t==null?void 0:t.rpcMap)||this.buildRpcMap(o,t.projectId),d=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(h=>this.formatChainId(h)),optionalChains:a.map(h=>this.formatChainId(h)),methods:s,events:l,optionalMethods:u,optionalEvents:c,rpcMap:f,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:d,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const n={};return t.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?vG(this.rpc.chains):vG(this.rpc.optionalChains),this.signer=await tPt.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await zde(()=>import("./index-4c200733.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(aL({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:n,rpcMap:i}=t;r&&bg(r)&&(this.rpc.chains=r.map(a=>this.formatChainId(a)),r.forEach(a=>{this.rpc.rpcMap[a]=(i==null?void 0:i[a])||this.getRpcUrl(a)})),n&&bg(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(a=>this.formatChainId(a)),n.forEach(a=>{this.rpc.rpcMap[a]=(i==null?void 0:i[a])||this.getRpcUrl(a)}))}getRpcUrl(t,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[t])||`${aPt}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}};var d2e={exports:{}};d2e.exports;(function(e){(function(t,r){function n(D,E){if(!D)throw new Error(E||"Assertion failed")}function i(D,E){D.super_=E;var S=function(){};S.prototype=E.prototype,D.prototype=new S,D.prototype.constructor=D}function a(D,E,S){if(a.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((E==="le"||E==="be")&&(S=E,E=10),this._init(D||0,E||10,S||"be"))}typeof t=="object"?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=fA.Buffer}catch{}a.isBN=function(E){return E instanceof a?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===a.wordSize&&Array.isArray(E.words)},a.max=function(E,S){return E.cmp(S)>0?E:S},a.min=function(E,S){return E.cmp(S)<0?E:S},a.prototype._init=function(E,S,C){if(typeof E=="number")return this._initNumber(E,S,C);if(typeof E=="object")return this._initArray(E,S,C);S==="hex"&&(S=16),n(S===(S|0)&&S>=2&&S<=36),E=E.toString().replace(/\s+/g,"");var M=0;E[0]==="-"&&(M++,this.negative=1),M<E.length&&(S===16?this._parseHex(E,M,C):(this._parseBase(E,S,M),C==="le"&&this._initArray(this.toArray(),S,C)))},a.prototype._initNumber=function(E,S,C){E<0&&(this.negative=1,E=-E),E<67108864?(this.words=[E&67108863],this.length=1):E<4503599627370496?(this.words=[E&67108863,E/67108864&67108863],this.length=2):(n(E<9007199254740992),this.words=[E&67108863,E/67108864&67108863,1],this.length=3),C==="le"&&this._initArray(this.toArray(),S,C)},a.prototype._initArray=function(E,S,C){if(n(typeof E.length=="number"),E.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(E.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var k,U,G=0;if(C==="be")for(M=E.length-1,k=0;M>=0;M-=3)U=E[M]|E[M-1]<<8|E[M-2]<<16,this.words[k]|=U<<G&67108863,this.words[k+1]=U>>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);else if(C==="le")for(M=0,k=0;M<E.length;M+=3)U=E[M]|E[M+1]<<8|E[M+2]<<16,this.words[k]|=U<<G&67108863,this.words[k+1]=U>>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);return this._strip()};function s(D,E){var S=D.charCodeAt(E);if(S>=48&&S<=57)return S-48;if(S>=65&&S<=70)return S-55;if(S>=97&&S<=102)return S-87;n(!1,"Invalid character in "+D)}function l(D,E,S){var C=s(D,S);return S-1>=E&&(C|=s(D,S-1)<<4),C}a.prototype._parseHex=function(E,S,C){this.length=Math.ceil((E.length-S)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var k=0,U=0,G;if(C==="be")for(M=E.length-1;M>=S;M-=2)G=l(E,S,M)<<k,this.words[U]|=G&67108863,k>=18?(k-=18,U+=1,this.words[U]|=G>>>26):k+=8;else{var B=E.length-S;for(M=B%2===0?S+1:S;M<E.length;M+=2)G=l(E,S,M)<<k,this.words[U]|=G&67108863,k>=18?(k-=18,U+=1,this.words[U]|=G>>>26):k+=8}this._strip()};function u(D,E,S,C){for(var M=0,k=0,U=Math.min(D.length,S),G=E;G<U;G++){var B=D.charCodeAt(G)-48;M*=C,B>=49?k=B-49+10:B>=17?k=B-17+10:k=B,n(B>=0&&k<C,"Invalid character"),M+=k}return M}a.prototype._parseBase=function(E,S,C){this.words=[0],this.length=1;for(var M=0,k=1;k<=67108863;k*=S)M++;M--,k=k/S|0;for(var U=E.length-C,G=U%M,B=Math.min(U,U-G)+C,x=0,H=C;H<B;H+=M)x=u(E,H,H+M,S),this.imuln(k),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x);if(G!==0){var q=1;for(x=u(E,H,E.length,S),H=0;H<G;H++)q*=S;this.imuln(q),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x)}this._strip()},a.prototype.copy=function(E){E.words=new Array(this.length);for(var S=0;S<this.length;S++)E.words[S]=this.words[S];E.length=this.length,E.negative=this.negative,E.red=this.red};function c(D,E){D.words=E.words,D.length=E.length,D.negative=E.negative,D.red=E.red}if(a.prototype._move=function(E){c(E,this)},a.prototype.clone=function(){var E=new a(null);return this.copy(E),E},a.prototype._expand=function(E){for(;this.length<E;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{a.prototype.inspect=f}else a.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],h=[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],p=[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];a.prototype.toString=function(E,S){E=E||10,S=S|0||1;var C;if(E===16||E==="hex"){C="";for(var M=0,k=0,U=0;U<this.length;U++){var G=this.words[U],B=((G<<M|k)&16777215).toString(16);k=G>>>24-M&16777215,M+=2,M>=26&&(M-=26,U--),k!==0||U!==this.length-1?C=d[6-B.length]+B+C:C=B+C}for(k!==0&&(C=k.toString(16)+C);C.length%S!==0;)C="0"+C;return this.negative!==0&&(C="-"+C),C}if(E===(E|0)&&E>=2&&E<=36){var x=h[E],H=p[E];C="";var q=this.clone();for(q.negative=0;!q.isZero();){var W=q.modrn(H).toString(E);q=q.idivn(H),q.isZero()?C=W+C:C=d[x-W.length]+W+C}for(this.isZero()&&(C="0"+C);C.length%S!==0;)C="0"+C;return this.negative!==0&&(C="-"+C),C}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(E,S){return this.toArrayLike(o,E,S)}),a.prototype.toArray=function(E,S){return this.toArrayLike(Array,E,S)};var g=function(E,S){return E.allocUnsafe?E.allocUnsafe(S):new E(S)};a.prototype.toArrayLike=function(E,S,C){this._strip();var M=this.byteLength(),k=C||Math.max(1,M);n(M<=k,"byte array longer than desired length"),n(k>0,"Requested array length <= 0");var U=g(E,k),G=S==="le"?"LE":"BE";return this["_toArrayLike"+G](U,M),U},a.prototype._toArrayLikeLE=function(E,S){for(var C=0,M=0,k=0,U=0;k<this.length;k++){var G=this.words[k]<<U|M;E[C++]=G&255,C<E.length&&(E[C++]=G>>8&255),C<E.length&&(E[C++]=G>>16&255),U===6?(C<E.length&&(E[C++]=G>>24&255),M=0,U=0):(M=G>>>24,U+=2)}if(C<E.length)for(E[C++]=M;C<E.length;)E[C++]=0},a.prototype._toArrayLikeBE=function(E,S){for(var C=E.length-1,M=0,k=0,U=0;k<this.length;k++){var G=this.words[k]<<U|M;E[C--]=G&255,C>=0&&(E[C--]=G>>8&255),C>=0&&(E[C--]=G>>16&255),U===6?(C>=0&&(E[C--]=G>>24&255),M=0,U=0):(M=G>>>24,U+=2)}if(C>=0)for(E[C--]=M;C>=0;)E[C--]=0},Math.clz32?a.prototype._countBits=function(E){return 32-Math.clz32(E)}:a.prototype._countBits=function(E){var S=E,C=0;return S>=4096&&(C+=13,S>>>=13),S>=64&&(C+=7,S>>>=7),S>=8&&(C+=4,S>>>=4),S>=2&&(C+=2,S>>>=2),C+S},a.prototype._zeroBits=function(E){if(E===0)return 26;var S=E,C=0;return S&8191||(C+=13,S>>>=13),S&127||(C+=7,S>>>=7),S&15||(C+=4,S>>>=4),S&3||(C+=2,S>>>=2),S&1||C++,C},a.prototype.bitLength=function(){var E=this.words[this.length-1],S=this._countBits(E);return(this.length-1)*26+S};function m(D){for(var E=new Array(D.bitLength()),S=0;S<E.length;S++){var C=S/26|0,M=S%26;E[S]=D.words[C]>>>M&1}return E}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,S=0;S<this.length;S++){var C=this._zeroBits(this.words[S]);if(E+=C,C!==26)break}return E},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(E){return this.negative!==0?this.abs().inotn(E).iaddn(1):this.clone()},a.prototype.fromTwos=function(E){return this.testn(E-1)?this.notn(E).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(E){for(;this.length<E.length;)this.words[this.length++]=0;for(var S=0;S<E.length;S++)this.words[S]=this.words[S]|E.words[S];return this._strip()},a.prototype.ior=function(E){return n((this.negative|E.negative)===0),this.iuor(E)},a.prototype.or=function(E){return this.length>E.length?this.clone().ior(E):E.clone().ior(this)},a.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},a.prototype.iuand=function(E){var S;this.length>E.length?S=E:S=this;for(var C=0;C<S.length;C++)this.words[C]=this.words[C]&E.words[C];return this.length=S.length,this._strip()},a.prototype.iand=function(E){return n((this.negative|E.negative)===0),this.iuand(E)},a.prototype.and=function(E){return this.length>E.length?this.clone().iand(E):E.clone().iand(this)},a.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},a.prototype.iuxor=function(E){var S,C;this.length>E.length?(S=this,C=E):(S=E,C=this);for(var M=0;M<C.length;M++)this.words[M]=S.words[M]^C.words[M];if(this!==S)for(;M<S.length;M++)this.words[M]=S.words[M];return this.length=S.length,this._strip()},a.prototype.ixor=function(E){return n((this.negative|E.negative)===0),this.iuxor(E)},a.prototype.xor=function(E){return this.length>E.length?this.clone().ixor(E):E.clone().ixor(this)},a.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},a.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var S=Math.ceil(E/26)|0,C=E%26;this._expand(S),C>0&&S--;for(var M=0;M<S;M++)this.words[M]=~this.words[M]&67108863;return C>0&&(this.words[M]=~this.words[M]&67108863>>26-C),this._strip()},a.prototype.notn=function(E){return this.clone().inotn(E)},a.prototype.setn=function(E,S){n(typeof E=="number"&&E>=0);var C=E/26|0,M=E%26;return this._expand(C+1),S?this.words[C]=this.words[C]|1<<M:this.words[C]=this.words[C]&~(1<<M),this._strip()},a.prototype.iadd=function(E){var S;if(this.negative!==0&&E.negative===0)return this.negative=0,S=this.isub(E),this.negative^=1,this._normSign();if(this.negative===0&&E.negative!==0)return E.negative=0,S=this.isub(E),E.negative=1,S._normSign();var C,M;this.length>E.length?(C=this,M=E):(C=E,M=this);for(var k=0,U=0;U<M.length;U++)S=(C.words[U]|0)+(M.words[U]|0)+k,this.words[U]=S&67108863,k=S>>>26;for(;k!==0&&U<C.length;U++)S=(C.words[U]|0)+k,this.words[U]=S&67108863,k=S>>>26;if(this.length=C.length,k!==0)this.words[this.length]=k,this.length++;else if(C!==this)for(;U<C.length;U++)this.words[U]=C.words[U];return this},a.prototype.add=function(E){var S;return E.negative!==0&&this.negative===0?(E.negative=0,S=this.sub(E),E.negative^=1,S):E.negative===0&&this.negative!==0?(this.negative=0,S=E.sub(this),this.negative=1,S):this.length>E.length?this.clone().iadd(E):E.clone().iadd(this)},a.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var S=this.iadd(E);return E.negative=1,S._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var C=this.cmp(E);if(C===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,k;C>0?(M=this,k=E):(M=E,k=this);for(var U=0,G=0;G<k.length;G++)S=(M.words[G]|0)-(k.words[G]|0)+U,U=S>>26,this.words[G]=S&67108863;for(;U!==0&&G<M.length;G++)S=(M.words[G]|0)+U,U=S>>26,this.words[G]=S&67108863;if(U===0&&G<M.length&&M!==this)for(;G<M.length;G++)this.words[G]=M.words[G];return this.length=Math.max(this.length,G),M!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(E){return this.clone().isub(E)};function y(D,E,S){S.negative=E.negative^D.negative;var C=D.length+E.length|0;S.length=C,C=C-1|0;var M=D.words[0]|0,k=E.words[0]|0,U=M*k,G=U&67108863,B=U/67108864|0;S.words[0]=G;for(var x=1;x<C;x++){for(var H=B>>>26,q=B&67108863,W=Math.min(x,E.length-1),Y=Math.max(0,x-D.length+1);Y<=W;Y++){var re=x-Y|0;M=D.words[re]|0,k=E.words[Y]|0,U=M*k+q,H+=U/67108864|0,q=U&67108863}S.words[x]=q|0,B=H|0}return B!==0?S.words[x]=B|0:S.length--,S._strip()}var b=function(E,S,C){var M=E.words,k=S.words,U=C.words,G=0,B,x,H,q=M[0]|0,W=q&8191,Y=q>>>13,re=M[1]|0,Q=re&8191,ie=re>>>13,ce=M[2]|0,te=ce&8191,J=ce>>>13,ge=M[3]|0,fe=ge&8191,ye=ge>>>13,Fe=M[4]|0,me=Fe&8191,Ue=Fe>>>13,tt=M[5]|0,Ve=tt&8191,Ae=tt>>>13,je=M[6]|0,Pe=je&8191,Oe=je>>>13,rt=M[7]|0,We=rt&8191,ne=rt>>>13,X=M[8]|0,K=X&8191,le=X>>>13,ve=M[9]|0,Ee=ve&8191,we=ve>>>13,ft=k[0]|0,He=ft&8191,Ke=ft>>>13,Jt=k[1]|0,at=Jt&8191,At=Jt>>>13,Vr=k[2]|0,xt=Vr&8191,Dt=Vr>>>13,Bn=k[3]|0,Nt=Bn&8191,Xt=Bn>>>13,ji=k[4]|0,ct=ji&8191,St=ji>>>13,Ji=k[5]|0,er=Ji&8191,Yt=Ji>>>13,la=k[6]|0,Wt=la&8191,Ht=la>>>13,zi=k[7]|0,vt=zi&8191,Lt=zi>>>13,Kr=k[8]|0,yt=Kr&8191,Pt=Kr>>>13,ua=k[9]|0,Me=ua&8191,$e=ua>>>13;C.negative=E.negative^S.negative,C.length=19,B=Math.imul(W,He),x=Math.imul(W,Ke),x=x+Math.imul(Y,He)|0,H=Math.imul(Y,Ke);var Mt=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,B=Math.imul(Q,He),x=Math.imul(Q,Ke),x=x+Math.imul(ie,He)|0,H=Math.imul(ie,Ke),B=B+Math.imul(W,at)|0,x=x+Math.imul(W,At)|0,x=x+Math.imul(Y,at)|0,H=H+Math.imul(Y,At)|0;var Tr=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,B=Math.imul(te,He),x=Math.imul(te,Ke),x=x+Math.imul(J,He)|0,H=Math.imul(J,Ke),B=B+Math.imul(Q,at)|0,x=x+Math.imul(Q,At)|0,x=x+Math.imul(ie,at)|0,H=H+Math.imul(ie,At)|0,B=B+Math.imul(W,xt)|0,x=x+Math.imul(W,Dt)|0,x=x+Math.imul(Y,xt)|0,H=H+Math.imul(Y,Dt)|0;var kr=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(kr>>>26)|0,kr&=67108863,B=Math.imul(fe,He),x=Math.imul(fe,Ke),x=x+Math.imul(ye,He)|0,H=Math.imul(ye,Ke),B=B+Math.imul(te,at)|0,x=x+Math.imul(te,At)|0,x=x+Math.imul(J,at)|0,H=H+Math.imul(J,At)|0,B=B+Math.imul(Q,xt)|0,x=x+Math.imul(Q,Dt)|0,x=x+Math.imul(ie,xt)|0,H=H+Math.imul(ie,Dt)|0,B=B+Math.imul(W,Nt)|0,x=x+Math.imul(W,Xt)|0,x=x+Math.imul(Y,Nt)|0,H=H+Math.imul(Y,Xt)|0;var cn=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(cn>>>26)|0,cn&=67108863,B=Math.imul(me,He),x=Math.imul(me,Ke),x=x+Math.imul(Ue,He)|0,H=Math.imul(Ue,Ke),B=B+Math.imul(fe,at)|0,x=x+Math.imul(fe,At)|0,x=x+Math.imul(ye,at)|0,H=H+Math.imul(ye,At)|0,B=B+Math.imul(te,xt)|0,x=x+Math.imul(te,Dt)|0,x=x+Math.imul(J,xt)|0,H=H+Math.imul(J,Dt)|0,B=B+Math.imul(Q,Nt)|0,x=x+Math.imul(Q,Xt)|0,x=x+Math.imul(ie,Nt)|0,H=H+Math.imul(ie,Xt)|0,B=B+Math.imul(W,ct)|0,x=x+Math.imul(W,St)|0,x=x+Math.imul(Y,ct)|0,H=H+Math.imul(Y,St)|0;var dn=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(dn>>>26)|0,dn&=67108863,B=Math.imul(Ve,He),x=Math.imul(Ve,Ke),x=x+Math.imul(Ae,He)|0,H=Math.imul(Ae,Ke),B=B+Math.imul(me,at)|0,x=x+Math.imul(me,At)|0,x=x+Math.imul(Ue,at)|0,H=H+Math.imul(Ue,At)|0,B=B+Math.imul(fe,xt)|0,x=x+Math.imul(fe,Dt)|0,x=x+Math.imul(ye,xt)|0,H=H+Math.imul(ye,Dt)|0,B=B+Math.imul(te,Nt)|0,x=x+Math.imul(te,Xt)|0,x=x+Math.imul(J,Nt)|0,H=H+Math.imul(J,Xt)|0,B=B+Math.imul(Q,ct)|0,x=x+Math.imul(Q,St)|0,x=x+Math.imul(ie,ct)|0,H=H+Math.imul(ie,St)|0,B=B+Math.imul(W,er)|0,x=x+Math.imul(W,Yt)|0,x=x+Math.imul(Y,er)|0,H=H+Math.imul(Y,Yt)|0;var ni=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ni>>>26)|0,ni&=67108863,B=Math.imul(Pe,He),x=Math.imul(Pe,Ke),x=x+Math.imul(Oe,He)|0,H=Math.imul(Oe,Ke),B=B+Math.imul(Ve,at)|0,x=x+Math.imul(Ve,At)|0,x=x+Math.imul(Ae,at)|0,H=H+Math.imul(Ae,At)|0,B=B+Math.imul(me,xt)|0,x=x+Math.imul(me,Dt)|0,x=x+Math.imul(Ue,xt)|0,H=H+Math.imul(Ue,Dt)|0,B=B+Math.imul(fe,Nt)|0,x=x+Math.imul(fe,Xt)|0,x=x+Math.imul(ye,Nt)|0,H=H+Math.imul(ye,Xt)|0,B=B+Math.imul(te,ct)|0,x=x+Math.imul(te,St)|0,x=x+Math.imul(J,ct)|0,H=H+Math.imul(J,St)|0,B=B+Math.imul(Q,er)|0,x=x+Math.imul(Q,Yt)|0,x=x+Math.imul(ie,er)|0,H=H+Math.imul(ie,Yt)|0,B=B+Math.imul(W,Wt)|0,x=x+Math.imul(W,Ht)|0,x=x+Math.imul(Y,Wt)|0,H=H+Math.imul(Y,Ht)|0;var ao=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ao>>>26)|0,ao&=67108863,B=Math.imul(We,He),x=Math.imul(We,Ke),x=x+Math.imul(ne,He)|0,H=Math.imul(ne,Ke),B=B+Math.imul(Pe,at)|0,x=x+Math.imul(Pe,At)|0,x=x+Math.imul(Oe,at)|0,H=H+Math.imul(Oe,At)|0,B=B+Math.imul(Ve,xt)|0,x=x+Math.imul(Ve,Dt)|0,x=x+Math.imul(Ae,xt)|0,H=H+Math.imul(Ae,Dt)|0,B=B+Math.imul(me,Nt)|0,x=x+Math.imul(me,Xt)|0,x=x+Math.imul(Ue,Nt)|0,H=H+Math.imul(Ue,Xt)|0,B=B+Math.imul(fe,ct)|0,x=x+Math.imul(fe,St)|0,x=x+Math.imul(ye,ct)|0,H=H+Math.imul(ye,St)|0,B=B+Math.imul(te,er)|0,x=x+Math.imul(te,Yt)|0,x=x+Math.imul(J,er)|0,H=H+Math.imul(J,Yt)|0,B=B+Math.imul(Q,Wt)|0,x=x+Math.imul(Q,Ht)|0,x=x+Math.imul(ie,Wt)|0,H=H+Math.imul(ie,Ht)|0,B=B+Math.imul(W,vt)|0,x=x+Math.imul(W,Lt)|0,x=x+Math.imul(Y,vt)|0,H=H+Math.imul(Y,Lt)|0;var ea=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ea>>>26)|0,ea&=67108863,B=Math.imul(K,He),x=Math.imul(K,Ke),x=x+Math.imul(le,He)|0,H=Math.imul(le,Ke),B=B+Math.imul(We,at)|0,x=x+Math.imul(We,At)|0,x=x+Math.imul(ne,at)|0,H=H+Math.imul(ne,At)|0,B=B+Math.imul(Pe,xt)|0,x=x+Math.imul(Pe,Dt)|0,x=x+Math.imul(Oe,xt)|0,H=H+Math.imul(Oe,Dt)|0,B=B+Math.imul(Ve,Nt)|0,x=x+Math.imul(Ve,Xt)|0,x=x+Math.imul(Ae,Nt)|0,H=H+Math.imul(Ae,Xt)|0,B=B+Math.imul(me,ct)|0,x=x+Math.imul(me,St)|0,x=x+Math.imul(Ue,ct)|0,H=H+Math.imul(Ue,St)|0,B=B+Math.imul(fe,er)|0,x=x+Math.imul(fe,Yt)|0,x=x+Math.imul(ye,er)|0,H=H+Math.imul(ye,Yt)|0,B=B+Math.imul(te,Wt)|0,x=x+Math.imul(te,Ht)|0,x=x+Math.imul(J,Wt)|0,H=H+Math.imul(J,Ht)|0,B=B+Math.imul(Q,vt)|0,x=x+Math.imul(Q,Lt)|0,x=x+Math.imul(ie,vt)|0,H=H+Math.imul(ie,Lt)|0,B=B+Math.imul(W,yt)|0,x=x+Math.imul(W,Pt)|0,x=x+Math.imul(Y,yt)|0,H=H+Math.imul(Y,Pt)|0;var go=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(go>>>26)|0,go&=67108863,B=Math.imul(Ee,He),x=Math.imul(Ee,Ke),x=x+Math.imul(we,He)|0,H=Math.imul(we,Ke),B=B+Math.imul(K,at)|0,x=x+Math.imul(K,At)|0,x=x+Math.imul(le,at)|0,H=H+Math.imul(le,At)|0,B=B+Math.imul(We,xt)|0,x=x+Math.imul(We,Dt)|0,x=x+Math.imul(ne,xt)|0,H=H+Math.imul(ne,Dt)|0,B=B+Math.imul(Pe,Nt)|0,x=x+Math.imul(Pe,Xt)|0,x=x+Math.imul(Oe,Nt)|0,H=H+Math.imul(Oe,Xt)|0,B=B+Math.imul(Ve,ct)|0,x=x+Math.imul(Ve,St)|0,x=x+Math.imul(Ae,ct)|0,H=H+Math.imul(Ae,St)|0,B=B+Math.imul(me,er)|0,x=x+Math.imul(me,Yt)|0,x=x+Math.imul(Ue,er)|0,H=H+Math.imul(Ue,Yt)|0,B=B+Math.imul(fe,Wt)|0,x=x+Math.imul(fe,Ht)|0,x=x+Math.imul(ye,Wt)|0,H=H+Math.imul(ye,Ht)|0,B=B+Math.imul(te,vt)|0,x=x+Math.imul(te,Lt)|0,x=x+Math.imul(J,vt)|0,H=H+Math.imul(J,Lt)|0,B=B+Math.imul(Q,yt)|0,x=x+Math.imul(Q,Pt)|0,x=x+Math.imul(ie,yt)|0,H=H+Math.imul(ie,Pt)|0,B=B+Math.imul(W,Me)|0,x=x+Math.imul(W,$e)|0,x=x+Math.imul(Y,Me)|0,H=H+Math.imul(Y,$e)|0;var ca=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ca>>>26)|0,ca&=67108863,B=Math.imul(Ee,at),x=Math.imul(Ee,At),x=x+Math.imul(we,at)|0,H=Math.imul(we,At),B=B+Math.imul(K,xt)|0,x=x+Math.imul(K,Dt)|0,x=x+Math.imul(le,xt)|0,H=H+Math.imul(le,Dt)|0,B=B+Math.imul(We,Nt)|0,x=x+Math.imul(We,Xt)|0,x=x+Math.imul(ne,Nt)|0,H=H+Math.imul(ne,Xt)|0,B=B+Math.imul(Pe,ct)|0,x=x+Math.imul(Pe,St)|0,x=x+Math.imul(Oe,ct)|0,H=H+Math.imul(Oe,St)|0,B=B+Math.imul(Ve,er)|0,x=x+Math.imul(Ve,Yt)|0,x=x+Math.imul(Ae,er)|0,H=H+Math.imul(Ae,Yt)|0,B=B+Math.imul(me,Wt)|0,x=x+Math.imul(me,Ht)|0,x=x+Math.imul(Ue,Wt)|0,H=H+Math.imul(Ue,Ht)|0,B=B+Math.imul(fe,vt)|0,x=x+Math.imul(fe,Lt)|0,x=x+Math.imul(ye,vt)|0,H=H+Math.imul(ye,Lt)|0,B=B+Math.imul(te,yt)|0,x=x+Math.imul(te,Pt)|0,x=x+Math.imul(J,yt)|0,H=H+Math.imul(J,Pt)|0,B=B+Math.imul(Q,Me)|0,x=x+Math.imul(Q,$e)|0,x=x+Math.imul(ie,Me)|0,H=H+Math.imul(ie,$e)|0;var Ia=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,B=Math.imul(Ee,xt),x=Math.imul(Ee,Dt),x=x+Math.imul(we,xt)|0,H=Math.imul(we,Dt),B=B+Math.imul(K,Nt)|0,x=x+Math.imul(K,Xt)|0,x=x+Math.imul(le,Nt)|0,H=H+Math.imul(le,Xt)|0,B=B+Math.imul(We,ct)|0,x=x+Math.imul(We,St)|0,x=x+Math.imul(ne,ct)|0,H=H+Math.imul(ne,St)|0,B=B+Math.imul(Pe,er)|0,x=x+Math.imul(Pe,Yt)|0,x=x+Math.imul(Oe,er)|0,H=H+Math.imul(Oe,Yt)|0,B=B+Math.imul(Ve,Wt)|0,x=x+Math.imul(Ve,Ht)|0,x=x+Math.imul(Ae,Wt)|0,H=H+Math.imul(Ae,Ht)|0,B=B+Math.imul(me,vt)|0,x=x+Math.imul(me,Lt)|0,x=x+Math.imul(Ue,vt)|0,H=H+Math.imul(Ue,Lt)|0,B=B+Math.imul(fe,yt)|0,x=x+Math.imul(fe,Pt)|0,x=x+Math.imul(ye,yt)|0,H=H+Math.imul(ye,Pt)|0,B=B+Math.imul(te,Me)|0,x=x+Math.imul(te,$e)|0,x=x+Math.imul(J,Me)|0,H=H+Math.imul(J,$e)|0;var en=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(en>>>26)|0,en&=67108863,B=Math.imul(Ee,Nt),x=Math.imul(Ee,Xt),x=x+Math.imul(we,Nt)|0,H=Math.imul(we,Xt),B=B+Math.imul(K,ct)|0,x=x+Math.imul(K,St)|0,x=x+Math.imul(le,ct)|0,H=H+Math.imul(le,St)|0,B=B+Math.imul(We,er)|0,x=x+Math.imul(We,Yt)|0,x=x+Math.imul(ne,er)|0,H=H+Math.imul(ne,Yt)|0,B=B+Math.imul(Pe,Wt)|0,x=x+Math.imul(Pe,Ht)|0,x=x+Math.imul(Oe,Wt)|0,H=H+Math.imul(Oe,Ht)|0,B=B+Math.imul(Ve,vt)|0,x=x+Math.imul(Ve,Lt)|0,x=x+Math.imul(Ae,vt)|0,H=H+Math.imul(Ae,Lt)|0,B=B+Math.imul(me,yt)|0,x=x+Math.imul(me,Pt)|0,x=x+Math.imul(Ue,yt)|0,H=H+Math.imul(Ue,Pt)|0,B=B+Math.imul(fe,Me)|0,x=x+Math.imul(fe,$e)|0,x=x+Math.imul(ye,Me)|0,H=H+Math.imul(ye,$e)|0;var Li=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Li>>>26)|0,Li&=67108863,B=Math.imul(Ee,ct),x=Math.imul(Ee,St),x=x+Math.imul(we,ct)|0,H=Math.imul(we,St),B=B+Math.imul(K,er)|0,x=x+Math.imul(K,Yt)|0,x=x+Math.imul(le,er)|0,H=H+Math.imul(le,Yt)|0,B=B+Math.imul(We,Wt)|0,x=x+Math.imul(We,Ht)|0,x=x+Math.imul(ne,Wt)|0,H=H+Math.imul(ne,Ht)|0,B=B+Math.imul(Pe,vt)|0,x=x+Math.imul(Pe,Lt)|0,x=x+Math.imul(Oe,vt)|0,H=H+Math.imul(Oe,Lt)|0,B=B+Math.imul(Ve,yt)|0,x=x+Math.imul(Ve,Pt)|0,x=x+Math.imul(Ae,yt)|0,H=H+Math.imul(Ae,Pt)|0,B=B+Math.imul(me,Me)|0,x=x+Math.imul(me,$e)|0,x=x+Math.imul(Ue,Me)|0,H=H+Math.imul(Ue,$e)|0;var pi=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(pi>>>26)|0,pi&=67108863,B=Math.imul(Ee,er),x=Math.imul(Ee,Yt),x=x+Math.imul(we,er)|0,H=Math.imul(we,Yt),B=B+Math.imul(K,Wt)|0,x=x+Math.imul(K,Ht)|0,x=x+Math.imul(le,Wt)|0,H=H+Math.imul(le,Ht)|0,B=B+Math.imul(We,vt)|0,x=x+Math.imul(We,Lt)|0,x=x+Math.imul(ne,vt)|0,H=H+Math.imul(ne,Lt)|0,B=B+Math.imul(Pe,yt)|0,x=x+Math.imul(Pe,Pt)|0,x=x+Math.imul(Oe,yt)|0,H=H+Math.imul(Oe,Pt)|0,B=B+Math.imul(Ve,Me)|0,x=x+Math.imul(Ve,$e)|0,x=x+Math.imul(Ae,Me)|0,H=H+Math.imul(Ae,$e)|0;var Go=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Go>>>26)|0,Go&=67108863,B=Math.imul(Ee,Wt),x=Math.imul(Ee,Ht),x=x+Math.imul(we,Wt)|0,H=Math.imul(we,Ht),B=B+Math.imul(K,vt)|0,x=x+Math.imul(K,Lt)|0,x=x+Math.imul(le,vt)|0,H=H+Math.imul(le,Lt)|0,B=B+Math.imul(We,yt)|0,x=x+Math.imul(We,Pt)|0,x=x+Math.imul(ne,yt)|0,H=H+Math.imul(ne,Pt)|0,B=B+Math.imul(Pe,Me)|0,x=x+Math.imul(Pe,$e)|0,x=x+Math.imul(Oe,Me)|0,H=H+Math.imul(Oe,$e)|0;var hs=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(hs>>>26)|0,hs&=67108863,B=Math.imul(Ee,vt),x=Math.imul(Ee,Lt),x=x+Math.imul(we,vt)|0,H=Math.imul(we,Lt),B=B+Math.imul(K,yt)|0,x=x+Math.imul(K,Pt)|0,x=x+Math.imul(le,yt)|0,H=H+Math.imul(le,Pt)|0,B=B+Math.imul(We,Me)|0,x=x+Math.imul(We,$e)|0,x=x+Math.imul(ne,Me)|0,H=H+Math.imul(ne,$e)|0;var Ml=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Ml>>>26)|0,Ml&=67108863,B=Math.imul(Ee,yt),x=Math.imul(Ee,Pt),x=x+Math.imul(we,yt)|0,H=Math.imul(we,Pt),B=B+Math.imul(K,Me)|0,x=x+Math.imul(K,$e)|0,x=x+Math.imul(le,Me)|0,H=H+Math.imul(le,$e)|0;var Dl=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Dl>>>26)|0,Dl&=67108863,B=Math.imul(Ee,Me),x=Math.imul(Ee,$e),x=x+Math.imul(we,Me)|0,H=Math.imul(we,$e);var pe=(G+B|0)+((x&8191)<<13)|0;return G=(H+(x>>>13)|0)+(pe>>>26)|0,pe&=67108863,U[0]=Mt,U[1]=Tr,U[2]=kr,U[3]=cn,U[4]=dn,U[5]=ni,U[6]=ao,U[7]=ea,U[8]=go,U[9]=ca,U[10]=Ia,U[11]=en,U[12]=Li,U[13]=pi,U[14]=Go,U[15]=hs,U[16]=Ml,U[17]=Dl,U[18]=pe,G!==0&&(U[19]=G,C.length++),C};Math.imul||(b=y);function w(D,E,S){S.negative=E.negative^D.negative,S.length=D.length+E.length;for(var C=0,M=0,k=0;k<S.length-1;k++){var U=M;M=0;for(var G=C&67108863,B=Math.min(k,E.length-1),x=Math.max(0,k-D.length+1);x<=B;x++){var H=k-x,q=D.words[H]|0,W=E.words[x]|0,Y=q*W,re=Y&67108863;U=U+(Y/67108864|0)|0,re=re+G|0,G=re&67108863,U=U+(re>>>26)|0,M+=U>>>26,U&=67108863}S.words[k]=G,C=U,U=M}return C!==0?S.words[k]=C:S.length--,S._strip()}function T(D,E,S){return w(D,E,S)}a.prototype.mulTo=function(E,S){var C,M=this.length+E.length;return this.length===10&&E.length===10?C=b(this,E,S):M<63?C=y(this,E,S):M<1024?C=w(this,E,S):C=T(this,E,S),C},a.prototype.mul=function(E){var S=new a(null);return S.words=new Array(this.length+E.length),this.mulTo(E,S)},a.prototype.mulf=function(E){var S=new a(null);return S.words=new Array(this.length+E.length),T(this,E,S)},a.prototype.imul=function(E){return this.clone().mulTo(E,this)},a.prototype.imuln=function(E){var S=E<0;S&&(E=-E),n(typeof E=="number"),n(E<67108864);for(var C=0,M=0;M<this.length;M++){var k=(this.words[M]|0)*E,U=(k&67108863)+(C&67108863);C>>=26,C+=k/67108864|0,C+=U>>>26,this.words[M]=U&67108863}return C!==0&&(this.words[M]=C,this.length++),S?this.ineg():this},a.prototype.muln=function(E){return this.clone().imuln(E)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(E){var S=m(E);if(S.length===0)return new a(1);for(var C=this,M=0;M<S.length&&S[M]===0;M++,C=C.sqr());if(++M<S.length)for(var k=C.sqr();M<S.length;M++,k=k.sqr())S[M]!==0&&(C=C.mul(k));return C},a.prototype.iushln=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26,M=67108863>>>26-S<<26-S,k;if(S!==0){var U=0;for(k=0;k<this.length;k++){var G=this.words[k]&M,B=(this.words[k]|0)-G<<S;this.words[k]=B|U,U=G>>>26-S}U&&(this.words[k]=U,this.length++)}if(C!==0){for(k=this.length-1;k>=0;k--)this.words[k+C]=this.words[k];for(k=0;k<C;k++)this.words[k]=0;this.length+=C}return this._strip()},a.prototype.ishln=function(E){return n(this.negative===0),this.iushln(E)},a.prototype.iushrn=function(E,S,C){n(typeof E=="number"&&E>=0);var M;S?M=(S-S%26)/26:M=0;var k=E%26,U=Math.min((E-k)/26,this.length),G=67108863^67108863>>>k<<k,B=C;if(M-=U,M=Math.max(0,M),B){for(var x=0;x<U;x++)B.words[x]=this.words[x];B.length=U}if(U!==0)if(this.length>U)for(this.length-=U,x=0;x<this.length;x++)this.words[x]=this.words[x+U];else this.words[0]=0,this.length=1;var H=0;for(x=this.length-1;x>=0&&(H!==0||x>=M);x--){var q=this.words[x]|0;this.words[x]=H<<26-k|q>>>k,H=q&G}return B&&H!==0&&(B.words[B.length++]=H),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(E,S,C){return n(this.negative===0),this.iushrn(E,S,C)},a.prototype.shln=function(E){return this.clone().ishln(E)},a.prototype.ushln=function(E){return this.clone().iushln(E)},a.prototype.shrn=function(E){return this.clone().ishrn(E)},a.prototype.ushrn=function(E){return this.clone().iushrn(E)},a.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26,M=1<<S;if(this.length<=C)return!1;var k=this.words[C];return!!(k&M)},a.prototype.imaskn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=C)return this;if(S!==0&&C++,this.length=Math.min(C,this.length),S!==0){var M=67108863^67108863>>>S<<S;this.words[this.length-1]&=M}return this._strip()},a.prototype.maskn=function(E){return this.clone().imaskn(E)},a.prototype.iaddn=function(E){return n(typeof E=="number"),n(E<67108864),E<0?this.isubn(-E):this.negative!==0?this.length===1&&(this.words[0]|0)<=E?(this.words[0]=E-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(E),this.negative=1,this):this._iaddn(E)},a.prototype._iaddn=function(E){this.words[0]+=E;for(var S=0;S<this.length&&this.words[S]>=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},a.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S<this.length&&this.words[S]<0;S++)this.words[S]+=67108864,this.words[S+1]-=1;return this._strip()},a.prototype.addn=function(E){return this.clone().iaddn(E)},a.prototype.subn=function(E){return this.clone().isubn(E)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(E,S,C){var M=E.length+C,k;this._expand(M);var U,G=0;for(k=0;k<E.length;k++){U=(this.words[k+C]|0)+G;var B=(E.words[k]|0)*S;U-=B&67108863,G=(U>>26)-(B/67108864|0),this.words[k+C]=U&67108863}for(;k<this.length-C;k++)U=(this.words[k+C]|0)+G,G=U>>26,this.words[k+C]=U&67108863;if(G===0)return this._strip();for(n(G===-1),G=0,k=0;k<this.length;k++)U=-(this.words[k]|0)+G,G=U>>26,this.words[k]=U&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(E,S){var C=this.length-E.length,M=this.clone(),k=E,U=k.words[k.length-1]|0,G=this._countBits(U);C=26-G,C!==0&&(k=k.ushln(C),M.iushln(C),U=k.words[k.length-1]|0);var B=M.length-k.length,x;if(S!=="mod"){x=new a(null),x.length=B+1,x.words=new Array(x.length);for(var H=0;H<x.length;H++)x.words[H]=0}var q=M.clone()._ishlnsubmul(k,1,B);q.negative===0&&(M=q,x&&(x.words[B]=1));for(var W=B-1;W>=0;W--){var Y=(M.words[k.length+W]|0)*67108864+(M.words[k.length+W-1]|0);for(Y=Math.min(Y/U|0,67108863),M._ishlnsubmul(k,Y,W);M.negative!==0;)Y--,M.negative=0,M._ishlnsubmul(k,1,W),M.isZero()||(M.negative^=1);x&&(x.words[W]=Y)}return x&&x._strip(),M._strip(),S!=="div"&&C!==0&&M.iushrn(C),{div:x||null,mod:M}},a.prototype.divmod=function(E,S,C){if(n(!E.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var M,k,U;return this.negative!==0&&E.negative===0?(U=this.neg().divmod(E,S),S!=="mod"&&(M=U.div.neg()),S!=="div"&&(k=U.mod.neg(),C&&k.negative!==0&&k.iadd(E)),{div:M,mod:k}):this.negative===0&&E.negative!==0?(U=this.divmod(E.neg(),S),S!=="mod"&&(M=U.div.neg()),{div:M,mod:U.mod}):this.negative&E.negative?(U=this.neg().divmod(E.neg(),S),S!=="div"&&(k=U.mod.neg(),C&&k.negative!==0&&k.isub(E)),{div:U.div,mod:k}):E.length>this.length||this.cmp(E)<0?{div:new a(0),mod:this}:E.length===1?S==="div"?{div:this.divn(E.words[0]),mod:null}:S==="mod"?{div:null,mod:new a(this.modrn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new a(this.modrn(E.words[0]))}:this._wordDiv(E,S)},a.prototype.div=function(E){return this.divmod(E,"div",!1).div},a.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},a.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},a.prototype.divRound=function(E){var S=this.divmod(E);if(S.mod.isZero())return S.div;var C=S.div.negative!==0?S.mod.isub(E):S.mod,M=E.ushrn(1),k=E.andln(1),U=C.cmp(M);return U<0||k===1&&U===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},a.prototype.modrn=function(E){var S=E<0;S&&(E=-E),n(E<=67108863);for(var C=(1<<26)%E,M=0,k=this.length-1;k>=0;k--)M=(C*M+(this.words[k]|0))%E;return S?-M:M},a.prototype.modn=function(E){return this.modrn(E)},a.prototype.idivn=function(E){var S=E<0;S&&(E=-E),n(E<=67108863);for(var C=0,M=this.length-1;M>=0;M--){var k=(this.words[M]|0)+C*67108864;this.words[M]=k/E|0,C=k%E}return this._strip(),S?this.ineg():this},a.prototype.divn=function(E){return this.clone().idivn(E)},a.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var S=this,C=E.clone();S.negative!==0?S=S.umod(E):S=S.clone();for(var M=new a(1),k=new a(0),U=new a(0),G=new a(1),B=0;S.isEven()&&C.isEven();)S.iushrn(1),C.iushrn(1),++B;for(var x=C.clone(),H=S.clone();!S.isZero();){for(var q=0,W=1;!(S.words[0]&W)&&q<26;++q,W<<=1);if(q>0)for(S.iushrn(q);q-- >0;)(M.isOdd()||k.isOdd())&&(M.iadd(x),k.isub(H)),M.iushrn(1),k.iushrn(1);for(var Y=0,re=1;!(C.words[0]&re)&&Y<26;++Y,re<<=1);if(Y>0)for(C.iushrn(Y);Y-- >0;)(U.isOdd()||G.isOdd())&&(U.iadd(x),G.isub(H)),U.iushrn(1),G.iushrn(1);S.cmp(C)>=0?(S.isub(C),M.isub(U),k.isub(G)):(C.isub(S),U.isub(M),G.isub(k))}return{a:U,b:G,gcd:C.iushln(B)}},a.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var S=this,C=E.clone();S.negative!==0?S=S.umod(E):S=S.clone();for(var M=new a(1),k=new a(0),U=C.clone();S.cmpn(1)>0&&C.cmpn(1)>0;){for(var G=0,B=1;!(S.words[0]&B)&&G<26;++G,B<<=1);if(G>0)for(S.iushrn(G);G-- >0;)M.isOdd()&&M.iadd(U),M.iushrn(1);for(var x=0,H=1;!(C.words[0]&H)&&x<26;++x,H<<=1);if(x>0)for(C.iushrn(x);x-- >0;)k.isOdd()&&k.iadd(U),k.iushrn(1);S.cmp(C)>=0?(S.isub(C),M.isub(k)):(C.isub(S),k.isub(M))}var q;return S.cmpn(1)===0?q=M:q=k,q.cmpn(0)<0&&q.iadd(E),q},a.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var S=this.clone(),C=E.clone();S.negative=0,C.negative=0;for(var M=0;S.isEven()&&C.isEven();M++)S.iushrn(1),C.iushrn(1);do{for(;S.isEven();)S.iushrn(1);for(;C.isEven();)C.iushrn(1);var k=S.cmp(C);if(k<0){var U=S;S=C,C=U}else if(k===0||C.cmpn(1)===0)break;S.isub(C)}while(!0);return C.iushln(M)},a.prototype.invm=function(E){return this.egcd(E).a.umod(E)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(E){return this.words[0]&E},a.prototype.bincn=function(E){n(typeof E=="number");var S=E%26,C=(E-S)/26,M=1<<S;if(this.length<=C)return this._expand(C+1),this.words[C]|=M,this;for(var k=M,U=C;k!==0&&U<this.length;U++){var G=this.words[U]|0;G+=k,k=G>>>26,G&=67108863,this.words[U]=G}return k!==0&&(this.words[U]=k,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(E){var S=E<0;if(this.negative!==0&&!S)return-1;if(this.negative===0&&S)return 1;this._strip();var C;if(this.length>1)C=1;else{S&&(E=-E),n(E<=67108863,"Number is too big");var M=this.words[0]|0;C=M===E?0:M<E?-1:1}return this.negative!==0?-C|0:C},a.prototype.cmp=function(E){if(this.negative!==0&&E.negative===0)return-1;if(this.negative===0&&E.negative!==0)return 1;var S=this.ucmp(E);return this.negative!==0?-S|0:S},a.prototype.ucmp=function(E){if(this.length>E.length)return 1;if(this.length<E.length)return-1;for(var S=0,C=this.length-1;C>=0;C--){var M=this.words[C]|0,k=E.words[C]|0;if(M!==k){M<k?S=-1:M>k&&(S=1);break}}return S},a.prototype.gtn=function(E){return this.cmpn(E)===1},a.prototype.gt=function(E){return this.cmp(E)===1},a.prototype.gten=function(E){return this.cmpn(E)>=0},a.prototype.gte=function(E){return this.cmp(E)>=0},a.prototype.ltn=function(E){return this.cmpn(E)===-1},a.prototype.lt=function(E){return this.cmp(E)===-1},a.prototype.lten=function(E){return this.cmpn(E)<=0},a.prototype.lte=function(E){return this.cmp(E)<=0},a.prototype.eqn=function(E){return this.cmpn(E)===0},a.prototype.eq=function(E){return this.cmp(E)===0},a.red=function(E){return new $(E)},a.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(E){return this.red=E,this},a.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},a.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},a.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},a.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},a.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},a.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},a.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},a.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var R={k256:null,p224:null,p192:null,p25519:null};function N(D,E){this.name=D,this.p=new a(E,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}N.prototype._tmp=function(){var E=new a(null);return E.words=new Array(Math.ceil(this.n/13)),E},N.prototype.ireduce=function(E){var S=E,C;do this.split(S,this.tmp),S=this.imulK(S),S=S.iadd(this.tmp),C=S.bitLength();while(C>this.n);var M=C<this.n?-1:S.ucmp(this.p);return M===0?(S.words[0]=0,S.length=1):M>0?S.isub(this.p):S.strip!==void 0?S.strip():S._strip(),S},N.prototype.split=function(E,S){E.iushrn(this.n,0,S)},N.prototype.imulK=function(E){return E.imul(this.k)};function A(){N.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(A,N),A.prototype.split=function(E,S){for(var C=4194303,M=Math.min(E.length,9),k=0;k<M;k++)S.words[k]=E.words[k];if(S.length=M,E.length<=9){E.words[0]=0,E.length=1;return}var U=E.words[9];for(S.words[S.length++]=U&C,k=10;k<E.length;k++){var G=E.words[k]|0;E.words[k-10]=(G&C)<<4|U>>>22,U=G}U>>>=22,E.words[k-10]=U,U===0&&E.length>10?E.length-=10:E.length-=9},A.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var S=0,C=0;C<E.length;C++){var M=E.words[C]|0;S+=M*977,E.words[C]=S&67108863,S=M*64+(S/67108864|0)}return E.words[E.length-1]===0&&(E.length--,E.words[E.length-1]===0&&E.length--),E};function L(){N.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(L,N);function O(){N.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(O,N);function I(){N.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(I,N),I.prototype.imulK=function(E){for(var S=0,C=0;C<E.length;C++){var M=(E.words[C]|0)*19+S,k=M&67108863;M>>>=26,E.words[C]=k,S=M}return S!==0&&(E.words[E.length++]=S),E},a._prime=function(E){if(R[E])return R[E];var S;if(E==="k256")S=new A;else if(E==="p224")S=new L;else if(E==="p192")S=new O;else if(E==="p25519")S=new I;else throw new Error("Unknown prime "+E);return R[E]=S,S};function $(D){if(typeof D=="string"){var E=a._prime(D);this.m=E.p,this.prime=E}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}$.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},$.prototype._verify2=function(E,S){n((E.negative|S.negative)===0,"red works only with positives"),n(E.red&&E.red===S.red,"red works only with red numbers")},$.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):(c(E,E.umod(this.m)._forceRed(this)),E)},$.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},$.prototype.add=function(E,S){this._verify2(E,S);var C=E.add(S);return C.cmp(this.m)>=0&&C.isub(this.m),C._forceRed(this)},$.prototype.iadd=function(E,S){this._verify2(E,S);var C=E.iadd(S);return C.cmp(this.m)>=0&&C.isub(this.m),C},$.prototype.sub=function(E,S){this._verify2(E,S);var C=E.sub(S);return C.cmpn(0)<0&&C.iadd(this.m),C._forceRed(this)},$.prototype.isub=function(E,S){this._verify2(E,S);var C=E.isub(S);return C.cmpn(0)<0&&C.iadd(this.m),C},$.prototype.shl=function(E,S){return this._verify1(E),this.imod(E.ushln(S))},$.prototype.imul=function(E,S){return this._verify2(E,S),this.imod(E.imul(S))},$.prototype.mul=function(E,S){return this._verify2(E,S),this.imod(E.mul(S))},$.prototype.isqr=function(E){return this.imul(E,E.clone())},$.prototype.sqr=function(E){return this.mul(E,E)},$.prototype.sqrt=function(E){if(E.isZero())return E.clone();var S=this.m.andln(3);if(n(S%2===1),S===3){var C=this.m.add(new a(1)).iushrn(2);return this.pow(E,C)}for(var M=this.m.subn(1),k=0;!M.isZero()&&M.andln(1)===0;)k++,M.iushrn(1);n(!M.isZero());var U=new a(1).toRed(this),G=U.redNeg(),B=this.m.subn(1).iushrn(1),x=this.m.bitLength();for(x=new a(2*x*x).toRed(this);this.pow(x,B).cmp(G)!==0;)x.redIAdd(G);for(var H=this.pow(x,M),q=this.pow(E,M.addn(1).iushrn(1)),W=this.pow(E,M),Y=k;W.cmp(U)!==0;){for(var re=W,Q=0;re.cmp(U)!==0;Q++)re=re.redSqr();n(Q<Y);var ie=this.pow(H,new a(1).iushln(Y-Q-1));q=q.redMul(ie),H=ie.redSqr(),W=W.redMul(H),Y=Q}return q},$.prototype.invm=function(E){var S=E._invmp(this.m);return S.negative!==0?(S.negative=0,this.imod(S).redNeg()):this.imod(S)},$.prototype.pow=function(E,S){if(S.isZero())return new a(1).toRed(this);if(S.cmpn(1)===0)return E.clone();var C=4,M=new Array(1<<C);M[0]=new a(1).toRed(this),M[1]=E;for(var k=2;k<M.length;k++)M[k]=this.mul(M[k-1],E);var U=M[0],G=0,B=0,x=S.bitLength()%26;for(x===0&&(x=26),k=S.length-1;k>=0;k--){for(var H=S.words[k],q=x-1;q>=0;q--){var W=H>>q&1;if(U!==M[0]&&(U=this.sqr(U)),W===0&&G===0){B=0;continue}G<<=1,G|=W,B++,!(B!==C&&(k!==0||q!==0))&&(U=this.mul(U,M[G]),B=0,G=0)}x=26}return U},$.prototype.convertTo=function(E){var S=E.umod(this.m);return S===E?S.clone():S},$.prototype.convertFrom=function(E){var S=E.clone();return S.red=null,S},a.mont=function(E){return new F(E)};function F(D){$.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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(F,$),F.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},F.prototype.convertFrom=function(E){var S=this.imod(E.mul(this.rinv));return S.red=null,S},F.prototype.imul=function(E,S){if(E.isZero()||S.isZero())return E.words[0]=0,E.length=1,E;var C=E.imul(S),M=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=C.isub(M).iushrn(this.shift),U=k;return k.cmp(this.m)>=0?U=k.isub(this.m):k.cmpn(0)<0&&(U=k.iadd(this.m)),U._forceRed(this)},F.prototype.mul=function(E,S){if(E.isZero()||S.isZero())return new a(0)._forceRed(this);var C=E.mul(S),M=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=C.isub(M).iushrn(this.shift),U=k;return k.cmp(this.m)>=0?U=k.isub(this.m):k.cmpn(0)<0&&(U=k.iadd(this.m)),U._forceRed(this)},F.prototype.invm=function(E){var S=this.imod(E._invmp(this.m).mul(this.r2));return S._forceRed(this)}})(e,gt)})(d2e);var vPt=d2e.exports;const gPt=Nn(vPt),mPt="logger/5.7.0";let cRe=!1,fRe=!1;const fF={debug:1,default:2,info:2,warning:3,error:4,off:5};let dRe=fF.default,xie=null;function yPt(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}const hRe=yPt();var Che;(function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"})(Che||(Che={}));var e0;(function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"})(e0||(e0={}));const pRe="0123456789abcdef";class Le{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,r){const n=t.toLowerCase();fF[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(dRe>fF[n])&&console.log.apply(console,r)}debug(...t){this._log(Le.levels.DEBUG,t)}info(...t){this._log(Le.levels.INFO,t)}warn(...t){this._log(Le.levels.WARNING,t)}makeError(t,r,n){if(fRe)return this.makeError("censored error",r,{});r||(r=Le.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(l=>{const u=n[l];try{if(u instanceof Uint8Array){let c="";for(let f=0;f<u.length;f++)c+=pRe[u[f]>>4],c+=pRe[u[f]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(u))}catch{i.push(l+"="+JSON.stringify(n[l].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case e0.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=t;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case e0.CALL_EXCEPTION:case e0.INSUFFICIENT_FUNDS:case e0.MISSING_NEW:case e0.NONCE_EXPIRED:case e0.REPLACEMENT_UNDERPRICED:case e0.TRANSACTION_REPLACED:case e0.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=r,Object.keys(n).forEach(function(l){s[l]=n[l]}),s}throwError(t,r,n){throw this.makeError(t,r,n)}throwArgumentError(t,r,n){return this.throwError(t,Le.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(t,r,n,i){t||this.throwError(r,n,i)}assertArgument(t,r,n,i){t||this.throwArgumentError(r,n,i)}checkNormalize(t){hRe&&this.throwError("platform missing String.prototype.normalize",Le.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:hRe})}checkSafeUint53(t,r){typeof t=="number"&&(r==null&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,Le.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,Le.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n?n=": "+n:n="",t<r&&this.throwError("missing argument"+n,Le.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,Le.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){(t===Object||t==null)&&this.throwError("missing new",Le.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Le.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",Le.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return xie||(xie=new Le(mPt)),xie}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Le.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),cRe){if(!t)return;this.globalLogger().throwError("error censorship permanent",Le.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fRe=!!t,cRe=!!r}static setLogLevel(t){const r=fF[t.toLowerCase()];if(r==null){Le.globalLogger().warn("invalid log level - "+t);return}dRe=r}static from(t){return new Le(t)}}Le.errors=e0;Le.levels=Che;const EPt="bytes/5.7.0",Bs=new Le(EPt);function SXe(e){return!!e.toHexString}function a4(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return a4(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function IM(e){return li(e)&&!(e.length%2)||m_(e)}function vRe(e){return typeof e=="number"&&e==e&&e%1===0}function m_(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!vRe(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!vRe(r)||r<0||r>=256)return!1}return!0}function kt(e,t){if(t||(t={}),typeof e=="number"){Bs.checkSafeUint53(e,"invalid arrayify value");const r=[];for(;e;)r.unshift(e&255),e=parseInt(String(e/256));return r.length===0&&r.push(0),a4(new Uint8Array(r))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),SXe(e)&&(e=e.toHexString()),li(e)){let r=e.substring(2);r.length%2&&(t.hexPad==="left"?r="0"+r:t.hexPad==="right"?r+="0":Bs.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return a4(new Uint8Array(n))}return m_(e)?a4(new Uint8Array(e)):Bs.throwArgumentError("invalid arrayify value","value",e)}function xo(e){const t=e.map(i=>kt(i)),r=t.reduce((i,a)=>i+a.length,0),n=new Uint8Array(r);return t.reduce((i,a)=>(n.set(a,i),i+a.length),0),a4(n)}function X1(e){let t=kt(e);if(t.length===0)return t;let r=0;for(;r<t.length&&t[r]===0;)r++;return r&&(t=t.slice(r)),t}function VL(e,t){e=kt(e),e.length>t&&Bs.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),a4(r)}function li(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}const Iie="0123456789abcdef";function Kt(e,t){if(t||(t={}),typeof e=="number"){Bs.checkSafeUint53(e,"invalid hexlify value");let r="";for(;e;)r=Iie[e&15]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof e=="bigint")return e=e.toString(16),e.length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),SXe(e))return e.toHexString();if(li(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":Bs.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(m_(e)){let r="0x";for(let n=0;n<e.length;n++){let i=e[n];r+=Iie[(i&240)>>4]+Iie[i&15]}return r}return Bs.throwArgumentError("invalid hexlify value","value",e)}function _g(e){if(typeof e!="string")e=Kt(e);else if(!li(e)||e.length%2)return null;return(e.length-2)/2}function ol(e,t,r){return typeof e!="string"?e=Kt(e):(!li(e)||e.length%2)&&Bs.throwArgumentError("invalid hexData","value",e),t=2+2*t,r!=null?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Af(e){let t="0x";return e.forEach(r=>{t+=Kt(r).substring(2)}),t}function OM(e){const t=wXe(Kt(e,{hexPad:"left"}));return t==="0x"?"0x0":t}function wXe(e){typeof e!="string"&&(e=Kt(e)),li(e)||Bs.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&e[t]==="0";)t++;return"0x"+e.substring(t)}function Oo(e,t){for(typeof e!="string"?e=Kt(e):li(e)||Bs.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Bs.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function mA(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(IM(e)){let r=kt(e);r.length===64?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Kt(r.slice(0,32)),t.s=Kt(r.slice(32,64))):r.length===65?(t.r=Kt(r.slice(0,32)),t.s=Kt(r.slice(32,64)),t.v=r[64]):Bs.throwArgumentError("invalid signature string","signature",e),t.v<27&&(t.v===0||t.v===1?t.v+=27:Bs.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Kt(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,t._vs!=null){const i=VL(kt(t._vs),32);t._vs=Kt(i);const a=i[0]>=128?1:0;t.recoveryParam==null?t.recoveryParam=a:t.recoveryParam!==a&&Bs.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),i[0]&=127;const o=Kt(i);t.s==null?t.s=o:t.s!==o&&Bs.throwArgumentError("signature v mismatch _vs","signature",e)}if(t.recoveryParam==null)t.v==null?Bs.throwArgumentError("signature missing v and recoveryParam","signature",e):t.v===0||t.v===1?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(t.v==null)t.v=27+t.recoveryParam;else{const i=t.v===0||t.v===1?t.v:1-t.v%2;t.recoveryParam!==i&&Bs.throwArgumentError("signature recoveryParam mismatch v","signature",e)}t.r==null||!li(t.r)?Bs.throwArgumentError("signature missing or invalid r","signature",e):t.r=Oo(t.r,32),t.s==null||!li(t.s)?Bs.throwArgumentError("signature missing or invalid s","signature",e):t.s=Oo(t.s,32);const r=kt(t.s);r[0]>=128&&Bs.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Kt(r);t._vs&&(li(t._vs)||Bs.throwArgumentError("signature invalid _vs","signature",e),t._vs=Oo(t._vs,32)),t._vs==null?t._vs=n:t._vs!==n&&Bs.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Rhe(e){return e=mA(e),Kt(xo([e.r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}const TXe="bignumber/5.7.0";var R9=gPt.BN;const ty=new Le(TXe),Oie={},gRe=9007199254740991;function bPt(e){return e!=null&&(Ut.isBigNumber(e)||typeof e=="number"&&e%1===0||typeof e=="string"&&!!e.match(/^-?[0-9]+$/)||li(e)||typeof e=="bigint"||m_(e))}let mRe=!1;class Ut{constructor(t,r){t!==Oie&&ty.throwError("cannot call constructor directly; use BigNumber.from",Le.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ed(Yi(this).fromTwos(t))}toTwos(t){return ed(Yi(this).toTwos(t))}abs(){return this._hex[0]==="-"?Ut.from(this._hex.substring(1)):this}add(t){return ed(Yi(this).add(Yi(t)))}sub(t){return ed(Yi(this).sub(Yi(t)))}div(t){return Ut.from(t).isZero()&&Nh("division-by-zero","div"),ed(Yi(this).div(Yi(t)))}mul(t){return ed(Yi(this).mul(Yi(t)))}mod(t){const r=Yi(t);return r.isNeg()&&Nh("division-by-zero","mod"),ed(Yi(this).umod(r))}pow(t){const r=Yi(t);return r.isNeg()&&Nh("negative-power","pow"),ed(Yi(this).pow(r))}and(t){const r=Yi(t);return(this.isNegative()||r.isNeg())&&Nh("unbound-bitwise-result","and"),ed(Yi(this).and(r))}or(t){const r=Yi(t);return(this.isNegative()||r.isNeg())&&Nh("unbound-bitwise-result","or"),ed(Yi(this).or(r))}xor(t){const r=Yi(t);return(this.isNegative()||r.isNeg())&&Nh("unbound-bitwise-result","xor"),ed(Yi(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&Nh("negative-width","mask"),ed(Yi(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Nh("negative-width","shl"),ed(Yi(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Nh("negative-width","shr"),ed(Yi(this).shrn(t))}eq(t){return Yi(this).eq(Yi(t))}lt(t){return Yi(this).lt(Yi(t))}lte(t){return Yi(this).lte(Yi(t))}gt(t){return Yi(this).gt(Yi(t))}gte(t){return Yi(this).gte(Yi(t))}isNegative(){return this._hex[0]==="-"}isZero(){return Yi(this).isZero()}toNumber(){try{return Yi(this).toNumber()}catch{Nh("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ty.throwError("this platform does not support BigInt",Le.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?mRe||(mRe=!0,ty.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ty.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Le.errors.UNEXPECTED_ARGUMENT,{}):ty.throwError("BigNumber.toString does not accept parameters",Le.errors.UNEXPECTED_ARGUMENT,{})),Yi(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ut)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new Ut(Oie,x9(t)):t.match(/^-?[0-9]+$/)?new Ut(Oie,x9(new R9(t))):ty.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&Nh("underflow","BigNumber.from",t),(t>=gRe||t<=-gRe)&&Nh("overflow","BigNumber.from",t),Ut.from(String(t));const r=t;if(typeof r=="bigint")return Ut.from(r.toString());if(m_(r))return Ut.from(Kt(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Ut.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(li(n)||n[0]==="-"&&li(n.substring(1))))return Ut.from(n)}return ty.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}}function x9(e){if(typeof e!="string")return x9(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&ty.throwArgumentError("invalid hex","value",e),e=x9(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function ed(e){return Ut.from(x9(e))}function Yi(e){const t=Ut.from(e).toHexString();return t[0]==="-"?new R9("-"+t.substring(3),16):new R9(t.substring(2),16)}function Nh(e,t,r){const n={fault:e,operation:t};return r!=null&&(n.value=r),ty.throwError(e,Le.errors.NUMERIC_FAULT,n)}function _Pt(e){return new R9(e,36).toString(16)}function SPt(e){return new R9(e,16).toString(36)}const Cf=new Le(TXe),WL={},AXe=Ut.from(0),CXe=Ut.from(-1);function RXe(e,t,r,n){const i={fault:t,operation:r};return n!==void 0&&(i.value=n),Cf.throwError(e,Le.errors.NUMERIC_FAULT,i)}let jL="0";for(;jL.length<256;)jL+=jL;function h2e(e){if(typeof e!="number")try{e=Ut.from(e).toNumber()}catch{}return typeof e=="number"&&e>=0&&e<=256&&!(e%1)?"1"+jL.substring(0,e):Cf.throwArgumentError("invalid decimal size","decimals",e)}function dF(e,t){t==null&&(t=0);const r=h2e(t);e=Ut.from(e);const n=e.lt(AXe);n&&(e=e.mul(CXe));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return r.length===1?e=a:e=a+"."+i,n&&(e="-"+e),e}function s1(e,t){t==null&&(t=0);const r=h2e(t);(typeof e!="string"||!e.match(/^-?[0-9.]+$/))&&Cf.throwArgumentError("invalid decimal value","value",e);const n=e.substring(0,1)==="-";n&&(e=e.substring(1)),e==="."&&Cf.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Cf.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&RXe("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.length<r.length-1;)o+="0";const s=Ut.from(a),l=Ut.from(o);let u=s.mul(r).add(l);return n&&(u=u.mul(CXe)),u}class o4{constructor(t,r,n,i){t!==WL&&Cf.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Le.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=n,this.decimals=i,this.name=(r?"":"u")+"fixed"+String(n)+"x"+String(i),this._multiplier=h2e(i),Object.freeze(this)}static from(t){if(t instanceof o4)return t;typeof t=="number"&&(t=`fixed128x${t}`);let r=!0,n=128,i=18;if(typeof t=="string"){if(t!=="fixed")if(t==="ufixed")r=!1;else{const a=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);a||Cf.throwArgumentError("invalid fixed format","format",t),r=a[1]!=="u",n=parseInt(a[2]),i=parseInt(a[3])}}else if(t){const a=(o,s,l)=>t[o]==null?l:(typeof t[o]!==s&&Cf.throwArgumentError("invalid fixed format ("+o+" not "+s+")","format."+o,t[o]),t[o]);r=a("signed","boolean",r),n=a("width","number",n),i=a("decimals","number",i)}return n%8&&Cf.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&Cf.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new o4(WL,r,n,i)}}class pu{constructor(t,r,n,i){t!==WL&&Cf.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Le.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Cf.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");t.length===1&&t.push("0");let r=pu.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(yRe.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");t.length===1&&t.push("0");let r=pu.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(yRe.toFormat(r.format))),r}round(t){t==null&&(t=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(t<0||t>80||t%1)&&Cf.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=pu.from("1"+jL.substring(0,t),this.format),i=wPt.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(t){if(t==null)return this._hex;t%8&&Cf.throwArgumentError("invalid byte width","width",t);const r=Ut.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return Oo(r,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return pu.fromString(this._value,t)}static fromValue(t,r,n){return n==null&&r!=null&&!bPt(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),pu.fromString(dF(t,r),o4.from(n))}static fromString(t,r){r==null&&(r="fixed");const n=o4.from(r),i=s1(t,n.decimals);!n.signed&&i.lt(AXe)&&RXe("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=Oo(a,n.width/8));const o=dF(i,n.decimals);return new pu(WL,a,o,n)}static fromBytes(t,r){r==null&&(r="fixed");const n=o4.from(r);if(kt(t).length>n.width/8)throw new Error("overflow");let i=Ut.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=dF(i,n.decimals);return new pu(WL,a,o,n)}static from(t,r){if(typeof t=="string")return pu.fromString(t,r);if(m_(t))return pu.fromBytes(t,r);try{return pu.fromValue(t,0,r)}catch(n){if(n.code!==Le.errors.INVALID_ARGUMENT)throw n}return Cf.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!!(t&&t._isFixedNumber)}}const yRe=pu.from(1),wPt=pu.from("0.5"),TPt="properties/5.7.0";var APt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const gG=new Le(TPt);function ot(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function Ju(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||typeof e.prototype!="object")break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function Us(e){return APt(this,void 0,void 0,function*(){const t=Object.keys(e).map(n=>{const i=e[n];return Promise.resolve(i).then(a=>({key:n,value:a}))});return(yield Promise.all(t)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function p2e(e,t){(!e||typeof e!="object")&&gG.throwArgumentError("invalid object","object",e),Object.keys(e).forEach(r=>{t[r]||gG.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)})}function Uo(e){const t={};for(const r in e)t[r]=e[r];return t}const CPt={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function xXe(e){if(e==null||CPt[typeof e])return!0;if(Array.isArray(e)||typeof e=="object"){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch{continue}if(!xXe(n))return!1}return!0}return gG.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function RPt(e){if(xXe(e))return e;if(Array.isArray(e))return Object.freeze(e.map(t=>Nf(t)));if(typeof e=="object"){const t={};for(const r in e){const n=e[r];n!==void 0&&ot(t,r,Nf(n))}return t}return gG.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function Nf(e){return RPt(e)}class yA{constructor(t){for(const r in t)this[r]=Nf(t[r])}}const NM="abi/5.7.0",ia=new Le(NM),TT={};let ERe={calldata:!0,memory:!0,storage:!0},xPt={calldata:!0,memory:!0};function B$(e,t){if(e==="bytes"||e==="string"){if(ERe[t])return!0}else if(e==="address"){if(t==="payable")return!0}else if((e.indexOf("[")>=0||e==="tuple")&&xPt[t])return!0;return(ERe[t]||t==="payable")&&ia.throwArgumentError("invalid modifier","name",t),!1}function IPt(e,t){let r=e;function n(s){ia.throwArgumentError(`unexpected character at position ${s}`,"param",e)}e=e.replace(/\s/g," ");function i(s){let l={type:"",name:"",parent:s,state:{allowType:!0}};return t&&(l.indexed=!1),l}let a={type:"",name:"",state:{allowType:!0}},o=a;for(let s=0;s<e.length;s++){let l=e[s];switch(l){case"(":o.state.allowType&&o.type===""?o.type="tuple":o.state.allowParams||n(s),o.state.allowType=!1,o.type=pC(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,o.name==="indexed"&&(t||n(s),o.indexed=!0,o.name=""),B$(o.type,o.name)&&(o.name=""),o.type=pC(o.type);let u=o;o=o.parent,o||n(s),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,o.name==="indexed"&&(t||n(s),o.indexed=!0,o.name=""),B$(o.type,o.name)&&(o.name=""),o.type=pC(o.type);let c=i(o.parent);o.parent.components.push(c),delete o.parent,o=c;break;case" ":o.state.allowType&&o.type!==""&&(o.type=pC(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&o.name!==""&&(o.name==="indexed"?(t||n(s),o.indexed&&n(s),o.indexed=!0,o.name=""):B$(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(s),o.type+=l,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(s),o.type+=l,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=l,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=l,delete o.state.allowArray):o.state.readArray?o.type+=l:n(s)}}return o.parent&&ia.throwArgumentError("unexpected eof","param",e),delete a.state,o.name==="indexed"?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):B$(o.type,o.name)&&(o.name=""),a.type=pC(a.type),a}function hF(e,t){for(let r in t)ot(e,r,t[r])}const ga=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),OPt=new RegExp(/^(.*)\[([0-9]*)\]$/);class Kl{constructor(t,r){t!==TT&&ia.throwError("use fromString",Le.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),hF(this,r);let n=this.type.match(OPt);n?hF(this,{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Kl.fromObject({type:n[1],components:this.components}),baseType:"array"}):hF(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json){let n={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(n.indexed=this.indexed),this.components&&(n.components=this.components.map(i=>JSON.parse(i.format(t)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(t),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(t!==ga.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(t)).join(t===ga.full?", ":",")+")"):r+=this.type,t!==ga.sighash&&(this.indexed===!0&&(r+=" indexed"),t===ga.full&&this.name&&(r+=" "+this.name)),r}static from(t,r){return typeof t=="string"?Kl.fromString(t,r):Kl.fromObject(t)}static fromObject(t){return Kl.isParamType(t)?t:new Kl(TT,{name:t.name||null,type:pC(t.type),indexed:t.indexed==null?null:!!t.indexed,components:t.components?t.components.map(Kl.fromObject):null})}static fromString(t,r){function n(i){return Kl.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n(IPt(t,!!r))}static isParamType(t){return!!(t!=null&&t._isParamType)}}function I9(e,t){return LPt(e).map(r=>Kl.fromString(r,t))}class L1{constructor(t,r){t!==TT&&ia.throwError("use a static from method",Le.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),hF(this,r),this._isFragment=!0,Object.freeze(this)}static from(t){return L1.isFragment(t)?t:typeof t=="string"?L1.fromString(t):L1.fromObject(t)}static fromObject(t){if(L1.isFragment(t))return t;switch(t.type){case"function":return Wp.fromObject(t);case"event":return _1.fromObject(t);case"constructor":return Vp.fromObject(t);case"error":return py.fromObject(t);case"fallback":case"receive":return null}return ia.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return t=t.replace(/\s/g," "),t=t.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),t=t.trim(),t.split(" ")[0]==="event"?_1.fromString(t.substring(5).trim()):t.split(" ")[0]==="function"?Wp.fromString(t.substring(8).trim()):t.split("(")[0].trim()==="constructor"?Vp.fromString(t.trim()):t.split(" ")[0]==="error"?py.fromString(t.substring(5).trim()):ia.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!!(t&&t._isFragment)}}class _1 extends L1{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(t)))});let r="";return t!==ga.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ",t!==ga.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(t){return typeof t=="string"?_1.fromString(t):_1.fromObject(t)}static fromObject(t){if(_1.isEventFragment(t))return t;t.type!=="event"&&ia.throwArgumentError("invalid event object","value",t);const r={name:O9(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Kl.fromObject):[],type:"event"};return new _1(TT,r)}static fromString(t){let r=t.match(N9);r||ia.throwArgumentError("invalid event string","value",t);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:ia.warn("unknown modifier: "+i)}}),_1.fromObject({name:r[1].trim(),anonymous:n,inputs:I9(r[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&t.type==="event"}}function IXe(e,t){t.gas=null;let r=e.split("@");return r.length!==1?(r.length>2&&ia.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||ia.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Ut.from(r[1]),r[0]):e}function OXe(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach(r=>{switch(r.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function NXe(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return e.stateMutability!=null?(t.stateMutability=e.stateMutability,t.constant=t.stateMutability==="view"||t.stateMutability==="pure",e.constant!=null&&!!e.constant!==t.constant&&ia.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable=t.stateMutability==="payable",e.payable!=null&&!!e.payable!==t.payable&&ia.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):e.payable!=null?(t.payable=!!e.payable,e.constant==null&&!t.payable&&e.type!=="constructor"&&ia.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&ia.throwArgumentError("cannot have constant payable function","value",e)):e.constant!=null?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):e.type!=="constructor"&&ia.throwArgumentError("unable to determine stateMutability","value",e),t}class Vp extends L1{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(t)))});t===ga.sighash&&ia.throwError("cannot format a constructor for sighash",Le.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(t){return typeof t=="string"?Vp.fromString(t):Vp.fromObject(t)}static fromObject(t){if(Vp.isConstructorFragment(t))return t;t.type!=="constructor"&&ia.throwArgumentError("invalid constructor object","value",t);let r=NXe(t);r.constant&&ia.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Kl.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Ut.from(t.gas):null};return new Vp(TT,n)}static fromString(t){let r={type:"constructor"};t=IXe(t,r);let n=t.match(N9);return(!n||n[1].trim()!=="constructor")&&ia.throwArgumentError("invalid constructor string","value",t),r.inputs=I9(n[2].trim(),!1),OXe(n[3].trim(),r),Vp.fromObject(r)}static isConstructorFragment(t){return t&&t._isFragment&&t.type==="constructor"}}class Wp extends Vp{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(t))),outputs:this.outputs.map(n=>JSON.parse(n.format(t)))});let r="";return t!==ga.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ",t!==ga.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(t)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(t){return typeof t=="string"?Wp.fromString(t):Wp.fromObject(t)}static fromObject(t){if(Wp.isFunctionFragment(t))return t;t.type!=="function"&&ia.throwArgumentError("invalid function object","value",t);let r=NXe(t);const n={type:t.type,name:O9(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Kl.fromObject):[],outputs:t.outputs?t.outputs.map(Kl.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Ut.from(t.gas):null};return new Wp(TT,n)}static fromString(t){let r={type:"function"};t=IXe(t,r);let n=t.split(" returns ");n.length>2&&ia.throwArgumentError("invalid function string","value",t);let i=n[0].match(N9);if(i||ia.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&O9(r.name),r.inputs=I9(i[2],!1),OXe(i[3].trim(),r),n.length>1){let a=n[1].match(N9);(a[1].trim()!=""||a[3].trim()!="")&&ia.throwArgumentError("unexpected tokens","value",t),r.outputs=I9(a[2],!1)}else r.outputs=[];return Wp.fromObject(r)}static isFunctionFragment(t){return t&&t._isFragment&&t.type==="function"}}function bRe(e){const t=e.format();return(t==="Error(string)"||t==="Panic(uint256)")&&ia.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class py extends L1{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(t)))});let r="";return t!==ga.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ",r.trim()}static from(t){return typeof t=="string"?py.fromString(t):py.fromObject(t)}static fromObject(t){if(py.isErrorFragment(t))return t;t.type!=="error"&&ia.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:O9(t.name),inputs:t.inputs?t.inputs.map(Kl.fromObject):[]};return bRe(new py(TT,r))}static fromString(t){let r={type:"error"},n=t.match(N9);return n||ia.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&O9(r.name),r.inputs=I9(n[2],!1),bRe(py.fromObject(r))}static isErrorFragment(t){return t&&t._isFragment&&t.type==="error"}}function pC(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const NPt=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function O9(e){return(!e||!e.match(NPt))&&ia.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const N9=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function LPt(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a===","&&n===0?(t.push(r),r=""):(r+=a,a==="("?n++:a===")"&&(n--,n===-1&&ia.throwArgumentError("unbalanced parenthesis","value",e)))}return r&&t.push(r),t}const v2e=new Le(NM);function LXe(e){const t=[],r=function(n,i){if(Array.isArray(i))for(let a in i){const o=n.slice();o.push(a);try{r(o,i[a])}catch(s){t.push({path:o,error:s})}}};return r([],e),t}class c2{constructor(t,r,n,i){this.name=t,this.type=r,this.localName=n,this.dynamic=i}_throwError(t,r){v2e.throwArgumentError(t,this.localName,r)}}class xhe{constructor(t){ot(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return Af(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(xo(t._data))}writeBytes(t){let r=kt(t);const n=r.length%this.wordSize;return n&&(r=xo([r,this._padding.slice(n)])),this._writeData(r)}_getValue(t){let r=kt(Ut.from(t));return r.length>this.wordSize&&v2e.throwError("value out-of-bounds",Le.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=xo([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[t]=this._getValue(r)}}}class mG{constructor(t,r,n,i){ot(this,"_data",kt(t)),ot(this,"wordSize",r||32),ot(this,"_coerceFunc",n),ot(this,"allowLoose",i),this._offset=0}get data(){return Kt(this._data)}get consumed(){return this._offset}static coerce(t,r){let n=t.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(t,r){return this._coerceFunc?this._coerceFunc(t,r):mG.coerce(t,r)}_peekBytes(t,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:v2e.throwError("data out-of-bounds",Le.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(t){return new mG(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,r){let n=this._peekBytes(0,t,!!r);return this._offset+=n.length,n.slice(0,t)}readValue(){return Ut.from(this.readBytes(this.wordSize))}}var PXe={exports:{}};(function(e){(function(){var t="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof Ln=="object"&&Ln.versions&&Ln.versions.node;o?i=gt:a&&(i=self);var s=!i.JS_SHA3_NO_COMMON_JS&&!0&&e.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],f=[4,1024,262144,67108864],d=[1,256,65536,16777216],h=[6,1536,393216,100663296],p=[0,8,16,24],g=[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],m=[224,256,384,512],y=[128,256],b=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(W){return Object.prototype.toString.call(W)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(W){return typeof W=="object"&&W.buffer&&W.buffer.constructor===ArrayBuffer});for(var T=function(W,Y,re){return function(Q){return new x(W,Y,W).update(Q)[re]()}},R=function(W,Y,re){return function(Q,ie){return new x(W,Y,ie).update(Q)[re]()}},N=function(W,Y,re){return function(Q,ie,ce,te){return E["cshake"+W].update(Q,ie,ce,te)[re]()}},A=function(W,Y,re){return function(Q,ie,ce,te){return E["kmac"+W].update(Q,ie,ce,te)[re]()}},L=function(W,Y,re,Q){for(var ie=0;ie<b.length;++ie){var ce=b[ie];W[ce]=Y(re,Q,ce)}return W},O=function(W,Y){var re=T(W,Y,"hex");return re.create=function(){return new x(W,Y,W)},re.update=function(Q){return re.create().update(Q)},L(re,T,W,Y)},I=function(W,Y){var re=R(W,Y,"hex");return re.create=function(Q){return new x(W,Y,Q)},re.update=function(Q,ie){return re.create(ie).update(Q)},L(re,R,W,Y)},$=function(W,Y){var re=w[W],Q=N(W,Y,"hex");return Q.create=function(ie,ce,te){return!ce&&!te?E["shake"+W].create(ie):new x(W,Y,ie).bytepad([ce,te],re)},Q.update=function(ie,ce,te,J){return Q.create(ce,te,J).update(ie)},L(Q,N,W,Y)},F=function(W,Y){var re=w[W],Q=A(W,Y,"hex");return Q.create=function(ie,ce,te){return new H(W,Y,ce).bytepad(["KMAC",te],re).bytepad([ie],re)},Q.update=function(ie,ce,te,J){return Q.create(ie,te,J).update(ce)},L(Q,A,W,Y)},D=[{name:"keccak",padding:d,bits:m,createMethod:O},{name:"sha3",padding:h,bits:m,createMethod:O},{name:"shake",padding:c,bits:y,createMethod:I},{name:"cshake",padding:f,bits:y,createMethod:$},{name:"kmac",padding:f,bits:y,createMethod:F}],E={},S=[],C=0;C<D.length;++C)for(var M=D[C],k=M.bits,U=0;U<k.length;++U){var G=M.name+"_"+k[U];if(S.push(G),E[G]=M.createMethod(k[U],M.padding),M.name!=="sha3"){var B=M.name+k[U];S.push(B),E[B]=E[G]}}function x(W,Y,re){this.blocks=[],this.s=[],this.padding=Y,this.outputBits=re,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(W<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=re>>5,this.extraBytes=(re&31)>>3;for(var Q=0;Q<50;++Q)this.s[Q]=0}x.prototype.update=function(W){if(this.finalized)throw new Error(r);var Y,re=typeof W;if(re!=="string"){if(re==="object"){if(W===null)throw new Error(t);if(l&&W.constructor===ArrayBuffer)W=new Uint8Array(W);else if(!Array.isArray(W)&&(!l||!ArrayBuffer.isView(W)))throw new Error(t)}else throw new Error(t);Y=!0}for(var Q=this.blocks,ie=this.byteCount,ce=W.length,te=this.blockCount,J=0,ge=this.s,fe,ye;J<ce;){if(this.reset)for(this.reset=!1,Q[0]=this.block,fe=1;fe<te+1;++fe)Q[fe]=0;if(Y)for(fe=this.start;J<ce&&fe<ie;++J)Q[fe>>2]|=W[J]<<p[fe++&3];else for(fe=this.start;J<ce&&fe<ie;++J)ye=W.charCodeAt(J),ye<128?Q[fe>>2]|=ye<<p[fe++&3]:ye<2048?(Q[fe>>2]|=(192|ye>>6)<<p[fe++&3],Q[fe>>2]|=(128|ye&63)<<p[fe++&3]):ye<55296||ye>=57344?(Q[fe>>2]|=(224|ye>>12)<<p[fe++&3],Q[fe>>2]|=(128|ye>>6&63)<<p[fe++&3],Q[fe>>2]|=(128|ye&63)<<p[fe++&3]):(ye=65536+((ye&1023)<<10|W.charCodeAt(++J)&1023),Q[fe>>2]|=(240|ye>>18)<<p[fe++&3],Q[fe>>2]|=(128|ye>>12&63)<<p[fe++&3],Q[fe>>2]|=(128|ye>>6&63)<<p[fe++&3],Q[fe>>2]|=(128|ye&63)<<p[fe++&3]);if(this.lastByteIndex=fe,fe>=ie){for(this.start=fe-ie,this.block=Q[te],fe=0;fe<te;++fe)ge[fe]^=Q[fe];q(ge),this.reset=!0}else this.start=fe}return this},x.prototype.encode=function(W,Y){var re=W&255,Q=1,ie=[re];for(W=W>>8,re=W&255;re>0;)ie.unshift(re),W=W>>8,re=W&255,++Q;return Y?ie.push(Q):ie.unshift(Q),this.update(ie),ie.length},x.prototype.encodeString=function(W){var Y,re=typeof W;if(re!=="string"){if(re==="object"){if(W===null)throw new Error(t);if(l&&W.constructor===ArrayBuffer)W=new Uint8Array(W);else if(!Array.isArray(W)&&(!l||!ArrayBuffer.isView(W)))throw new Error(t)}else throw new Error(t);Y=!0}var Q=0,ie=W.length;if(Y)Q=ie;else for(var ce=0;ce<W.length;++ce){var te=W.charCodeAt(ce);te<128?Q+=1:te<2048?Q+=2:te<55296||te>=57344?Q+=3:(te=65536+((te&1023)<<10|W.charCodeAt(++ce)&1023),Q+=4)}return Q+=this.encode(Q*8),this.update(W),Q},x.prototype.bytepad=function(W,Y){for(var re=this.encode(Y),Q=0;Q<W.length;++Q)re+=this.encodeString(W[Q]);var ie=Y-re%Y,ce=[];return ce.length=ie,this.update(ce),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var W=this.blocks,Y=this.lastByteIndex,re=this.blockCount,Q=this.s;if(W[Y>>2]|=this.padding[Y&3],this.lastByteIndex===this.byteCount)for(W[0]=W[re],Y=1;Y<re+1;++Y)W[Y]=0;for(W[re-1]|=2147483648,Y=0;Y<re;++Y)Q[Y]^=W[Y];q(Q)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var W=this.blockCount,Y=this.s,re=this.outputBlocks,Q=this.extraBytes,ie=0,ce=0,te="",J;ce<re;){for(ie=0;ie<W&&ce<re;++ie,++ce)J=Y[ie],te+=u[J>>4&15]+u[J&15]+u[J>>12&15]+u[J>>8&15]+u[J>>20&15]+u[J>>16&15]+u[J>>28&15]+u[J>>24&15];ce%W===0&&(q(Y),ie=0)}return Q&&(J=Y[ie],te+=u[J>>4&15]+u[J&15],Q>1&&(te+=u[J>>12&15]+u[J>>8&15]),Q>2&&(te+=u[J>>20&15]+u[J>>16&15])),te},x.prototype.arrayBuffer=function(){this.finalize();var W=this.blockCount,Y=this.s,re=this.outputBlocks,Q=this.extraBytes,ie=0,ce=0,te=this.outputBits>>3,J;Q?J=new ArrayBuffer(re+1<<2):J=new ArrayBuffer(te);for(var ge=new Uint32Array(J);ce<re;){for(ie=0;ie<W&&ce<re;++ie,++ce)ge[ce]=Y[ie];ce%W===0&&q(Y)}return Q&&(ge[ie]=Y[ie],J=J.slice(0,te)),J},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var W=this.blockCount,Y=this.s,re=this.outputBlocks,Q=this.extraBytes,ie=0,ce=0,te=[],J,ge;ce<re;){for(ie=0;ie<W&&ce<re;++ie,++ce)J=ce<<2,ge=Y[ie],te[J]=ge&255,te[J+1]=ge>>8&255,te[J+2]=ge>>16&255,te[J+3]=ge>>24&255;ce%W===0&&q(Y)}return Q&&(J=ce<<2,ge=Y[ie],te[J]=ge&255,Q>1&&(te[J+1]=ge>>8&255),Q>2&&(te[J+2]=ge>>16&255)),te};function H(W,Y,re){x.call(this,W,Y,re)}H.prototype=new x,H.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var q=function(W){var Y,re,Q,ie,ce,te,J,ge,fe,ye,Fe,me,Ue,tt,Ve,Ae,je,Pe,Oe,rt,We,ne,X,K,le,ve,Ee,we,ft,He,Ke,Jt,at,At,Vr,xt,Dt,Bn,Nt,Xt,ji,ct,St,Ji,er,Yt,la,Wt,Ht,zi,vt,Lt,Kr,yt,Pt,ua,Me,$e,Mt,Tr,kr,cn,dn;for(Q=0;Q<48;Q+=2)ie=W[0]^W[10]^W[20]^W[30]^W[40],ce=W[1]^W[11]^W[21]^W[31]^W[41],te=W[2]^W[12]^W[22]^W[32]^W[42],J=W[3]^W[13]^W[23]^W[33]^W[43],ge=W[4]^W[14]^W[24]^W[34]^W[44],fe=W[5]^W[15]^W[25]^W[35]^W[45],ye=W[6]^W[16]^W[26]^W[36]^W[46],Fe=W[7]^W[17]^W[27]^W[37]^W[47],me=W[8]^W[18]^W[28]^W[38]^W[48],Ue=W[9]^W[19]^W[29]^W[39]^W[49],Y=me^(te<<1|J>>>31),re=Ue^(J<<1|te>>>31),W[0]^=Y,W[1]^=re,W[10]^=Y,W[11]^=re,W[20]^=Y,W[21]^=re,W[30]^=Y,W[31]^=re,W[40]^=Y,W[41]^=re,Y=ie^(ge<<1|fe>>>31),re=ce^(fe<<1|ge>>>31),W[2]^=Y,W[3]^=re,W[12]^=Y,W[13]^=re,W[22]^=Y,W[23]^=re,W[32]^=Y,W[33]^=re,W[42]^=Y,W[43]^=re,Y=te^(ye<<1|Fe>>>31),re=J^(Fe<<1|ye>>>31),W[4]^=Y,W[5]^=re,W[14]^=Y,W[15]^=re,W[24]^=Y,W[25]^=re,W[34]^=Y,W[35]^=re,W[44]^=Y,W[45]^=re,Y=ge^(me<<1|Ue>>>31),re=fe^(Ue<<1|me>>>31),W[6]^=Y,W[7]^=re,W[16]^=Y,W[17]^=re,W[26]^=Y,W[27]^=re,W[36]^=Y,W[37]^=re,W[46]^=Y,W[47]^=re,Y=ye^(ie<<1|ce>>>31),re=Fe^(ce<<1|ie>>>31),W[8]^=Y,W[9]^=re,W[18]^=Y,W[19]^=re,W[28]^=Y,W[29]^=re,W[38]^=Y,W[39]^=re,W[48]^=Y,W[49]^=re,tt=W[0],Ve=W[1],Yt=W[11]<<4|W[10]>>>28,la=W[10]<<4|W[11]>>>28,we=W[20]<<3|W[21]>>>29,ft=W[21]<<3|W[20]>>>29,Tr=W[31]<<9|W[30]>>>23,kr=W[30]<<9|W[31]>>>23,ct=W[40]<<18|W[41]>>>14,St=W[41]<<18|W[40]>>>14,At=W[2]<<1|W[3]>>>31,Vr=W[3]<<1|W[2]>>>31,Ae=W[13]<<12|W[12]>>>20,je=W[12]<<12|W[13]>>>20,Wt=W[22]<<10|W[23]>>>22,Ht=W[23]<<10|W[22]>>>22,He=W[33]<<13|W[32]>>>19,Ke=W[32]<<13|W[33]>>>19,cn=W[42]<<2|W[43]>>>30,dn=W[43]<<2|W[42]>>>30,yt=W[5]<<30|W[4]>>>2,Pt=W[4]<<30|W[5]>>>2,xt=W[14]<<6|W[15]>>>26,Dt=W[15]<<6|W[14]>>>26,Pe=W[25]<<11|W[24]>>>21,Oe=W[24]<<11|W[25]>>>21,zi=W[34]<<15|W[35]>>>17,vt=W[35]<<15|W[34]>>>17,Jt=W[45]<<29|W[44]>>>3,at=W[44]<<29|W[45]>>>3,K=W[6]<<28|W[7]>>>4,le=W[7]<<28|W[6]>>>4,ua=W[17]<<23|W[16]>>>9,Me=W[16]<<23|W[17]>>>9,Bn=W[26]<<25|W[27]>>>7,Nt=W[27]<<25|W[26]>>>7,rt=W[36]<<21|W[37]>>>11,We=W[37]<<21|W[36]>>>11,Lt=W[47]<<24|W[46]>>>8,Kr=W[46]<<24|W[47]>>>8,Ji=W[8]<<27|W[9]>>>5,er=W[9]<<27|W[8]>>>5,ve=W[18]<<20|W[19]>>>12,Ee=W[19]<<20|W[18]>>>12,$e=W[29]<<7|W[28]>>>25,Mt=W[28]<<7|W[29]>>>25,Xt=W[38]<<8|W[39]>>>24,ji=W[39]<<8|W[38]>>>24,ne=W[48]<<14|W[49]>>>18,X=W[49]<<14|W[48]>>>18,W[0]=tt^~Ae&Pe,W[1]=Ve^~je&Oe,W[10]=K^~ve&we,W[11]=le^~Ee&ft,W[20]=At^~xt&Bn,W[21]=Vr^~Dt&Nt,W[30]=Ji^~Yt&Wt,W[31]=er^~la&Ht,W[40]=yt^~ua&$e,W[41]=Pt^~Me&Mt,W[2]=Ae^~Pe&rt,W[3]=je^~Oe&We,W[12]=ve^~we&He,W[13]=Ee^~ft&Ke,W[22]=xt^~Bn&Xt,W[23]=Dt^~Nt&ji,W[32]=Yt^~Wt&zi,W[33]=la^~Ht&vt,W[42]=ua^~$e&Tr,W[43]=Me^~Mt&kr,W[4]=Pe^~rt&ne,W[5]=Oe^~We&X,W[14]=we^~He&Jt,W[15]=ft^~Ke&at,W[24]=Bn^~Xt&ct,W[25]=Nt^~ji&St,W[34]=Wt^~zi&Lt,W[35]=Ht^~vt&Kr,W[44]=$e^~Tr&cn,W[45]=Mt^~kr&dn,W[6]=rt^~ne&tt,W[7]=We^~X&Ve,W[16]=He^~Jt&K,W[17]=Ke^~at&le,W[26]=Xt^~ct&At,W[27]=ji^~St&Vr,W[36]=zi^~Lt&Ji,W[37]=vt^~Kr&er,W[46]=Tr^~cn&yt,W[47]=kr^~dn&Pt,W[8]=ne^~tt&Ae,W[9]=X^~Ve&je,W[18]=Jt^~K&ve,W[19]=at^~le&Ee,W[28]=ct^~At&xt,W[29]=St^~Vr&Dt,W[38]=Lt^~Ji&Yt,W[39]=Kr^~er&la,W[48]=cn^~yt&ua,W[49]=dn^~Pt&Me,W[0]^=g[Q],W[1]^=g[Q+1]};if(s)e.exports=E;else for(C=0;C<S.length;++C)i[S[C]]=E[S[C]]})()})(PXe);var PPt=PXe.exports;const MPt=Nn(PPt);function co(e){return"0x"+MPt.keccak_256(kt(e))}const DPt="rlp/5.7.0",p1=new Le(DPt);function _Re(e){const t=[];for(;e;)t.unshift(e&255),e>>=8;return t}function SRe(e,t,r){let n=0;for(let i=0;i<r;i++)n=n*256+e[t+i];return n}function MXe(e){if(Array.isArray(e)){let n=[];if(e.forEach(function(a){n=n.concat(MXe(a))}),n.length<=55)return n.unshift(192+n.length),n;const i=_Re(n.length);return i.unshift(247+i.length),i.concat(n)}IM(e)||p1.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(kt(e));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=_Re(t.length);return r.unshift(183+r.length),r.concat(t)}function AT(e){return Kt(MXe(e))}function wRe(e,t,r,n){const i=[];for(;r<t+1+n;){const a=DXe(e,r);i.push(a.result),r+=a.consumed,r>t+1+n&&p1.throwError("child data too short",Le.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function DXe(e,t){if(e.length===0&&p1.throwError("data too short",Le.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&p1.throwError("data short segment too short",Le.errors.BUFFER_OVERRUN,{});const n=SRe(e,t+1,r);return t+1+r+n>e.length&&p1.throwError("data long segment too short",Le.errors.BUFFER_OVERRUN,{}),wRe(e,t,t+1+r,r+n)}else if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&p1.throwError("data array too short",Le.errors.BUFFER_OVERRUN,{}),wRe(e,t,t+1,r)}else if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&p1.throwError("data array too short",Le.errors.BUFFER_OVERRUN,{});const n=SRe(e,t+1,r);t+1+r+n>e.length&&p1.throwError("data array too short",Le.errors.BUFFER_OVERRUN,{});const i=Kt(e.slice(t+1+r,t+1+r+n));return{consumed:1+r+n,result:i}}else if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&p1.throwError("data too short",Le.errors.BUFFER_OVERRUN,{});const n=Kt(e.slice(t+1,t+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:Kt(e[t])}}function Xj(e){const t=kt(e),r=DXe(t,0);return r.consumed!==t.length&&p1.throwArgumentError("invalid rlp data","data",e),r.result}const $Pt=Object.freeze(Object.defineProperty({__proto__:null,decode:Xj,encode:AT},Symbol.toStringTag,{value:"Module"})),kPt="address/5.7.0",PE=new Le(kPt);function TRe(e){li(e,20)||PE.throwArgumentError("invalid address","address",e),e=e.toLowerCase();const t=e.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=t[i].charCodeAt(0);const n=kt(co(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(n[i>>1]&15)>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}const BPt=9007199254740991;function UPt(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const g2e={};for(let e=0;e<10;e++)g2e[String(e)]=String(e);for(let e=0;e<26;e++)g2e[String.fromCharCode(65+e)]=String(10+e);const ARe=Math.floor(UPt(BPt));function $Xe(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let t=e.split("").map(n=>g2e[n]).join("");for(;t.length>=ARe;){let n=t.substring(0,ARe);t=parseInt(n,10)%97+t.substring(n.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function ya(e){let t=null;if(typeof e!="string"&&PE.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))e.substring(0,2)!=="0x"&&(e="0x"+e),t=TRe(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&PE.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==$Xe(e)&&PE.throwArgumentError("bad icap checksum","address",e),t=_Pt(e.substring(4));t.length<40;)t="0"+t;t=TRe("0x"+t)}else PE.throwArgumentError("invalid address","address",e);return t}function FPt(e){try{return ya(e),!0}catch{}return!1}function HPt(e){let t=SPt(ya(e).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+$Xe("XE00"+t)+t}function Kj(e){let t=null;try{t=ya(e.from)}catch{PE.throwArgumentError("missing from address","transaction",e)}const r=X1(kt(Ut.from(e.nonce).toHexString()));return ya(ol(co(AT([t,r])),12))}function GPt(e,t,r){return _g(t)!==32&&PE.throwArgumentError("salt must be 32 bytes","salt",t),_g(r)!==32&&PE.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),ya(ol(co(xo(["0xff",ya(e),t,r])),12))}class VPt extends c2{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,r){try{r=ya(r)}catch(n){this._throwError(n.message,r)}return t.writeValue(r)}decode(t){return ya(Oo(t.readValue().toHexString(),20))}}class WPt extends c2{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,r){return this.coder.encode(t,r)}decode(t){return this.coder.decode(t)}}const OC=new Le(NM);function kXe(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let l={};n=t.map(u=>{const c=u.localName;return c||OC.throwError("cannot encode object for signature with missing names",Le.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]&&OC.throwError("cannot encode object for signature with duplicate names",Le.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]=!0,r[c]})}else OC.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&OC.throwArgumentError("types/value length mismatch","tuple",r);let i=new xhe(e.wordSize),a=new xhe(e.wordSize),o=[];t.forEach((l,u)=>{let c=n[u];if(l.dynamic){let f=a.length;l.encode(a,c);let d=i.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let s=e.appendWriter(i);return s+=e.appendWriter(a),s}function BXe(e,t){let r=[],n=e.subReader(0);t.forEach(a=>{let o=null;if(a.dynamic){let s=e.readValue(),l=n.subReader(s.toNumber());try{o=a.decode(l)}catch(u){if(u.code===Le.errors.BUFFER_OVERRUN)throw u;o=u,o.baseType=a.name,o.name=a.localName,o.type=a.type}}else try{o=a.decode(e)}catch(s){if(s.code===Le.errors.BUFFER_OVERRUN)throw s;o=s,o.baseType=a.name,o.name=a.localName,o.type=a.type}o!=null&&r.push(o)});const i=t.reduce((a,o)=>{const s=o.localName;return s&&(a[s]||(a[s]=0),a[s]++),a},{});t.forEach((a,o)=>{let s=a.localName;if(!s||i[s]!==1||(s==="length"&&(s="_length"),r[s]!=null))return;const l=r[o];l instanceof Error?Object.defineProperty(r,s,{enumerable:!0,get:()=>{throw l}}):r[s]=l});for(let a=0;a<r.length;a++){const o=r[a];o instanceof Error&&Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw o}})}return Object.freeze(r)}class jPt extends c2{constructor(t,r,n){const i=t.type+"["+(r>=0?r:"")+"]",a=r===-1||t.dynamic;super("array",i,n,a),this.coder=t,this.length=r}defaultValue(){const t=this.coder.defaultValue(),r=[];for(let n=0;n<this.length;n++)r.push(t);return r}encode(t,r){Array.isArray(r)||this._throwError("expected array value",r);let n=this.length;n===-1&&(n=r.length,t.writeValue(r.length)),OC.checkArgumentCount(r.length,n,"coder array"+(this.localName?" "+this.localName:""));let i=[];for(let a=0;a<r.length;a++)i.push(this.coder);return kXe(t,i,r)}decode(t){let r=this.length;r===-1&&(r=t.readValue().toNumber(),r*32>t._data.length&&OC.throwError("insufficient data length",Le.errors.BUFFER_OVERRUN,{length:t._data.length,count:r}));let n=[];for(let i=0;i<r;i++)n.push(new WPt(this.coder));return t.coerce(this.name,BXe(t,n))}}class zPt extends c2{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,r){return t.writeValue(r?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class UXe extends c2{constructor(t,r){super(t,t,r,!0)}defaultValue(){return"0x"}encode(t,r){r=kt(r);let n=t.writeValue(r.length);return n+=t.writeBytes(r),n}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class YPt extends UXe{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,Kt(super.decode(t)))}}class qPt extends c2{constructor(t,r){let n="bytes"+String(t);super(n,n,r,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,r){let n=kt(r);return n.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(n)}decode(t){return t.coerce(this.name,Kt(t.readBytes(this.size)))}}class XPt extends c2{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,r){return r!=null&&this._throwError("not null",r),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}const FXe="0x0000000000000000000000000000000000000000",HXe=Ut.from(-1),m2e=Ut.from(0),GXe=Ut.from(1),KPt=Ut.from(2),ZPt=Ut.from("1000000000000000000"),VXe=Ut.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),QPt=Ut.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),JPt=Ut.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),y2e="0x0000000000000000000000000000000000000000000000000000000000000000",eMt="Ξ",tMt=Object.freeze(Object.defineProperty({__proto__:null,AddressZero:FXe,EtherSymbol:eMt,HashZero:y2e,MaxInt256:JPt,MaxUint256:VXe,MinInt256:QPt,NegativeOne:HXe,One:GXe,Two:KPt,WeiPerEther:ZPt,Zero:m2e},Symbol.toStringTag,{value:"Module"}));class rMt extends c2{constructor(t,r,n){const i=(r?"int":"uint")+t*8;super(i,i,n,!1),this.size=t,this.signed=r}defaultValue(){return 0}encode(t,r){let n=Ut.from(r),i=VXe.mask(t.wordSize*8);if(this.signed){let a=i.mask(this.size*8-1);(n.gt(a)||n.lt(a.add(GXe).mul(HXe)))&&this._throwError("value out-of-bounds",r)}else(n.lt(m2e)||n.gt(i.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return n=n.toTwos(this.size*8).mask(this.size*8),this.signed&&(n=n.fromTwos(this.size*8).toTwos(8*t.wordSize)),t.writeValue(n)}decode(t){let r=t.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),t.coerce(this.name,r)}}const nMt="strings/5.7.0",WXe=new Le(nMt);var Sg;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(Sg||(Sg={}));var pd;(function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"})(pd||(pd={}));function iMt(e,t,r,n,i){return WXe.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function jXe(e,t,r,n,i){if(e===pd.BAD_PREFIX||e===pd.UNEXPECTED_CONTINUE){let a=0;for(let o=t+1;o<r.length&&r[o]>>6===2;o++)a++;return a}return e===pd.OVERRUN?r.length-t-1:0}function aMt(e,t,r,n,i){return e===pd.OVERLONG?(n.push(i),0):(n.push(65533),jXe(e,t,r))}const zXe=Object.freeze({error:iMt,ignore:jXe,replace:aMt});function E2e(e,t){t==null&&(t=zXe.error),e=kt(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(!(i>>7)){r.push(i);continue}let a=null,o=null;if((i&224)===192)a=1,o=127;else if((i&240)===224)a=2,o=2047;else if((i&248)===240)a=3,o=65535;else{(i&192)===128?n+=t(pd.UNEXPECTED_CONTINUE,n-1,e,r):n+=t(pd.BAD_PREFIX,n-1,e,r);continue}if(n-1+a>=e.length){n+=t(pd.OVERRUN,n-1,e,r);continue}let s=i&(1<<8-a-1)-1;for(let l=0;l<a;l++){let u=e[n];if((u&192)!=128){n+=t(pd.MISSING_CONTINUE,n,e,r),s=null;break}s=s<<6|u&63,n++}if(s!==null){if(s>1114111){n+=t(pd.OUT_OF_RANGE,n-1-a,e,r,s);continue}if(s>=55296&&s<=57343){n+=t(pd.UTF16_SURROGATE,n-1-a,e,r,s);continue}if(s<=o){n+=t(pd.OVERLONG,n-1-a,e,r,s);continue}r.push(s)}}return r}function hl(e,t=Sg.current){t!=Sg.current&&(WXe.checkNormalize(),e=e.normalize(t));let r=[];for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const a=e.charCodeAt(n);if(n>=e.length||(a&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(a&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return kt(r)}function Nie(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function oMt(e,t){return'"'+E2e(e,t).map(r=>{if(r<256){switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(r>=32&&r<127)return String.fromCharCode(r)}return r<=65535?Nie(r):(r-=65536,Nie((r>>10&1023)+55296)+Nie((r&1023)+56320))}).join("")+'"'}function Ihe(e){return e.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function EA(e,t){return Ihe(E2e(e,t))}function yG(e,t=Sg.current){return E2e(hl(e,t))}function sMt(e){const t=hl(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return Kt(xo([t,y2e]).slice(0,32))}function lMt(e){const t=kt(e);if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;t[r-1]===0;)r--;return EA(t.slice(0,r))}function uMt(e){if(e.length%4!==0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function b2e(e,t){t||(t=function(i){return[parseInt(i,16)]});let r=0,n={};return e.split(",").forEach(i=>{let a=i.split(":");r+=parseInt(a[0],16),n[r]=t(a[1])}),n}function YXe(e){let t=0;return e.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=t+parseInt(n[0],16);return t=parseInt(n[1],16),{l:i,h:t}})}function _2e(e,t){let r=0;for(let n=0;n<t.length;n++){let i=t[n];if(r+=i.l,e>=r&&e<=r+i.h&&(e-r)%(i.d||1)===0){if(i.e&&i.e.indexOf(e-r)!==-1)continue;return i}}return null}const cMt=YXe("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"),fMt="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(e=>parseInt(e,16)),dMt=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],hMt=b2e("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"),pMt=b2e("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"),vMt=b2e("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",uMt),gMt=YXe("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 mMt(e){return e.reduce((t,r)=>(r.forEach(n=>{t.push(n)}),t),[])}function yMt(e){return!!_2e(e,cMt)}function EMt(e){let t=_2e(e,dMt);if(t)return[e+t.s];let r=hMt[e];if(r)return r;let n=pMt[e];if(n)return[e+n[0]];let i=vMt[e];return i||null}function bMt(e){return!!_2e(e,gMt)}function _Mt(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=yG(e);t=mMt(t.map(n=>{if(fMt.indexOf(n)>=0)return[];if(n>=65024&&n<=65039)return[];let i=EMt(n);return i||[n]})),t=yG(Ihe(t),Sg.NFKC),t.forEach(n=>{if(bMt(n))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),t.forEach(n=>{if(yMt(n))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let r=Ihe(t);if(r.substring(0,1)==="-"||r.substring(2,4)==="--"||r.substring(r.length-1)==="-")throw new Error("invalid hyphen");return r}class SMt extends UXe{constructor(t){super("string",t)}defaultValue(){return""}encode(t,r){return super.encode(t,hl(r))}decode(t){return EA(super.decode(t))}}class U$ extends c2{constructor(t,r){let n=!1;const i=[];t.forEach(o=>{o.dynamic&&(n=!0),i.push(o.type)});const a="tuple("+i.join(",")+")";super("tuple",a,r,n),this.coders=t}defaultValue(){const t=[];this.coders.forEach(n=>{t.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const a=i.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});return this.coders.forEach((n,i)=>{let a=n.localName;!a||r[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[i]))}),Object.freeze(t)}encode(t,r){return kXe(t,this.coders,r)}decode(t){return t.coerce(this.name,BXe(t,this.coders))}}const F$=new Le(NM),wMt=new RegExp(/^bytes([0-9]*)$/),TMt=new RegExp(/^(u?int)([0-9]*)$/);class qXe{constructor(t){ot(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new VPt(t.name);case"bool":return new zPt(t.name);case"string":return new SMt(t.name);case"bytes":return new YPt(t.name);case"array":return new jPt(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new U$((t.components||[]).map(n=>this._getCoder(n)),t.name);case"":return new XPt(t.name)}let r=t.type.match(TMt);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&F$.throwArgumentError("invalid "+r[1]+" bit length","param",t),new rMt(n/8,r[1]==="int",t.name)}if(r=t.type.match(wMt),r){let n=parseInt(r[1]);return(n===0||n>32)&&F$.throwArgumentError("invalid bytes length","param",t),new qPt(n,t.name)}return F$.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,r){return new mG(t,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new xhe(this._getWordSize())}getDefaultValue(t){const r=t.map(i=>this._getCoder(Kl.from(i)));return new U$(r,"_").defaultValue()}encode(t,r){t.length!==r.length&&F$.throwError("types/values length mismatch",Le.errors.INVALID_ARGUMENT,{count:{types:t.length,values:r.length},value:{types:t,values:r}});const n=t.map(o=>this._getCoder(Kl.from(o))),i=new U$(n,"_"),a=this._getWriter();return i.encode(a,r),a.data}decode(t,r,n){const i=t.map(o=>this._getCoder(Kl.from(o)));return new U$(i,"_").decode(this._getReader(kt(r),n))}}const XXe=new qXe;function ME(e){return co(hl(e))}const KXe="hash/5.7.0";function S2e(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return kt(t)}function w2e(e){e=kt(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}const AMt=Object.freeze(Object.defineProperty({__proto__:null,decode:S2e,encode:w2e},Symbol.toStringTag,{value:"Module"}));function ZXe(e,t){t==null&&(t=1);const r=[],n=r.forEach,i=function(a,o){n.call(a,function(s){o>0&&Array.isArray(s)?i(s,o-1):r.push(s)})};return i(e,t),r}function CMt(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}function RMt(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,a=[0,1];for(let R=1;R<n;R++)a.push(i+=r());let o=r(),s=t;t+=o;let l=0,u=0;function c(){return l==0&&(u=u<<8|e[t++],l=8),u>>--l&1}const f=31,d=Math.pow(2,f),h=d>>>1,p=h>>1,g=d-1;let m=0;for(let R=0;R<f;R++)m=m<<1|c();let y=[],b=0,w=d;for(;;){let R=Math.floor(((m-b+1)*i-1)/w),N=0,A=n;for(;A-N>1;){let I=N+A>>>1;R<a[I]?A=I:N=I}if(N==0)break;y.push(N);let L=b+Math.floor(w*a[N]/i),O=b+Math.floor(w*a[N+1]/i)-1;for(;!((L^O)&h);)m=m<<1&g|c(),L=L<<1&g,O=O<<1&g|1;for(;L&~O&p;)m=m&h|m<<1&g>>>1|c(),L=L<<1^h,O=(O^h)<<1|h|1;b=L,w=1+O-L}let T=n-4;return y.map(R=>{switch(R-T){case 3:return T+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return T+256+(e[s++]<<8|e[s++]);case 1:return T+e[s++];default:return R-1}})}function xMt(e){let t=0;return()=>e[t++]}function IMt(e){return xMt(RMt(e))}function OMt(e){return e&1?~e>>1:e>>1}function NMt(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}function CRe(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function LMt(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=OMt(t());return r}function EG(e,t){let r=CRe(e(),e),n=e(),i=CRe(n,e),a=NMt(n,e);for(let o=0;o<n;o++)for(let s=0;s<a[o];s++)r.push(i[o]+s);return t?r.map(o=>t[o]):r}function PMt(e){let t=[];for(;;){let r=e();if(r==0)break;t.push(DMt(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push($Mt(r,e))}return CMt(ZXe(t))}function MMt(e){let t=[];for(;;){let r=e();if(r==0)break;t.push(r)}return t}function QXe(e,t,r){let n=Array(e).fill(void 0).map(()=>[]);for(let i=0;i<t;i++)LMt(e,r).forEach((a,o)=>n[o].push(a));return n}function DMt(e,t){let r=1+t(),n=t(),i=MMt(t),a=QXe(i.length,1+e,t);return ZXe(a.map((o,s)=>{const l=o[0],u=o.slice(1);return Array(i[s]).fill(void 0).map((c,f)=>{let d=f*n;return[l+f*r,u.map(h=>h+d)]})}))}function $Mt(e,t){let r=1+t();return QXe(r,1+e,t).map(i=>[i[0],i.slice(1)])}function kMt(e){let t=EG(e).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=EG(e,t);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=e(),a=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let s=i==1,l=i==2;return{branches:n,valid:a,fe0f:o,save:s,check:l}}}function BMt(){return IMt(S2e("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Zj=BMt(),UMt=new Set(EG(Zj)),FMt=new Set(EG(Zj)),HMt=PMt(Zj),GMt=kMt(Zj),RRe=45,xRe=95;function JXe(e){return yG(e)}function VMt(e){return e.filter(t=>t!=65039)}function eKe(e){for(let t of e.split(".")){let r=JXe(t);try{for(let n=r.lastIndexOf(xRe)-1;n>=0;n--)if(r[n]!==xRe)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===RRe&&r[3]===RRe)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${t}": ${n.message}`)}}return e}function WMt(e){return eKe(jMt(e,VMt))}function jMt(e,t){let r=JXe(e).reverse(),n=[];for(;r.length;){let i=YMt(r);if(i){n.push(...t(i));continue}let a=r.pop();if(UMt.has(a)){n.push(a);continue}if(FMt.has(a))continue;let o=HMt[a];if(o){n.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${a.toString(16).toUpperCase()}`)}return eKe(zMt(String.fromCodePoint(...n)))}function zMt(e){return e.normalize("NFC")}function YMt(e,t){var r;let n=GMt,i,a,o=[],s=e.length;for(t&&(t.length=0);s;){let l=e[--s];if(n=(r=n.branches.find(u=>u.set.has(l)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)a=l;else if(n.check&&l===a)break;o.push(l),n.fe0f&&(o.push(65039),s>0&&e[s-1]==65039&&s--),n.valid&&(i=o.slice(),n.valid==2&&i.splice(1,1),t&&t.push(...e.slice(s).reverse()),e.length=s)}return i}const qMt=new Le(KXe),tKe=new Uint8Array(32);tKe.fill(0);function IRe(e){if(e.length===0)throw new Error("invalid ENS name; empty component");return e}function T2e(e){const t=hl(WMt(e)),r=[];if(e.length===0)return r;let n=0;for(let i=0;i<t.length;i++)t[i]===46&&(r.push(IRe(t.slice(n,i))),n=i+1);if(n>=t.length)throw new Error("invalid ENS name; empty component");return r.push(IRe(t.slice(n))),r}function XMt(e){try{return T2e(e).length!==0}catch{}return!1}function zL(e){typeof e!="string"&&qMt.throwArgumentError("invalid ENS name; not a string","name",e);let t=tKe;const r=T2e(e);for(;r.length;)t=co(xo([t,co(r.pop())]));return Kt(t)}function rKe(e){return Kt(xo(T2e(e).map(t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(t.length+1);return r.set(t,1),r[0]=r.length-1,r})))+"00"}const KMt=`Ethereum Signed Message:
|
|
5691
|
+
}`;var fr=KO(function(){return Yr(ee,pt+"return "+De).apply(r,oe)});if(fr.source=De,HS(fr))throw fr;return fr}function $re(v){return Zr(v).toLowerCase()}function kre(v){return Zr(v).toUpperCase()}function Bre(v,_,P){if(v=Zr(v),v&&(P||_===r))return a6(v);if(!v||!(_=yo(_)))return v;var V=ps(v),j=ps(_),ee=o6(V,j),oe=s6(V,j)+1;return Uu(V,ee,oe).join("")}function Ure(v,_,P){if(v=Zr(v),v&&(P||_===r))return v.slice(0,u6(v)+1);if(!v||!(_=yo(_)))return v;var V=ps(v),j=s6(V,ps(_))+1;return Uu(V,0,j).join("")}function Fre(v,_,P){if(v=Zr(v),v&&(P||_===r))return v.replace(Wt,"");if(!v||!(_=yo(_)))return v;var V=ps(v),j=o6(V,ps(_));return Uu(V,j).join("")}function Hre(v,_){var P=I,V=$;if(Dn(_)){var j="separator"in _?_.separator:j;P="length"in _?ur(_.length):P,V="omission"in _?yo(_.omission):V}v=Zr(v);var ee=v.length;if(Hd(v)){var oe=ps(v);ee=oe.length}if(P>=ee)return v;var ue=P-Gd(V);if(ue<1)return V;var he=oe?Uu(oe,0,ue).join(""):v.slice(0,ue);if(j===r)return he+V;if(oe&&(ue+=he.length-ue),GS(j)){if(v.slice(ue).search(j)){var Ce,Re=he;for(j.global||(j=iS(j.source,Zr(Me.exec(j))+"g")),j.lastIndex=0;Ce=j.exec(Re);)var De=Ce.index;he=he.slice(0,De===r?ue:De)}}else if(v.indexOf(yo(j),ue)!=ue){var Je=he.lastIndexOf(j);Je>-1&&(he=he.slice(0,Je))}return he+V}function Gre(v){return v=Zr(v),v&&Bn.test(v)?v.replace(xt,mZ):v}var Vre=Xd(function(v,_,P){return v+(P?" ":"")+_.toUpperCase()}),jS=Z6("toUpperCase");function XO(v,_,P){return v=Zr(v),_=P?r:_,_===r?dZ(v)?bZ(v):nZ(v):v.match(_)||[]}var KO=hr(function(v,_){try{return Sa(v,r,_)}catch(P){return HS(P)?P:new tr(P)}}),Wre=Fl(function(v,_){return Vo(_,function(P){P=nl(P),Bl(v,P,US(v[P],v))}),v});function jre(v){var _=v==null?0:v.length,P=wt();return v=_?Rn(v,function(V){if(typeof V[1]!="function")throw new Wo(o);return[P(V[0]),V[1]]}):[],hr(function(V){for(var j=-1;++j<_;){var ee=v[j];if(Sa(ee[0],this,V))return Sa(ee[1],this,V)}})}function zre(v){return mQ(zo(v,f))}function zS(v){return function(){return v}}function Yre(v,_){return v==null||v!==v?_:v}var qre=J6(),Xre=J6(!0);function Ka(v){return v}function YS(v){return I6(typeof v=="function"?v:zo(v,f))}function Kre(v){return N6(zo(v,f))}function Zre(v,_){return L6(v,zo(_,f))}var Qre=hr(function(v,_){return function(P){return hp(P,v,_)}}),Jre=hr(function(v,_){return function(P){return hp(v,P,_)}});function qS(v,_,P){var V=Hi(_),j=dm(_,V);P==null&&!(Dn(_)&&(j.length||!V.length))&&(P=_,_=v,v=this,j=dm(_,Hi(_)));var ee=!(Dn(P)&&"chain"in P)||!!P.chain,oe=Gl(v);return Vo(j,function(ue){var he=_[ue];v[ue]=he,oe&&(v.prototype[ue]=function(){var Ce=this.__chain__;if(ee||Ce){var Re=v(this.__wrapped__),De=Re.__actions__=Ya(this.__actions__);return De.push({func:he,args:arguments,thisArg:v}),Re.__chain__=Ce,Re}return he.apply(v,Pu([this.value()],arguments))})}),v}function ene(){return _n._===this&&(_n._=CZ),this}function XS(){}function tne(v){return v=ur(v),hr(function(_){return P6(_,v)})}var rne=CS(Rn),nne=CS(e6),ine=CS(Z_);function ZO(v){return PS(v)?Q_(nl(v)):MQ(v)}function ane(v){return function(_){return v==null?r:sf(v,_)}}var one=tO(),sne=tO(!0);function KS(){return[]}function ZS(){return!1}function lne(){return{}}function une(){return""}function cne(){return!0}function fne(v,_){if(v=ur(v),v<1||v>k)return[];var P=B,V=da(v,B);_=wt(_),v-=B;for(var j=tS(V,_);++P<v;)_(P);return j}function dne(v){return rr(v)?Rn(v,nl):Eo(v)?[v]:Ya(mO(Zr(v)))}function hne(v){var _=++TZ;return Zr(v)+_}var pne=ym(function(v,_){return v+_},0),vne=RS("ceil"),gne=ym(function(v,_){return v/_},1),mne=RS("floor");function yne(v){return v&&v.length?fm(v,Ka,dS):r}function Ene(v,_){return v&&v.length?fm(v,wt(_,2),dS):r}function bne(v){return n6(v,Ka)}function _ne(v,_){return n6(v,wt(_,2))}function Sne(v){return v&&v.length?fm(v,Ka,gS):r}function wne(v,_){return v&&v.length?fm(v,wt(_,2),gS):r}var Tne=ym(function(v,_){return v*_},1),Ane=RS("round"),Cne=ym(function(v,_){return v-_},0);function Rne(v){return v&&v.length?eS(v,Ka):0}function xne(v,_){return v&&v.length?eS(v,wt(_,2)):0}return Z.after=Kee,Z.ary=xO,Z.assign=kte,Z.assignIn=GO,Z.assignInWith=Nm,Z.assignWith=Bte,Z.at=Ute,Z.before=IO,Z.bind=US,Z.bindAll=Wre,Z.bindKey=OO,Z.castArray=lte,Z.chain=AO,Z.chunk=mJ,Z.compact=yJ,Z.concat=EJ,Z.cond=jre,Z.conforms=zre,Z.constant=zS,Z.countBy=Ree,Z.create=Fte,Z.curry=NO,Z.curryRight=LO,Z.debounce=PO,Z.defaults=Hte,Z.defaultsDeep=Gte,Z.defer=Zee,Z.delay=Qee,Z.difference=bJ,Z.differenceBy=_J,Z.differenceWith=SJ,Z.drop=wJ,Z.dropRight=TJ,Z.dropRightWhile=AJ,Z.dropWhile=CJ,Z.fill=RJ,Z.filter=Iee,Z.flatMap=Lee,Z.flatMapDeep=Pee,Z.flatMapDepth=Mee,Z.flatten=_O,Z.flattenDeep=xJ,Z.flattenDepth=IJ,Z.flip=Jee,Z.flow=qre,Z.flowRight=Xre,Z.fromPairs=OJ,Z.functions=Xte,Z.functionsIn=Kte,Z.groupBy=Dee,Z.initial=LJ,Z.intersection=PJ,Z.intersectionBy=MJ,Z.intersectionWith=DJ,Z.invert=Qte,Z.invertBy=Jte,Z.invokeMap=kee,Z.iteratee=YS,Z.keyBy=Bee,Z.keys=Hi,Z.keysIn=Xa,Z.map=Am,Z.mapKeys=tre,Z.mapValues=rre,Z.matches=Kre,Z.matchesProperty=Zre,Z.memoize=Rm,Z.merge=nre,Z.mergeWith=VO,Z.method=Qre,Z.methodOf=Jre,Z.mixin=qS,Z.negate=xm,Z.nthArg=tne,Z.omit=ire,Z.omitBy=are,Z.once=ete,Z.orderBy=Uee,Z.over=rne,Z.overArgs=tte,Z.overEvery=nne,Z.overSome=ine,Z.partial=FS,Z.partialRight=MO,Z.partition=Fee,Z.pick=ore,Z.pickBy=WO,Z.property=ZO,Z.propertyOf=ane,Z.pull=UJ,Z.pullAll=wO,Z.pullAllBy=FJ,Z.pullAllWith=HJ,Z.pullAt=GJ,Z.range=one,Z.rangeRight=sne,Z.rearg=rte,Z.reject=Vee,Z.remove=VJ,Z.rest=nte,Z.reverse=kS,Z.sampleSize=jee,Z.set=lre,Z.setWith=ure,Z.shuffle=zee,Z.slice=WJ,Z.sortBy=Xee,Z.sortedUniq=ZJ,Z.sortedUniqBy=QJ,Z.split=Lre,Z.spread=ite,Z.tail=JJ,Z.take=eee,Z.takeRight=tee,Z.takeRightWhile=ree,Z.takeWhile=nee,Z.tap=yee,Z.throttle=ate,Z.thru=Tm,Z.toArray=UO,Z.toPairs=jO,Z.toPairsIn=zO,Z.toPath=dne,Z.toPlainObject=HO,Z.transform=cre,Z.unary=ote,Z.union=iee,Z.unionBy=aee,Z.unionWith=oee,Z.uniq=see,Z.uniqBy=lee,Z.uniqWith=uee,Z.unset=fre,Z.unzip=BS,Z.unzipWith=TO,Z.update=dre,Z.updateWith=hre,Z.values=Qd,Z.valuesIn=pre,Z.without=cee,Z.words=XO,Z.wrap=ste,Z.xor=fee,Z.xorBy=dee,Z.xorWith=hee,Z.zip=pee,Z.zipObject=vee,Z.zipObjectDeep=gee,Z.zipWith=mee,Z.entries=jO,Z.entriesIn=zO,Z.extend=GO,Z.extendWith=Nm,qS(Z,Z),Z.add=pne,Z.attempt=KO,Z.camelCase=yre,Z.capitalize=YO,Z.ceil=vne,Z.clamp=vre,Z.clone=ute,Z.cloneDeep=fte,Z.cloneDeepWith=dte,Z.cloneWith=cte,Z.conformsTo=hte,Z.deburr=qO,Z.defaultTo=Yre,Z.divide=gne,Z.endsWith=Ere,Z.eq=gs,Z.escape=bre,Z.escapeRegExp=_re,Z.every=xee,Z.find=Oee,Z.findIndex=EO,Z.findKey=Vte,Z.findLast=Nee,Z.findLastIndex=bO,Z.findLastKey=Wte,Z.floor=mne,Z.forEach=CO,Z.forEachRight=RO,Z.forIn=jte,Z.forInRight=zte,Z.forOwn=Yte,Z.forOwnRight=qte,Z.get=VS,Z.gt=pte,Z.gte=vte,Z.has=Zte,Z.hasIn=WS,Z.head=SO,Z.identity=Ka,Z.includes=$ee,Z.indexOf=NJ,Z.inRange=gre,Z.invoke=ere,Z.isArguments=cf,Z.isArray=rr,Z.isArrayBuffer=gte,Z.isArrayLike=qa,Z.isArrayLikeObject=Qn,Z.isBoolean=mte,Z.isBuffer=Fu,Z.isDate=yte,Z.isElement=Ete,Z.isEmpty=bte,Z.isEqual=_te,Z.isEqualWith=Ste,Z.isError=HS,Z.isFinite=wte,Z.isFunction=Gl,Z.isInteger=DO,Z.isLength=Im,Z.isMap=$O,Z.isMatch=Tte,Z.isMatchWith=Ate,Z.isNaN=Cte,Z.isNative=Rte,Z.isNil=Ite,Z.isNull=xte,Z.isNumber=kO,Z.isObject=Dn,Z.isObjectLike=Wn,Z.isPlainObject=Ep,Z.isRegExp=GS,Z.isSafeInteger=Ote,Z.isSet=BO,Z.isString=Om,Z.isSymbol=Eo,Z.isTypedArray=Zd,Z.isUndefined=Nte,Z.isWeakMap=Lte,Z.isWeakSet=Pte,Z.join=$J,Z.kebabCase=Sre,Z.last=qo,Z.lastIndexOf=kJ,Z.lowerCase=wre,Z.lowerFirst=Tre,Z.lt=Mte,Z.lte=Dte,Z.max=yne,Z.maxBy=Ene,Z.mean=bne,Z.meanBy=_ne,Z.min=Sne,Z.minBy=wne,Z.stubArray=KS,Z.stubFalse=ZS,Z.stubObject=lne,Z.stubString=une,Z.stubTrue=cne,Z.multiply=Tne,Z.nth=BJ,Z.noConflict=ene,Z.noop=XS,Z.now=Cm,Z.pad=Are,Z.padEnd=Cre,Z.padStart=Rre,Z.parseInt=xre,Z.random=mre,Z.reduce=Hee,Z.reduceRight=Gee,Z.repeat=Ire,Z.replace=Ore,Z.result=sre,Z.round=Ane,Z.runInContext=de,Z.sample=Wee,Z.size=Yee,Z.snakeCase=Nre,Z.some=qee,Z.sortedIndex=jJ,Z.sortedIndexBy=zJ,Z.sortedIndexOf=YJ,Z.sortedLastIndex=qJ,Z.sortedLastIndexBy=XJ,Z.sortedLastIndexOf=KJ,Z.startCase=Pre,Z.startsWith=Mre,Z.subtract=Cne,Z.sum=Rne,Z.sumBy=xne,Z.template=Dre,Z.times=fne,Z.toFinite=Vl,Z.toInteger=ur,Z.toLength=FO,Z.toLower=$re,Z.toNumber=Xo,Z.toSafeInteger=$te,Z.toString=Zr,Z.toUpper=kre,Z.trim=Bre,Z.trimEnd=Ure,Z.trimStart=Fre,Z.truncate=Hre,Z.unescape=Gre,Z.uniqueId=hne,Z.upperCase=Vre,Z.upperFirst=jS,Z.each=CO,Z.eachRight=RO,Z.first=SO,qS(Z,function(){var v={};return tl(Z,function(_,P){rn.call(Z.prototype,P)||(v[P]=_)}),v}(),{chain:!1}),Z.VERSION=n,Vo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(v){Z[v].placeholder=Z}),Vo(["drop","take"],function(v,_){Ar.prototype[v]=function(P){P=P===r?1:xi(ur(P),0);var V=this.__filtered__&&!_?new Ar(this):this.clone();return V.__filtered__?V.__takeCount__=da(P,V.__takeCount__):V.__views__.push({size:da(P,B),type:v+(V.__dir__<0?"Right":"")}),V},Ar.prototype[v+"Right"]=function(P){return this.reverse()[v](P).reverse()}}),Vo(["filter","map","takeWhile"],function(v,_){var P=_+1,V=P==E||P==C;Ar.prototype[v]=function(j){var ee=this.clone();return ee.__iteratees__.push({iteratee:wt(j,3),type:P}),ee.__filtered__=ee.__filtered__||V,ee}}),Vo(["head","last"],function(v,_){var P="take"+(_?"Right":"");Ar.prototype[v]=function(){return this[P](1).value()[0]}}),Vo(["initial","tail"],function(v,_){var P="drop"+(_?"":"Right");Ar.prototype[v]=function(){return this.__filtered__?new Ar(this):this[P](1)}}),Ar.prototype.compact=function(){return this.filter(Ka)},Ar.prototype.find=function(v){return this.filter(v).head()},Ar.prototype.findLast=function(v){return this.reverse().find(v)},Ar.prototype.invokeMap=hr(function(v,_){return typeof v=="function"?new Ar(this):this.map(function(P){return hp(P,v,_)})}),Ar.prototype.reject=function(v){return this.filter(xm(wt(v)))},Ar.prototype.slice=function(v,_){v=ur(v);var P=this;return P.__filtered__&&(v>0||_<0)?new Ar(P):(v<0?P=P.takeRight(-v):v&&(P=P.drop(v)),_!==r&&(_=ur(_),P=_<0?P.dropRight(-_):P.take(_-v)),P)},Ar.prototype.takeRightWhile=function(v){return this.reverse().takeWhile(v).reverse()},Ar.prototype.toArray=function(){return this.take(B)},tl(Ar.prototype,function(v,_){var P=/^(?:filter|find|map|reject)|While$/.test(_),V=/^(?:head|last)$/.test(_),j=Z[V?"take"+(_=="last"?"Right":""):_],ee=V||/^find/.test(_);j&&(Z.prototype[_]=function(){var oe=this.__wrapped__,ue=V?[1]:arguments,he=oe instanceof Ar,Ce=ue[0],Re=he||rr(oe),De=function(Er){var Ir=j.apply(Z,Pu([Er],ue));return V&&Je?Ir[0]:Ir};Re&&P&&typeof Ce=="function"&&Ce.length!=1&&(he=Re=!1);var Je=this.__chain__,pt=!!this.__actions__.length,It=ee&&!Je,fr=he&&!pt;if(!ee&&Re){oe=fr?oe:new Ar(this);var Ot=v.apply(oe,ue);return Ot.__actions__.push({func:Tm,args:[De],thisArg:r}),new jo(Ot,Je)}return It&&fr?v.apply(this,ue):(Ot=this.thru(De),It?V?Ot.value()[0]:Ot.value():Ot)})}),Vo(["pop","push","shift","sort","splice","unshift"],function(v){var _=Kg[v],P=/^(?:push|sort|unshift)$/.test(v)?"tap":"thru",V=/^(?:pop|shift)$/.test(v);Z.prototype[v]=function(){var j=arguments;if(V&&!this.__chain__){var ee=this.value();return _.apply(rr(ee)?ee:[],j)}return this[P](function(oe){return _.apply(rr(oe)?oe:[],j)})}}),tl(Ar.prototype,function(v,_){var P=Z[_];if(P){var V=P.name+"";rn.call(zd,V)||(zd[V]=[]),zd[V].push({name:_,func:P})}}),zd[mm(r,y).name]=[{name:"wrapper",func:r}],Ar.prototype.clone=GZ,Ar.prototype.reverse=VZ,Ar.prototype.value=WZ,Z.prototype.at=Eee,Z.prototype.chain=bee,Z.prototype.commit=_ee,Z.prototype.next=See,Z.prototype.plant=Tee,Z.prototype.reverse=Aee,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=Cee,Z.prototype.first=Z.prototype.head,op&&(Z.prototype[op]=wee),Z},Vd=_Z();za?((za.exports=Vd)._=Vd,Oa._=Vd):_n._=Vd}).call(p8)})(whe,whe.exports);var L9t=Object.defineProperty,P9t=Object.defineProperties,M9t=Object.getOwnPropertyDescriptors,rRe=Object.getOwnPropertySymbols,D9t=Object.prototype.hasOwnProperty,$9t=Object.prototype.propertyIsEnumerable,nRe=(e,t,r)=>t in e?L9t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$$=(e,t)=>{for(var r in t||(t={}))D9t.call(t,r)&&nRe(e,r,t[r]);if(rRe)for(var r of rRe(t))$9t.call(t,r)&&nRe(e,r,t[r]);return e},k9t=(e,t)=>P9t(e,M9t(t));function Ob(e,t,r){var n;const i=D4t(e);return((n=t.rpcMap)==null?void 0:n[i.reference])||`${N9t}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function gA(e){return e.includes(":")?e.split(":")[1]:e}function EXe(e){return e.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function B9t(e,t){const r=Object.keys(t.namespaces).filter(i=>i.includes(e));if(!r.length)return[];const n=[];return r.forEach(i=>{const a=t.namespaces[i].accounts;n.push(...a)}),n}function U9t(e={},t={}){const r=iRe(e),n=iRe(t);return whe.exports.merge(r,n)}function iRe(e){var t,r,n,i;const a={};if(!n4(e))return a;for(const[o,s]of Object.entries(e)){const l=Xye(o)?[o]:s.chains,u=s.methods||[],c=s.events||[],f=s.rpcMap||{},d=nL(o);a[d]=k9t($$($$({},a[d]),s),{chains:nie(l,(t=a[d])==null?void 0:t.chains),methods:nie(u,(r=a[d])==null?void 0:r.methods),events:nie(c,(n=a[d])==null?void 0:n.events),rpcMap:$$($$({},f),(i=a[d])==null?void 0:i.rpcMap)})}return a}function F9t(e){return e.includes(":")?e.split(":")[2]:e}function H9t(e){const t={};for(const[r,n]of Object.entries(e)){const i=n.methods||[],a=n.events||[],o=n.accounts||[],s=Xye(r)?[r]:n.chains?n.chains:EXe(n.accounts);t[r]={chains:s,methods:i,events:a,accounts:o}}return t}function Tie(e){return typeof e=="number"?e:e.includes("0x")?parseInt(e,16):e.includes(":")?Number(e.split(":")[1]):Number(e)}const bXe={},us=e=>bXe[e],Aie=(e,t)=>{bXe[e]=t};let G9t=class{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}},V9t=class{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const n=r||Ob(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(gA(r));t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,n;let i=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const a=parseInt(i,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}};class W9t{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class j9t{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class z9t{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=gA(r);t[i]=this.createHttpProvider(i,n)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||this.getCardanoRPCUrl(t);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class Y9t{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class q9t{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;const i=gA(r);t[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new l2(new g_(n,us("disableProviderPing")))}}class X9t{constructor(t){this.name="near",this.namespace=t.namespace,this.events=us("events"),this.client=us("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const n=r||Ob(`${this.name}:${t}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,n)}this.events.emit(u2.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var n;t[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const n=this.createHttpProvider(t,r);n&&(this.httpProviders[t]=n)}createHttpProvider(t,r){const n=r||Ob(t,this.namespace);return typeof n>"u"?void 0:new l2(new g_(n,us("disableProviderPing")))}}var K9t=Object.defineProperty,Z9t=Object.defineProperties,Q9t=Object.getOwnPropertyDescriptors,aRe=Object.getOwnPropertySymbols,J9t=Object.prototype.hasOwnProperty,ePt=Object.prototype.propertyIsEnumerable,oRe=(e,t,r)=>t in e?K9t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k$=(e,t)=>{for(var r in t||(t={}))J9t.call(t,r)&&oRe(e,r,t[r]);if(aRe)for(var r of aRe(t))ePt.call(t,r)&&oRe(e,r,t[r]);return e},Cie=(e,t)=>Z9t(e,Q9t(t));class f2e{constructor(t){this.events=new Bye,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Hj(Gj({level:(t==null?void 0:t.logger)||eRe})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new f2e(t);return await r.initialize(),r}async request(t,r){const[n,i]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:k$({},t),chainId:`${n}:${i}`,topic:this.session.topic})}sendAsync(t,r,n){const i=new Date().getTime();this.request(t,n).then(a=>r(null,Wj(i,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 t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Ws("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(a=>{this.session=a,this.namespaces||(this.namespaces=H9t(a.namespaces),this.persist("namespaces",this.namespaces))}).catch(a=>{if(a.message!==mXe)throw a;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[n,i]=this.validateChain(t);this.getProvider(n).setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(bg(r)){for(const n of r)t.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 t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await E9t.init({logger:this.providerOpts.logger||eRe,relayUrl:this.providerOpts.relayUrl||x9t,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>nL(r)))];Aie("client",this.client),Aie("events",this.events),Aie("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const n=B9t(r,this.session),i=EXe(n),a=U9t(this.namespaces,this.optionalNamespaces),o=Cie(k$({},a[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new V9t({namespace:o});break;case"solana":this.rpcProviders[r]=new W9t({namespace:o});break;case"cosmos":this.rpcProviders[r]=new j9t({namespace:o});break;case"polkadot":this.rpcProviders[r]=new G9t({namespace:o});break;case"cip34":this.rpcProviders[r]=new z9t({namespace:o});break;case"elrond":this.rpcProviders[r]=new Y9t({namespace:o});break;case"multiversx":this.rpcProviders[r]=new q9t({namespace:o});break;case"near":this.rpcProviders[r]=new X9t({namespace:o});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&bg(i)&&this.events.emit("accountsChanged",i.map(F9t))}else if(n.name==="chainChanged"){const i=r.chainId,a=r.event.data,o=nL(i),s=Tie(i)!==Tie(a)?`${o}:${Tie(a)}`:i;this.onChainChanged(s)}else this.events.emit(n.name,n.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var n;const{namespaces:i}=r,a=(n=this.client)==null?void 0:n.session.get(t);this.session=Cie(k$({},a),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",Cie(k$({},Ws("USER_DISCONNECTED")),{data:t.topic}))}),this.on(u2.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=t;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(t){const[r,n]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>nL(o)).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=nL(Object.keys(this.namespaces)[0]),a=this.rpcProviders[i].getDefaultChain();return[i,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var n;if(!this.namespaces)return;const[i,a]=this.validateChain(t);r||this.getProvider(i).setDefaultChain(a),((n=this.namespaces[i])!=null?n:this.namespaces[`${i}:${a}`]).defaultChain=a,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",a)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${tRe}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${tRe}/${t}`)}}const tPt=f2e,rPt="wc",nPt="ethereum_provider",iPt=`${rPt}@2:${nPt}:`,aPt="https://rpc.walletconnect.com/v1/",The=["eth_sendTransaction","personal_sign"],oPt=["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"],Ahe=["chainChanged","accountsChanged"],sPt=["chainChanged","accountsChanged","message","disconnect","connect"];var lPt=Object.defineProperty,uPt=Object.defineProperties,cPt=Object.getOwnPropertyDescriptors,sRe=Object.getOwnPropertySymbols,fPt=Object.prototype.hasOwnProperty,dPt=Object.prototype.propertyIsEnumerable,lRe=(e,t,r)=>t in e?lPt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aL=(e,t)=>{for(var r in t||(t={}))fPt.call(t,r)&&lRe(e,r,t[r]);if(sRe)for(var r of sRe(t))dPt.call(t,r)&&lRe(e,r,t[r]);return e},uRe=(e,t)=>uPt(e,cPt(t));function vG(e){return Number(e[0].split(":")[1])}function Rie(e){return`0x${e.toString(16)}`}function hPt(e){const{chains:t,optionalChains:r,methods:n,optionalMethods:i,events:a,optionalEvents:o,rpcMap:s}=e;if(!bg(t))throw new Error("Invalid chains");const l={chains:t,methods:n||The,events:a||Ahe,rpcMap:aL({},t.length?{[vG(t)]:s[vG(t)]}:{})},u=a==null?void 0:a.filter(h=>!Ahe.includes(h)),c=n==null?void 0:n.filter(h=>!The.includes(h));if(!r&&!o&&!i&&!(u!=null&&u.length)&&!(c!=null&&c.length))return{required:t.length?l:void 0};const f=(u==null?void 0:u.length)&&(c==null?void 0:c.length)||!r,d={chains:[...new Set(f?l.chains.concat(r||[]):r)],methods:[...new Set(l.methods.concat(i!=null&&i.length?i:oPt))],events:[...new Set(l.events.concat(o!=null&&o.length?o:sPt))],rpcMap:s};return{required:t.length?l:void 0,optional:r.length?d:void 0}}let pPt=class _Xe{constructor(){this.events=new Xc.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=iPt,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new _Xe;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:n}=hPt(this.rpc);try{const i=await new Promise(async(o,s)=>{var l;this.rpc.showQrModal&&((l=this.modal)==null||l.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),s(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(uRe(aL({namespaces:aL({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(u=>{o(u)}).catch(u=>{s(new Error(u.message))})});if(!i)return;const a=$4t(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Rie(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event: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",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",Rie(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",uRe(aL({},Ws("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",Rie(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,n,i]=t.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,n;const i=(r=t==null?void 0:t.chains)!=null?r:[],a=(n=t==null?void 0:t.optionalChains)!=null?n:[],o=i.concat(a);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const s=i.length?(t==null?void 0:t.methods)||The:[],l=i.length?(t==null?void 0:t.events)||Ahe:[],u=(t==null?void 0:t.optionalMethods)||[],c=(t==null?void 0:t.optionalEvents)||[],f=(t==null?void 0:t.rpcMap)||this.buildRpcMap(o,t.projectId),d=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(h=>this.formatChainId(h)),optionalChains:a.map(h=>this.formatChainId(h)),methods:s,events:l,optionalMethods:u,optionalEvents:c,rpcMap:f,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:d,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const n={};return t.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?vG(this.rpc.chains):vG(this.rpc.optionalChains),this.signer=await tPt.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await zde(()=>import("./index-66d897e7.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(aL({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:n,rpcMap:i}=t;r&&bg(r)&&(this.rpc.chains=r.map(a=>this.formatChainId(a)),r.forEach(a=>{this.rpc.rpcMap[a]=(i==null?void 0:i[a])||this.getRpcUrl(a)})),n&&bg(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(a=>this.formatChainId(a)),n.forEach(a=>{this.rpc.rpcMap[a]=(i==null?void 0:i[a])||this.getRpcUrl(a)}))}getRpcUrl(t,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[t])||`${aPt}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}};var d2e={exports:{}};d2e.exports;(function(e){(function(t,r){function n(D,E){if(!D)throw new Error(E||"Assertion failed")}function i(D,E){D.super_=E;var S=function(){};S.prototype=E.prototype,D.prototype=new S,D.prototype.constructor=D}function a(D,E,S){if(a.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((E==="le"||E==="be")&&(S=E,E=10),this._init(D||0,E||10,S||"be"))}typeof t=="object"?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=fA.Buffer}catch{}a.isBN=function(E){return E instanceof a?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===a.wordSize&&Array.isArray(E.words)},a.max=function(E,S){return E.cmp(S)>0?E:S},a.min=function(E,S){return E.cmp(S)<0?E:S},a.prototype._init=function(E,S,C){if(typeof E=="number")return this._initNumber(E,S,C);if(typeof E=="object")return this._initArray(E,S,C);S==="hex"&&(S=16),n(S===(S|0)&&S>=2&&S<=36),E=E.toString().replace(/\s+/g,"");var M=0;E[0]==="-"&&(M++,this.negative=1),M<E.length&&(S===16?this._parseHex(E,M,C):(this._parseBase(E,S,M),C==="le"&&this._initArray(this.toArray(),S,C)))},a.prototype._initNumber=function(E,S,C){E<0&&(this.negative=1,E=-E),E<67108864?(this.words=[E&67108863],this.length=1):E<4503599627370496?(this.words=[E&67108863,E/67108864&67108863],this.length=2):(n(E<9007199254740992),this.words=[E&67108863,E/67108864&67108863,1],this.length=3),C==="le"&&this._initArray(this.toArray(),S,C)},a.prototype._initArray=function(E,S,C){if(n(typeof E.length=="number"),E.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(E.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var k,U,G=0;if(C==="be")for(M=E.length-1,k=0;M>=0;M-=3)U=E[M]|E[M-1]<<8|E[M-2]<<16,this.words[k]|=U<<G&67108863,this.words[k+1]=U>>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);else if(C==="le")for(M=0,k=0;M<E.length;M+=3)U=E[M]|E[M+1]<<8|E[M+2]<<16,this.words[k]|=U<<G&67108863,this.words[k+1]=U>>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);return this._strip()};function s(D,E){var S=D.charCodeAt(E);if(S>=48&&S<=57)return S-48;if(S>=65&&S<=70)return S-55;if(S>=97&&S<=102)return S-87;n(!1,"Invalid character in "+D)}function l(D,E,S){var C=s(D,S);return S-1>=E&&(C|=s(D,S-1)<<4),C}a.prototype._parseHex=function(E,S,C){this.length=Math.ceil((E.length-S)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var k=0,U=0,G;if(C==="be")for(M=E.length-1;M>=S;M-=2)G=l(E,S,M)<<k,this.words[U]|=G&67108863,k>=18?(k-=18,U+=1,this.words[U]|=G>>>26):k+=8;else{var B=E.length-S;for(M=B%2===0?S+1:S;M<E.length;M+=2)G=l(E,S,M)<<k,this.words[U]|=G&67108863,k>=18?(k-=18,U+=1,this.words[U]|=G>>>26):k+=8}this._strip()};function u(D,E,S,C){for(var M=0,k=0,U=Math.min(D.length,S),G=E;G<U;G++){var B=D.charCodeAt(G)-48;M*=C,B>=49?k=B-49+10:B>=17?k=B-17+10:k=B,n(B>=0&&k<C,"Invalid character"),M+=k}return M}a.prototype._parseBase=function(E,S,C){this.words=[0],this.length=1;for(var M=0,k=1;k<=67108863;k*=S)M++;M--,k=k/S|0;for(var U=E.length-C,G=U%M,B=Math.min(U,U-G)+C,x=0,H=C;H<B;H+=M)x=u(E,H,H+M,S),this.imuln(k),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x);if(G!==0){var q=1;for(x=u(E,H,E.length,S),H=0;H<G;H++)q*=S;this.imuln(q),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x)}this._strip()},a.prototype.copy=function(E){E.words=new Array(this.length);for(var S=0;S<this.length;S++)E.words[S]=this.words[S];E.length=this.length,E.negative=this.negative,E.red=this.red};function c(D,E){D.words=E.words,D.length=E.length,D.negative=E.negative,D.red=E.red}if(a.prototype._move=function(E){c(E,this)},a.prototype.clone=function(){var E=new a(null);return this.copy(E),E},a.prototype._expand=function(E){for(;this.length<E;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{a.prototype.inspect=f}else a.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],h=[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],p=[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];a.prototype.toString=function(E,S){E=E||10,S=S|0||1;var C;if(E===16||E==="hex"){C="";for(var M=0,k=0,U=0;U<this.length;U++){var G=this.words[U],B=((G<<M|k)&16777215).toString(16);k=G>>>24-M&16777215,M+=2,M>=26&&(M-=26,U--),k!==0||U!==this.length-1?C=d[6-B.length]+B+C:C=B+C}for(k!==0&&(C=k.toString(16)+C);C.length%S!==0;)C="0"+C;return this.negative!==0&&(C="-"+C),C}if(E===(E|0)&&E>=2&&E<=36){var x=h[E],H=p[E];C="";var q=this.clone();for(q.negative=0;!q.isZero();){var W=q.modrn(H).toString(E);q=q.idivn(H),q.isZero()?C=W+C:C=d[x-W.length]+W+C}for(this.isZero()&&(C="0"+C);C.length%S!==0;)C="0"+C;return this.negative!==0&&(C="-"+C),C}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(E,S){return this.toArrayLike(o,E,S)}),a.prototype.toArray=function(E,S){return this.toArrayLike(Array,E,S)};var g=function(E,S){return E.allocUnsafe?E.allocUnsafe(S):new E(S)};a.prototype.toArrayLike=function(E,S,C){this._strip();var M=this.byteLength(),k=C||Math.max(1,M);n(M<=k,"byte array longer than desired length"),n(k>0,"Requested array length <= 0");var U=g(E,k),G=S==="le"?"LE":"BE";return this["_toArrayLike"+G](U,M),U},a.prototype._toArrayLikeLE=function(E,S){for(var C=0,M=0,k=0,U=0;k<this.length;k++){var G=this.words[k]<<U|M;E[C++]=G&255,C<E.length&&(E[C++]=G>>8&255),C<E.length&&(E[C++]=G>>16&255),U===6?(C<E.length&&(E[C++]=G>>24&255),M=0,U=0):(M=G>>>24,U+=2)}if(C<E.length)for(E[C++]=M;C<E.length;)E[C++]=0},a.prototype._toArrayLikeBE=function(E,S){for(var C=E.length-1,M=0,k=0,U=0;k<this.length;k++){var G=this.words[k]<<U|M;E[C--]=G&255,C>=0&&(E[C--]=G>>8&255),C>=0&&(E[C--]=G>>16&255),U===6?(C>=0&&(E[C--]=G>>24&255),M=0,U=0):(M=G>>>24,U+=2)}if(C>=0)for(E[C--]=M;C>=0;)E[C--]=0},Math.clz32?a.prototype._countBits=function(E){return 32-Math.clz32(E)}:a.prototype._countBits=function(E){var S=E,C=0;return S>=4096&&(C+=13,S>>>=13),S>=64&&(C+=7,S>>>=7),S>=8&&(C+=4,S>>>=4),S>=2&&(C+=2,S>>>=2),C+S},a.prototype._zeroBits=function(E){if(E===0)return 26;var S=E,C=0;return S&8191||(C+=13,S>>>=13),S&127||(C+=7,S>>>=7),S&15||(C+=4,S>>>=4),S&3||(C+=2,S>>>=2),S&1||C++,C},a.prototype.bitLength=function(){var E=this.words[this.length-1],S=this._countBits(E);return(this.length-1)*26+S};function m(D){for(var E=new Array(D.bitLength()),S=0;S<E.length;S++){var C=S/26|0,M=S%26;E[S]=D.words[C]>>>M&1}return E}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,S=0;S<this.length;S++){var C=this._zeroBits(this.words[S]);if(E+=C,C!==26)break}return E},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(E){return this.negative!==0?this.abs().inotn(E).iaddn(1):this.clone()},a.prototype.fromTwos=function(E){return this.testn(E-1)?this.notn(E).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(E){for(;this.length<E.length;)this.words[this.length++]=0;for(var S=0;S<E.length;S++)this.words[S]=this.words[S]|E.words[S];return this._strip()},a.prototype.ior=function(E){return n((this.negative|E.negative)===0),this.iuor(E)},a.prototype.or=function(E){return this.length>E.length?this.clone().ior(E):E.clone().ior(this)},a.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},a.prototype.iuand=function(E){var S;this.length>E.length?S=E:S=this;for(var C=0;C<S.length;C++)this.words[C]=this.words[C]&E.words[C];return this.length=S.length,this._strip()},a.prototype.iand=function(E){return n((this.negative|E.negative)===0),this.iuand(E)},a.prototype.and=function(E){return this.length>E.length?this.clone().iand(E):E.clone().iand(this)},a.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},a.prototype.iuxor=function(E){var S,C;this.length>E.length?(S=this,C=E):(S=E,C=this);for(var M=0;M<C.length;M++)this.words[M]=S.words[M]^C.words[M];if(this!==S)for(;M<S.length;M++)this.words[M]=S.words[M];return this.length=S.length,this._strip()},a.prototype.ixor=function(E){return n((this.negative|E.negative)===0),this.iuxor(E)},a.prototype.xor=function(E){return this.length>E.length?this.clone().ixor(E):E.clone().ixor(this)},a.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},a.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var S=Math.ceil(E/26)|0,C=E%26;this._expand(S),C>0&&S--;for(var M=0;M<S;M++)this.words[M]=~this.words[M]&67108863;return C>0&&(this.words[M]=~this.words[M]&67108863>>26-C),this._strip()},a.prototype.notn=function(E){return this.clone().inotn(E)},a.prototype.setn=function(E,S){n(typeof E=="number"&&E>=0);var C=E/26|0,M=E%26;return this._expand(C+1),S?this.words[C]=this.words[C]|1<<M:this.words[C]=this.words[C]&~(1<<M),this._strip()},a.prototype.iadd=function(E){var S;if(this.negative!==0&&E.negative===0)return this.negative=0,S=this.isub(E),this.negative^=1,this._normSign();if(this.negative===0&&E.negative!==0)return E.negative=0,S=this.isub(E),E.negative=1,S._normSign();var C,M;this.length>E.length?(C=this,M=E):(C=E,M=this);for(var k=0,U=0;U<M.length;U++)S=(C.words[U]|0)+(M.words[U]|0)+k,this.words[U]=S&67108863,k=S>>>26;for(;k!==0&&U<C.length;U++)S=(C.words[U]|0)+k,this.words[U]=S&67108863,k=S>>>26;if(this.length=C.length,k!==0)this.words[this.length]=k,this.length++;else if(C!==this)for(;U<C.length;U++)this.words[U]=C.words[U];return this},a.prototype.add=function(E){var S;return E.negative!==0&&this.negative===0?(E.negative=0,S=this.sub(E),E.negative^=1,S):E.negative===0&&this.negative!==0?(this.negative=0,S=E.sub(this),this.negative=1,S):this.length>E.length?this.clone().iadd(E):E.clone().iadd(this)},a.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var S=this.iadd(E);return E.negative=1,S._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var C=this.cmp(E);if(C===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,k;C>0?(M=this,k=E):(M=E,k=this);for(var U=0,G=0;G<k.length;G++)S=(M.words[G]|0)-(k.words[G]|0)+U,U=S>>26,this.words[G]=S&67108863;for(;U!==0&&G<M.length;G++)S=(M.words[G]|0)+U,U=S>>26,this.words[G]=S&67108863;if(U===0&&G<M.length&&M!==this)for(;G<M.length;G++)this.words[G]=M.words[G];return this.length=Math.max(this.length,G),M!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(E){return this.clone().isub(E)};function y(D,E,S){S.negative=E.negative^D.negative;var C=D.length+E.length|0;S.length=C,C=C-1|0;var M=D.words[0]|0,k=E.words[0]|0,U=M*k,G=U&67108863,B=U/67108864|0;S.words[0]=G;for(var x=1;x<C;x++){for(var H=B>>>26,q=B&67108863,W=Math.min(x,E.length-1),Y=Math.max(0,x-D.length+1);Y<=W;Y++){var re=x-Y|0;M=D.words[re]|0,k=E.words[Y]|0,U=M*k+q,H+=U/67108864|0,q=U&67108863}S.words[x]=q|0,B=H|0}return B!==0?S.words[x]=B|0:S.length--,S._strip()}var b=function(E,S,C){var M=E.words,k=S.words,U=C.words,G=0,B,x,H,q=M[0]|0,W=q&8191,Y=q>>>13,re=M[1]|0,Q=re&8191,ie=re>>>13,ce=M[2]|0,te=ce&8191,J=ce>>>13,ge=M[3]|0,fe=ge&8191,ye=ge>>>13,Fe=M[4]|0,me=Fe&8191,Ue=Fe>>>13,tt=M[5]|0,Ve=tt&8191,Ae=tt>>>13,je=M[6]|0,Pe=je&8191,Oe=je>>>13,rt=M[7]|0,We=rt&8191,ne=rt>>>13,X=M[8]|0,K=X&8191,le=X>>>13,ve=M[9]|0,Ee=ve&8191,we=ve>>>13,ft=k[0]|0,He=ft&8191,Ke=ft>>>13,Jt=k[1]|0,at=Jt&8191,At=Jt>>>13,Vr=k[2]|0,xt=Vr&8191,Dt=Vr>>>13,Bn=k[3]|0,Nt=Bn&8191,Xt=Bn>>>13,ji=k[4]|0,ct=ji&8191,St=ji>>>13,Ji=k[5]|0,er=Ji&8191,Yt=Ji>>>13,la=k[6]|0,Wt=la&8191,Ht=la>>>13,zi=k[7]|0,vt=zi&8191,Lt=zi>>>13,Kr=k[8]|0,yt=Kr&8191,Pt=Kr>>>13,ua=k[9]|0,Me=ua&8191,$e=ua>>>13;C.negative=E.negative^S.negative,C.length=19,B=Math.imul(W,He),x=Math.imul(W,Ke),x=x+Math.imul(Y,He)|0,H=Math.imul(Y,Ke);var Mt=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,B=Math.imul(Q,He),x=Math.imul(Q,Ke),x=x+Math.imul(ie,He)|0,H=Math.imul(ie,Ke),B=B+Math.imul(W,at)|0,x=x+Math.imul(W,At)|0,x=x+Math.imul(Y,at)|0,H=H+Math.imul(Y,At)|0;var Tr=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,B=Math.imul(te,He),x=Math.imul(te,Ke),x=x+Math.imul(J,He)|0,H=Math.imul(J,Ke),B=B+Math.imul(Q,at)|0,x=x+Math.imul(Q,At)|0,x=x+Math.imul(ie,at)|0,H=H+Math.imul(ie,At)|0,B=B+Math.imul(W,xt)|0,x=x+Math.imul(W,Dt)|0,x=x+Math.imul(Y,xt)|0,H=H+Math.imul(Y,Dt)|0;var kr=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(kr>>>26)|0,kr&=67108863,B=Math.imul(fe,He),x=Math.imul(fe,Ke),x=x+Math.imul(ye,He)|0,H=Math.imul(ye,Ke),B=B+Math.imul(te,at)|0,x=x+Math.imul(te,At)|0,x=x+Math.imul(J,at)|0,H=H+Math.imul(J,At)|0,B=B+Math.imul(Q,xt)|0,x=x+Math.imul(Q,Dt)|0,x=x+Math.imul(ie,xt)|0,H=H+Math.imul(ie,Dt)|0,B=B+Math.imul(W,Nt)|0,x=x+Math.imul(W,Xt)|0,x=x+Math.imul(Y,Nt)|0,H=H+Math.imul(Y,Xt)|0;var cn=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(cn>>>26)|0,cn&=67108863,B=Math.imul(me,He),x=Math.imul(me,Ke),x=x+Math.imul(Ue,He)|0,H=Math.imul(Ue,Ke),B=B+Math.imul(fe,at)|0,x=x+Math.imul(fe,At)|0,x=x+Math.imul(ye,at)|0,H=H+Math.imul(ye,At)|0,B=B+Math.imul(te,xt)|0,x=x+Math.imul(te,Dt)|0,x=x+Math.imul(J,xt)|0,H=H+Math.imul(J,Dt)|0,B=B+Math.imul(Q,Nt)|0,x=x+Math.imul(Q,Xt)|0,x=x+Math.imul(ie,Nt)|0,H=H+Math.imul(ie,Xt)|0,B=B+Math.imul(W,ct)|0,x=x+Math.imul(W,St)|0,x=x+Math.imul(Y,ct)|0,H=H+Math.imul(Y,St)|0;var dn=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(dn>>>26)|0,dn&=67108863,B=Math.imul(Ve,He),x=Math.imul(Ve,Ke),x=x+Math.imul(Ae,He)|0,H=Math.imul(Ae,Ke),B=B+Math.imul(me,at)|0,x=x+Math.imul(me,At)|0,x=x+Math.imul(Ue,at)|0,H=H+Math.imul(Ue,At)|0,B=B+Math.imul(fe,xt)|0,x=x+Math.imul(fe,Dt)|0,x=x+Math.imul(ye,xt)|0,H=H+Math.imul(ye,Dt)|0,B=B+Math.imul(te,Nt)|0,x=x+Math.imul(te,Xt)|0,x=x+Math.imul(J,Nt)|0,H=H+Math.imul(J,Xt)|0,B=B+Math.imul(Q,ct)|0,x=x+Math.imul(Q,St)|0,x=x+Math.imul(ie,ct)|0,H=H+Math.imul(ie,St)|0,B=B+Math.imul(W,er)|0,x=x+Math.imul(W,Yt)|0,x=x+Math.imul(Y,er)|0,H=H+Math.imul(Y,Yt)|0;var ni=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ni>>>26)|0,ni&=67108863,B=Math.imul(Pe,He),x=Math.imul(Pe,Ke),x=x+Math.imul(Oe,He)|0,H=Math.imul(Oe,Ke),B=B+Math.imul(Ve,at)|0,x=x+Math.imul(Ve,At)|0,x=x+Math.imul(Ae,at)|0,H=H+Math.imul(Ae,At)|0,B=B+Math.imul(me,xt)|0,x=x+Math.imul(me,Dt)|0,x=x+Math.imul(Ue,xt)|0,H=H+Math.imul(Ue,Dt)|0,B=B+Math.imul(fe,Nt)|0,x=x+Math.imul(fe,Xt)|0,x=x+Math.imul(ye,Nt)|0,H=H+Math.imul(ye,Xt)|0,B=B+Math.imul(te,ct)|0,x=x+Math.imul(te,St)|0,x=x+Math.imul(J,ct)|0,H=H+Math.imul(J,St)|0,B=B+Math.imul(Q,er)|0,x=x+Math.imul(Q,Yt)|0,x=x+Math.imul(ie,er)|0,H=H+Math.imul(ie,Yt)|0,B=B+Math.imul(W,Wt)|0,x=x+Math.imul(W,Ht)|0,x=x+Math.imul(Y,Wt)|0,H=H+Math.imul(Y,Ht)|0;var ao=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ao>>>26)|0,ao&=67108863,B=Math.imul(We,He),x=Math.imul(We,Ke),x=x+Math.imul(ne,He)|0,H=Math.imul(ne,Ke),B=B+Math.imul(Pe,at)|0,x=x+Math.imul(Pe,At)|0,x=x+Math.imul(Oe,at)|0,H=H+Math.imul(Oe,At)|0,B=B+Math.imul(Ve,xt)|0,x=x+Math.imul(Ve,Dt)|0,x=x+Math.imul(Ae,xt)|0,H=H+Math.imul(Ae,Dt)|0,B=B+Math.imul(me,Nt)|0,x=x+Math.imul(me,Xt)|0,x=x+Math.imul(Ue,Nt)|0,H=H+Math.imul(Ue,Xt)|0,B=B+Math.imul(fe,ct)|0,x=x+Math.imul(fe,St)|0,x=x+Math.imul(ye,ct)|0,H=H+Math.imul(ye,St)|0,B=B+Math.imul(te,er)|0,x=x+Math.imul(te,Yt)|0,x=x+Math.imul(J,er)|0,H=H+Math.imul(J,Yt)|0,B=B+Math.imul(Q,Wt)|0,x=x+Math.imul(Q,Ht)|0,x=x+Math.imul(ie,Wt)|0,H=H+Math.imul(ie,Ht)|0,B=B+Math.imul(W,vt)|0,x=x+Math.imul(W,Lt)|0,x=x+Math.imul(Y,vt)|0,H=H+Math.imul(Y,Lt)|0;var ea=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ea>>>26)|0,ea&=67108863,B=Math.imul(K,He),x=Math.imul(K,Ke),x=x+Math.imul(le,He)|0,H=Math.imul(le,Ke),B=B+Math.imul(We,at)|0,x=x+Math.imul(We,At)|0,x=x+Math.imul(ne,at)|0,H=H+Math.imul(ne,At)|0,B=B+Math.imul(Pe,xt)|0,x=x+Math.imul(Pe,Dt)|0,x=x+Math.imul(Oe,xt)|0,H=H+Math.imul(Oe,Dt)|0,B=B+Math.imul(Ve,Nt)|0,x=x+Math.imul(Ve,Xt)|0,x=x+Math.imul(Ae,Nt)|0,H=H+Math.imul(Ae,Xt)|0,B=B+Math.imul(me,ct)|0,x=x+Math.imul(me,St)|0,x=x+Math.imul(Ue,ct)|0,H=H+Math.imul(Ue,St)|0,B=B+Math.imul(fe,er)|0,x=x+Math.imul(fe,Yt)|0,x=x+Math.imul(ye,er)|0,H=H+Math.imul(ye,Yt)|0,B=B+Math.imul(te,Wt)|0,x=x+Math.imul(te,Ht)|0,x=x+Math.imul(J,Wt)|0,H=H+Math.imul(J,Ht)|0,B=B+Math.imul(Q,vt)|0,x=x+Math.imul(Q,Lt)|0,x=x+Math.imul(ie,vt)|0,H=H+Math.imul(ie,Lt)|0,B=B+Math.imul(W,yt)|0,x=x+Math.imul(W,Pt)|0,x=x+Math.imul(Y,yt)|0,H=H+Math.imul(Y,Pt)|0;var go=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(go>>>26)|0,go&=67108863,B=Math.imul(Ee,He),x=Math.imul(Ee,Ke),x=x+Math.imul(we,He)|0,H=Math.imul(we,Ke),B=B+Math.imul(K,at)|0,x=x+Math.imul(K,At)|0,x=x+Math.imul(le,at)|0,H=H+Math.imul(le,At)|0,B=B+Math.imul(We,xt)|0,x=x+Math.imul(We,Dt)|0,x=x+Math.imul(ne,xt)|0,H=H+Math.imul(ne,Dt)|0,B=B+Math.imul(Pe,Nt)|0,x=x+Math.imul(Pe,Xt)|0,x=x+Math.imul(Oe,Nt)|0,H=H+Math.imul(Oe,Xt)|0,B=B+Math.imul(Ve,ct)|0,x=x+Math.imul(Ve,St)|0,x=x+Math.imul(Ae,ct)|0,H=H+Math.imul(Ae,St)|0,B=B+Math.imul(me,er)|0,x=x+Math.imul(me,Yt)|0,x=x+Math.imul(Ue,er)|0,H=H+Math.imul(Ue,Yt)|0,B=B+Math.imul(fe,Wt)|0,x=x+Math.imul(fe,Ht)|0,x=x+Math.imul(ye,Wt)|0,H=H+Math.imul(ye,Ht)|0,B=B+Math.imul(te,vt)|0,x=x+Math.imul(te,Lt)|0,x=x+Math.imul(J,vt)|0,H=H+Math.imul(J,Lt)|0,B=B+Math.imul(Q,yt)|0,x=x+Math.imul(Q,Pt)|0,x=x+Math.imul(ie,yt)|0,H=H+Math.imul(ie,Pt)|0,B=B+Math.imul(W,Me)|0,x=x+Math.imul(W,$e)|0,x=x+Math.imul(Y,Me)|0,H=H+Math.imul(Y,$e)|0;var ca=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ca>>>26)|0,ca&=67108863,B=Math.imul(Ee,at),x=Math.imul(Ee,At),x=x+Math.imul(we,at)|0,H=Math.imul(we,At),B=B+Math.imul(K,xt)|0,x=x+Math.imul(K,Dt)|0,x=x+Math.imul(le,xt)|0,H=H+Math.imul(le,Dt)|0,B=B+Math.imul(We,Nt)|0,x=x+Math.imul(We,Xt)|0,x=x+Math.imul(ne,Nt)|0,H=H+Math.imul(ne,Xt)|0,B=B+Math.imul(Pe,ct)|0,x=x+Math.imul(Pe,St)|0,x=x+Math.imul(Oe,ct)|0,H=H+Math.imul(Oe,St)|0,B=B+Math.imul(Ve,er)|0,x=x+Math.imul(Ve,Yt)|0,x=x+Math.imul(Ae,er)|0,H=H+Math.imul(Ae,Yt)|0,B=B+Math.imul(me,Wt)|0,x=x+Math.imul(me,Ht)|0,x=x+Math.imul(Ue,Wt)|0,H=H+Math.imul(Ue,Ht)|0,B=B+Math.imul(fe,vt)|0,x=x+Math.imul(fe,Lt)|0,x=x+Math.imul(ye,vt)|0,H=H+Math.imul(ye,Lt)|0,B=B+Math.imul(te,yt)|0,x=x+Math.imul(te,Pt)|0,x=x+Math.imul(J,yt)|0,H=H+Math.imul(J,Pt)|0,B=B+Math.imul(Q,Me)|0,x=x+Math.imul(Q,$e)|0,x=x+Math.imul(ie,Me)|0,H=H+Math.imul(ie,$e)|0;var Ia=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,B=Math.imul(Ee,xt),x=Math.imul(Ee,Dt),x=x+Math.imul(we,xt)|0,H=Math.imul(we,Dt),B=B+Math.imul(K,Nt)|0,x=x+Math.imul(K,Xt)|0,x=x+Math.imul(le,Nt)|0,H=H+Math.imul(le,Xt)|0,B=B+Math.imul(We,ct)|0,x=x+Math.imul(We,St)|0,x=x+Math.imul(ne,ct)|0,H=H+Math.imul(ne,St)|0,B=B+Math.imul(Pe,er)|0,x=x+Math.imul(Pe,Yt)|0,x=x+Math.imul(Oe,er)|0,H=H+Math.imul(Oe,Yt)|0,B=B+Math.imul(Ve,Wt)|0,x=x+Math.imul(Ve,Ht)|0,x=x+Math.imul(Ae,Wt)|0,H=H+Math.imul(Ae,Ht)|0,B=B+Math.imul(me,vt)|0,x=x+Math.imul(me,Lt)|0,x=x+Math.imul(Ue,vt)|0,H=H+Math.imul(Ue,Lt)|0,B=B+Math.imul(fe,yt)|0,x=x+Math.imul(fe,Pt)|0,x=x+Math.imul(ye,yt)|0,H=H+Math.imul(ye,Pt)|0,B=B+Math.imul(te,Me)|0,x=x+Math.imul(te,$e)|0,x=x+Math.imul(J,Me)|0,H=H+Math.imul(J,$e)|0;var en=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(en>>>26)|0,en&=67108863,B=Math.imul(Ee,Nt),x=Math.imul(Ee,Xt),x=x+Math.imul(we,Nt)|0,H=Math.imul(we,Xt),B=B+Math.imul(K,ct)|0,x=x+Math.imul(K,St)|0,x=x+Math.imul(le,ct)|0,H=H+Math.imul(le,St)|0,B=B+Math.imul(We,er)|0,x=x+Math.imul(We,Yt)|0,x=x+Math.imul(ne,er)|0,H=H+Math.imul(ne,Yt)|0,B=B+Math.imul(Pe,Wt)|0,x=x+Math.imul(Pe,Ht)|0,x=x+Math.imul(Oe,Wt)|0,H=H+Math.imul(Oe,Ht)|0,B=B+Math.imul(Ve,vt)|0,x=x+Math.imul(Ve,Lt)|0,x=x+Math.imul(Ae,vt)|0,H=H+Math.imul(Ae,Lt)|0,B=B+Math.imul(me,yt)|0,x=x+Math.imul(me,Pt)|0,x=x+Math.imul(Ue,yt)|0,H=H+Math.imul(Ue,Pt)|0,B=B+Math.imul(fe,Me)|0,x=x+Math.imul(fe,$e)|0,x=x+Math.imul(ye,Me)|0,H=H+Math.imul(ye,$e)|0;var Li=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Li>>>26)|0,Li&=67108863,B=Math.imul(Ee,ct),x=Math.imul(Ee,St),x=x+Math.imul(we,ct)|0,H=Math.imul(we,St),B=B+Math.imul(K,er)|0,x=x+Math.imul(K,Yt)|0,x=x+Math.imul(le,er)|0,H=H+Math.imul(le,Yt)|0,B=B+Math.imul(We,Wt)|0,x=x+Math.imul(We,Ht)|0,x=x+Math.imul(ne,Wt)|0,H=H+Math.imul(ne,Ht)|0,B=B+Math.imul(Pe,vt)|0,x=x+Math.imul(Pe,Lt)|0,x=x+Math.imul(Oe,vt)|0,H=H+Math.imul(Oe,Lt)|0,B=B+Math.imul(Ve,yt)|0,x=x+Math.imul(Ve,Pt)|0,x=x+Math.imul(Ae,yt)|0,H=H+Math.imul(Ae,Pt)|0,B=B+Math.imul(me,Me)|0,x=x+Math.imul(me,$e)|0,x=x+Math.imul(Ue,Me)|0,H=H+Math.imul(Ue,$e)|0;var pi=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(pi>>>26)|0,pi&=67108863,B=Math.imul(Ee,er),x=Math.imul(Ee,Yt),x=x+Math.imul(we,er)|0,H=Math.imul(we,Yt),B=B+Math.imul(K,Wt)|0,x=x+Math.imul(K,Ht)|0,x=x+Math.imul(le,Wt)|0,H=H+Math.imul(le,Ht)|0,B=B+Math.imul(We,vt)|0,x=x+Math.imul(We,Lt)|0,x=x+Math.imul(ne,vt)|0,H=H+Math.imul(ne,Lt)|0,B=B+Math.imul(Pe,yt)|0,x=x+Math.imul(Pe,Pt)|0,x=x+Math.imul(Oe,yt)|0,H=H+Math.imul(Oe,Pt)|0,B=B+Math.imul(Ve,Me)|0,x=x+Math.imul(Ve,$e)|0,x=x+Math.imul(Ae,Me)|0,H=H+Math.imul(Ae,$e)|0;var Go=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Go>>>26)|0,Go&=67108863,B=Math.imul(Ee,Wt),x=Math.imul(Ee,Ht),x=x+Math.imul(we,Wt)|0,H=Math.imul(we,Ht),B=B+Math.imul(K,vt)|0,x=x+Math.imul(K,Lt)|0,x=x+Math.imul(le,vt)|0,H=H+Math.imul(le,Lt)|0,B=B+Math.imul(We,yt)|0,x=x+Math.imul(We,Pt)|0,x=x+Math.imul(ne,yt)|0,H=H+Math.imul(ne,Pt)|0,B=B+Math.imul(Pe,Me)|0,x=x+Math.imul(Pe,$e)|0,x=x+Math.imul(Oe,Me)|0,H=H+Math.imul(Oe,$e)|0;var hs=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(hs>>>26)|0,hs&=67108863,B=Math.imul(Ee,vt),x=Math.imul(Ee,Lt),x=x+Math.imul(we,vt)|0,H=Math.imul(we,Lt),B=B+Math.imul(K,yt)|0,x=x+Math.imul(K,Pt)|0,x=x+Math.imul(le,yt)|0,H=H+Math.imul(le,Pt)|0,B=B+Math.imul(We,Me)|0,x=x+Math.imul(We,$e)|0,x=x+Math.imul(ne,Me)|0,H=H+Math.imul(ne,$e)|0;var Ml=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Ml>>>26)|0,Ml&=67108863,B=Math.imul(Ee,yt),x=Math.imul(Ee,Pt),x=x+Math.imul(we,yt)|0,H=Math.imul(we,Pt),B=B+Math.imul(K,Me)|0,x=x+Math.imul(K,$e)|0,x=x+Math.imul(le,Me)|0,H=H+Math.imul(le,$e)|0;var Dl=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Dl>>>26)|0,Dl&=67108863,B=Math.imul(Ee,Me),x=Math.imul(Ee,$e),x=x+Math.imul(we,Me)|0,H=Math.imul(we,$e);var pe=(G+B|0)+((x&8191)<<13)|0;return G=(H+(x>>>13)|0)+(pe>>>26)|0,pe&=67108863,U[0]=Mt,U[1]=Tr,U[2]=kr,U[3]=cn,U[4]=dn,U[5]=ni,U[6]=ao,U[7]=ea,U[8]=go,U[9]=ca,U[10]=Ia,U[11]=en,U[12]=Li,U[13]=pi,U[14]=Go,U[15]=hs,U[16]=Ml,U[17]=Dl,U[18]=pe,G!==0&&(U[19]=G,C.length++),C};Math.imul||(b=y);function w(D,E,S){S.negative=E.negative^D.negative,S.length=D.length+E.length;for(var C=0,M=0,k=0;k<S.length-1;k++){var U=M;M=0;for(var G=C&67108863,B=Math.min(k,E.length-1),x=Math.max(0,k-D.length+1);x<=B;x++){var H=k-x,q=D.words[H]|0,W=E.words[x]|0,Y=q*W,re=Y&67108863;U=U+(Y/67108864|0)|0,re=re+G|0,G=re&67108863,U=U+(re>>>26)|0,M+=U>>>26,U&=67108863}S.words[k]=G,C=U,U=M}return C!==0?S.words[k]=C:S.length--,S._strip()}function T(D,E,S){return w(D,E,S)}a.prototype.mulTo=function(E,S){var C,M=this.length+E.length;return this.length===10&&E.length===10?C=b(this,E,S):M<63?C=y(this,E,S):M<1024?C=w(this,E,S):C=T(this,E,S),C},a.prototype.mul=function(E){var S=new a(null);return S.words=new Array(this.length+E.length),this.mulTo(E,S)},a.prototype.mulf=function(E){var S=new a(null);return S.words=new Array(this.length+E.length),T(this,E,S)},a.prototype.imul=function(E){return this.clone().mulTo(E,this)},a.prototype.imuln=function(E){var S=E<0;S&&(E=-E),n(typeof E=="number"),n(E<67108864);for(var C=0,M=0;M<this.length;M++){var k=(this.words[M]|0)*E,U=(k&67108863)+(C&67108863);C>>=26,C+=k/67108864|0,C+=U>>>26,this.words[M]=U&67108863}return C!==0&&(this.words[M]=C,this.length++),S?this.ineg():this},a.prototype.muln=function(E){return this.clone().imuln(E)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(E){var S=m(E);if(S.length===0)return new a(1);for(var C=this,M=0;M<S.length&&S[M]===0;M++,C=C.sqr());if(++M<S.length)for(var k=C.sqr();M<S.length;M++,k=k.sqr())S[M]!==0&&(C=C.mul(k));return C},a.prototype.iushln=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26,M=67108863>>>26-S<<26-S,k;if(S!==0){var U=0;for(k=0;k<this.length;k++){var G=this.words[k]&M,B=(this.words[k]|0)-G<<S;this.words[k]=B|U,U=G>>>26-S}U&&(this.words[k]=U,this.length++)}if(C!==0){for(k=this.length-1;k>=0;k--)this.words[k+C]=this.words[k];for(k=0;k<C;k++)this.words[k]=0;this.length+=C}return this._strip()},a.prototype.ishln=function(E){return n(this.negative===0),this.iushln(E)},a.prototype.iushrn=function(E,S,C){n(typeof E=="number"&&E>=0);var M;S?M=(S-S%26)/26:M=0;var k=E%26,U=Math.min((E-k)/26,this.length),G=67108863^67108863>>>k<<k,B=C;if(M-=U,M=Math.max(0,M),B){for(var x=0;x<U;x++)B.words[x]=this.words[x];B.length=U}if(U!==0)if(this.length>U)for(this.length-=U,x=0;x<this.length;x++)this.words[x]=this.words[x+U];else this.words[0]=0,this.length=1;var H=0;for(x=this.length-1;x>=0&&(H!==0||x>=M);x--){var q=this.words[x]|0;this.words[x]=H<<26-k|q>>>k,H=q&G}return B&&H!==0&&(B.words[B.length++]=H),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(E,S,C){return n(this.negative===0),this.iushrn(E,S,C)},a.prototype.shln=function(E){return this.clone().ishln(E)},a.prototype.ushln=function(E){return this.clone().iushln(E)},a.prototype.shrn=function(E){return this.clone().ishrn(E)},a.prototype.ushrn=function(E){return this.clone().iushrn(E)},a.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26,M=1<<S;if(this.length<=C)return!1;var k=this.words[C];return!!(k&M)},a.prototype.imaskn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=C)return this;if(S!==0&&C++,this.length=Math.min(C,this.length),S!==0){var M=67108863^67108863>>>S<<S;this.words[this.length-1]&=M}return this._strip()},a.prototype.maskn=function(E){return this.clone().imaskn(E)},a.prototype.iaddn=function(E){return n(typeof E=="number"),n(E<67108864),E<0?this.isubn(-E):this.negative!==0?this.length===1&&(this.words[0]|0)<=E?(this.words[0]=E-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(E),this.negative=1,this):this._iaddn(E)},a.prototype._iaddn=function(E){this.words[0]+=E;for(var S=0;S<this.length&&this.words[S]>=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},a.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S<this.length&&this.words[S]<0;S++)this.words[S]+=67108864,this.words[S+1]-=1;return this._strip()},a.prototype.addn=function(E){return this.clone().iaddn(E)},a.prototype.subn=function(E){return this.clone().isubn(E)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(E,S,C){var M=E.length+C,k;this._expand(M);var U,G=0;for(k=0;k<E.length;k++){U=(this.words[k+C]|0)+G;var B=(E.words[k]|0)*S;U-=B&67108863,G=(U>>26)-(B/67108864|0),this.words[k+C]=U&67108863}for(;k<this.length-C;k++)U=(this.words[k+C]|0)+G,G=U>>26,this.words[k+C]=U&67108863;if(G===0)return this._strip();for(n(G===-1),G=0,k=0;k<this.length;k++)U=-(this.words[k]|0)+G,G=U>>26,this.words[k]=U&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(E,S){var C=this.length-E.length,M=this.clone(),k=E,U=k.words[k.length-1]|0,G=this._countBits(U);C=26-G,C!==0&&(k=k.ushln(C),M.iushln(C),U=k.words[k.length-1]|0);var B=M.length-k.length,x;if(S!=="mod"){x=new a(null),x.length=B+1,x.words=new Array(x.length);for(var H=0;H<x.length;H++)x.words[H]=0}var q=M.clone()._ishlnsubmul(k,1,B);q.negative===0&&(M=q,x&&(x.words[B]=1));for(var W=B-1;W>=0;W--){var Y=(M.words[k.length+W]|0)*67108864+(M.words[k.length+W-1]|0);for(Y=Math.min(Y/U|0,67108863),M._ishlnsubmul(k,Y,W);M.negative!==0;)Y--,M.negative=0,M._ishlnsubmul(k,1,W),M.isZero()||(M.negative^=1);x&&(x.words[W]=Y)}return x&&x._strip(),M._strip(),S!=="div"&&C!==0&&M.iushrn(C),{div:x||null,mod:M}},a.prototype.divmod=function(E,S,C){if(n(!E.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var M,k,U;return this.negative!==0&&E.negative===0?(U=this.neg().divmod(E,S),S!=="mod"&&(M=U.div.neg()),S!=="div"&&(k=U.mod.neg(),C&&k.negative!==0&&k.iadd(E)),{div:M,mod:k}):this.negative===0&&E.negative!==0?(U=this.divmod(E.neg(),S),S!=="mod"&&(M=U.div.neg()),{div:M,mod:U.mod}):this.negative&E.negative?(U=this.neg().divmod(E.neg(),S),S!=="div"&&(k=U.mod.neg(),C&&k.negative!==0&&k.isub(E)),{div:U.div,mod:k}):E.length>this.length||this.cmp(E)<0?{div:new a(0),mod:this}:E.length===1?S==="div"?{div:this.divn(E.words[0]),mod:null}:S==="mod"?{div:null,mod:new a(this.modrn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new a(this.modrn(E.words[0]))}:this._wordDiv(E,S)},a.prototype.div=function(E){return this.divmod(E,"div",!1).div},a.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},a.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},a.prototype.divRound=function(E){var S=this.divmod(E);if(S.mod.isZero())return S.div;var C=S.div.negative!==0?S.mod.isub(E):S.mod,M=E.ushrn(1),k=E.andln(1),U=C.cmp(M);return U<0||k===1&&U===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},a.prototype.modrn=function(E){var S=E<0;S&&(E=-E),n(E<=67108863);for(var C=(1<<26)%E,M=0,k=this.length-1;k>=0;k--)M=(C*M+(this.words[k]|0))%E;return S?-M:M},a.prototype.modn=function(E){return this.modrn(E)},a.prototype.idivn=function(E){var S=E<0;S&&(E=-E),n(E<=67108863);for(var C=0,M=this.length-1;M>=0;M--){var k=(this.words[M]|0)+C*67108864;this.words[M]=k/E|0,C=k%E}return this._strip(),S?this.ineg():this},a.prototype.divn=function(E){return this.clone().idivn(E)},a.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var S=this,C=E.clone();S.negative!==0?S=S.umod(E):S=S.clone();for(var M=new a(1),k=new a(0),U=new a(0),G=new a(1),B=0;S.isEven()&&C.isEven();)S.iushrn(1),C.iushrn(1),++B;for(var x=C.clone(),H=S.clone();!S.isZero();){for(var q=0,W=1;!(S.words[0]&W)&&q<26;++q,W<<=1);if(q>0)for(S.iushrn(q);q-- >0;)(M.isOdd()||k.isOdd())&&(M.iadd(x),k.isub(H)),M.iushrn(1),k.iushrn(1);for(var Y=0,re=1;!(C.words[0]&re)&&Y<26;++Y,re<<=1);if(Y>0)for(C.iushrn(Y);Y-- >0;)(U.isOdd()||G.isOdd())&&(U.iadd(x),G.isub(H)),U.iushrn(1),G.iushrn(1);S.cmp(C)>=0?(S.isub(C),M.isub(U),k.isub(G)):(C.isub(S),U.isub(M),G.isub(k))}return{a:U,b:G,gcd:C.iushln(B)}},a.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var S=this,C=E.clone();S.negative!==0?S=S.umod(E):S=S.clone();for(var M=new a(1),k=new a(0),U=C.clone();S.cmpn(1)>0&&C.cmpn(1)>0;){for(var G=0,B=1;!(S.words[0]&B)&&G<26;++G,B<<=1);if(G>0)for(S.iushrn(G);G-- >0;)M.isOdd()&&M.iadd(U),M.iushrn(1);for(var x=0,H=1;!(C.words[0]&H)&&x<26;++x,H<<=1);if(x>0)for(C.iushrn(x);x-- >0;)k.isOdd()&&k.iadd(U),k.iushrn(1);S.cmp(C)>=0?(S.isub(C),M.isub(k)):(C.isub(S),k.isub(M))}var q;return S.cmpn(1)===0?q=M:q=k,q.cmpn(0)<0&&q.iadd(E),q},a.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var S=this.clone(),C=E.clone();S.negative=0,C.negative=0;for(var M=0;S.isEven()&&C.isEven();M++)S.iushrn(1),C.iushrn(1);do{for(;S.isEven();)S.iushrn(1);for(;C.isEven();)C.iushrn(1);var k=S.cmp(C);if(k<0){var U=S;S=C,C=U}else if(k===0||C.cmpn(1)===0)break;S.isub(C)}while(!0);return C.iushln(M)},a.prototype.invm=function(E){return this.egcd(E).a.umod(E)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(E){return this.words[0]&E},a.prototype.bincn=function(E){n(typeof E=="number");var S=E%26,C=(E-S)/26,M=1<<S;if(this.length<=C)return this._expand(C+1),this.words[C]|=M,this;for(var k=M,U=C;k!==0&&U<this.length;U++){var G=this.words[U]|0;G+=k,k=G>>>26,G&=67108863,this.words[U]=G}return k!==0&&(this.words[U]=k,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(E){var S=E<0;if(this.negative!==0&&!S)return-1;if(this.negative===0&&S)return 1;this._strip();var C;if(this.length>1)C=1;else{S&&(E=-E),n(E<=67108863,"Number is too big");var M=this.words[0]|0;C=M===E?0:M<E?-1:1}return this.negative!==0?-C|0:C},a.prototype.cmp=function(E){if(this.negative!==0&&E.negative===0)return-1;if(this.negative===0&&E.negative!==0)return 1;var S=this.ucmp(E);return this.negative!==0?-S|0:S},a.prototype.ucmp=function(E){if(this.length>E.length)return 1;if(this.length<E.length)return-1;for(var S=0,C=this.length-1;C>=0;C--){var M=this.words[C]|0,k=E.words[C]|0;if(M!==k){M<k?S=-1:M>k&&(S=1);break}}return S},a.prototype.gtn=function(E){return this.cmpn(E)===1},a.prototype.gt=function(E){return this.cmp(E)===1},a.prototype.gten=function(E){return this.cmpn(E)>=0},a.prototype.gte=function(E){return this.cmp(E)>=0},a.prototype.ltn=function(E){return this.cmpn(E)===-1},a.prototype.lt=function(E){return this.cmp(E)===-1},a.prototype.lten=function(E){return this.cmpn(E)<=0},a.prototype.lte=function(E){return this.cmp(E)<=0},a.prototype.eqn=function(E){return this.cmpn(E)===0},a.prototype.eq=function(E){return this.cmp(E)===0},a.red=function(E){return new $(E)},a.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(E){return this.red=E,this},a.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},a.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},a.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},a.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},a.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},a.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},a.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},a.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var R={k256:null,p224:null,p192:null,p25519:null};function N(D,E){this.name=D,this.p=new a(E,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}N.prototype._tmp=function(){var E=new a(null);return E.words=new Array(Math.ceil(this.n/13)),E},N.prototype.ireduce=function(E){var S=E,C;do this.split(S,this.tmp),S=this.imulK(S),S=S.iadd(this.tmp),C=S.bitLength();while(C>this.n);var M=C<this.n?-1:S.ucmp(this.p);return M===0?(S.words[0]=0,S.length=1):M>0?S.isub(this.p):S.strip!==void 0?S.strip():S._strip(),S},N.prototype.split=function(E,S){E.iushrn(this.n,0,S)},N.prototype.imulK=function(E){return E.imul(this.k)};function A(){N.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(A,N),A.prototype.split=function(E,S){for(var C=4194303,M=Math.min(E.length,9),k=0;k<M;k++)S.words[k]=E.words[k];if(S.length=M,E.length<=9){E.words[0]=0,E.length=1;return}var U=E.words[9];for(S.words[S.length++]=U&C,k=10;k<E.length;k++){var G=E.words[k]|0;E.words[k-10]=(G&C)<<4|U>>>22,U=G}U>>>=22,E.words[k-10]=U,U===0&&E.length>10?E.length-=10:E.length-=9},A.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var S=0,C=0;C<E.length;C++){var M=E.words[C]|0;S+=M*977,E.words[C]=S&67108863,S=M*64+(S/67108864|0)}return E.words[E.length-1]===0&&(E.length--,E.words[E.length-1]===0&&E.length--),E};function L(){N.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(L,N);function O(){N.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(O,N);function I(){N.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(I,N),I.prototype.imulK=function(E){for(var S=0,C=0;C<E.length;C++){var M=(E.words[C]|0)*19+S,k=M&67108863;M>>>=26,E.words[C]=k,S=M}return S!==0&&(E.words[E.length++]=S),E},a._prime=function(E){if(R[E])return R[E];var S;if(E==="k256")S=new A;else if(E==="p224")S=new L;else if(E==="p192")S=new O;else if(E==="p25519")S=new I;else throw new Error("Unknown prime "+E);return R[E]=S,S};function $(D){if(typeof D=="string"){var E=a._prime(D);this.m=E.p,this.prime=E}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}$.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},$.prototype._verify2=function(E,S){n((E.negative|S.negative)===0,"red works only with positives"),n(E.red&&E.red===S.red,"red works only with red numbers")},$.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):(c(E,E.umod(this.m)._forceRed(this)),E)},$.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},$.prototype.add=function(E,S){this._verify2(E,S);var C=E.add(S);return C.cmp(this.m)>=0&&C.isub(this.m),C._forceRed(this)},$.prototype.iadd=function(E,S){this._verify2(E,S);var C=E.iadd(S);return C.cmp(this.m)>=0&&C.isub(this.m),C},$.prototype.sub=function(E,S){this._verify2(E,S);var C=E.sub(S);return C.cmpn(0)<0&&C.iadd(this.m),C._forceRed(this)},$.prototype.isub=function(E,S){this._verify2(E,S);var C=E.isub(S);return C.cmpn(0)<0&&C.iadd(this.m),C},$.prototype.shl=function(E,S){return this._verify1(E),this.imod(E.ushln(S))},$.prototype.imul=function(E,S){return this._verify2(E,S),this.imod(E.imul(S))},$.prototype.mul=function(E,S){return this._verify2(E,S),this.imod(E.mul(S))},$.prototype.isqr=function(E){return this.imul(E,E.clone())},$.prototype.sqr=function(E){return this.mul(E,E)},$.prototype.sqrt=function(E){if(E.isZero())return E.clone();var S=this.m.andln(3);if(n(S%2===1),S===3){var C=this.m.add(new a(1)).iushrn(2);return this.pow(E,C)}for(var M=this.m.subn(1),k=0;!M.isZero()&&M.andln(1)===0;)k++,M.iushrn(1);n(!M.isZero());var U=new a(1).toRed(this),G=U.redNeg(),B=this.m.subn(1).iushrn(1),x=this.m.bitLength();for(x=new a(2*x*x).toRed(this);this.pow(x,B).cmp(G)!==0;)x.redIAdd(G);for(var H=this.pow(x,M),q=this.pow(E,M.addn(1).iushrn(1)),W=this.pow(E,M),Y=k;W.cmp(U)!==0;){for(var re=W,Q=0;re.cmp(U)!==0;Q++)re=re.redSqr();n(Q<Y);var ie=this.pow(H,new a(1).iushln(Y-Q-1));q=q.redMul(ie),H=ie.redSqr(),W=W.redMul(H),Y=Q}return q},$.prototype.invm=function(E){var S=E._invmp(this.m);return S.negative!==0?(S.negative=0,this.imod(S).redNeg()):this.imod(S)},$.prototype.pow=function(E,S){if(S.isZero())return new a(1).toRed(this);if(S.cmpn(1)===0)return E.clone();var C=4,M=new Array(1<<C);M[0]=new a(1).toRed(this),M[1]=E;for(var k=2;k<M.length;k++)M[k]=this.mul(M[k-1],E);var U=M[0],G=0,B=0,x=S.bitLength()%26;for(x===0&&(x=26),k=S.length-1;k>=0;k--){for(var H=S.words[k],q=x-1;q>=0;q--){var W=H>>q&1;if(U!==M[0]&&(U=this.sqr(U)),W===0&&G===0){B=0;continue}G<<=1,G|=W,B++,!(B!==C&&(k!==0||q!==0))&&(U=this.mul(U,M[G]),B=0,G=0)}x=26}return U},$.prototype.convertTo=function(E){var S=E.umod(this.m);return S===E?S.clone():S},$.prototype.convertFrom=function(E){var S=E.clone();return S.red=null,S},a.mont=function(E){return new F(E)};function F(D){$.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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(F,$),F.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},F.prototype.convertFrom=function(E){var S=this.imod(E.mul(this.rinv));return S.red=null,S},F.prototype.imul=function(E,S){if(E.isZero()||S.isZero())return E.words[0]=0,E.length=1,E;var C=E.imul(S),M=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=C.isub(M).iushrn(this.shift),U=k;return k.cmp(this.m)>=0?U=k.isub(this.m):k.cmpn(0)<0&&(U=k.iadd(this.m)),U._forceRed(this)},F.prototype.mul=function(E,S){if(E.isZero()||S.isZero())return new a(0)._forceRed(this);var C=E.mul(S),M=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=C.isub(M).iushrn(this.shift),U=k;return k.cmp(this.m)>=0?U=k.isub(this.m):k.cmpn(0)<0&&(U=k.iadd(this.m)),U._forceRed(this)},F.prototype.invm=function(E){var S=this.imod(E._invmp(this.m).mul(this.r2));return S._forceRed(this)}})(e,gt)})(d2e);var vPt=d2e.exports;const gPt=Nn(vPt),mPt="logger/5.7.0";let cRe=!1,fRe=!1;const fF={debug:1,default:2,info:2,warning:3,error:4,off:5};let dRe=fF.default,xie=null;function yPt(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{e.push(t)}}),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}const hRe=yPt();var Che;(function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"})(Che||(Che={}));var e0;(function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"})(e0||(e0={}));const pRe="0123456789abcdef";class Le{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,r){const n=t.toLowerCase();fF[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(dRe>fF[n])&&console.log.apply(console,r)}debug(...t){this._log(Le.levels.DEBUG,t)}info(...t){this._log(Le.levels.INFO,t)}warn(...t){this._log(Le.levels.WARNING,t)}makeError(t,r,n){if(fRe)return this.makeError("censored error",r,{});r||(r=Le.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(l=>{const u=n[l];try{if(u instanceof Uint8Array){let c="";for(let f=0;f<u.length;f++)c+=pRe[u[f]>>4],c+=pRe[u[f]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(u))}catch{i.push(l+"="+JSON.stringify(n[l].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const a=t;let o="";switch(r){case e0.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=t;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case e0.CALL_EXCEPTION:case e0.INSUFFICIENT_FUNDS:case e0.MISSING_NEW:case e0.NONCE_EXPIRED:case e0.REPLACEMENT_UNDERPRICED:case e0.TRANSACTION_REPLACED:case e0.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const s=new Error(t);return s.reason=a,s.code=r,Object.keys(n).forEach(function(l){s[l]=n[l]}),s}throwError(t,r,n){throw this.makeError(t,r,n)}throwArgumentError(t,r,n){return this.throwError(t,Le.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(t,r,n,i){t||this.throwError(r,n,i)}assertArgument(t,r,n,i){t||this.throwArgumentError(r,n,i)}checkNormalize(t){hRe&&this.throwError("platform missing String.prototype.normalize",Le.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:hRe})}checkSafeUint53(t,r){typeof t=="number"&&(r==null&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,Le.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,Le.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n?n=": "+n:n="",t<r&&this.throwError("missing argument"+n,Le.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,Le.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){(t===Object||t==null)&&this.throwError("missing new",Le.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",Le.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",Le.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return xie||(xie=new Le(mPt)),xie}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",Le.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),cRe){if(!t)return;this.globalLogger().throwError("error censorship permanent",Le.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fRe=!!t,cRe=!!r}static setLogLevel(t){const r=fF[t.toLowerCase()];if(r==null){Le.globalLogger().warn("invalid log level - "+t);return}dRe=r}static from(t){return new Le(t)}}Le.errors=e0;Le.levels=Che;const EPt="bytes/5.7.0",Bs=new Le(EPt);function SXe(e){return!!e.toHexString}function a4(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return a4(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function IM(e){return li(e)&&!(e.length%2)||m_(e)}function vRe(e){return typeof e=="number"&&e==e&&e%1===0}function m_(e){if(e==null)return!1;if(e.constructor===Uint8Array)return!0;if(typeof e=="string"||!vRe(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!vRe(r)||r<0||r>=256)return!1}return!0}function kt(e,t){if(t||(t={}),typeof e=="number"){Bs.checkSafeUint53(e,"invalid arrayify value");const r=[];for(;e;)r.unshift(e&255),e=parseInt(String(e/256));return r.length===0&&r.push(0),a4(new Uint8Array(r))}if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),SXe(e)&&(e=e.toHexString()),li(e)){let r=e.substring(2);r.length%2&&(t.hexPad==="left"?r="0"+r:t.hexPad==="right"?r+="0":Bs.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return a4(new Uint8Array(n))}return m_(e)?a4(new Uint8Array(e)):Bs.throwArgumentError("invalid arrayify value","value",e)}function xo(e){const t=e.map(i=>kt(i)),r=t.reduce((i,a)=>i+a.length,0),n=new Uint8Array(r);return t.reduce((i,a)=>(n.set(a,i),i+a.length),0),a4(n)}function X1(e){let t=kt(e);if(t.length===0)return t;let r=0;for(;r<t.length&&t[r]===0;)r++;return r&&(t=t.slice(r)),t}function VL(e,t){e=kt(e),e.length>t&&Bs.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),a4(r)}function li(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}const Iie="0123456789abcdef";function Kt(e,t){if(t||(t={}),typeof e=="number"){Bs.checkSafeUint53(e,"invalid hexlify value");let r="";for(;e;)r=Iie[e&15]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof e=="bigint")return e=e.toString(16),e.length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),SXe(e))return e.toHexString();if(li(e))return e.length%2&&(t.hexPad==="left"?e="0x0"+e.substring(2):t.hexPad==="right"?e+="0":Bs.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(m_(e)){let r="0x";for(let n=0;n<e.length;n++){let i=e[n];r+=Iie[(i&240)>>4]+Iie[i&15]}return r}return Bs.throwArgumentError("invalid hexlify value","value",e)}function _g(e){if(typeof e!="string")e=Kt(e);else if(!li(e)||e.length%2)return null;return(e.length-2)/2}function ol(e,t,r){return typeof e!="string"?e=Kt(e):(!li(e)||e.length%2)&&Bs.throwArgumentError("invalid hexData","value",e),t=2+2*t,r!=null?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Af(e){let t="0x";return e.forEach(r=>{t+=Kt(r).substring(2)}),t}function OM(e){const t=wXe(Kt(e,{hexPad:"left"}));return t==="0x"?"0x0":t}function wXe(e){typeof e!="string"&&(e=Kt(e)),li(e)||Bs.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t<e.length&&e[t]==="0";)t++;return"0x"+e.substring(t)}function Oo(e,t){for(typeof e!="string"?e=Kt(e):li(e)||Bs.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Bs.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function mA(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(IM(e)){let r=kt(e);r.length===64?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Kt(r.slice(0,32)),t.s=Kt(r.slice(32,64))):r.length===65?(t.r=Kt(r.slice(0,32)),t.s=Kt(r.slice(32,64)),t.v=r[64]):Bs.throwArgumentError("invalid signature string","signature",e),t.v<27&&(t.v===0||t.v===1?t.v+=27:Bs.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Kt(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,t._vs!=null){const i=VL(kt(t._vs),32);t._vs=Kt(i);const a=i[0]>=128?1:0;t.recoveryParam==null?t.recoveryParam=a:t.recoveryParam!==a&&Bs.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),i[0]&=127;const o=Kt(i);t.s==null?t.s=o:t.s!==o&&Bs.throwArgumentError("signature v mismatch _vs","signature",e)}if(t.recoveryParam==null)t.v==null?Bs.throwArgumentError("signature missing v and recoveryParam","signature",e):t.v===0||t.v===1?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(t.v==null)t.v=27+t.recoveryParam;else{const i=t.v===0||t.v===1?t.v:1-t.v%2;t.recoveryParam!==i&&Bs.throwArgumentError("signature recoveryParam mismatch v","signature",e)}t.r==null||!li(t.r)?Bs.throwArgumentError("signature missing or invalid r","signature",e):t.r=Oo(t.r,32),t.s==null||!li(t.s)?Bs.throwArgumentError("signature missing or invalid s","signature",e):t.s=Oo(t.s,32);const r=kt(t.s);r[0]>=128&&Bs.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Kt(r);t._vs&&(li(t._vs)||Bs.throwArgumentError("signature invalid _vs","signature",e),t._vs=Oo(t._vs,32)),t._vs==null?t._vs=n:t._vs!==n&&Bs.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Rhe(e){return e=mA(e),Kt(xo([e.r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}const TXe="bignumber/5.7.0";var R9=gPt.BN;const ty=new Le(TXe),Oie={},gRe=9007199254740991;function bPt(e){return e!=null&&(Ut.isBigNumber(e)||typeof e=="number"&&e%1===0||typeof e=="string"&&!!e.match(/^-?[0-9]+$/)||li(e)||typeof e=="bigint"||m_(e))}let mRe=!1;class Ut{constructor(t,r){t!==Oie&&ty.throwError("cannot call constructor directly; use BigNumber.from",Le.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return ed(Yi(this).fromTwos(t))}toTwos(t){return ed(Yi(this).toTwos(t))}abs(){return this._hex[0]==="-"?Ut.from(this._hex.substring(1)):this}add(t){return ed(Yi(this).add(Yi(t)))}sub(t){return ed(Yi(this).sub(Yi(t)))}div(t){return Ut.from(t).isZero()&&Nh("division-by-zero","div"),ed(Yi(this).div(Yi(t)))}mul(t){return ed(Yi(this).mul(Yi(t)))}mod(t){const r=Yi(t);return r.isNeg()&&Nh("division-by-zero","mod"),ed(Yi(this).umod(r))}pow(t){const r=Yi(t);return r.isNeg()&&Nh("negative-power","pow"),ed(Yi(this).pow(r))}and(t){const r=Yi(t);return(this.isNegative()||r.isNeg())&&Nh("unbound-bitwise-result","and"),ed(Yi(this).and(r))}or(t){const r=Yi(t);return(this.isNegative()||r.isNeg())&&Nh("unbound-bitwise-result","or"),ed(Yi(this).or(r))}xor(t){const r=Yi(t);return(this.isNegative()||r.isNeg())&&Nh("unbound-bitwise-result","xor"),ed(Yi(this).xor(r))}mask(t){return(this.isNegative()||t<0)&&Nh("negative-width","mask"),ed(Yi(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Nh("negative-width","shl"),ed(Yi(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Nh("negative-width","shr"),ed(Yi(this).shrn(t))}eq(t){return Yi(this).eq(Yi(t))}lt(t){return Yi(this).lt(Yi(t))}lte(t){return Yi(this).lte(Yi(t))}gt(t){return Yi(this).gt(Yi(t))}gte(t){return Yi(this).gte(Yi(t))}isNegative(){return this._hex[0]==="-"}isZero(){return Yi(this).isZero()}toNumber(){try{return Yi(this).toNumber()}catch{Nh("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ty.throwError("this platform does not support BigInt",Le.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?mRe||(mRe=!0,ty.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ty.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Le.errors.UNEXPECTED_ARGUMENT,{}):ty.throwError("BigNumber.toString does not accept parameters",Le.errors.UNEXPECTED_ARGUMENT,{})),Yi(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Ut)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new Ut(Oie,x9(t)):t.match(/^-?[0-9]+$/)?new Ut(Oie,x9(new R9(t))):ty.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&Nh("underflow","BigNumber.from",t),(t>=gRe||t<=-gRe)&&Nh("overflow","BigNumber.from",t),Ut.from(String(t));const r=t;if(typeof r=="bigint")return Ut.from(r.toString());if(m_(r))return Ut.from(Kt(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Ut.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(li(n)||n[0]==="-"&&li(n.substring(1))))return Ut.from(n)}return ty.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}}function x9(e){if(typeof e!="string")return x9(e.toString(16));if(e[0]==="-")return e=e.substring(1),e[0]==="-"&&ty.throwArgumentError("invalid hex","value",e),e=x9(e),e==="0x00"?e:"-"+e;if(e.substring(0,2)!=="0x"&&(e="0x"+e),e==="0x")return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&e.substring(0,4)==="0x00";)e="0x"+e.substring(4);return e}function ed(e){return Ut.from(x9(e))}function Yi(e){const t=Ut.from(e).toHexString();return t[0]==="-"?new R9("-"+t.substring(3),16):new R9(t.substring(2),16)}function Nh(e,t,r){const n={fault:e,operation:t};return r!=null&&(n.value=r),ty.throwError(e,Le.errors.NUMERIC_FAULT,n)}function _Pt(e){return new R9(e,36).toString(16)}function SPt(e){return new R9(e,16).toString(36)}const Cf=new Le(TXe),WL={},AXe=Ut.from(0),CXe=Ut.from(-1);function RXe(e,t,r,n){const i={fault:t,operation:r};return n!==void 0&&(i.value=n),Cf.throwError(e,Le.errors.NUMERIC_FAULT,i)}let jL="0";for(;jL.length<256;)jL+=jL;function h2e(e){if(typeof e!="number")try{e=Ut.from(e).toNumber()}catch{}return typeof e=="number"&&e>=0&&e<=256&&!(e%1)?"1"+jL.substring(0,e):Cf.throwArgumentError("invalid decimal size","decimals",e)}function dF(e,t){t==null&&(t=0);const r=h2e(t);e=Ut.from(e);const n=e.lt(AXe);n&&(e=e.mul(CXe));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=e.div(r).toString();return r.length===1?e=a:e=a+"."+i,n&&(e="-"+e),e}function s1(e,t){t==null&&(t=0);const r=h2e(t);(typeof e!="string"||!e.match(/^-?[0-9.]+$/))&&Cf.throwArgumentError("invalid decimal value","value",e);const n=e.substring(0,1)==="-";n&&(e=e.substring(1)),e==="."&&Cf.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Cf.throwArgumentError("too many decimal points","value",e);let a=i[0],o=i[1];for(a||(a="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&RXe("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.length<r.length-1;)o+="0";const s=Ut.from(a),l=Ut.from(o);let u=s.mul(r).add(l);return n&&(u=u.mul(CXe)),u}class o4{constructor(t,r,n,i){t!==WL&&Cf.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Le.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=n,this.decimals=i,this.name=(r?"":"u")+"fixed"+String(n)+"x"+String(i),this._multiplier=h2e(i),Object.freeze(this)}static from(t){if(t instanceof o4)return t;typeof t=="number"&&(t=`fixed128x${t}`);let r=!0,n=128,i=18;if(typeof t=="string"){if(t!=="fixed")if(t==="ufixed")r=!1;else{const a=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);a||Cf.throwArgumentError("invalid fixed format","format",t),r=a[1]!=="u",n=parseInt(a[2]),i=parseInt(a[3])}}else if(t){const a=(o,s,l)=>t[o]==null?l:(typeof t[o]!==s&&Cf.throwArgumentError("invalid fixed format ("+o+" not "+s+")","format."+o,t[o]),t[o]);r=a("signed","boolean",r),n=a("width","number",n),i=a("decimals","number",i)}return n%8&&Cf.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&Cf.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new o4(WL,r,n,i)}}class pu{constructor(t,r,n,i){t!==WL&&Cf.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Le.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Cf.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=s1(this._value,this.format.decimals),n=s1(t._value,t.format.decimals);return pu.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");t.length===1&&t.push("0");let r=pu.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(yRe.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");t.length===1&&t.push("0");let r=pu.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(yRe.toFormat(r.format))),r}round(t){t==null&&(t=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(t<0||t>80||t%1)&&Cf.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=pu.from("1"+jL.substring(0,t),this.format),i=wPt.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(t){if(t==null)return this._hex;t%8&&Cf.throwArgumentError("invalid byte width","width",t);const r=Ut.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return Oo(r,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return pu.fromString(this._value,t)}static fromValue(t,r,n){return n==null&&r!=null&&!bPt(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),pu.fromString(dF(t,r),o4.from(n))}static fromString(t,r){r==null&&(r="fixed");const n=o4.from(r),i=s1(t,n.decimals);!n.signed&&i.lt(AXe)&&RXe("unsigned value cannot be negative","overflow","value",t);let a=null;n.signed?a=i.toTwos(n.width).toHexString():(a=i.toHexString(),a=Oo(a,n.width/8));const o=dF(i,n.decimals);return new pu(WL,a,o,n)}static fromBytes(t,r){r==null&&(r="fixed");const n=o4.from(r);if(kt(t).length>n.width/8)throw new Error("overflow");let i=Ut.from(t);n.signed&&(i=i.fromTwos(n.width));const a=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=dF(i,n.decimals);return new pu(WL,a,o,n)}static from(t,r){if(typeof t=="string")return pu.fromString(t,r);if(m_(t))return pu.fromBytes(t,r);try{return pu.fromValue(t,0,r)}catch(n){if(n.code!==Le.errors.INVALID_ARGUMENT)throw n}return Cf.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!!(t&&t._isFixedNumber)}}const yRe=pu.from(1),wPt=pu.from("0.5"),TPt="properties/5.7.0";var APt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const gG=new Le(TPt);function ot(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function Ju(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||typeof e.prototype!="object")break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function Us(e){return APt(this,void 0,void 0,function*(){const t=Object.keys(e).map(n=>{const i=e[n];return Promise.resolve(i).then(a=>({key:n,value:a}))});return(yield Promise.all(t)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function p2e(e,t){(!e||typeof e!="object")&&gG.throwArgumentError("invalid object","object",e),Object.keys(e).forEach(r=>{t[r]||gG.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)})}function Uo(e){const t={};for(const r in e)t[r]=e[r];return t}const CPt={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function xXe(e){if(e==null||CPt[typeof e])return!0;if(Array.isArray(e)||typeof e=="object"){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;r<t.length;r++){let n=null;try{n=e[t[r]]}catch{continue}if(!xXe(n))return!1}return!0}return gG.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function RPt(e){if(xXe(e))return e;if(Array.isArray(e))return Object.freeze(e.map(t=>Nf(t)));if(typeof e=="object"){const t={};for(const r in e){const n=e[r];n!==void 0&&ot(t,r,Nf(n))}return t}return gG.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}function Nf(e){return RPt(e)}class yA{constructor(t){for(const r in t)this[r]=Nf(t[r])}}const NM="abi/5.7.0",ia=new Le(NM),TT={};let ERe={calldata:!0,memory:!0,storage:!0},xPt={calldata:!0,memory:!0};function B$(e,t){if(e==="bytes"||e==="string"){if(ERe[t])return!0}else if(e==="address"){if(t==="payable")return!0}else if((e.indexOf("[")>=0||e==="tuple")&&xPt[t])return!0;return(ERe[t]||t==="payable")&&ia.throwArgumentError("invalid modifier","name",t),!1}function IPt(e,t){let r=e;function n(s){ia.throwArgumentError(`unexpected character at position ${s}`,"param",e)}e=e.replace(/\s/g," ");function i(s){let l={type:"",name:"",parent:s,state:{allowType:!0}};return t&&(l.indexed=!1),l}let a={type:"",name:"",state:{allowType:!0}},o=a;for(let s=0;s<e.length;s++){let l=e[s];switch(l){case"(":o.state.allowType&&o.type===""?o.type="tuple":o.state.allowParams||n(s),o.state.allowType=!1,o.type=pC(o.type),o.components=[i(o)],o=o.components[0];break;case")":delete o.state,o.name==="indexed"&&(t||n(s),o.indexed=!0,o.name=""),B$(o.type,o.name)&&(o.name=""),o.type=pC(o.type);let u=o;o=o.parent,o||n(s),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,o.name==="indexed"&&(t||n(s),o.indexed=!0,o.name=""),B$(o.type,o.name)&&(o.name=""),o.type=pC(o.type);let c=i(o.parent);o.parent.components.push(c),delete o.parent,o=c;break;case" ":o.state.allowType&&o.type!==""&&(o.type=pC(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&o.name!==""&&(o.name==="indexed"?(t||n(s),o.indexed&&n(s),o.indexed=!0,o.name=""):B$(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||n(s),o.type+=l,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(s),o.type+=l,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=l,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=l,delete o.state.allowArray):o.state.readArray?o.type+=l:n(s)}}return o.parent&&ia.throwArgumentError("unexpected eof","param",e),delete a.state,o.name==="indexed"?(t||n(r.length-7),o.indexed&&n(r.length-7),o.indexed=!0,o.name=""):B$(o.type,o.name)&&(o.name=""),a.type=pC(a.type),a}function hF(e,t){for(let r in t)ot(e,r,t[r])}const ga=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),OPt=new RegExp(/^(.*)\[([0-9]*)\]$/);class Kl{constructor(t,r){t!==TT&&ia.throwError("use fromString",Le.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),hF(this,r);let n=this.type.match(OPt);n?hF(this,{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Kl.fromObject({type:n[1],components:this.components}),baseType:"array"}):hF(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json){let n={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(n.indexed=this.indexed),this.components&&(n.components=this.components.map(i=>JSON.parse(i.format(t)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(t),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(t!==ga.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(t)).join(t===ga.full?", ":",")+")"):r+=this.type,t!==ga.sighash&&(this.indexed===!0&&(r+=" indexed"),t===ga.full&&this.name&&(r+=" "+this.name)),r}static from(t,r){return typeof t=="string"?Kl.fromString(t,r):Kl.fromObject(t)}static fromObject(t){return Kl.isParamType(t)?t:new Kl(TT,{name:t.name||null,type:pC(t.type),indexed:t.indexed==null?null:!!t.indexed,components:t.components?t.components.map(Kl.fromObject):null})}static fromString(t,r){function n(i){return Kl.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n(IPt(t,!!r))}static isParamType(t){return!!(t!=null&&t._isParamType)}}function I9(e,t){return LPt(e).map(r=>Kl.fromString(r,t))}class L1{constructor(t,r){t!==TT&&ia.throwError("use a static from method",Le.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),hF(this,r),this._isFragment=!0,Object.freeze(this)}static from(t){return L1.isFragment(t)?t:typeof t=="string"?L1.fromString(t):L1.fromObject(t)}static fromObject(t){if(L1.isFragment(t))return t;switch(t.type){case"function":return Wp.fromObject(t);case"event":return _1.fromObject(t);case"constructor":return Vp.fromObject(t);case"error":return py.fromObject(t);case"fallback":case"receive":return null}return ia.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return t=t.replace(/\s/g," "),t=t.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),t=t.trim(),t.split(" ")[0]==="event"?_1.fromString(t.substring(5).trim()):t.split(" ")[0]==="function"?Wp.fromString(t.substring(8).trim()):t.split("(")[0].trim()==="constructor"?Vp.fromString(t.trim()):t.split(" ")[0]==="error"?py.fromString(t.substring(5).trim()):ia.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!!(t&&t._isFragment)}}class _1 extends L1{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(t)))});let r="";return t!==ga.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ",t!==ga.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(t){return typeof t=="string"?_1.fromString(t):_1.fromObject(t)}static fromObject(t){if(_1.isEventFragment(t))return t;t.type!=="event"&&ia.throwArgumentError("invalid event object","value",t);const r={name:O9(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Kl.fromObject):[],type:"event"};return new _1(TT,r)}static fromString(t){let r=t.match(N9);r||ia.throwArgumentError("invalid event string","value",t);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:ia.warn("unknown modifier: "+i)}}),_1.fromObject({name:r[1].trim(),anonymous:n,inputs:I9(r[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&t.type==="event"}}function IXe(e,t){t.gas=null;let r=e.split("@");return r.length!==1?(r.length>2&&ia.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||ia.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Ut.from(r[1]),r[0]):e}function OXe(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach(r=>{switch(r.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function NXe(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return e.stateMutability!=null?(t.stateMutability=e.stateMutability,t.constant=t.stateMutability==="view"||t.stateMutability==="pure",e.constant!=null&&!!e.constant!==t.constant&&ia.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable=t.stateMutability==="payable",e.payable!=null&&!!e.payable!==t.payable&&ia.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):e.payable!=null?(t.payable=!!e.payable,e.constant==null&&!t.payable&&e.type!=="constructor"&&ia.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&ia.throwArgumentError("cannot have constant payable function","value",e)):e.constant!=null?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):e.type!=="constructor"&&ia.throwArgumentError("unable to determine stateMutability","value",e),t}class Vp extends L1{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(t)))});t===ga.sighash&&ia.throwError("cannot format a constructor for sighash",Le.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(t){return typeof t=="string"?Vp.fromString(t):Vp.fromObject(t)}static fromObject(t){if(Vp.isConstructorFragment(t))return t;t.type!=="constructor"&&ia.throwArgumentError("invalid constructor object","value",t);let r=NXe(t);r.constant&&ia.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Kl.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Ut.from(t.gas):null};return new Vp(TT,n)}static fromString(t){let r={type:"constructor"};t=IXe(t,r);let n=t.match(N9);return(!n||n[1].trim()!=="constructor")&&ia.throwArgumentError("invalid constructor string","value",t),r.inputs=I9(n[2].trim(),!1),OXe(n[3].trim(),r),Vp.fromObject(r)}static isConstructorFragment(t){return t&&t._isFragment&&t.type==="constructor"}}class Wp extends Vp{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(t))),outputs:this.outputs.map(n=>JSON.parse(n.format(t)))});let r="";return t!==ga.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ",t!==ga.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(t)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(t){return typeof t=="string"?Wp.fromString(t):Wp.fromObject(t)}static fromObject(t){if(Wp.isFunctionFragment(t))return t;t.type!=="function"&&ia.throwArgumentError("invalid function object","value",t);let r=NXe(t);const n={type:t.type,name:O9(t.name),constant:r.constant,inputs:t.inputs?t.inputs.map(Kl.fromObject):[],outputs:t.outputs?t.outputs.map(Kl.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:t.gas?Ut.from(t.gas):null};return new Wp(TT,n)}static fromString(t){let r={type:"function"};t=IXe(t,r);let n=t.split(" returns ");n.length>2&&ia.throwArgumentError("invalid function string","value",t);let i=n[0].match(N9);if(i||ia.throwArgumentError("invalid function signature","value",t),r.name=i[1].trim(),r.name&&O9(r.name),r.inputs=I9(i[2],!1),OXe(i[3].trim(),r),n.length>1){let a=n[1].match(N9);(a[1].trim()!=""||a[3].trim()!="")&&ia.throwArgumentError("unexpected tokens","value",t),r.outputs=I9(a[2],!1)}else r.outputs=[];return Wp.fromObject(r)}static isFunctionFragment(t){return t&&t._isFragment&&t.type==="function"}}function bRe(e){const t=e.format();return(t==="Error(string)"||t==="Panic(uint256)")&&ia.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class py extends L1{format(t){if(t||(t=ga.sighash),ga[t]||ia.throwArgumentError("invalid format type","format",t),t===ga.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(t)))});let r="";return t!==ga.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(t)).join(t===ga.full?", ":",")+") ",r.trim()}static from(t){return typeof t=="string"?py.fromString(t):py.fromObject(t)}static fromObject(t){if(py.isErrorFragment(t))return t;t.type!=="error"&&ia.throwArgumentError("invalid error object","value",t);const r={type:t.type,name:O9(t.name),inputs:t.inputs?t.inputs.map(Kl.fromObject):[]};return bRe(new py(TT,r))}static fromString(t){let r={type:"error"},n=t.match(N9);return n||ia.throwArgumentError("invalid error signature","value",t),r.name=n[1].trim(),r.name&&O9(r.name),r.inputs=I9(n[2],!1),bRe(py.fromObject(r))}static isErrorFragment(t){return t&&t._isFragment&&t.type==="error"}}function pC(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const NPt=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function O9(e){return(!e||!e.match(NPt))&&ia.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const N9=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function LPt(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a===","&&n===0?(t.push(r),r=""):(r+=a,a==="("?n++:a===")"&&(n--,n===-1&&ia.throwArgumentError("unbalanced parenthesis","value",e)))}return r&&t.push(r),t}const v2e=new Le(NM);function LXe(e){const t=[],r=function(n,i){if(Array.isArray(i))for(let a in i){const o=n.slice();o.push(a);try{r(o,i[a])}catch(s){t.push({path:o,error:s})}}};return r([],e),t}class c2{constructor(t,r,n,i){this.name=t,this.type=r,this.localName=n,this.dynamic=i}_throwError(t,r){v2e.throwArgumentError(t,this.localName,r)}}class xhe{constructor(t){ot(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return Af(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(xo(t._data))}writeBytes(t){let r=kt(t);const n=r.length%this.wordSize;return n&&(r=xo([r,this._padding.slice(n)])),this._writeData(r)}_getValue(t){let r=kt(Ut.from(t));return r.length>this.wordSize&&v2e.throwError("value out-of-bounds",Le.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=xo([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[t]=this._getValue(r)}}}class mG{constructor(t,r,n,i){ot(this,"_data",kt(t)),ot(this,"wordSize",r||32),ot(this,"_coerceFunc",n),ot(this,"allowLoose",i),this._offset=0}get data(){return Kt(this._data)}get consumed(){return this._offset}static coerce(t,r){let n=t.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(t,r){return this._coerceFunc?this._coerceFunc(t,r):mG.coerce(t,r)}_peekBytes(t,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:v2e.throwError("data out-of-bounds",Le.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(t){return new mG(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,r){let n=this._peekBytes(0,t,!!r);return this._offset+=n.length,n.slice(0,t)}readValue(){return Ut.from(this.readBytes(this.wordSize))}}var PXe={exports:{}};(function(e){(function(){var t="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof Ln=="object"&&Ln.versions&&Ln.versions.node;o?i=gt:a&&(i=self);var s=!i.JS_SHA3_NO_COMMON_JS&&!0&&e.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],f=[4,1024,262144,67108864],d=[1,256,65536,16777216],h=[6,1536,393216,100663296],p=[0,8,16,24],g=[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],m=[224,256,384,512],y=[128,256],b=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(W){return Object.prototype.toString.call(W)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(W){return typeof W=="object"&&W.buffer&&W.buffer.constructor===ArrayBuffer});for(var T=function(W,Y,re){return function(Q){return new x(W,Y,W).update(Q)[re]()}},R=function(W,Y,re){return function(Q,ie){return new x(W,Y,ie).update(Q)[re]()}},N=function(W,Y,re){return function(Q,ie,ce,te){return E["cshake"+W].update(Q,ie,ce,te)[re]()}},A=function(W,Y,re){return function(Q,ie,ce,te){return E["kmac"+W].update(Q,ie,ce,te)[re]()}},L=function(W,Y,re,Q){for(var ie=0;ie<b.length;++ie){var ce=b[ie];W[ce]=Y(re,Q,ce)}return W},O=function(W,Y){var re=T(W,Y,"hex");return re.create=function(){return new x(W,Y,W)},re.update=function(Q){return re.create().update(Q)},L(re,T,W,Y)},I=function(W,Y){var re=R(W,Y,"hex");return re.create=function(Q){return new x(W,Y,Q)},re.update=function(Q,ie){return re.create(ie).update(Q)},L(re,R,W,Y)},$=function(W,Y){var re=w[W],Q=N(W,Y,"hex");return Q.create=function(ie,ce,te){return!ce&&!te?E["shake"+W].create(ie):new x(W,Y,ie).bytepad([ce,te],re)},Q.update=function(ie,ce,te,J){return Q.create(ce,te,J).update(ie)},L(Q,N,W,Y)},F=function(W,Y){var re=w[W],Q=A(W,Y,"hex");return Q.create=function(ie,ce,te){return new H(W,Y,ce).bytepad(["KMAC",te],re).bytepad([ie],re)},Q.update=function(ie,ce,te,J){return Q.create(ie,te,J).update(ce)},L(Q,A,W,Y)},D=[{name:"keccak",padding:d,bits:m,createMethod:O},{name:"sha3",padding:h,bits:m,createMethod:O},{name:"shake",padding:c,bits:y,createMethod:I},{name:"cshake",padding:f,bits:y,createMethod:$},{name:"kmac",padding:f,bits:y,createMethod:F}],E={},S=[],C=0;C<D.length;++C)for(var M=D[C],k=M.bits,U=0;U<k.length;++U){var G=M.name+"_"+k[U];if(S.push(G),E[G]=M.createMethod(k[U],M.padding),M.name!=="sha3"){var B=M.name+k[U];S.push(B),E[B]=E[G]}}function x(W,Y,re){this.blocks=[],this.s=[],this.padding=Y,this.outputBits=re,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(W<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=re>>5,this.extraBytes=(re&31)>>3;for(var Q=0;Q<50;++Q)this.s[Q]=0}x.prototype.update=function(W){if(this.finalized)throw new Error(r);var Y,re=typeof W;if(re!=="string"){if(re==="object"){if(W===null)throw new Error(t);if(l&&W.constructor===ArrayBuffer)W=new Uint8Array(W);else if(!Array.isArray(W)&&(!l||!ArrayBuffer.isView(W)))throw new Error(t)}else throw new Error(t);Y=!0}for(var Q=this.blocks,ie=this.byteCount,ce=W.length,te=this.blockCount,J=0,ge=this.s,fe,ye;J<ce;){if(this.reset)for(this.reset=!1,Q[0]=this.block,fe=1;fe<te+1;++fe)Q[fe]=0;if(Y)for(fe=this.start;J<ce&&fe<ie;++J)Q[fe>>2]|=W[J]<<p[fe++&3];else for(fe=this.start;J<ce&&fe<ie;++J)ye=W.charCodeAt(J),ye<128?Q[fe>>2]|=ye<<p[fe++&3]:ye<2048?(Q[fe>>2]|=(192|ye>>6)<<p[fe++&3],Q[fe>>2]|=(128|ye&63)<<p[fe++&3]):ye<55296||ye>=57344?(Q[fe>>2]|=(224|ye>>12)<<p[fe++&3],Q[fe>>2]|=(128|ye>>6&63)<<p[fe++&3],Q[fe>>2]|=(128|ye&63)<<p[fe++&3]):(ye=65536+((ye&1023)<<10|W.charCodeAt(++J)&1023),Q[fe>>2]|=(240|ye>>18)<<p[fe++&3],Q[fe>>2]|=(128|ye>>12&63)<<p[fe++&3],Q[fe>>2]|=(128|ye>>6&63)<<p[fe++&3],Q[fe>>2]|=(128|ye&63)<<p[fe++&3]);if(this.lastByteIndex=fe,fe>=ie){for(this.start=fe-ie,this.block=Q[te],fe=0;fe<te;++fe)ge[fe]^=Q[fe];q(ge),this.reset=!0}else this.start=fe}return this},x.prototype.encode=function(W,Y){var re=W&255,Q=1,ie=[re];for(W=W>>8,re=W&255;re>0;)ie.unshift(re),W=W>>8,re=W&255,++Q;return Y?ie.push(Q):ie.unshift(Q),this.update(ie),ie.length},x.prototype.encodeString=function(W){var Y,re=typeof W;if(re!=="string"){if(re==="object"){if(W===null)throw new Error(t);if(l&&W.constructor===ArrayBuffer)W=new Uint8Array(W);else if(!Array.isArray(W)&&(!l||!ArrayBuffer.isView(W)))throw new Error(t)}else throw new Error(t);Y=!0}var Q=0,ie=W.length;if(Y)Q=ie;else for(var ce=0;ce<W.length;++ce){var te=W.charCodeAt(ce);te<128?Q+=1:te<2048?Q+=2:te<55296||te>=57344?Q+=3:(te=65536+((te&1023)<<10|W.charCodeAt(++ce)&1023),Q+=4)}return Q+=this.encode(Q*8),this.update(W),Q},x.prototype.bytepad=function(W,Y){for(var re=this.encode(Y),Q=0;Q<W.length;++Q)re+=this.encodeString(W[Q]);var ie=Y-re%Y,ce=[];return ce.length=ie,this.update(ce),this},x.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var W=this.blocks,Y=this.lastByteIndex,re=this.blockCount,Q=this.s;if(W[Y>>2]|=this.padding[Y&3],this.lastByteIndex===this.byteCount)for(W[0]=W[re],Y=1;Y<re+1;++Y)W[Y]=0;for(W[re-1]|=2147483648,Y=0;Y<re;++Y)Q[Y]^=W[Y];q(Q)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var W=this.blockCount,Y=this.s,re=this.outputBlocks,Q=this.extraBytes,ie=0,ce=0,te="",J;ce<re;){for(ie=0;ie<W&&ce<re;++ie,++ce)J=Y[ie],te+=u[J>>4&15]+u[J&15]+u[J>>12&15]+u[J>>8&15]+u[J>>20&15]+u[J>>16&15]+u[J>>28&15]+u[J>>24&15];ce%W===0&&(q(Y),ie=0)}return Q&&(J=Y[ie],te+=u[J>>4&15]+u[J&15],Q>1&&(te+=u[J>>12&15]+u[J>>8&15]),Q>2&&(te+=u[J>>20&15]+u[J>>16&15])),te},x.prototype.arrayBuffer=function(){this.finalize();var W=this.blockCount,Y=this.s,re=this.outputBlocks,Q=this.extraBytes,ie=0,ce=0,te=this.outputBits>>3,J;Q?J=new ArrayBuffer(re+1<<2):J=new ArrayBuffer(te);for(var ge=new Uint32Array(J);ce<re;){for(ie=0;ie<W&&ce<re;++ie,++ce)ge[ce]=Y[ie];ce%W===0&&q(Y)}return Q&&(ge[ie]=Y[ie],J=J.slice(0,te)),J},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var W=this.blockCount,Y=this.s,re=this.outputBlocks,Q=this.extraBytes,ie=0,ce=0,te=[],J,ge;ce<re;){for(ie=0;ie<W&&ce<re;++ie,++ce)J=ce<<2,ge=Y[ie],te[J]=ge&255,te[J+1]=ge>>8&255,te[J+2]=ge>>16&255,te[J+3]=ge>>24&255;ce%W===0&&q(Y)}return Q&&(J=ce<<2,ge=Y[ie],te[J]=ge&255,Q>1&&(te[J+1]=ge>>8&255),Q>2&&(te[J+2]=ge>>16&255)),te};function H(W,Y,re){x.call(this,W,Y,re)}H.prototype=new x,H.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var q=function(W){var Y,re,Q,ie,ce,te,J,ge,fe,ye,Fe,me,Ue,tt,Ve,Ae,je,Pe,Oe,rt,We,ne,X,K,le,ve,Ee,we,ft,He,Ke,Jt,at,At,Vr,xt,Dt,Bn,Nt,Xt,ji,ct,St,Ji,er,Yt,la,Wt,Ht,zi,vt,Lt,Kr,yt,Pt,ua,Me,$e,Mt,Tr,kr,cn,dn;for(Q=0;Q<48;Q+=2)ie=W[0]^W[10]^W[20]^W[30]^W[40],ce=W[1]^W[11]^W[21]^W[31]^W[41],te=W[2]^W[12]^W[22]^W[32]^W[42],J=W[3]^W[13]^W[23]^W[33]^W[43],ge=W[4]^W[14]^W[24]^W[34]^W[44],fe=W[5]^W[15]^W[25]^W[35]^W[45],ye=W[6]^W[16]^W[26]^W[36]^W[46],Fe=W[7]^W[17]^W[27]^W[37]^W[47],me=W[8]^W[18]^W[28]^W[38]^W[48],Ue=W[9]^W[19]^W[29]^W[39]^W[49],Y=me^(te<<1|J>>>31),re=Ue^(J<<1|te>>>31),W[0]^=Y,W[1]^=re,W[10]^=Y,W[11]^=re,W[20]^=Y,W[21]^=re,W[30]^=Y,W[31]^=re,W[40]^=Y,W[41]^=re,Y=ie^(ge<<1|fe>>>31),re=ce^(fe<<1|ge>>>31),W[2]^=Y,W[3]^=re,W[12]^=Y,W[13]^=re,W[22]^=Y,W[23]^=re,W[32]^=Y,W[33]^=re,W[42]^=Y,W[43]^=re,Y=te^(ye<<1|Fe>>>31),re=J^(Fe<<1|ye>>>31),W[4]^=Y,W[5]^=re,W[14]^=Y,W[15]^=re,W[24]^=Y,W[25]^=re,W[34]^=Y,W[35]^=re,W[44]^=Y,W[45]^=re,Y=ge^(me<<1|Ue>>>31),re=fe^(Ue<<1|me>>>31),W[6]^=Y,W[7]^=re,W[16]^=Y,W[17]^=re,W[26]^=Y,W[27]^=re,W[36]^=Y,W[37]^=re,W[46]^=Y,W[47]^=re,Y=ye^(ie<<1|ce>>>31),re=Fe^(ce<<1|ie>>>31),W[8]^=Y,W[9]^=re,W[18]^=Y,W[19]^=re,W[28]^=Y,W[29]^=re,W[38]^=Y,W[39]^=re,W[48]^=Y,W[49]^=re,tt=W[0],Ve=W[1],Yt=W[11]<<4|W[10]>>>28,la=W[10]<<4|W[11]>>>28,we=W[20]<<3|W[21]>>>29,ft=W[21]<<3|W[20]>>>29,Tr=W[31]<<9|W[30]>>>23,kr=W[30]<<9|W[31]>>>23,ct=W[40]<<18|W[41]>>>14,St=W[41]<<18|W[40]>>>14,At=W[2]<<1|W[3]>>>31,Vr=W[3]<<1|W[2]>>>31,Ae=W[13]<<12|W[12]>>>20,je=W[12]<<12|W[13]>>>20,Wt=W[22]<<10|W[23]>>>22,Ht=W[23]<<10|W[22]>>>22,He=W[33]<<13|W[32]>>>19,Ke=W[32]<<13|W[33]>>>19,cn=W[42]<<2|W[43]>>>30,dn=W[43]<<2|W[42]>>>30,yt=W[5]<<30|W[4]>>>2,Pt=W[4]<<30|W[5]>>>2,xt=W[14]<<6|W[15]>>>26,Dt=W[15]<<6|W[14]>>>26,Pe=W[25]<<11|W[24]>>>21,Oe=W[24]<<11|W[25]>>>21,zi=W[34]<<15|W[35]>>>17,vt=W[35]<<15|W[34]>>>17,Jt=W[45]<<29|W[44]>>>3,at=W[44]<<29|W[45]>>>3,K=W[6]<<28|W[7]>>>4,le=W[7]<<28|W[6]>>>4,ua=W[17]<<23|W[16]>>>9,Me=W[16]<<23|W[17]>>>9,Bn=W[26]<<25|W[27]>>>7,Nt=W[27]<<25|W[26]>>>7,rt=W[36]<<21|W[37]>>>11,We=W[37]<<21|W[36]>>>11,Lt=W[47]<<24|W[46]>>>8,Kr=W[46]<<24|W[47]>>>8,Ji=W[8]<<27|W[9]>>>5,er=W[9]<<27|W[8]>>>5,ve=W[18]<<20|W[19]>>>12,Ee=W[19]<<20|W[18]>>>12,$e=W[29]<<7|W[28]>>>25,Mt=W[28]<<7|W[29]>>>25,Xt=W[38]<<8|W[39]>>>24,ji=W[39]<<8|W[38]>>>24,ne=W[48]<<14|W[49]>>>18,X=W[49]<<14|W[48]>>>18,W[0]=tt^~Ae&Pe,W[1]=Ve^~je&Oe,W[10]=K^~ve&we,W[11]=le^~Ee&ft,W[20]=At^~xt&Bn,W[21]=Vr^~Dt&Nt,W[30]=Ji^~Yt&Wt,W[31]=er^~la&Ht,W[40]=yt^~ua&$e,W[41]=Pt^~Me&Mt,W[2]=Ae^~Pe&rt,W[3]=je^~Oe&We,W[12]=ve^~we&He,W[13]=Ee^~ft&Ke,W[22]=xt^~Bn&Xt,W[23]=Dt^~Nt&ji,W[32]=Yt^~Wt&zi,W[33]=la^~Ht&vt,W[42]=ua^~$e&Tr,W[43]=Me^~Mt&kr,W[4]=Pe^~rt&ne,W[5]=Oe^~We&X,W[14]=we^~He&Jt,W[15]=ft^~Ke&at,W[24]=Bn^~Xt&ct,W[25]=Nt^~ji&St,W[34]=Wt^~zi&Lt,W[35]=Ht^~vt&Kr,W[44]=$e^~Tr&cn,W[45]=Mt^~kr&dn,W[6]=rt^~ne&tt,W[7]=We^~X&Ve,W[16]=He^~Jt&K,W[17]=Ke^~at&le,W[26]=Xt^~ct&At,W[27]=ji^~St&Vr,W[36]=zi^~Lt&Ji,W[37]=vt^~Kr&er,W[46]=Tr^~cn&yt,W[47]=kr^~dn&Pt,W[8]=ne^~tt&Ae,W[9]=X^~Ve&je,W[18]=Jt^~K&ve,W[19]=at^~le&Ee,W[28]=ct^~At&xt,W[29]=St^~Vr&Dt,W[38]=Lt^~Ji&Yt,W[39]=Kr^~er&la,W[48]=cn^~yt&ua,W[49]=dn^~Pt&Me,W[0]^=g[Q],W[1]^=g[Q+1]};if(s)e.exports=E;else for(C=0;C<S.length;++C)i[S[C]]=E[S[C]]})()})(PXe);var PPt=PXe.exports;const MPt=Nn(PPt);function co(e){return"0x"+MPt.keccak_256(kt(e))}const DPt="rlp/5.7.0",p1=new Le(DPt);function _Re(e){const t=[];for(;e;)t.unshift(e&255),e>>=8;return t}function SRe(e,t,r){let n=0;for(let i=0;i<r;i++)n=n*256+e[t+i];return n}function MXe(e){if(Array.isArray(e)){let n=[];if(e.forEach(function(a){n=n.concat(MXe(a))}),n.length<=55)return n.unshift(192+n.length),n;const i=_Re(n.length);return i.unshift(247+i.length),i.concat(n)}IM(e)||p1.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(kt(e));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=_Re(t.length);return r.unshift(183+r.length),r.concat(t)}function AT(e){return Kt(MXe(e))}function wRe(e,t,r,n){const i=[];for(;r<t+1+n;){const a=DXe(e,r);i.push(a.result),r+=a.consumed,r>t+1+n&&p1.throwError("child data too short",Le.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function DXe(e,t){if(e.length===0&&p1.throwError("data too short",Le.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&p1.throwError("data short segment too short",Le.errors.BUFFER_OVERRUN,{});const n=SRe(e,t+1,r);return t+1+r+n>e.length&&p1.throwError("data long segment too short",Le.errors.BUFFER_OVERRUN,{}),wRe(e,t,t+1+r,r+n)}else if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&p1.throwError("data array too short",Le.errors.BUFFER_OVERRUN,{}),wRe(e,t,t+1,r)}else if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&p1.throwError("data array too short",Le.errors.BUFFER_OVERRUN,{});const n=SRe(e,t+1,r);t+1+r+n>e.length&&p1.throwError("data array too short",Le.errors.BUFFER_OVERRUN,{});const i=Kt(e.slice(t+1+r,t+1+r+n));return{consumed:1+r+n,result:i}}else if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&p1.throwError("data too short",Le.errors.BUFFER_OVERRUN,{});const n=Kt(e.slice(t+1,t+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:Kt(e[t])}}function Xj(e){const t=kt(e),r=DXe(t,0);return r.consumed!==t.length&&p1.throwArgumentError("invalid rlp data","data",e),r.result}const $Pt=Object.freeze(Object.defineProperty({__proto__:null,decode:Xj,encode:AT},Symbol.toStringTag,{value:"Module"})),kPt="address/5.7.0",PE=new Le(kPt);function TRe(e){li(e,20)||PE.throwArgumentError("invalid address","address",e),e=e.toLowerCase();const t=e.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=t[i].charCodeAt(0);const n=kt(co(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(n[i>>1]&15)>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}const BPt=9007199254740991;function UPt(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const g2e={};for(let e=0;e<10;e++)g2e[String(e)]=String(e);for(let e=0;e<26;e++)g2e[String.fromCharCode(65+e)]=String(10+e);const ARe=Math.floor(UPt(BPt));function $Xe(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+"00";let t=e.split("").map(n=>g2e[n]).join("");for(;t.length>=ARe;){let n=t.substring(0,ARe);t=parseInt(n,10)%97+t.substring(n.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function ya(e){let t=null;if(typeof e!="string"&&PE.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))e.substring(0,2)!=="0x"&&(e="0x"+e),t=TRe(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&PE.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==$Xe(e)&&PE.throwArgumentError("bad icap checksum","address",e),t=_Pt(e.substring(4));t.length<40;)t="0"+t;t=TRe("0x"+t)}else PE.throwArgumentError("invalid address","address",e);return t}function FPt(e){try{return ya(e),!0}catch{}return!1}function HPt(e){let t=SPt(ya(e).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+$Xe("XE00"+t)+t}function Kj(e){let t=null;try{t=ya(e.from)}catch{PE.throwArgumentError("missing from address","transaction",e)}const r=X1(kt(Ut.from(e.nonce).toHexString()));return ya(ol(co(AT([t,r])),12))}function GPt(e,t,r){return _g(t)!==32&&PE.throwArgumentError("salt must be 32 bytes","salt",t),_g(r)!==32&&PE.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),ya(ol(co(xo(["0xff",ya(e),t,r])),12))}class VPt extends c2{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,r){try{r=ya(r)}catch(n){this._throwError(n.message,r)}return t.writeValue(r)}decode(t){return ya(Oo(t.readValue().toHexString(),20))}}class WPt extends c2{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,r){return this.coder.encode(t,r)}decode(t){return this.coder.decode(t)}}const OC=new Le(NM);function kXe(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let l={};n=t.map(u=>{const c=u.localName;return c||OC.throwError("cannot encode object for signature with missing names",Le.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]&&OC.throwError("cannot encode object for signature with duplicate names",Le.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),l[c]=!0,r[c]})}else OC.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&OC.throwArgumentError("types/value length mismatch","tuple",r);let i=new xhe(e.wordSize),a=new xhe(e.wordSize),o=[];t.forEach((l,u)=>{let c=n[u];if(l.dynamic){let f=a.length;l.encode(a,c);let d=i.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let s=e.appendWriter(i);return s+=e.appendWriter(a),s}function BXe(e,t){let r=[],n=e.subReader(0);t.forEach(a=>{let o=null;if(a.dynamic){let s=e.readValue(),l=n.subReader(s.toNumber());try{o=a.decode(l)}catch(u){if(u.code===Le.errors.BUFFER_OVERRUN)throw u;o=u,o.baseType=a.name,o.name=a.localName,o.type=a.type}}else try{o=a.decode(e)}catch(s){if(s.code===Le.errors.BUFFER_OVERRUN)throw s;o=s,o.baseType=a.name,o.name=a.localName,o.type=a.type}o!=null&&r.push(o)});const i=t.reduce((a,o)=>{const s=o.localName;return s&&(a[s]||(a[s]=0),a[s]++),a},{});t.forEach((a,o)=>{let s=a.localName;if(!s||i[s]!==1||(s==="length"&&(s="_length"),r[s]!=null))return;const l=r[o];l instanceof Error?Object.defineProperty(r,s,{enumerable:!0,get:()=>{throw l}}):r[s]=l});for(let a=0;a<r.length;a++){const o=r[a];o instanceof Error&&Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw o}})}return Object.freeze(r)}class jPt extends c2{constructor(t,r,n){const i=t.type+"["+(r>=0?r:"")+"]",a=r===-1||t.dynamic;super("array",i,n,a),this.coder=t,this.length=r}defaultValue(){const t=this.coder.defaultValue(),r=[];for(let n=0;n<this.length;n++)r.push(t);return r}encode(t,r){Array.isArray(r)||this._throwError("expected array value",r);let n=this.length;n===-1&&(n=r.length,t.writeValue(r.length)),OC.checkArgumentCount(r.length,n,"coder array"+(this.localName?" "+this.localName:""));let i=[];for(let a=0;a<r.length;a++)i.push(this.coder);return kXe(t,i,r)}decode(t){let r=this.length;r===-1&&(r=t.readValue().toNumber(),r*32>t._data.length&&OC.throwError("insufficient data length",Le.errors.BUFFER_OVERRUN,{length:t._data.length,count:r}));let n=[];for(let i=0;i<r;i++)n.push(new WPt(this.coder));return t.coerce(this.name,BXe(t,n))}}class zPt extends c2{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,r){return t.writeValue(r?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class UXe extends c2{constructor(t,r){super(t,t,r,!0)}defaultValue(){return"0x"}encode(t,r){r=kt(r);let n=t.writeValue(r.length);return n+=t.writeBytes(r),n}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class YPt extends UXe{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,Kt(super.decode(t)))}}class qPt extends c2{constructor(t,r){let n="bytes"+String(t);super(n,n,r,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,r){let n=kt(r);return n.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(n)}decode(t){return t.coerce(this.name,Kt(t.readBytes(this.size)))}}class XPt extends c2{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,r){return r!=null&&this._throwError("not null",r),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}const FXe="0x0000000000000000000000000000000000000000",HXe=Ut.from(-1),m2e=Ut.from(0),GXe=Ut.from(1),KPt=Ut.from(2),ZPt=Ut.from("1000000000000000000"),VXe=Ut.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),QPt=Ut.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),JPt=Ut.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),y2e="0x0000000000000000000000000000000000000000000000000000000000000000",eMt="Ξ",tMt=Object.freeze(Object.defineProperty({__proto__:null,AddressZero:FXe,EtherSymbol:eMt,HashZero:y2e,MaxInt256:JPt,MaxUint256:VXe,MinInt256:QPt,NegativeOne:HXe,One:GXe,Two:KPt,WeiPerEther:ZPt,Zero:m2e},Symbol.toStringTag,{value:"Module"}));class rMt extends c2{constructor(t,r,n){const i=(r?"int":"uint")+t*8;super(i,i,n,!1),this.size=t,this.signed=r}defaultValue(){return 0}encode(t,r){let n=Ut.from(r),i=VXe.mask(t.wordSize*8);if(this.signed){let a=i.mask(this.size*8-1);(n.gt(a)||n.lt(a.add(GXe).mul(HXe)))&&this._throwError("value out-of-bounds",r)}else(n.lt(m2e)||n.gt(i.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return n=n.toTwos(this.size*8).mask(this.size*8),this.signed&&(n=n.fromTwos(this.size*8).toTwos(8*t.wordSize)),t.writeValue(n)}decode(t){let r=t.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),t.coerce(this.name,r)}}const nMt="strings/5.7.0",WXe=new Le(nMt);var Sg;(function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"})(Sg||(Sg={}));var pd;(function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"})(pd||(pd={}));function iMt(e,t,r,n,i){return WXe.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function jXe(e,t,r,n,i){if(e===pd.BAD_PREFIX||e===pd.UNEXPECTED_CONTINUE){let a=0;for(let o=t+1;o<r.length&&r[o]>>6===2;o++)a++;return a}return e===pd.OVERRUN?r.length-t-1:0}function aMt(e,t,r,n,i){return e===pd.OVERLONG?(n.push(i),0):(n.push(65533),jXe(e,t,r))}const zXe=Object.freeze({error:iMt,ignore:jXe,replace:aMt});function E2e(e,t){t==null&&(t=zXe.error),e=kt(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(!(i>>7)){r.push(i);continue}let a=null,o=null;if((i&224)===192)a=1,o=127;else if((i&240)===224)a=2,o=2047;else if((i&248)===240)a=3,o=65535;else{(i&192)===128?n+=t(pd.UNEXPECTED_CONTINUE,n-1,e,r):n+=t(pd.BAD_PREFIX,n-1,e,r);continue}if(n-1+a>=e.length){n+=t(pd.OVERRUN,n-1,e,r);continue}let s=i&(1<<8-a-1)-1;for(let l=0;l<a;l++){let u=e[n];if((u&192)!=128){n+=t(pd.MISSING_CONTINUE,n,e,r),s=null;break}s=s<<6|u&63,n++}if(s!==null){if(s>1114111){n+=t(pd.OUT_OF_RANGE,n-1-a,e,r,s);continue}if(s>=55296&&s<=57343){n+=t(pd.UTF16_SURROGATE,n-1-a,e,r,s);continue}if(s<=o){n+=t(pd.OVERLONG,n-1-a,e,r,s);continue}r.push(s)}}return r}function hl(e,t=Sg.current){t!=Sg.current&&(WXe.checkNormalize(),e=e.normalize(t));let r=[];for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const a=e.charCodeAt(n);if(n>=e.length||(a&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(a&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return kt(r)}function Nie(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function oMt(e,t){return'"'+E2e(e,t).map(r=>{if(r<256){switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(r>=32&&r<127)return String.fromCharCode(r)}return r<=65535?Nie(r):(r-=65536,Nie((r>>10&1023)+55296)+Nie((r&1023)+56320))}).join("")+'"'}function Ihe(e){return e.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function EA(e,t){return Ihe(E2e(e,t))}function yG(e,t=Sg.current){return E2e(hl(e,t))}function sMt(e){const t=hl(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return Kt(xo([t,y2e]).slice(0,32))}function lMt(e){const t=kt(e);if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;t[r-1]===0;)r--;return EA(t.slice(0,r))}function uMt(e){if(e.length%4!==0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function b2e(e,t){t||(t=function(i){return[parseInt(i,16)]});let r=0,n={};return e.split(",").forEach(i=>{let a=i.split(":");r+=parseInt(a[0],16),n[r]=t(a[1])}),n}function YXe(e){let t=0;return e.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=t+parseInt(n[0],16);return t=parseInt(n[1],16),{l:i,h:t}})}function _2e(e,t){let r=0;for(let n=0;n<t.length;n++){let i=t[n];if(r+=i.l,e>=r&&e<=r+i.h&&(e-r)%(i.d||1)===0){if(i.e&&i.e.indexOf(e-r)!==-1)continue;return i}}return null}const cMt=YXe("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"),fMt="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(e=>parseInt(e,16)),dMt=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],hMt=b2e("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"),pMt=b2e("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"),vMt=b2e("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",uMt),gMt=YXe("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 mMt(e){return e.reduce((t,r)=>(r.forEach(n=>{t.push(n)}),t),[])}function yMt(e){return!!_2e(e,cMt)}function EMt(e){let t=_2e(e,dMt);if(t)return[e+t.s];let r=hMt[e];if(r)return r;let n=pMt[e];if(n)return[e+n[0]];let i=vMt[e];return i||null}function bMt(e){return!!_2e(e,gMt)}function _Mt(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=yG(e);t=mMt(t.map(n=>{if(fMt.indexOf(n)>=0)return[];if(n>=65024&&n<=65039)return[];let i=EMt(n);return i||[n]})),t=yG(Ihe(t),Sg.NFKC),t.forEach(n=>{if(bMt(n))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),t.forEach(n=>{if(yMt(n))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let r=Ihe(t);if(r.substring(0,1)==="-"||r.substring(2,4)==="--"||r.substring(r.length-1)==="-")throw new Error("invalid hyphen");return r}class SMt extends UXe{constructor(t){super("string",t)}defaultValue(){return""}encode(t,r){return super.encode(t,hl(r))}decode(t){return EA(super.decode(t))}}class U$ extends c2{constructor(t,r){let n=!1;const i=[];t.forEach(o=>{o.dynamic&&(n=!0),i.push(o.type)});const a="tuple("+i.join(",")+")";super("tuple",a,r,n),this.coders=t}defaultValue(){const t=[];this.coders.forEach(n=>{t.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const a=i.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});return this.coders.forEach((n,i)=>{let a=n.localName;!a||r[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[i]))}),Object.freeze(t)}encode(t,r){return kXe(t,this.coders,r)}decode(t){return t.coerce(this.name,BXe(t,this.coders))}}const F$=new Le(NM),wMt=new RegExp(/^bytes([0-9]*)$/),TMt=new RegExp(/^(u?int)([0-9]*)$/);class qXe{constructor(t){ot(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new VPt(t.name);case"bool":return new zPt(t.name);case"string":return new SMt(t.name);case"bytes":return new YPt(t.name);case"array":return new jPt(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new U$((t.components||[]).map(n=>this._getCoder(n)),t.name);case"":return new XPt(t.name)}let r=t.type.match(TMt);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&F$.throwArgumentError("invalid "+r[1]+" bit length","param",t),new rMt(n/8,r[1]==="int",t.name)}if(r=t.type.match(wMt),r){let n=parseInt(r[1]);return(n===0||n>32)&&F$.throwArgumentError("invalid bytes length","param",t),new qPt(n,t.name)}return F$.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,r){return new mG(t,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new xhe(this._getWordSize())}getDefaultValue(t){const r=t.map(i=>this._getCoder(Kl.from(i)));return new U$(r,"_").defaultValue()}encode(t,r){t.length!==r.length&&F$.throwError("types/values length mismatch",Le.errors.INVALID_ARGUMENT,{count:{types:t.length,values:r.length},value:{types:t,values:r}});const n=t.map(o=>this._getCoder(Kl.from(o))),i=new U$(n,"_"),a=this._getWriter();return i.encode(a,r),a.data}decode(t,r,n){const i=t.map(o=>this._getCoder(Kl.from(o)));return new U$(i,"_").decode(this._getReader(kt(r),n))}}const XXe=new qXe;function ME(e){return co(hl(e))}const KXe="hash/5.7.0";function S2e(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return kt(t)}function w2e(e){e=kt(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}const AMt=Object.freeze(Object.defineProperty({__proto__:null,decode:S2e,encode:w2e},Symbol.toStringTag,{value:"Module"}));function ZXe(e,t){t==null&&(t=1);const r=[],n=r.forEach,i=function(a,o){n.call(a,function(s){o>0&&Array.isArray(s)?i(s,o-1):r.push(s)})};return i(e,t),r}function CMt(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}function RMt(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,a=[0,1];for(let R=1;R<n;R++)a.push(i+=r());let o=r(),s=t;t+=o;let l=0,u=0;function c(){return l==0&&(u=u<<8|e[t++],l=8),u>>--l&1}const f=31,d=Math.pow(2,f),h=d>>>1,p=h>>1,g=d-1;let m=0;for(let R=0;R<f;R++)m=m<<1|c();let y=[],b=0,w=d;for(;;){let R=Math.floor(((m-b+1)*i-1)/w),N=0,A=n;for(;A-N>1;){let I=N+A>>>1;R<a[I]?A=I:N=I}if(N==0)break;y.push(N);let L=b+Math.floor(w*a[N]/i),O=b+Math.floor(w*a[N+1]/i)-1;for(;!((L^O)&h);)m=m<<1&g|c(),L=L<<1&g,O=O<<1&g|1;for(;L&~O&p;)m=m&h|m<<1&g>>>1|c(),L=L<<1^h,O=(O^h)<<1|h|1;b=L,w=1+O-L}let T=n-4;return y.map(R=>{switch(R-T){case 3:return T+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return T+256+(e[s++]<<8|e[s++]);case 1:return T+e[s++];default:return R-1}})}function xMt(e){let t=0;return()=>e[t++]}function IMt(e){return xMt(RMt(e))}function OMt(e){return e&1?~e>>1:e>>1}function NMt(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}function CRe(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function LMt(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=OMt(t());return r}function EG(e,t){let r=CRe(e(),e),n=e(),i=CRe(n,e),a=NMt(n,e);for(let o=0;o<n;o++)for(let s=0;s<a[o];s++)r.push(i[o]+s);return t?r.map(o=>t[o]):r}function PMt(e){let t=[];for(;;){let r=e();if(r==0)break;t.push(DMt(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push($Mt(r,e))}return CMt(ZXe(t))}function MMt(e){let t=[];for(;;){let r=e();if(r==0)break;t.push(r)}return t}function QXe(e,t,r){let n=Array(e).fill(void 0).map(()=>[]);for(let i=0;i<t;i++)LMt(e,r).forEach((a,o)=>n[o].push(a));return n}function DMt(e,t){let r=1+t(),n=t(),i=MMt(t),a=QXe(i.length,1+e,t);return ZXe(a.map((o,s)=>{const l=o[0],u=o.slice(1);return Array(i[s]).fill(void 0).map((c,f)=>{let d=f*n;return[l+f*r,u.map(h=>h+d)]})}))}function $Mt(e,t){let r=1+t();return QXe(r,1+e,t).map(i=>[i[0],i.slice(1)])}function kMt(e){let t=EG(e).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=EG(e,t);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=e(),a=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let s=i==1,l=i==2;return{branches:n,valid:a,fe0f:o,save:s,check:l}}}function BMt(){return IMt(S2e("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Zj=BMt(),UMt=new Set(EG(Zj)),FMt=new Set(EG(Zj)),HMt=PMt(Zj),GMt=kMt(Zj),RRe=45,xRe=95;function JXe(e){return yG(e)}function VMt(e){return e.filter(t=>t!=65039)}function eKe(e){for(let t of e.split(".")){let r=JXe(t);try{for(let n=r.lastIndexOf(xRe)-1;n>=0;n--)if(r[n]!==xRe)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===RRe&&r[3]===RRe)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${t}": ${n.message}`)}}return e}function WMt(e){return eKe(jMt(e,VMt))}function jMt(e,t){let r=JXe(e).reverse(),n=[];for(;r.length;){let i=YMt(r);if(i){n.push(...t(i));continue}let a=r.pop();if(UMt.has(a)){n.push(a);continue}if(FMt.has(a))continue;let o=HMt[a];if(o){n.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${a.toString(16).toUpperCase()}`)}return eKe(zMt(String.fromCodePoint(...n)))}function zMt(e){return e.normalize("NFC")}function YMt(e,t){var r;let n=GMt,i,a,o=[],s=e.length;for(t&&(t.length=0);s;){let l=e[--s];if(n=(r=n.branches.find(u=>u.set.has(l)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)a=l;else if(n.check&&l===a)break;o.push(l),n.fe0f&&(o.push(65039),s>0&&e[s-1]==65039&&s--),n.valid&&(i=o.slice(),n.valid==2&&i.splice(1,1),t&&t.push(...e.slice(s).reverse()),e.length=s)}return i}const qMt=new Le(KXe),tKe=new Uint8Array(32);tKe.fill(0);function IRe(e){if(e.length===0)throw new Error("invalid ENS name; empty component");return e}function T2e(e){const t=hl(WMt(e)),r=[];if(e.length===0)return r;let n=0;for(let i=0;i<t.length;i++)t[i]===46&&(r.push(IRe(t.slice(n,i))),n=i+1);if(n>=t.length)throw new Error("invalid ENS name; empty component");return r.push(IRe(t.slice(n))),r}function XMt(e){try{return T2e(e).length!==0}catch{}return!1}function zL(e){typeof e!="string"&&qMt.throwArgumentError("invalid ENS name; not a string","name",e);let t=tKe;const r=T2e(e);for(;r.length;)t=co(xo([t,co(r.pop())]));return Kt(t)}function rKe(e){return Kt(xo(T2e(e).map(t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(t.length+1);return r.set(t,1),r[0]=r.length-1,r})))+"00"}const KMt=`Ethereum Signed Message:
|
|
5692
5692
|
`;function A2e(e){return typeof e=="string"&&(e=hl(e)),co(xo([hl(KMt),hl(String(e.length)),e]))}var ZMt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const _s=new Le(KXe),nKe=new Uint8Array(32);nKe.fill(0);const QMt=Ut.from(-1),iKe=Ut.from(0),aKe=Ut.from(1),JMt=Ut.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eDt(e){const t=kt(e),r=t.length%32;return r?Af([t,nKe.slice(r)]):Kt(t)}const tDt=Oo(aKe.toHexString(),32),rDt=Oo(iKe.toHexString(),32),ORe={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Lie=["name","version","chainId","verifyingContract","salt"];function NRe(e){return function(t){return typeof t!="string"&&_s.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const nDt={name:NRe("name"),version:NRe("version"),chainId:function(e){try{return Ut.from(e).toString()}catch{}return _s.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return ya(e).toLowerCase()}catch{}return _s.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=kt(e);if(t.length!==32)throw new Error("bad length");return Kt(t)}catch{}return _s.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Pie(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=t[1]==="",n=parseInt(t[2]||"256");(n%8!==0||n>256||t[2]&&t[2]!==String(n))&&_s.throwArgumentError("invalid numeric width","type",e);const i=JMt.mask(r?n-1:n),a=r?i.add(aKe).mul(QMt):iKe;return function(o){const s=Ut.from(o);return(s.lt(a)||s.gt(i))&&_s.throwArgumentError(`value out-of-bounds for ${e}`,"value",o),Oo(s.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(r===0||r>32||t[1]!==String(r))&&_s.throwArgumentError("invalid bytes width","type",e),function(n){return kt(n).length!==r&&_s.throwArgumentError(`invalid length for ${e}`,"value",n),eDt(n)}}}switch(e){case"address":return function(t){return Oo(ya(t),32)};case"bool":return function(t){return t?tDt:rDt};case"bytes":return function(t){return co(t)};case"string":return function(t){return ME(t)}}return null}function LRe(e,t){return`${e}(${t.map(({name:r,type:n})=>n+" "+r).join(",")})`}class zu{constructor(t){ot(this,"types",Object.freeze(Nf(t))),ot(this,"_encoderCache",{}),ot(this,"_types",{});const r={},n={},i={};Object.keys(t).forEach(s=>{r[s]={},n[s]=[],i[s]={}});for(const s in t){const l={};t[s].forEach(u=>{l[u.name]&&_s.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(s)}`,"types",t),l[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===s&&_s.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",t),!Pie(c)&&(n[c]||_s.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",t),n[c].push(s),r[s][c]=!0)})}const a=Object.keys(n).filter(s=>n[s].length===0);a.length===0?_s.throwArgumentError("missing primary type","types",t):a.length>1&&_s.throwArgumentError(`ambiguous primary types or unused types: ${a.map(s=>JSON.stringify(s)).join(", ")}`,"types",t),ot(this,"primaryType",a[0]);function o(s,l){l[s]&&_s.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t),l[s]=!0,Object.keys(r[s]).forEach(u=>{n[u]&&(o(u,l),Object.keys(l).forEach(c=>{i[c][u]=!0}))}),delete l[s]}o(this.primaryType,{});for(const s in i){const l=Object.keys(i[s]);l.sort(),this._types[s]=LRe(s,t[s])+l.map(u=>LRe(u,t[u])).join("")}}getEncoder(t){let r=this._encoderCache[t];return r||(r=this._encoderCache[t]=this._getEncoder(t)),r}_getEncoder(t){{const i=Pie(t);if(i)return i}const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],a=this.getEncoder(i),o=parseInt(r[3]);return s=>{o>=0&&s.length!==o&&_s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",s);let l=s.map(a);return this._types[i]&&(l=l.map(co)),co(Af(l))}}const n=this.types[t];if(n){const i=ME(this._types[t]);return a=>{const o=n.map(({name:s,type:l})=>{const u=this.getEncoder(l)(a[s]);return this._types[l]?co(u):u});return o.unshift(i),Af(o)}}return _s.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const r=this._types[t];return r||_s.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),r}encodeData(t,r){return this.getEncoder(t)(r)}hashStruct(t,r){return co(this.encodeData(t,r))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,r,n){if(Pie(t))return n(t,r);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],s=parseInt(i[3]);return s>=0&&r.length!==s&&_s.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(l=>this._visit(o,l,n))}const a=this.types[t];return a?a.reduce((o,{name:s,type:l})=>(o[s]=this._visit(l,r[s],n),o),{}):_s.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,r){return this._visit(this.primaryType,t,r)}static from(t){return new zu(t)}static getPrimaryType(t){return zu.from(t).primaryType}static hashStruct(t,r,n){return zu.from(r).hashStruct(t,n)}static hashDomain(t){const r=[];for(const n in t){const i=ORe[n];i||_s.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),r.push({name:n,type:i})}return r.sort((n,i)=>Lie.indexOf(n.name)-Lie.indexOf(i.name)),zu.hashStruct("EIP712Domain",{EIP712Domain:r},t)}static encode(t,r,n){return Af(["0x1901",zu.hashDomain(t),zu.from(r).hash(n)])}static hash(t,r,n){return co(zu.encode(t,r,n))}static resolveNames(t,r,n,i){return ZMt(this,void 0,void 0,function*(){t=Uo(t);const a={};t.verifyingContract&&!li(t.verifyingContract,20)&&(a[t.verifyingContract]="0x");const o=zu.from(r);o.visit(n,(s,l)=>(s==="address"&&!li(l,20)&&(a[l]="0x"),l));for(const s in a)a[s]=yield i(s);return t.verifyingContract&&a[t.verifyingContract]&&(t.verifyingContract=a[t.verifyingContract]),n=o.visit(n,(s,l)=>s==="address"&&a[l]?a[l]:l),{domain:t,value:n}})}static getPayload(t,r,n){zu.hashDomain(t);const i={},a=[];Lie.forEach(l=>{const u=t[l];u!=null&&(i[l]=nDt[l](u),a.push({name:l,type:ORe[l]}))});const o=zu.from(r),s=Uo(r);return s.EIP712Domain?_s.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):s.EIP712Domain=a,o.encode(n),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(n,(l,u)=>{if(l.match(/^bytes(\d*)/))return Kt(kt(u));if(l.match(/^u?int/))return Ut.from(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&&_s.throwArgumentError("invalid string","value",u),u}return _s.throwArgumentError("unsupported type","type",l)})}}}const Es=new Le(NM);class oKe extends yA{}class sKe extends yA{}class iDt extends yA{}class bG extends yA{static isIndexed(t){return!!(t&&t._isIndexed)}}const aDt={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function PRe(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class Ohe{constructor(t){let r=[];typeof t=="string"?r=JSON.parse(t):r=t,ot(this,"fragments",r.map(n=>L1.from(n)).filter(n=>n!=null)),ot(this,"_abiCoder",Ju(new.target,"getAbiCoder")()),ot(this,"functions",{}),ot(this,"errors",{}),ot(this,"events",{}),ot(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){Es.warn("duplicate definition - constructor");return}ot(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let a=n.format();if(i[a]){Es.warn("duplicate definition - "+a);return}i[a]=n}),this.deploy||ot(this,"deploy",Vp.from({payable:!1,type:"constructor"})),ot(this,"_isInterface",!0)}format(t){t||(t=ga.full),t===ga.sighash&&Es.throwArgumentError("interface does not support formatting sighash","format",t);const r=this.fragments.map(n=>n.format(t));return t===ga.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return XXe}static getAddress(t){return ya(t)}static getSighash(t){return ol(ME(t.format()),0,4)}static getEventTopic(t){return ME(t.format())}getFunction(t){if(li(t)){for(const n in this.functions)if(t===this.getSighash(n))return this.functions[n];Es.throwArgumentError("no matching function","sighash",t)}if(t.indexOf("(")===-1){const n=t.trim(),i=Object.keys(this.functions).filter(a=>a.split("(")[0]===n);return i.length===0?Es.throwArgumentError("no matching function","name",n):i.length>1&&Es.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[Wp.fromString(t).format()];return r||Es.throwArgumentError("no matching function","signature",t),r}getEvent(t){if(li(t)){const n=t.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];Es.throwArgumentError("no matching event","topichash",n)}if(t.indexOf("(")===-1){const n=t.trim(),i=Object.keys(this.events).filter(a=>a.split("(")[0]===n);return i.length===0?Es.throwArgumentError("no matching event","name",n):i.length>1&&Es.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_1.fromString(t).format()];return r||Es.throwArgumentError("no matching event","signature",t),r}getError(t){if(li(t)){const n=Ju(this.constructor,"getSighash");for(const i in this.errors){const a=this.errors[i];if(t===n(a))return this.errors[i]}Es.throwArgumentError("no matching error","sighash",t)}if(t.indexOf("(")===-1){const n=t.trim(),i=Object.keys(this.errors).filter(a=>a.split("(")[0]===n);return i.length===0?Es.throwArgumentError("no matching error","name",n):i.length>1&&Es.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[Wp.fromString(t).format()];return r||Es.throwArgumentError("no matching error","signature",t),r}getSighash(t){if(typeof t=="string")try{t=this.getFunction(t)}catch(r){try{t=this.getError(t)}catch{throw r}}return Ju(this.constructor,"getSighash")(t)}getEventTopic(t){return typeof t=="string"&&(t=this.getEvent(t)),Ju(this.constructor,"getEventTopic")(t)}_decodeParams(t,r){return this._abiCoder.decode(t,r)}_encodeParams(t,r){return this._abiCoder.encode(t,r)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,r){typeof t=="string"&&(t=this.getError(t));const n=kt(r);return Kt(n.slice(0,4))!==this.getSighash(t)&&Es.throwArgumentError(`data signature does not match error ${t.name}.`,"data",Kt(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,r){return typeof t=="string"&&(t=this.getError(t)),Kt(xo([this.getSighash(t),this._encodeParams(t.inputs,r||[])]))}decodeFunctionData(t,r){typeof t=="string"&&(t=this.getFunction(t));const n=kt(r);return Kt(n.slice(0,4))!==this.getSighash(t)&&Es.throwArgumentError(`data signature does not match function ${t.name}.`,"data",Kt(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,r){return typeof t=="string"&&(t=this.getFunction(t)),Kt(xo([this.getSighash(t),this._encodeParams(t.inputs,r||[])]))}decodeFunctionResult(t,r){typeof t=="string"&&(t=this.getFunction(t));let n=kt(r),i=null,a="",o=null,s=null,l=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,n)}catch{}break;case 4:{const u=Kt(n.slice(0,4)),c=aDt[u];if(c)o=this._abiCoder.decode(c.inputs,n.slice(4)),s=c.name,l=c.signature,c.reason&&(i=o[0]),s==="Error"?a=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:s==="Panic"&&(a=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const f=this.getError(u);o=this._abiCoder.decode(f.inputs,n.slice(4)),s=f.name,l=f.format()}catch{}break}}return Es.throwError("call revert exception"+a,Le.errors.CALL_EXCEPTION,{method:t.format(),data:Kt(r),errorArgs:o,errorName:s,errorSignature:l,reason:i})}encodeFunctionResult(t,r){return typeof t=="string"&&(t=this.getFunction(t)),Kt(this._abiCoder.encode(t.outputs,r||[]))}encodeFilterTopics(t,r){typeof t=="string"&&(t=this.getEvent(t)),r.length>t.inputs.length&&Es.throwError("too many arguments for "+t.format(),Le.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];t.anonymous||n.push(this.getEventTopic(t));const i=(a,o)=>a.type==="string"?ME(o):a.type==="bytes"?co(Kt(o)):(a.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),a.type.match(/^u?int/)&&(o=Ut.from(o).toHexString()),a.type==="address"&&this._abiCoder.encode(["address"],[o]),Oo(Kt(o),32));for(r.forEach((a,o)=>{let s=t.inputs[o];if(!s.indexed){a!=null&&Es.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+s.name,a);return}a==null?n.push(null):s.baseType==="array"||s.baseType==="tuple"?Es.throwArgumentError("filtering with tuples or arrays not supported","contract."+s.name,a):Array.isArray(a)?n.push(a.map(l=>i(s,l))):n.push(i(s,a))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(t,r){typeof t=="string"&&(t=this.getEvent(t));const n=[],i=[],a=[];return t.anonymous||n.push(this.getEventTopic(t)),r.length!==t.inputs.length&&Es.throwArgumentError("event arguments/values mismatch","values",r),t.inputs.forEach((o,s)=>{const l=r[s];if(o.indexed)if(o.type==="string")n.push(ME(l));else if(o.type==="bytes")n.push(co(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),a.push(l)}),{data:this._abiCoder.encode(i,a),topics:n}}decodeEventLog(t,r,n){if(typeof t=="string"&&(t=this.getEvent(t)),n!=null&&!t.anonymous){let d=this.getEventTopic(t);(!li(n[0],32)||n[0].toLowerCase()!==d)&&Es.throwError("fragment/topic mismatch",Le.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:d,value:n[0]}),n=n.slice(1)}let i=[],a=[],o=[];t.inputs.forEach((d,h)=>{d.indexed?d.type==="string"||d.type==="bytes"||d.baseType==="tuple"||d.baseType==="array"?(i.push(Kl.fromObject({type:"bytes32",name:d.name})),o.push(!0)):(i.push(d),o.push(!1)):(a.push(d),o.push(!1))});let s=n!=null?this._abiCoder.decode(i,xo(n)):null,l=this._abiCoder.decode(a,r,!0),u=[],c=0,f=0;t.inputs.forEach((d,h)=>{if(d.indexed)if(s==null)u[h]=new bG({_isIndexed:!0,hash:null});else if(o[h])u[h]=new bG({_isIndexed:!0,hash:s[f++]});else try{u[h]=s[f++]}catch(p){u[h]=p}else try{u[h]=l[c++]}catch(p){u[h]=p}if(d.name&&u[d.name]==null){const p=u[h];p instanceof Error?Object.defineProperty(u,d.name,{enumerable:!0,get:()=>{throw PRe(`property ${JSON.stringify(d.name)}`,p)}}):u[d.name]=p}});for(let d=0;d<u.length;d++){const h=u[d];h instanceof Error&&Object.defineProperty(u,d,{enumerable:!0,get:()=>{throw PRe(`index ${d}`,h)}})}return Object.freeze(u)}parseTransaction(t){let r=this.getFunction(t.data.substring(0,10).toLowerCase());return r?new sKe({args:this._abiCoder.decode(r.inputs,"0x"+t.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Ut.from(t.value||"0")}):null}parseLog(t){let r=this.getEvent(t.topics[0]);return!r||r.anonymous?null:new oKe({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,t.data,t.topics)})}parseError(t){const r=Kt(t);let n=this.getError(r.substring(0,10).toLowerCase());return n?new iDt({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!!(t&&t._isInterface)}}const oDt="abstract-provider/5.7.0";var sDt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const lDt=new Le(oDt);class uDt extends yA{static isForkEvent(t){return!!(t&&t._isForkEvent)}}class bA{constructor(){lDt.checkAbstract(new.target,bA),ot(this,"_isProvider",!0)}getFeeData(){return sDt(this,void 0,void 0,function*(){const{block:t,gasPrice:r}=yield Us({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let n=null,i=null,a=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,a=Ut.from("1500000000"),i=t.baseFeePerGas.mul(2).add(a)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:a,gasPrice:r}})}addListener(t,r){return this.on(t,r)}removeListener(t,r){return this.off(t,r)}static isProvider(t){return!!(t&&t._isProvider)}}const cDt="abstract-signer/5.7.0";var Sp=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const Wh=new Le(cDt),fDt=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],dDt=[Le.errors.INSUFFICIENT_FUNDS,Le.errors.NONCE_EXPIRED,Le.errors.REPLACEMENT_UNDERPRICED];class y_{constructor(){Wh.checkAbstract(new.target,y_),ot(this,"_isSigner",!0)}getBalance(t){return Sp(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)})}getTransactionCount(t){return Sp(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)})}estimateGas(t){return Sp(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield Us(this.checkTransaction(t));return yield this.provider.estimateGas(r)})}call(t,r){return Sp(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield Us(this.checkTransaction(t));return yield this.provider.call(n,r)})}sendTransaction(t){return Sp(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(t),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Sp(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Sp(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Sp(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(t){return Sp(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)})}checkTransaction(t){for(const n in t)fDt.indexOf(n)===-1&&Wh.throwArgumentError("invalid transaction key: "+n,"transaction",t);const r=Uo(t);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Wh.throwArgumentError("from address mismatch","transaction",t),n[0])),r}populateTransaction(t){return Sp(this,void 0,void 0,function*(){const r=yield Us(this.checkTransaction(t));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Sp(this,void 0,void 0,function*(){if(i==null)return null;const a=yield this.resolveName(i);return a==null&&Wh.throwArgumentError("provided ENS name resolves to null","tx.to",i),a})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Wh.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t):(r.type===0||r.type===1)&&n&&Wh.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Wh.throwError("network does not support EIP-1559",Le.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Wh.throwError("failed to get consistent fee data",Le.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(dDt.indexOf(i.code)>=0)throw i;return Wh.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Le.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Wh.throwArgumentError("chainId address mismatch","transaction",t),i[0])),yield Us(r)})}_checkProvider(t){this.provider||Wh.throwError("missing provider",Le.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!!(t&&t._isSigner)}}class Qj extends y_{constructor(t,r){super(),ot(this,"address",t),ot(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,r){return Promise.resolve().then(()=>{Wh.throwError(t,Le.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new Qj(this.address,t)}}var C2e={exports:{}};C2e.exports;(function(e){(function(t,r){function n(D,E){if(!D)throw new Error(E||"Assertion failed")}function i(D,E){D.super_=E;var S=function(){};S.prototype=E.prototype,D.prototype=new S,D.prototype.constructor=D}function a(D,E,S){if(a.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&((E==="le"||E==="be")&&(S=E,E=10),this._init(D||0,E||10,S||"be"))}typeof t=="object"?t.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=fA.Buffer}catch{}a.isBN=function(E){return E instanceof a?!0:E!==null&&typeof E=="object"&&E.constructor.wordSize===a.wordSize&&Array.isArray(E.words)},a.max=function(E,S){return E.cmp(S)>0?E:S},a.min=function(E,S){return E.cmp(S)<0?E:S},a.prototype._init=function(E,S,C){if(typeof E=="number")return this._initNumber(E,S,C);if(typeof E=="object")return this._initArray(E,S,C);S==="hex"&&(S=16),n(S===(S|0)&&S>=2&&S<=36),E=E.toString().replace(/\s+/g,"");var M=0;E[0]==="-"&&(M++,this.negative=1),M<E.length&&(S===16?this._parseHex(E,M,C):(this._parseBase(E,S,M),C==="le"&&this._initArray(this.toArray(),S,C)))},a.prototype._initNumber=function(E,S,C){E<0&&(this.negative=1,E=-E),E<67108864?(this.words=[E&67108863],this.length=1):E<4503599627370496?(this.words=[E&67108863,E/67108864&67108863],this.length=2):(n(E<9007199254740992),this.words=[E&67108863,E/67108864&67108863,1],this.length=3),C==="le"&&this._initArray(this.toArray(),S,C)},a.prototype._initArray=function(E,S,C){if(n(typeof E.length=="number"),E.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(E.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var k,U,G=0;if(C==="be")for(M=E.length-1,k=0;M>=0;M-=3)U=E[M]|E[M-1]<<8|E[M-2]<<16,this.words[k]|=U<<G&67108863,this.words[k+1]=U>>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);else if(C==="le")for(M=0,k=0;M<E.length;M+=3)U=E[M]|E[M+1]<<8|E[M+2]<<16,this.words[k]|=U<<G&67108863,this.words[k+1]=U>>>26-G&67108863,G+=24,G>=26&&(G-=26,k++);return this._strip()};function s(D,E){var S=D.charCodeAt(E);if(S>=48&&S<=57)return S-48;if(S>=65&&S<=70)return S-55;if(S>=97&&S<=102)return S-87;n(!1,"Invalid character in "+D)}function l(D,E,S){var C=s(D,S);return S-1>=E&&(C|=s(D,S-1)<<4),C}a.prototype._parseHex=function(E,S,C){this.length=Math.ceil((E.length-S)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var k=0,U=0,G;if(C==="be")for(M=E.length-1;M>=S;M-=2)G=l(E,S,M)<<k,this.words[U]|=G&67108863,k>=18?(k-=18,U+=1,this.words[U]|=G>>>26):k+=8;else{var B=E.length-S;for(M=B%2===0?S+1:S;M<E.length;M+=2)G=l(E,S,M)<<k,this.words[U]|=G&67108863,k>=18?(k-=18,U+=1,this.words[U]|=G>>>26):k+=8}this._strip()};function u(D,E,S,C){for(var M=0,k=0,U=Math.min(D.length,S),G=E;G<U;G++){var B=D.charCodeAt(G)-48;M*=C,B>=49?k=B-49+10:B>=17?k=B-17+10:k=B,n(B>=0&&k<C,"Invalid character"),M+=k}return M}a.prototype._parseBase=function(E,S,C){this.words=[0],this.length=1;for(var M=0,k=1;k<=67108863;k*=S)M++;M--,k=k/S|0;for(var U=E.length-C,G=U%M,B=Math.min(U,U-G)+C,x=0,H=C;H<B;H+=M)x=u(E,H,H+M,S),this.imuln(k),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x);if(G!==0){var q=1;for(x=u(E,H,E.length,S),H=0;H<G;H++)q*=S;this.imuln(q),this.words[0]+x<67108864?this.words[0]+=x:this._iaddn(x)}this._strip()},a.prototype.copy=function(E){E.words=new Array(this.length);for(var S=0;S<this.length;S++)E.words[S]=this.words[S];E.length=this.length,E.negative=this.negative,E.red=this.red};function c(D,E){D.words=E.words,D.length=E.length,D.negative=E.negative,D.red=E.red}if(a.prototype._move=function(E){c(E,this)},a.prototype.clone=function(){var E=new a(null);return this.copy(E),E},a.prototype._expand=function(E){for(;this.length<E;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch{a.prototype.inspect=f}else a.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],h=[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],p=[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];a.prototype.toString=function(E,S){E=E||10,S=S|0||1;var C;if(E===16||E==="hex"){C="";for(var M=0,k=0,U=0;U<this.length;U++){var G=this.words[U],B=((G<<M|k)&16777215).toString(16);k=G>>>24-M&16777215,M+=2,M>=26&&(M-=26,U--),k!==0||U!==this.length-1?C=d[6-B.length]+B+C:C=B+C}for(k!==0&&(C=k.toString(16)+C);C.length%S!==0;)C="0"+C;return this.negative!==0&&(C="-"+C),C}if(E===(E|0)&&E>=2&&E<=36){var x=h[E],H=p[E];C="";var q=this.clone();for(q.negative=0;!q.isZero();){var W=q.modrn(H).toString(E);q=q.idivn(H),q.isZero()?C=W+C:C=d[x-W.length]+W+C}for(this.isZero()&&(C="0"+C);C.length%S!==0;)C="0"+C;return this.negative!==0&&(C="-"+C),C}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var E=this.words[0];return this.length===2?E+=this.words[1]*67108864:this.length===3&&this.words[2]===1?E+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-E:E},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(E,S){return this.toArrayLike(o,E,S)}),a.prototype.toArray=function(E,S){return this.toArrayLike(Array,E,S)};var g=function(E,S){return E.allocUnsafe?E.allocUnsafe(S):new E(S)};a.prototype.toArrayLike=function(E,S,C){this._strip();var M=this.byteLength(),k=C||Math.max(1,M);n(M<=k,"byte array longer than desired length"),n(k>0,"Requested array length <= 0");var U=g(E,k),G=S==="le"?"LE":"BE";return this["_toArrayLike"+G](U,M),U},a.prototype._toArrayLikeLE=function(E,S){for(var C=0,M=0,k=0,U=0;k<this.length;k++){var G=this.words[k]<<U|M;E[C++]=G&255,C<E.length&&(E[C++]=G>>8&255),C<E.length&&(E[C++]=G>>16&255),U===6?(C<E.length&&(E[C++]=G>>24&255),M=0,U=0):(M=G>>>24,U+=2)}if(C<E.length)for(E[C++]=M;C<E.length;)E[C++]=0},a.prototype._toArrayLikeBE=function(E,S){for(var C=E.length-1,M=0,k=0,U=0;k<this.length;k++){var G=this.words[k]<<U|M;E[C--]=G&255,C>=0&&(E[C--]=G>>8&255),C>=0&&(E[C--]=G>>16&255),U===6?(C>=0&&(E[C--]=G>>24&255),M=0,U=0):(M=G>>>24,U+=2)}if(C>=0)for(E[C--]=M;C>=0;)E[C--]=0},Math.clz32?a.prototype._countBits=function(E){return 32-Math.clz32(E)}:a.prototype._countBits=function(E){var S=E,C=0;return S>=4096&&(C+=13,S>>>=13),S>=64&&(C+=7,S>>>=7),S>=8&&(C+=4,S>>>=4),S>=2&&(C+=2,S>>>=2),C+S},a.prototype._zeroBits=function(E){if(E===0)return 26;var S=E,C=0;return S&8191||(C+=13,S>>>=13),S&127||(C+=7,S>>>=7),S&15||(C+=4,S>>>=4),S&3||(C+=2,S>>>=2),S&1||C++,C},a.prototype.bitLength=function(){var E=this.words[this.length-1],S=this._countBits(E);return(this.length-1)*26+S};function m(D){for(var E=new Array(D.bitLength()),S=0;S<E.length;S++){var C=S/26|0,M=S%26;E[S]=D.words[C]>>>M&1}return E}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var E=0,S=0;S<this.length;S++){var C=this._zeroBits(this.words[S]);if(E+=C,C!==26)break}return E},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(E){return this.negative!==0?this.abs().inotn(E).iaddn(1):this.clone()},a.prototype.fromTwos=function(E){return this.testn(E-1)?this.notn(E).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(E){for(;this.length<E.length;)this.words[this.length++]=0;for(var S=0;S<E.length;S++)this.words[S]=this.words[S]|E.words[S];return this._strip()},a.prototype.ior=function(E){return n((this.negative|E.negative)===0),this.iuor(E)},a.prototype.or=function(E){return this.length>E.length?this.clone().ior(E):E.clone().ior(this)},a.prototype.uor=function(E){return this.length>E.length?this.clone().iuor(E):E.clone().iuor(this)},a.prototype.iuand=function(E){var S;this.length>E.length?S=E:S=this;for(var C=0;C<S.length;C++)this.words[C]=this.words[C]&E.words[C];return this.length=S.length,this._strip()},a.prototype.iand=function(E){return n((this.negative|E.negative)===0),this.iuand(E)},a.prototype.and=function(E){return this.length>E.length?this.clone().iand(E):E.clone().iand(this)},a.prototype.uand=function(E){return this.length>E.length?this.clone().iuand(E):E.clone().iuand(this)},a.prototype.iuxor=function(E){var S,C;this.length>E.length?(S=this,C=E):(S=E,C=this);for(var M=0;M<C.length;M++)this.words[M]=S.words[M]^C.words[M];if(this!==S)for(;M<S.length;M++)this.words[M]=S.words[M];return this.length=S.length,this._strip()},a.prototype.ixor=function(E){return n((this.negative|E.negative)===0),this.iuxor(E)},a.prototype.xor=function(E){return this.length>E.length?this.clone().ixor(E):E.clone().ixor(this)},a.prototype.uxor=function(E){return this.length>E.length?this.clone().iuxor(E):E.clone().iuxor(this)},a.prototype.inotn=function(E){n(typeof E=="number"&&E>=0);var S=Math.ceil(E/26)|0,C=E%26;this._expand(S),C>0&&S--;for(var M=0;M<S;M++)this.words[M]=~this.words[M]&67108863;return C>0&&(this.words[M]=~this.words[M]&67108863>>26-C),this._strip()},a.prototype.notn=function(E){return this.clone().inotn(E)},a.prototype.setn=function(E,S){n(typeof E=="number"&&E>=0);var C=E/26|0,M=E%26;return this._expand(C+1),S?this.words[C]=this.words[C]|1<<M:this.words[C]=this.words[C]&~(1<<M),this._strip()},a.prototype.iadd=function(E){var S;if(this.negative!==0&&E.negative===0)return this.negative=0,S=this.isub(E),this.negative^=1,this._normSign();if(this.negative===0&&E.negative!==0)return E.negative=0,S=this.isub(E),E.negative=1,S._normSign();var C,M;this.length>E.length?(C=this,M=E):(C=E,M=this);for(var k=0,U=0;U<M.length;U++)S=(C.words[U]|0)+(M.words[U]|0)+k,this.words[U]=S&67108863,k=S>>>26;for(;k!==0&&U<C.length;U++)S=(C.words[U]|0)+k,this.words[U]=S&67108863,k=S>>>26;if(this.length=C.length,k!==0)this.words[this.length]=k,this.length++;else if(C!==this)for(;U<C.length;U++)this.words[U]=C.words[U];return this},a.prototype.add=function(E){var S;return E.negative!==0&&this.negative===0?(E.negative=0,S=this.sub(E),E.negative^=1,S):E.negative===0&&this.negative!==0?(this.negative=0,S=E.sub(this),this.negative=1,S):this.length>E.length?this.clone().iadd(E):E.clone().iadd(this)},a.prototype.isub=function(E){if(E.negative!==0){E.negative=0;var S=this.iadd(E);return E.negative=1,S._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(E),this.negative=1,this._normSign();var C=this.cmp(E);if(C===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,k;C>0?(M=this,k=E):(M=E,k=this);for(var U=0,G=0;G<k.length;G++)S=(M.words[G]|0)-(k.words[G]|0)+U,U=S>>26,this.words[G]=S&67108863;for(;U!==0&&G<M.length;G++)S=(M.words[G]|0)+U,U=S>>26,this.words[G]=S&67108863;if(U===0&&G<M.length&&M!==this)for(;G<M.length;G++)this.words[G]=M.words[G];return this.length=Math.max(this.length,G),M!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(E){return this.clone().isub(E)};function y(D,E,S){S.negative=E.negative^D.negative;var C=D.length+E.length|0;S.length=C,C=C-1|0;var M=D.words[0]|0,k=E.words[0]|0,U=M*k,G=U&67108863,B=U/67108864|0;S.words[0]=G;for(var x=1;x<C;x++){for(var H=B>>>26,q=B&67108863,W=Math.min(x,E.length-1),Y=Math.max(0,x-D.length+1);Y<=W;Y++){var re=x-Y|0;M=D.words[re]|0,k=E.words[Y]|0,U=M*k+q,H+=U/67108864|0,q=U&67108863}S.words[x]=q|0,B=H|0}return B!==0?S.words[x]=B|0:S.length--,S._strip()}var b=function(E,S,C){var M=E.words,k=S.words,U=C.words,G=0,B,x,H,q=M[0]|0,W=q&8191,Y=q>>>13,re=M[1]|0,Q=re&8191,ie=re>>>13,ce=M[2]|0,te=ce&8191,J=ce>>>13,ge=M[3]|0,fe=ge&8191,ye=ge>>>13,Fe=M[4]|0,me=Fe&8191,Ue=Fe>>>13,tt=M[5]|0,Ve=tt&8191,Ae=tt>>>13,je=M[6]|0,Pe=je&8191,Oe=je>>>13,rt=M[7]|0,We=rt&8191,ne=rt>>>13,X=M[8]|0,K=X&8191,le=X>>>13,ve=M[9]|0,Ee=ve&8191,we=ve>>>13,ft=k[0]|0,He=ft&8191,Ke=ft>>>13,Jt=k[1]|0,at=Jt&8191,At=Jt>>>13,Vr=k[2]|0,xt=Vr&8191,Dt=Vr>>>13,Bn=k[3]|0,Nt=Bn&8191,Xt=Bn>>>13,ji=k[4]|0,ct=ji&8191,St=ji>>>13,Ji=k[5]|0,er=Ji&8191,Yt=Ji>>>13,la=k[6]|0,Wt=la&8191,Ht=la>>>13,zi=k[7]|0,vt=zi&8191,Lt=zi>>>13,Kr=k[8]|0,yt=Kr&8191,Pt=Kr>>>13,ua=k[9]|0,Me=ua&8191,$e=ua>>>13;C.negative=E.negative^S.negative,C.length=19,B=Math.imul(W,He),x=Math.imul(W,Ke),x=x+Math.imul(Y,He)|0,H=Math.imul(Y,Ke);var Mt=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,B=Math.imul(Q,He),x=Math.imul(Q,Ke),x=x+Math.imul(ie,He)|0,H=Math.imul(ie,Ke),B=B+Math.imul(W,at)|0,x=x+Math.imul(W,At)|0,x=x+Math.imul(Y,at)|0,H=H+Math.imul(Y,At)|0;var Tr=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,B=Math.imul(te,He),x=Math.imul(te,Ke),x=x+Math.imul(J,He)|0,H=Math.imul(J,Ke),B=B+Math.imul(Q,at)|0,x=x+Math.imul(Q,At)|0,x=x+Math.imul(ie,at)|0,H=H+Math.imul(ie,At)|0,B=B+Math.imul(W,xt)|0,x=x+Math.imul(W,Dt)|0,x=x+Math.imul(Y,xt)|0,H=H+Math.imul(Y,Dt)|0;var kr=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(kr>>>26)|0,kr&=67108863,B=Math.imul(fe,He),x=Math.imul(fe,Ke),x=x+Math.imul(ye,He)|0,H=Math.imul(ye,Ke),B=B+Math.imul(te,at)|0,x=x+Math.imul(te,At)|0,x=x+Math.imul(J,at)|0,H=H+Math.imul(J,At)|0,B=B+Math.imul(Q,xt)|0,x=x+Math.imul(Q,Dt)|0,x=x+Math.imul(ie,xt)|0,H=H+Math.imul(ie,Dt)|0,B=B+Math.imul(W,Nt)|0,x=x+Math.imul(W,Xt)|0,x=x+Math.imul(Y,Nt)|0,H=H+Math.imul(Y,Xt)|0;var cn=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(cn>>>26)|0,cn&=67108863,B=Math.imul(me,He),x=Math.imul(me,Ke),x=x+Math.imul(Ue,He)|0,H=Math.imul(Ue,Ke),B=B+Math.imul(fe,at)|0,x=x+Math.imul(fe,At)|0,x=x+Math.imul(ye,at)|0,H=H+Math.imul(ye,At)|0,B=B+Math.imul(te,xt)|0,x=x+Math.imul(te,Dt)|0,x=x+Math.imul(J,xt)|0,H=H+Math.imul(J,Dt)|0,B=B+Math.imul(Q,Nt)|0,x=x+Math.imul(Q,Xt)|0,x=x+Math.imul(ie,Nt)|0,H=H+Math.imul(ie,Xt)|0,B=B+Math.imul(W,ct)|0,x=x+Math.imul(W,St)|0,x=x+Math.imul(Y,ct)|0,H=H+Math.imul(Y,St)|0;var dn=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(dn>>>26)|0,dn&=67108863,B=Math.imul(Ve,He),x=Math.imul(Ve,Ke),x=x+Math.imul(Ae,He)|0,H=Math.imul(Ae,Ke),B=B+Math.imul(me,at)|0,x=x+Math.imul(me,At)|0,x=x+Math.imul(Ue,at)|0,H=H+Math.imul(Ue,At)|0,B=B+Math.imul(fe,xt)|0,x=x+Math.imul(fe,Dt)|0,x=x+Math.imul(ye,xt)|0,H=H+Math.imul(ye,Dt)|0,B=B+Math.imul(te,Nt)|0,x=x+Math.imul(te,Xt)|0,x=x+Math.imul(J,Nt)|0,H=H+Math.imul(J,Xt)|0,B=B+Math.imul(Q,ct)|0,x=x+Math.imul(Q,St)|0,x=x+Math.imul(ie,ct)|0,H=H+Math.imul(ie,St)|0,B=B+Math.imul(W,er)|0,x=x+Math.imul(W,Yt)|0,x=x+Math.imul(Y,er)|0,H=H+Math.imul(Y,Yt)|0;var ni=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ni>>>26)|0,ni&=67108863,B=Math.imul(Pe,He),x=Math.imul(Pe,Ke),x=x+Math.imul(Oe,He)|0,H=Math.imul(Oe,Ke),B=B+Math.imul(Ve,at)|0,x=x+Math.imul(Ve,At)|0,x=x+Math.imul(Ae,at)|0,H=H+Math.imul(Ae,At)|0,B=B+Math.imul(me,xt)|0,x=x+Math.imul(me,Dt)|0,x=x+Math.imul(Ue,xt)|0,H=H+Math.imul(Ue,Dt)|0,B=B+Math.imul(fe,Nt)|0,x=x+Math.imul(fe,Xt)|0,x=x+Math.imul(ye,Nt)|0,H=H+Math.imul(ye,Xt)|0,B=B+Math.imul(te,ct)|0,x=x+Math.imul(te,St)|0,x=x+Math.imul(J,ct)|0,H=H+Math.imul(J,St)|0,B=B+Math.imul(Q,er)|0,x=x+Math.imul(Q,Yt)|0,x=x+Math.imul(ie,er)|0,H=H+Math.imul(ie,Yt)|0,B=B+Math.imul(W,Wt)|0,x=x+Math.imul(W,Ht)|0,x=x+Math.imul(Y,Wt)|0,H=H+Math.imul(Y,Ht)|0;var ao=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ao>>>26)|0,ao&=67108863,B=Math.imul(We,He),x=Math.imul(We,Ke),x=x+Math.imul(ne,He)|0,H=Math.imul(ne,Ke),B=B+Math.imul(Pe,at)|0,x=x+Math.imul(Pe,At)|0,x=x+Math.imul(Oe,at)|0,H=H+Math.imul(Oe,At)|0,B=B+Math.imul(Ve,xt)|0,x=x+Math.imul(Ve,Dt)|0,x=x+Math.imul(Ae,xt)|0,H=H+Math.imul(Ae,Dt)|0,B=B+Math.imul(me,Nt)|0,x=x+Math.imul(me,Xt)|0,x=x+Math.imul(Ue,Nt)|0,H=H+Math.imul(Ue,Xt)|0,B=B+Math.imul(fe,ct)|0,x=x+Math.imul(fe,St)|0,x=x+Math.imul(ye,ct)|0,H=H+Math.imul(ye,St)|0,B=B+Math.imul(te,er)|0,x=x+Math.imul(te,Yt)|0,x=x+Math.imul(J,er)|0,H=H+Math.imul(J,Yt)|0,B=B+Math.imul(Q,Wt)|0,x=x+Math.imul(Q,Ht)|0,x=x+Math.imul(ie,Wt)|0,H=H+Math.imul(ie,Ht)|0,B=B+Math.imul(W,vt)|0,x=x+Math.imul(W,Lt)|0,x=x+Math.imul(Y,vt)|0,H=H+Math.imul(Y,Lt)|0;var ea=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ea>>>26)|0,ea&=67108863,B=Math.imul(K,He),x=Math.imul(K,Ke),x=x+Math.imul(le,He)|0,H=Math.imul(le,Ke),B=B+Math.imul(We,at)|0,x=x+Math.imul(We,At)|0,x=x+Math.imul(ne,at)|0,H=H+Math.imul(ne,At)|0,B=B+Math.imul(Pe,xt)|0,x=x+Math.imul(Pe,Dt)|0,x=x+Math.imul(Oe,xt)|0,H=H+Math.imul(Oe,Dt)|0,B=B+Math.imul(Ve,Nt)|0,x=x+Math.imul(Ve,Xt)|0,x=x+Math.imul(Ae,Nt)|0,H=H+Math.imul(Ae,Xt)|0,B=B+Math.imul(me,ct)|0,x=x+Math.imul(me,St)|0,x=x+Math.imul(Ue,ct)|0,H=H+Math.imul(Ue,St)|0,B=B+Math.imul(fe,er)|0,x=x+Math.imul(fe,Yt)|0,x=x+Math.imul(ye,er)|0,H=H+Math.imul(ye,Yt)|0,B=B+Math.imul(te,Wt)|0,x=x+Math.imul(te,Ht)|0,x=x+Math.imul(J,Wt)|0,H=H+Math.imul(J,Ht)|0,B=B+Math.imul(Q,vt)|0,x=x+Math.imul(Q,Lt)|0,x=x+Math.imul(ie,vt)|0,H=H+Math.imul(ie,Lt)|0,B=B+Math.imul(W,yt)|0,x=x+Math.imul(W,Pt)|0,x=x+Math.imul(Y,yt)|0,H=H+Math.imul(Y,Pt)|0;var go=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(go>>>26)|0,go&=67108863,B=Math.imul(Ee,He),x=Math.imul(Ee,Ke),x=x+Math.imul(we,He)|0,H=Math.imul(we,Ke),B=B+Math.imul(K,at)|0,x=x+Math.imul(K,At)|0,x=x+Math.imul(le,at)|0,H=H+Math.imul(le,At)|0,B=B+Math.imul(We,xt)|0,x=x+Math.imul(We,Dt)|0,x=x+Math.imul(ne,xt)|0,H=H+Math.imul(ne,Dt)|0,B=B+Math.imul(Pe,Nt)|0,x=x+Math.imul(Pe,Xt)|0,x=x+Math.imul(Oe,Nt)|0,H=H+Math.imul(Oe,Xt)|0,B=B+Math.imul(Ve,ct)|0,x=x+Math.imul(Ve,St)|0,x=x+Math.imul(Ae,ct)|0,H=H+Math.imul(Ae,St)|0,B=B+Math.imul(me,er)|0,x=x+Math.imul(me,Yt)|0,x=x+Math.imul(Ue,er)|0,H=H+Math.imul(Ue,Yt)|0,B=B+Math.imul(fe,Wt)|0,x=x+Math.imul(fe,Ht)|0,x=x+Math.imul(ye,Wt)|0,H=H+Math.imul(ye,Ht)|0,B=B+Math.imul(te,vt)|0,x=x+Math.imul(te,Lt)|0,x=x+Math.imul(J,vt)|0,H=H+Math.imul(J,Lt)|0,B=B+Math.imul(Q,yt)|0,x=x+Math.imul(Q,Pt)|0,x=x+Math.imul(ie,yt)|0,H=H+Math.imul(ie,Pt)|0,B=B+Math.imul(W,Me)|0,x=x+Math.imul(W,$e)|0,x=x+Math.imul(Y,Me)|0,H=H+Math.imul(Y,$e)|0;var ca=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(ca>>>26)|0,ca&=67108863,B=Math.imul(Ee,at),x=Math.imul(Ee,At),x=x+Math.imul(we,at)|0,H=Math.imul(we,At),B=B+Math.imul(K,xt)|0,x=x+Math.imul(K,Dt)|0,x=x+Math.imul(le,xt)|0,H=H+Math.imul(le,Dt)|0,B=B+Math.imul(We,Nt)|0,x=x+Math.imul(We,Xt)|0,x=x+Math.imul(ne,Nt)|0,H=H+Math.imul(ne,Xt)|0,B=B+Math.imul(Pe,ct)|0,x=x+Math.imul(Pe,St)|0,x=x+Math.imul(Oe,ct)|0,H=H+Math.imul(Oe,St)|0,B=B+Math.imul(Ve,er)|0,x=x+Math.imul(Ve,Yt)|0,x=x+Math.imul(Ae,er)|0,H=H+Math.imul(Ae,Yt)|0,B=B+Math.imul(me,Wt)|0,x=x+Math.imul(me,Ht)|0,x=x+Math.imul(Ue,Wt)|0,H=H+Math.imul(Ue,Ht)|0,B=B+Math.imul(fe,vt)|0,x=x+Math.imul(fe,Lt)|0,x=x+Math.imul(ye,vt)|0,H=H+Math.imul(ye,Lt)|0,B=B+Math.imul(te,yt)|0,x=x+Math.imul(te,Pt)|0,x=x+Math.imul(J,yt)|0,H=H+Math.imul(J,Pt)|0,B=B+Math.imul(Q,Me)|0,x=x+Math.imul(Q,$e)|0,x=x+Math.imul(ie,Me)|0,H=H+Math.imul(ie,$e)|0;var Ia=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,B=Math.imul(Ee,xt),x=Math.imul(Ee,Dt),x=x+Math.imul(we,xt)|0,H=Math.imul(we,Dt),B=B+Math.imul(K,Nt)|0,x=x+Math.imul(K,Xt)|0,x=x+Math.imul(le,Nt)|0,H=H+Math.imul(le,Xt)|0,B=B+Math.imul(We,ct)|0,x=x+Math.imul(We,St)|0,x=x+Math.imul(ne,ct)|0,H=H+Math.imul(ne,St)|0,B=B+Math.imul(Pe,er)|0,x=x+Math.imul(Pe,Yt)|0,x=x+Math.imul(Oe,er)|0,H=H+Math.imul(Oe,Yt)|0,B=B+Math.imul(Ve,Wt)|0,x=x+Math.imul(Ve,Ht)|0,x=x+Math.imul(Ae,Wt)|0,H=H+Math.imul(Ae,Ht)|0,B=B+Math.imul(me,vt)|0,x=x+Math.imul(me,Lt)|0,x=x+Math.imul(Ue,vt)|0,H=H+Math.imul(Ue,Lt)|0,B=B+Math.imul(fe,yt)|0,x=x+Math.imul(fe,Pt)|0,x=x+Math.imul(ye,yt)|0,H=H+Math.imul(ye,Pt)|0,B=B+Math.imul(te,Me)|0,x=x+Math.imul(te,$e)|0,x=x+Math.imul(J,Me)|0,H=H+Math.imul(J,$e)|0;var en=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(en>>>26)|0,en&=67108863,B=Math.imul(Ee,Nt),x=Math.imul(Ee,Xt),x=x+Math.imul(we,Nt)|0,H=Math.imul(we,Xt),B=B+Math.imul(K,ct)|0,x=x+Math.imul(K,St)|0,x=x+Math.imul(le,ct)|0,H=H+Math.imul(le,St)|0,B=B+Math.imul(We,er)|0,x=x+Math.imul(We,Yt)|0,x=x+Math.imul(ne,er)|0,H=H+Math.imul(ne,Yt)|0,B=B+Math.imul(Pe,Wt)|0,x=x+Math.imul(Pe,Ht)|0,x=x+Math.imul(Oe,Wt)|0,H=H+Math.imul(Oe,Ht)|0,B=B+Math.imul(Ve,vt)|0,x=x+Math.imul(Ve,Lt)|0,x=x+Math.imul(Ae,vt)|0,H=H+Math.imul(Ae,Lt)|0,B=B+Math.imul(me,yt)|0,x=x+Math.imul(me,Pt)|0,x=x+Math.imul(Ue,yt)|0,H=H+Math.imul(Ue,Pt)|0,B=B+Math.imul(fe,Me)|0,x=x+Math.imul(fe,$e)|0,x=x+Math.imul(ye,Me)|0,H=H+Math.imul(ye,$e)|0;var Li=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Li>>>26)|0,Li&=67108863,B=Math.imul(Ee,ct),x=Math.imul(Ee,St),x=x+Math.imul(we,ct)|0,H=Math.imul(we,St),B=B+Math.imul(K,er)|0,x=x+Math.imul(K,Yt)|0,x=x+Math.imul(le,er)|0,H=H+Math.imul(le,Yt)|0,B=B+Math.imul(We,Wt)|0,x=x+Math.imul(We,Ht)|0,x=x+Math.imul(ne,Wt)|0,H=H+Math.imul(ne,Ht)|0,B=B+Math.imul(Pe,vt)|0,x=x+Math.imul(Pe,Lt)|0,x=x+Math.imul(Oe,vt)|0,H=H+Math.imul(Oe,Lt)|0,B=B+Math.imul(Ve,yt)|0,x=x+Math.imul(Ve,Pt)|0,x=x+Math.imul(Ae,yt)|0,H=H+Math.imul(Ae,Pt)|0,B=B+Math.imul(me,Me)|0,x=x+Math.imul(me,$e)|0,x=x+Math.imul(Ue,Me)|0,H=H+Math.imul(Ue,$e)|0;var pi=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(pi>>>26)|0,pi&=67108863,B=Math.imul(Ee,er),x=Math.imul(Ee,Yt),x=x+Math.imul(we,er)|0,H=Math.imul(we,Yt),B=B+Math.imul(K,Wt)|0,x=x+Math.imul(K,Ht)|0,x=x+Math.imul(le,Wt)|0,H=H+Math.imul(le,Ht)|0,B=B+Math.imul(We,vt)|0,x=x+Math.imul(We,Lt)|0,x=x+Math.imul(ne,vt)|0,H=H+Math.imul(ne,Lt)|0,B=B+Math.imul(Pe,yt)|0,x=x+Math.imul(Pe,Pt)|0,x=x+Math.imul(Oe,yt)|0,H=H+Math.imul(Oe,Pt)|0,B=B+Math.imul(Ve,Me)|0,x=x+Math.imul(Ve,$e)|0,x=x+Math.imul(Ae,Me)|0,H=H+Math.imul(Ae,$e)|0;var Go=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Go>>>26)|0,Go&=67108863,B=Math.imul(Ee,Wt),x=Math.imul(Ee,Ht),x=x+Math.imul(we,Wt)|0,H=Math.imul(we,Ht),B=B+Math.imul(K,vt)|0,x=x+Math.imul(K,Lt)|0,x=x+Math.imul(le,vt)|0,H=H+Math.imul(le,Lt)|0,B=B+Math.imul(We,yt)|0,x=x+Math.imul(We,Pt)|0,x=x+Math.imul(ne,yt)|0,H=H+Math.imul(ne,Pt)|0,B=B+Math.imul(Pe,Me)|0,x=x+Math.imul(Pe,$e)|0,x=x+Math.imul(Oe,Me)|0,H=H+Math.imul(Oe,$e)|0;var hs=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(hs>>>26)|0,hs&=67108863,B=Math.imul(Ee,vt),x=Math.imul(Ee,Lt),x=x+Math.imul(we,vt)|0,H=Math.imul(we,Lt),B=B+Math.imul(K,yt)|0,x=x+Math.imul(K,Pt)|0,x=x+Math.imul(le,yt)|0,H=H+Math.imul(le,Pt)|0,B=B+Math.imul(We,Me)|0,x=x+Math.imul(We,$e)|0,x=x+Math.imul(ne,Me)|0,H=H+Math.imul(ne,$e)|0;var Ml=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Ml>>>26)|0,Ml&=67108863,B=Math.imul(Ee,yt),x=Math.imul(Ee,Pt),x=x+Math.imul(we,yt)|0,H=Math.imul(we,Pt),B=B+Math.imul(K,Me)|0,x=x+Math.imul(K,$e)|0,x=x+Math.imul(le,Me)|0,H=H+Math.imul(le,$e)|0;var Dl=(G+B|0)+((x&8191)<<13)|0;G=(H+(x>>>13)|0)+(Dl>>>26)|0,Dl&=67108863,B=Math.imul(Ee,Me),x=Math.imul(Ee,$e),x=x+Math.imul(we,Me)|0,H=Math.imul(we,$e);var pe=(G+B|0)+((x&8191)<<13)|0;return G=(H+(x>>>13)|0)+(pe>>>26)|0,pe&=67108863,U[0]=Mt,U[1]=Tr,U[2]=kr,U[3]=cn,U[4]=dn,U[5]=ni,U[6]=ao,U[7]=ea,U[8]=go,U[9]=ca,U[10]=Ia,U[11]=en,U[12]=Li,U[13]=pi,U[14]=Go,U[15]=hs,U[16]=Ml,U[17]=Dl,U[18]=pe,G!==0&&(U[19]=G,C.length++),C};Math.imul||(b=y);function w(D,E,S){S.negative=E.negative^D.negative,S.length=D.length+E.length;for(var C=0,M=0,k=0;k<S.length-1;k++){var U=M;M=0;for(var G=C&67108863,B=Math.min(k,E.length-1),x=Math.max(0,k-D.length+1);x<=B;x++){var H=k-x,q=D.words[H]|0,W=E.words[x]|0,Y=q*W,re=Y&67108863;U=U+(Y/67108864|0)|0,re=re+G|0,G=re&67108863,U=U+(re>>>26)|0,M+=U>>>26,U&=67108863}S.words[k]=G,C=U,U=M}return C!==0?S.words[k]=C:S.length--,S._strip()}function T(D,E,S){return w(D,E,S)}a.prototype.mulTo=function(E,S){var C,M=this.length+E.length;return this.length===10&&E.length===10?C=b(this,E,S):M<63?C=y(this,E,S):M<1024?C=w(this,E,S):C=T(this,E,S),C},a.prototype.mul=function(E){var S=new a(null);return S.words=new Array(this.length+E.length),this.mulTo(E,S)},a.prototype.mulf=function(E){var S=new a(null);return S.words=new Array(this.length+E.length),T(this,E,S)},a.prototype.imul=function(E){return this.clone().mulTo(E,this)},a.prototype.imuln=function(E){var S=E<0;S&&(E=-E),n(typeof E=="number"),n(E<67108864);for(var C=0,M=0;M<this.length;M++){var k=(this.words[M]|0)*E,U=(k&67108863)+(C&67108863);C>>=26,C+=k/67108864|0,C+=U>>>26,this.words[M]=U&67108863}return C!==0&&(this.words[M]=C,this.length++),S?this.ineg():this},a.prototype.muln=function(E){return this.clone().imuln(E)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(E){var S=m(E);if(S.length===0)return new a(1);for(var C=this,M=0;M<S.length&&S[M]===0;M++,C=C.sqr());if(++M<S.length)for(var k=C.sqr();M<S.length;M++,k=k.sqr())S[M]!==0&&(C=C.mul(k));return C},a.prototype.iushln=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26,M=67108863>>>26-S<<26-S,k;if(S!==0){var U=0;for(k=0;k<this.length;k++){var G=this.words[k]&M,B=(this.words[k]|0)-G<<S;this.words[k]=B|U,U=G>>>26-S}U&&(this.words[k]=U,this.length++)}if(C!==0){for(k=this.length-1;k>=0;k--)this.words[k+C]=this.words[k];for(k=0;k<C;k++)this.words[k]=0;this.length+=C}return this._strip()},a.prototype.ishln=function(E){return n(this.negative===0),this.iushln(E)},a.prototype.iushrn=function(E,S,C){n(typeof E=="number"&&E>=0);var M;S?M=(S-S%26)/26:M=0;var k=E%26,U=Math.min((E-k)/26,this.length),G=67108863^67108863>>>k<<k,B=C;if(M-=U,M=Math.max(0,M),B){for(var x=0;x<U;x++)B.words[x]=this.words[x];B.length=U}if(U!==0)if(this.length>U)for(this.length-=U,x=0;x<this.length;x++)this.words[x]=this.words[x+U];else this.words[0]=0,this.length=1;var H=0;for(x=this.length-1;x>=0&&(H!==0||x>=M);x--){var q=this.words[x]|0;this.words[x]=H<<26-k|q>>>k,H=q&G}return B&&H!==0&&(B.words[B.length++]=H),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(E,S,C){return n(this.negative===0),this.iushrn(E,S,C)},a.prototype.shln=function(E){return this.clone().ishln(E)},a.prototype.ushln=function(E){return this.clone().iushln(E)},a.prototype.shrn=function(E){return this.clone().ishrn(E)},a.prototype.ushrn=function(E){return this.clone().iushrn(E)},a.prototype.testn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26,M=1<<S;if(this.length<=C)return!1;var k=this.words[C];return!!(k&M)},a.prototype.imaskn=function(E){n(typeof E=="number"&&E>=0);var S=E%26,C=(E-S)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=C)return this;if(S!==0&&C++,this.length=Math.min(C,this.length),S!==0){var M=67108863^67108863>>>S<<S;this.words[this.length-1]&=M}return this._strip()},a.prototype.maskn=function(E){return this.clone().imaskn(E)},a.prototype.iaddn=function(E){return n(typeof E=="number"),n(E<67108864),E<0?this.isubn(-E):this.negative!==0?this.length===1&&(this.words[0]|0)<=E?(this.words[0]=E-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(E),this.negative=1,this):this._iaddn(E)},a.prototype._iaddn=function(E){this.words[0]+=E;for(var S=0;S<this.length&&this.words[S]>=67108864;S++)this.words[S]-=67108864,S===this.length-1?this.words[S+1]=1:this.words[S+1]++;return this.length=Math.max(this.length,S+1),this},a.prototype.isubn=function(E){if(n(typeof E=="number"),n(E<67108864),E<0)return this.iaddn(-E);if(this.negative!==0)return this.negative=0,this.iaddn(E),this.negative=1,this;if(this.words[0]-=E,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var S=0;S<this.length&&this.words[S]<0;S++)this.words[S]+=67108864,this.words[S+1]-=1;return this._strip()},a.prototype.addn=function(E){return this.clone().iaddn(E)},a.prototype.subn=function(E){return this.clone().isubn(E)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(E,S,C){var M=E.length+C,k;this._expand(M);var U,G=0;for(k=0;k<E.length;k++){U=(this.words[k+C]|0)+G;var B=(E.words[k]|0)*S;U-=B&67108863,G=(U>>26)-(B/67108864|0),this.words[k+C]=U&67108863}for(;k<this.length-C;k++)U=(this.words[k+C]|0)+G,G=U>>26,this.words[k+C]=U&67108863;if(G===0)return this._strip();for(n(G===-1),G=0,k=0;k<this.length;k++)U=-(this.words[k]|0)+G,G=U>>26,this.words[k]=U&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(E,S){var C=this.length-E.length,M=this.clone(),k=E,U=k.words[k.length-1]|0,G=this._countBits(U);C=26-G,C!==0&&(k=k.ushln(C),M.iushln(C),U=k.words[k.length-1]|0);var B=M.length-k.length,x;if(S!=="mod"){x=new a(null),x.length=B+1,x.words=new Array(x.length);for(var H=0;H<x.length;H++)x.words[H]=0}var q=M.clone()._ishlnsubmul(k,1,B);q.negative===0&&(M=q,x&&(x.words[B]=1));for(var W=B-1;W>=0;W--){var Y=(M.words[k.length+W]|0)*67108864+(M.words[k.length+W-1]|0);for(Y=Math.min(Y/U|0,67108863),M._ishlnsubmul(k,Y,W);M.negative!==0;)Y--,M.negative=0,M._ishlnsubmul(k,1,W),M.isZero()||(M.negative^=1);x&&(x.words[W]=Y)}return x&&x._strip(),M._strip(),S!=="div"&&C!==0&&M.iushrn(C),{div:x||null,mod:M}},a.prototype.divmod=function(E,S,C){if(n(!E.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var M,k,U;return this.negative!==0&&E.negative===0?(U=this.neg().divmod(E,S),S!=="mod"&&(M=U.div.neg()),S!=="div"&&(k=U.mod.neg(),C&&k.negative!==0&&k.iadd(E)),{div:M,mod:k}):this.negative===0&&E.negative!==0?(U=this.divmod(E.neg(),S),S!=="mod"&&(M=U.div.neg()),{div:M,mod:U.mod}):this.negative&E.negative?(U=this.neg().divmod(E.neg(),S),S!=="div"&&(k=U.mod.neg(),C&&k.negative!==0&&k.isub(E)),{div:U.div,mod:k}):E.length>this.length||this.cmp(E)<0?{div:new a(0),mod:this}:E.length===1?S==="div"?{div:this.divn(E.words[0]),mod:null}:S==="mod"?{div:null,mod:new a(this.modrn(E.words[0]))}:{div:this.divn(E.words[0]),mod:new a(this.modrn(E.words[0]))}:this._wordDiv(E,S)},a.prototype.div=function(E){return this.divmod(E,"div",!1).div},a.prototype.mod=function(E){return this.divmod(E,"mod",!1).mod},a.prototype.umod=function(E){return this.divmod(E,"mod",!0).mod},a.prototype.divRound=function(E){var S=this.divmod(E);if(S.mod.isZero())return S.div;var C=S.div.negative!==0?S.mod.isub(E):S.mod,M=E.ushrn(1),k=E.andln(1),U=C.cmp(M);return U<0||k===1&&U===0?S.div:S.div.negative!==0?S.div.isubn(1):S.div.iaddn(1)},a.prototype.modrn=function(E){var S=E<0;S&&(E=-E),n(E<=67108863);for(var C=(1<<26)%E,M=0,k=this.length-1;k>=0;k--)M=(C*M+(this.words[k]|0))%E;return S?-M:M},a.prototype.modn=function(E){return this.modrn(E)},a.prototype.idivn=function(E){var S=E<0;S&&(E=-E),n(E<=67108863);for(var C=0,M=this.length-1;M>=0;M--){var k=(this.words[M]|0)+C*67108864;this.words[M]=k/E|0,C=k%E}return this._strip(),S?this.ineg():this},a.prototype.divn=function(E){return this.clone().idivn(E)},a.prototype.egcd=function(E){n(E.negative===0),n(!E.isZero());var S=this,C=E.clone();S.negative!==0?S=S.umod(E):S=S.clone();for(var M=new a(1),k=new a(0),U=new a(0),G=new a(1),B=0;S.isEven()&&C.isEven();)S.iushrn(1),C.iushrn(1),++B;for(var x=C.clone(),H=S.clone();!S.isZero();){for(var q=0,W=1;!(S.words[0]&W)&&q<26;++q,W<<=1);if(q>0)for(S.iushrn(q);q-- >0;)(M.isOdd()||k.isOdd())&&(M.iadd(x),k.isub(H)),M.iushrn(1),k.iushrn(1);for(var Y=0,re=1;!(C.words[0]&re)&&Y<26;++Y,re<<=1);if(Y>0)for(C.iushrn(Y);Y-- >0;)(U.isOdd()||G.isOdd())&&(U.iadd(x),G.isub(H)),U.iushrn(1),G.iushrn(1);S.cmp(C)>=0?(S.isub(C),M.isub(U),k.isub(G)):(C.isub(S),U.isub(M),G.isub(k))}return{a:U,b:G,gcd:C.iushln(B)}},a.prototype._invmp=function(E){n(E.negative===0),n(!E.isZero());var S=this,C=E.clone();S.negative!==0?S=S.umod(E):S=S.clone();for(var M=new a(1),k=new a(0),U=C.clone();S.cmpn(1)>0&&C.cmpn(1)>0;){for(var G=0,B=1;!(S.words[0]&B)&&G<26;++G,B<<=1);if(G>0)for(S.iushrn(G);G-- >0;)M.isOdd()&&M.iadd(U),M.iushrn(1);for(var x=0,H=1;!(C.words[0]&H)&&x<26;++x,H<<=1);if(x>0)for(C.iushrn(x);x-- >0;)k.isOdd()&&k.iadd(U),k.iushrn(1);S.cmp(C)>=0?(S.isub(C),M.isub(k)):(C.isub(S),k.isub(M))}var q;return S.cmpn(1)===0?q=M:q=k,q.cmpn(0)<0&&q.iadd(E),q},a.prototype.gcd=function(E){if(this.isZero())return E.abs();if(E.isZero())return this.abs();var S=this.clone(),C=E.clone();S.negative=0,C.negative=0;for(var M=0;S.isEven()&&C.isEven();M++)S.iushrn(1),C.iushrn(1);do{for(;S.isEven();)S.iushrn(1);for(;C.isEven();)C.iushrn(1);var k=S.cmp(C);if(k<0){var U=S;S=C,C=U}else if(k===0||C.cmpn(1)===0)break;S.isub(C)}while(!0);return C.iushln(M)},a.prototype.invm=function(E){return this.egcd(E).a.umod(E)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(E){return this.words[0]&E},a.prototype.bincn=function(E){n(typeof E=="number");var S=E%26,C=(E-S)/26,M=1<<S;if(this.length<=C)return this._expand(C+1),this.words[C]|=M,this;for(var k=M,U=C;k!==0&&U<this.length;U++){var G=this.words[U]|0;G+=k,k=G>>>26,G&=67108863,this.words[U]=G}return k!==0&&(this.words[U]=k,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(E){var S=E<0;if(this.negative!==0&&!S)return-1;if(this.negative===0&&S)return 1;this._strip();var C;if(this.length>1)C=1;else{S&&(E=-E),n(E<=67108863,"Number is too big");var M=this.words[0]|0;C=M===E?0:M<E?-1:1}return this.negative!==0?-C|0:C},a.prototype.cmp=function(E){if(this.negative!==0&&E.negative===0)return-1;if(this.negative===0&&E.negative!==0)return 1;var S=this.ucmp(E);return this.negative!==0?-S|0:S},a.prototype.ucmp=function(E){if(this.length>E.length)return 1;if(this.length<E.length)return-1;for(var S=0,C=this.length-1;C>=0;C--){var M=this.words[C]|0,k=E.words[C]|0;if(M!==k){M<k?S=-1:M>k&&(S=1);break}}return S},a.prototype.gtn=function(E){return this.cmpn(E)===1},a.prototype.gt=function(E){return this.cmp(E)===1},a.prototype.gten=function(E){return this.cmpn(E)>=0},a.prototype.gte=function(E){return this.cmp(E)>=0},a.prototype.ltn=function(E){return this.cmpn(E)===-1},a.prototype.lt=function(E){return this.cmp(E)===-1},a.prototype.lten=function(E){return this.cmpn(E)<=0},a.prototype.lte=function(E){return this.cmp(E)<=0},a.prototype.eqn=function(E){return this.cmpn(E)===0},a.prototype.eq=function(E){return this.cmp(E)===0},a.red=function(E){return new $(E)},a.prototype.toRed=function(E){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),E.convertTo(this)._forceRed(E)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(E){return this.red=E,this},a.prototype.forceRed=function(E){return n(!this.red,"Already a number in reduction context"),this._forceRed(E)},a.prototype.redAdd=function(E){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,E)},a.prototype.redIAdd=function(E){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,E)},a.prototype.redSub=function(E){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,E)},a.prototype.redISub=function(E){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,E)},a.prototype.redShl=function(E){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,E)},a.prototype.redMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.mul(this,E)},a.prototype.redIMul=function(E){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,E),this.red.imul(this,E)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(E){return n(this.red&&!E.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,E)};var R={k256:null,p224:null,p192:null,p25519:null};function N(D,E){this.name=D,this.p=new a(E,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}N.prototype._tmp=function(){var E=new a(null);return E.words=new Array(Math.ceil(this.n/13)),E},N.prototype.ireduce=function(E){var S=E,C;do this.split(S,this.tmp),S=this.imulK(S),S=S.iadd(this.tmp),C=S.bitLength();while(C>this.n);var M=C<this.n?-1:S.ucmp(this.p);return M===0?(S.words[0]=0,S.length=1):M>0?S.isub(this.p):S.strip!==void 0?S.strip():S._strip(),S},N.prototype.split=function(E,S){E.iushrn(this.n,0,S)},N.prototype.imulK=function(E){return E.imul(this.k)};function A(){N.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(A,N),A.prototype.split=function(E,S){for(var C=4194303,M=Math.min(E.length,9),k=0;k<M;k++)S.words[k]=E.words[k];if(S.length=M,E.length<=9){E.words[0]=0,E.length=1;return}var U=E.words[9];for(S.words[S.length++]=U&C,k=10;k<E.length;k++){var G=E.words[k]|0;E.words[k-10]=(G&C)<<4|U>>>22,U=G}U>>>=22,E.words[k-10]=U,U===0&&E.length>10?E.length-=10:E.length-=9},A.prototype.imulK=function(E){E.words[E.length]=0,E.words[E.length+1]=0,E.length+=2;for(var S=0,C=0;C<E.length;C++){var M=E.words[C]|0;S+=M*977,E.words[C]=S&67108863,S=M*64+(S/67108864|0)}return E.words[E.length-1]===0&&(E.length--,E.words[E.length-1]===0&&E.length--),E};function L(){N.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(L,N);function O(){N.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(O,N);function I(){N.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(I,N),I.prototype.imulK=function(E){for(var S=0,C=0;C<E.length;C++){var M=(E.words[C]|0)*19+S,k=M&67108863;M>>>=26,E.words[C]=k,S=M}return S!==0&&(E.words[E.length++]=S),E},a._prime=function(E){if(R[E])return R[E];var S;if(E==="k256")S=new A;else if(E==="p224")S=new L;else if(E==="p192")S=new O;else if(E==="p25519")S=new I;else throw new Error("Unknown prime "+E);return R[E]=S,S};function $(D){if(typeof D=="string"){var E=a._prime(D);this.m=E.p,this.prime=E}else n(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}$.prototype._verify1=function(E){n(E.negative===0,"red works only with positives"),n(E.red,"red works only with red numbers")},$.prototype._verify2=function(E,S){n((E.negative|S.negative)===0,"red works only with positives"),n(E.red&&E.red===S.red,"red works only with red numbers")},$.prototype.imod=function(E){return this.prime?this.prime.ireduce(E)._forceRed(this):(c(E,E.umod(this.m)._forceRed(this)),E)},$.prototype.neg=function(E){return E.isZero()?E.clone():this.m.sub(E)._forceRed(this)},$.prototype.add=function(E,S){this._verify2(E,S);var C=E.add(S);return C.cmp(this.m)>=0&&C.isub(this.m),C._forceRed(this)},$.prototype.iadd=function(E,S){this._verify2(E,S);var C=E.iadd(S);return C.cmp(this.m)>=0&&C.isub(this.m),C},$.prototype.sub=function(E,S){this._verify2(E,S);var C=E.sub(S);return C.cmpn(0)<0&&C.iadd(this.m),C._forceRed(this)},$.prototype.isub=function(E,S){this._verify2(E,S);var C=E.isub(S);return C.cmpn(0)<0&&C.iadd(this.m),C},$.prototype.shl=function(E,S){return this._verify1(E),this.imod(E.ushln(S))},$.prototype.imul=function(E,S){return this._verify2(E,S),this.imod(E.imul(S))},$.prototype.mul=function(E,S){return this._verify2(E,S),this.imod(E.mul(S))},$.prototype.isqr=function(E){return this.imul(E,E.clone())},$.prototype.sqr=function(E){return this.mul(E,E)},$.prototype.sqrt=function(E){if(E.isZero())return E.clone();var S=this.m.andln(3);if(n(S%2===1),S===3){var C=this.m.add(new a(1)).iushrn(2);return this.pow(E,C)}for(var M=this.m.subn(1),k=0;!M.isZero()&&M.andln(1)===0;)k++,M.iushrn(1);n(!M.isZero());var U=new a(1).toRed(this),G=U.redNeg(),B=this.m.subn(1).iushrn(1),x=this.m.bitLength();for(x=new a(2*x*x).toRed(this);this.pow(x,B).cmp(G)!==0;)x.redIAdd(G);for(var H=this.pow(x,M),q=this.pow(E,M.addn(1).iushrn(1)),W=this.pow(E,M),Y=k;W.cmp(U)!==0;){for(var re=W,Q=0;re.cmp(U)!==0;Q++)re=re.redSqr();n(Q<Y);var ie=this.pow(H,new a(1).iushln(Y-Q-1));q=q.redMul(ie),H=ie.redSqr(),W=W.redMul(H),Y=Q}return q},$.prototype.invm=function(E){var S=E._invmp(this.m);return S.negative!==0?(S.negative=0,this.imod(S).redNeg()):this.imod(S)},$.prototype.pow=function(E,S){if(S.isZero())return new a(1).toRed(this);if(S.cmpn(1)===0)return E.clone();var C=4,M=new Array(1<<C);M[0]=new a(1).toRed(this),M[1]=E;for(var k=2;k<M.length;k++)M[k]=this.mul(M[k-1],E);var U=M[0],G=0,B=0,x=S.bitLength()%26;for(x===0&&(x=26),k=S.length-1;k>=0;k--){for(var H=S.words[k],q=x-1;q>=0;q--){var W=H>>q&1;if(U!==M[0]&&(U=this.sqr(U)),W===0&&G===0){B=0;continue}G<<=1,G|=W,B++,!(B!==C&&(k!==0||q!==0))&&(U=this.mul(U,M[G]),B=0,G=0)}x=26}return U},$.prototype.convertTo=function(E){var S=E.umod(this.m);return S===E?S.clone():S},$.prototype.convertFrom=function(E){var S=E.clone();return S.red=null,S},a.mont=function(E){return new F(E)};function F(D){$.call(this,D),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(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(F,$),F.prototype.convertTo=function(E){return this.imod(E.ushln(this.shift))},F.prototype.convertFrom=function(E){var S=this.imod(E.mul(this.rinv));return S.red=null,S},F.prototype.imul=function(E,S){if(E.isZero()||S.isZero())return E.words[0]=0,E.length=1,E;var C=E.imul(S),M=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=C.isub(M).iushrn(this.shift),U=k;return k.cmp(this.m)>=0?U=k.isub(this.m):k.cmpn(0)<0&&(U=k.iadd(this.m)),U._forceRed(this)},F.prototype.mul=function(E,S){if(E.isZero()||S.isZero())return new a(0)._forceRed(this);var C=E.mul(S),M=C.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),k=C.isub(M).iushrn(this.shift),U=k;return k.cmp(this.m)>=0?U=k.isub(this.m):k.cmpn(0)<0&&(U=k.iadd(this.m)),U._forceRed(this)},F.prototype.invm=function(E){var S=this.imod(E._invmp(this.m).mul(this.r2));return S._forceRed(this)}})(e,gt)})(C2e);var hDt=C2e.exports;const oi=Nn(hDt);var lKe={},Zi={},LM=uKe;function uKe(e,t){if(!e)throw new Error(t||"Assertion failed")}uKe.equal=function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)};var Nhe={exports:{}};typeof Object.create=="function"?Nhe.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Nhe.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}};var G0=Nhe.exports,pDt=LM,vDt=G0;Zi.inherits=vDt;function gDt(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function mDt(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var a=e.charCodeAt(i);a<128?r[n++]=a:a<2048?(r[n++]=a>>6|192,r[n++]=a&63|128):gDt(e,i)?(a=65536+((a&1023)<<10)+(e.charCodeAt(++i)&1023),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=a&63|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=a&63|128)}else for(i=0;i<e.length;i++)r[i]=e[i]|0;return r}Zi.toArray=mDt;function yDt(e){for(var t="",r=0;r<e.length;r++)t+=fKe(e[r].toString(16));return t}Zi.toHex=yDt;function cKe(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}Zi.htonl=cKe;function EDt(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];t==="little"&&(i=cKe(i)),r+=dKe(i.toString(16))}return r}Zi.toHex32=EDt;function fKe(e){return e.length===1?"0"+e:e}Zi.zero2=fKe;function dKe(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}Zi.zero8=dKe;function bDt(e,t,r,n){var i=r-t;pDt(i%4===0);for(var a=new Array(i/4),o=0,s=t;o<a.length;o++,s+=4){var l;n==="big"?l=e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:l=e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],a[o]=l>>>0}return a}Zi.join32=bDt;function _Dt(e,t){for(var r=new Array(e.length*4),n=0,i=0;n<e.length;n++,i+=4){var a=e[n];t==="big"?(r[i]=a>>>24,r[i+1]=a>>>16&255,r[i+2]=a>>>8&255,r[i+3]=a&255):(r[i+3]=a>>>24,r[i+2]=a>>>16&255,r[i+1]=a>>>8&255,r[i]=a&255)}return r}Zi.split32=_Dt;function SDt(e,t){return e>>>t|e<<32-t}Zi.rotr32=SDt;function wDt(e,t){return e<<t|e>>>32-t}Zi.rotl32=wDt;function TDt(e,t){return e+t>>>0}Zi.sum32=TDt;function ADt(e,t,r){return e+t+r>>>0}Zi.sum32_3=ADt;function CDt(e,t,r,n){return e+t+r+n>>>0}Zi.sum32_4=CDt;function RDt(e,t,r,n,i){return e+t+r+n+i>>>0}Zi.sum32_5=RDt;function xDt(e,t,r,n){var i=e[t],a=e[t+1],o=n+a>>>0,s=(o<n?1:0)+r+i;e[t]=s>>>0,e[t+1]=o}Zi.sum64=xDt;function IDt(e,t,r,n){var i=t+n>>>0,a=(i<t?1:0)+e+r;return a>>>0}Zi.sum64_hi=IDt;function ODt(e,t,r,n){var i=t+n;return i>>>0}Zi.sum64_lo=ODt;function NDt(e,t,r,n,i,a,o,s){var l=0,u=t;u=u+n>>>0,l+=u<t?1:0,u=u+a>>>0,l+=u<a?1:0,u=u+s>>>0,l+=u<s?1:0;var c=e+r+i+o+l;return c>>>0}Zi.sum64_4_hi=NDt;function LDt(e,t,r,n,i,a,o,s){var l=t+n+a+s;return l>>>0}Zi.sum64_4_lo=LDt;function PDt(e,t,r,n,i,a,o,s,l,u){var c=0,f=t;f=f+n>>>0,c+=f<t?1:0,f=f+a>>>0,c+=f<a?1:0,f=f+s>>>0,c+=f<s?1:0,f=f+u>>>0,c+=f<u?1:0;var d=e+r+i+o+l+c;return d>>>0}Zi.sum64_5_hi=PDt;function MDt(e,t,r,n,i,a,o,s,l,u){var c=t+n+a+s+u;return c>>>0}Zi.sum64_5_lo=MDt;function DDt(e,t,r){var n=t<<32-r|e>>>r;return n>>>0}Zi.rotr64_hi=DDt;function $Dt(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}Zi.rotr64_lo=$Dt;function kDt(e,t,r){return e>>>r}Zi.shr64_hi=kDt;function BDt(e,t,r){var n=e<<32-r|t>>>r;return n>>>0}Zi.shr64_lo=BDt;var Rx={},MRe=Zi,UDt=LM;function Jj(){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}Rx.BlockHash=Jj;Jj.prototype.update=function(t,r){if(t=MRe.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),this.pending.length===0&&(this.pending=null),t=MRe.join32(t,0,t.length-n,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this};Jj.prototype.digest=function(t){return this.update(this._pad()),UDt(this.pending===null),this._digest(t)};Jj.prototype._pad=function(){var t=this.pendingTotal,r=this._delta8,n=r-(t+this.padLength)%r,i=new Array(n+this.padLength);i[0]=128;for(var a=1;a<n;a++)i[a]=0;if(t<<=3,this.endian==="big"){for(var o=8;o<this.padLength;o++)i[a++]=0;i[a++]=0,i[a++]=0,i[a++]=0,i[a++]=0,i[a++]=t>>>24&255,i[a++]=t>>>16&255,i[a++]=t>>>8&255,i[a++]=t&255}else for(i[a++]=t&255,i[a++]=t>>>8&255,i[a++]=t>>>16&255,i[a++]=t>>>24&255,i[a++]=0,i[a++]=0,i[a++]=0,i[a++]=0,o=8;o<this.padLength;o++)i[a++]=0;return i};var xx={},Pg={},FDt=Zi,K1=FDt.rotr32;function HDt(e,t,r,n){if(e===0)return hKe(t,r,n);if(e===1||e===3)return vKe(t,r,n);if(e===2)return pKe(t,r,n)}Pg.ft_1=HDt;function hKe(e,t,r){return e&t^~e&r}Pg.ch32=hKe;function pKe(e,t,r){return e&t^e&r^t&r}Pg.maj32=pKe;function vKe(e,t,r){return e^t^r}Pg.p32=vKe;function GDt(e){return K1(e,2)^K1(e,13)^K1(e,22)}Pg.s0_256=GDt;function VDt(e){return K1(e,6)^K1(e,11)^K1(e,25)}Pg.s1_256=VDt;function WDt(e){return K1(e,7)^K1(e,18)^e>>>3}Pg.g0_256=WDt;function jDt(e){return K1(e,17)^K1(e,19)^e>>>10}Pg.g1_256=jDt;var dR=Zi,zDt=Rx,YDt=Pg,Mie=dR.rotl32,v8=dR.sum32,qDt=dR.sum32_5,XDt=YDt.ft_1,gKe=zDt.BlockHash,KDt=[1518500249,1859775393,2400959708,3395469782];function wg(){if(!(this instanceof wg))return new wg;gKe.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}dR.inherits(wg,gKe);var ZDt=wg;wg.blockSize=512;wg.outSize=160;wg.hmacStrength=80;wg.padLength=64;wg.prototype._update=function(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i<n.length;i++)n[i]=Mie(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var a=this.h[0],o=this.h[1],s=this.h[2],l=this.h[3],u=this.h[4];for(i=0;i<n.length;i++){var c=~~(i/20),f=qDt(Mie(a,5),XDt(c,o,s,l),u,n[i],KDt[c]);u=l,l=s,s=Mie(o,30),o=a,a=f}this.h[0]=v8(this.h[0],a),this.h[1]=v8(this.h[1],o),this.h[2]=v8(this.h[2],s),this.h[3]=v8(this.h[3],l),this.h[4]=v8(this.h[4],u)};wg.prototype._digest=function(t){return t==="hex"?dR.toHex32(this.h,"big"):dR.split32(this.h,"big")};var hR=Zi,QDt=Rx,Ix=Pg,JDt=LM,wp=hR.sum32,e$t=hR.sum32_4,t$t=hR.sum32_5,r$t=Ix.ch32,n$t=Ix.maj32,i$t=Ix.s0_256,a$t=Ix.s1_256,o$t=Ix.g0_256,s$t=Ix.g1_256,mKe=QDt.BlockHash,l$t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Tg(){if(!(this instanceof Tg))return new Tg;mKe.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=l$t,this.W=new Array(64)}hR.inherits(Tg,mKe);var yKe=Tg;Tg.blockSize=512;Tg.outSize=256;Tg.hmacStrength=192;Tg.padLength=64;Tg.prototype._update=function(t,r){for(var n=this.W,i=0;i<16;i++)n[i]=t[r+i];for(;i<n.length;i++)n[i]=e$t(s$t(n[i-2]),n[i-7],o$t(n[i-15]),n[i-16]);var a=this.h[0],o=this.h[1],s=this.h[2],l=this.h[3],u=this.h[4],c=this.h[5],f=this.h[6],d=this.h[7];for(JDt(this.k.length===n.length),i=0;i<n.length;i++){var h=t$t(d,a$t(u),r$t(u,c,f),this.k[i],n[i]),p=wp(i$t(a),n$t(a,o,s));d=f,f=c,c=u,u=wp(l,h),l=s,s=o,o=a,a=wp(h,p)}this.h[0]=wp(this.h[0],a),this.h[1]=wp(this.h[1],o),this.h[2]=wp(this.h[2],s),this.h[3]=wp(this.h[3],l),this.h[4]=wp(this.h[4],u),this.h[5]=wp(this.h[5],c),this.h[6]=wp(this.h[6],f),this.h[7]=wp(this.h[7],d)};Tg.prototype._digest=function(t){return t==="hex"?hR.toHex32(this.h,"big"):hR.split32(this.h,"big")};var Lhe=Zi,EKe=yKe;function By(){if(!(this instanceof By))return new By;EKe.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Lhe.inherits(By,EKe);var u$t=By;By.blockSize=512;By.outSize=224;By.hmacStrength=192;By.padLength=64;By.prototype._digest=function(t){return t==="hex"?Lhe.toHex32(this.h.slice(0,7),"big"):Lhe.split32(this.h.slice(0,7),"big")};var Rd=Zi,c$t=Rx,f$t=LM,Z1=Rd.rotr64_hi,Q1=Rd.rotr64_lo,bKe=Rd.shr64_hi,_Ke=Rd.shr64_lo,L2=Rd.sum64,Die=Rd.sum64_hi,$ie=Rd.sum64_lo,d$t=Rd.sum64_4_hi,h$t=Rd.sum64_4_lo,p$t=Rd.sum64_5_hi,v$t=Rd.sum64_5_lo,SKe=c$t.BlockHash,g$t=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function yv(){if(!(this instanceof yv))return new yv;SKe.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=g$t,this.W=new Array(160)}Rd.inherits(yv,SKe);var wKe=yv;yv.blockSize=1024;yv.outSize=512;yv.hmacStrength=192;yv.padLength=128;yv.prototype._prepareBlock=function(t,r){for(var n=this.W,i=0;i<32;i++)n[i]=t[r+i];for(;i<n.length;i+=2){var a=R$t(n[i-4],n[i-3]),o=x$t(n[i-4],n[i-3]),s=n[i-14],l=n[i-13],u=A$t(n[i-30],n[i-29]),c=C$t(n[i-30],n[i-29]),f=n[i-32],d=n[i-31];n[i]=d$t(a,o,s,l,u,c,f,d),n[i+1]=h$t(a,o,s,l,u,c,f,d)}};yv.prototype._update=function(t,r){this._prepareBlock(t,r);var n=this.W,i=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],l=this.h[4],u=this.h[5],c=this.h[6],f=this.h[7],d=this.h[8],h=this.h[9],p=this.h[10],g=this.h[11],m=this.h[12],y=this.h[13],b=this.h[14],w=this.h[15];f$t(this.k.length===n.length);for(var T=0;T<n.length;T+=2){var R=b,N=w,A=w$t(d,h),L=T$t(d,h),O=m$t(d,h,p,g,m),I=y$t(d,h,p,g,m,y),$=this.k[T],F=this.k[T+1],D=n[T],E=n[T+1],S=p$t(R,N,A,L,O,I,$,F,D,E),C=v$t(R,N,A,L,O,I,$,F,D,E);R=_$t(i,a),N=S$t(i,a),A=E$t(i,a,o,s,l),L=b$t(i,a,o,s,l,u);var M=Die(R,N,A,L),k=$ie(R,N,A,L);b=m,w=y,m=p,y=g,p=d,g=h,d=Die(c,f,S,C),h=$ie(f,f,S,C),c=l,f=u,l=o,u=s,o=i,s=a,i=Die(S,C,M,k),a=$ie(S,C,M,k)}L2(this.h,0,i,a),L2(this.h,2,o,s),L2(this.h,4,l,u),L2(this.h,6,c,f),L2(this.h,8,d,h),L2(this.h,10,p,g),L2(this.h,12,m,y),L2(this.h,14,b,w)};yv.prototype._digest=function(t){return t==="hex"?Rd.toHex32(this.h,"big"):Rd.split32(this.h,"big")};function m$t(e,t,r,n,i){var a=e&r^~e&i;return a<0&&(a+=4294967296),a}function y$t(e,t,r,n,i,a){var o=t&n^~t&a;return o<0&&(o+=4294967296),o}function E$t(e,t,r,n,i){var a=e&r^e&i^r&i;return a<0&&(a+=4294967296),a}function b$t(e,t,r,n,i,a){var o=t&n^t&a^n&a;return o<0&&(o+=4294967296),o}function _$t(e,t){var r=Z1(e,t,28),n=Z1(t,e,2),i=Z1(t,e,7),a=r^n^i;return a<0&&(a+=4294967296),a}function S$t(e,t){var r=Q1(e,t,28),n=Q1(t,e,2),i=Q1(t,e,7),a=r^n^i;return a<0&&(a+=4294967296),a}function w$t(e,t){var r=Z1(e,t,14),n=Z1(e,t,18),i=Z1(t,e,9),a=r^n^i;return a<0&&(a+=4294967296),a}function T$t(e,t){var r=Q1(e,t,14),n=Q1(e,t,18),i=Q1(t,e,9),a=r^n^i;return a<0&&(a+=4294967296),a}function A$t(e,t){var r=Z1(e,t,1),n=Z1(e,t,8),i=bKe(e,t,7),a=r^n^i;return a<0&&(a+=4294967296),a}function C$t(e,t){var r=Q1(e,t,1),n=Q1(e,t,8),i=_Ke(e,t,7),a=r^n^i;return a<0&&(a+=4294967296),a}function R$t(e,t){var r=Z1(e,t,19),n=Z1(t,e,29),i=bKe(e,t,6),a=r^n^i;return a<0&&(a+=4294967296),a}function x$t(e,t){var r=Q1(e,t,19),n=Q1(t,e,29),i=_Ke(e,t,6),a=r^n^i;return a<0&&(a+=4294967296),a}var Phe=Zi,TKe=wKe;function Uy(){if(!(this instanceof Uy))return new Uy;TKe.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Phe.inherits(Uy,TKe);var I$t=Uy;Uy.blockSize=1024;Uy.outSize=384;Uy.hmacStrength=192;Uy.padLength=128;Uy.prototype._digest=function(t){return t==="hex"?Phe.toHex32(this.h.slice(0,12),"big"):Phe.split32(this.h.slice(0,12),"big")};xx.sha1=ZDt;xx.sha224=u$t;xx.sha256=yKe;xx.sha384=I$t;xx.sha512=wKe;var AKe={},CT=Zi,O$t=Rx,H$=CT.rotl32,DRe=CT.sum32,g8=CT.sum32_3,$Re=CT.sum32_4,CKe=O$t.BlockHash;function Ag(){if(!(this instanceof Ag))return new Ag;CKe.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}CT.inherits(Ag,CKe);AKe.ripemd160=Ag;Ag.blockSize=512;Ag.outSize=160;Ag.hmacStrength=192;Ag.padLength=64;Ag.prototype._update=function(t,r){for(var n=this.h[0],i=this.h[1],a=this.h[2],o=this.h[3],s=this.h[4],l=n,u=i,c=a,f=o,d=s,h=0;h<80;h++){var p=DRe(H$($Re(n,kRe(h,i,a,o),t[P$t[h]+r],N$t(h)),D$t[h]),s);n=s,s=o,o=H$(a,10),a=i,i=p,p=DRe(H$($Re(l,kRe(79-h,u,c,f),t[M$t[h]+r],L$t(h)),$$t[h]),d),l=d,d=f,f=H$(c,10),c=u,u=p}p=g8(this.h[1],a,f),this.h[1]=g8(this.h[2],o,d),this.h[2]=g8(this.h[3],s,l),this.h[3]=g8(this.h[4],n,u),this.h[4]=g8(this.h[0],i,c),this.h[0]=p};Ag.prototype._digest=function(t){return t==="hex"?CT.toHex32(this.h,"little"):CT.split32(this.h,"little")};function kRe(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function N$t(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function L$t(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var P$t=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],M$t=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],D$t=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],$$t=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],k$t=Zi,B$t=LM;function pR(e,t,r){if(!(this instanceof pR))return new pR(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(k$t.toArray(t,r))}var U$t=pR;pR.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),B$t(t.length<=this.blockSize);for(var r=t.length;r<this.blockSize;r++)t.push(0);for(r=0;r<t.length;r++)t[r]^=54;for(this.inner=new this.Hash().update(t),r=0;r<t.length;r++)t[r]^=106;this.outer=new this.Hash().update(t)};pR.prototype.update=function(t,r){return this.inner.update(t,r),this};pR.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};(function(e){var t=e;t.utils=Zi,t.common=Rx,t.sha=xx,t.ripemd=AKe,t.hmac=U$t,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})(lKe);const hd=Nn(lKe);function Ox(e,t,r){return r={path:t,exports:{},require:function(n,i){return F$t(n,i??r.path)}},e(r,r.exports),r.exports}function F$t(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var R2e=RKe;function RKe(e,t){if(!e)throw new Error(t||"Assertion failed")}RKe.equal=function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)};var qp=Ox(function(e,t){var r=t;function n(o,s){if(Array.isArray(o))return o.slice();if(!o)return[];var l=[];if(typeof o!="string"){for(var u=0;u<o.length;u++)l[u]=o[u]|0;return l}if(s==="hex"){o=o.replace(/[^a-z0-9]+/ig,""),o.length%2!==0&&(o="0"+o);for(var u=0;u<o.length;u+=2)l.push(parseInt(o[u]+o[u+1],16))}else for(var u=0;u<o.length;u++){var c=o.charCodeAt(u),f=c>>8,d=c&255;f?l.push(f,d):l.push(d)}return l}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function a(o){for(var s="",l=0;l<o.length;l++)s+=i(o[l].toString(16));return s}r.toHex=a,r.encode=function(s,l){return l==="hex"?a(s):s}}),Rh=Ox(function(e,t){var r=t;r.assert=R2e,r.toArray=qp.toArray,r.zero2=qp.zero2,r.toHex=qp.toHex,r.encode=qp.encode;function n(l,u,c){var f=new Array(Math.max(l.bitLength(),c)+1);f.fill(0);for(var d=1<<u+1,h=l.clone(),p=0;p<f.length;p++){var g,m=h.andln(d-1);h.isOdd()?(m>(d>>1)-1?g=(d>>1)-m:g=m,h.isubn(g)):g=0,f[p]=g,h.iushrn(1)}return f}r.getNAF=n;function i(l,u){var c=[[],[]];l=l.clone(),u=u.clone();for(var f=0,d=0,h;l.cmpn(-f)>0||u.cmpn(-d)>0;){var p=l.andln(3)+f&3,g=u.andln(3)+d&3;p===3&&(p=-1),g===3&&(g=-1);var m;p&1?(h=l.andln(7)+f&7,(h===3||h===5)&&g===2?m=-p:m=p):m=0,c[0].push(m);var y;g&1?(h=u.andln(7)+d&7,(h===3||h===5)&&p===2?y=-g:y=g):y=0,c[1].push(y),2*f===m+1&&(f=1-f),2*d===y+1&&(d=1-d),l.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function a(l,u,c){var f="_"+u;l.prototype[u]=function(){return this[f]!==void 0?this[f]:this[f]=c.call(this)}}r.cachedProperty=a;function o(l){return typeof l=="string"?r.toArray(l,"hex"):l}r.parseBytes=o;function s(l){return new oi(l,"hex","le")}r.intFromLE=s}),_G=Rh.getNAF,H$t=Rh.getJSF,SG=Rh.assert;function E_(e,t){this.type=e,this.p=new oi(t.p,16),this.red=t.prime?oi.red(t.prime):oi.mont(this.p),this.zero=new oi(0).toRed(this.red),this.one=new oi(1).toRed(this.red),this.two=new oi(2).toRed(this.red),this.n=t.n&&new oi(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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 _A=E_;E_.prototype.point=function(){throw new Error("Not implemented")};E_.prototype.validate=function(){throw new Error("Not implemented")};E_.prototype._fixedNafMul=function(t,r){SG(t.precomputed);var n=t._getDoubles(),i=_G(r,1,this._bitLength),a=(1<<n.step+1)-(n.step%2===0?2:1);a/=3;var o=[],s,l;for(s=0;s<i.length;s+=n.step){l=0;for(var u=s+n.step-1;u>=s;u--)l=(l<<1)+i[u];o.push(l)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=a;d>0;d--){for(s=0;s<o.length;s++)l=o[s],l===d?f=f.mixedAdd(n.points[s]):l===-d&&(f=f.mixedAdd(n.points[s].neg()));c=c.add(f)}return c.toP()};E_.prototype._wnafMul=function(t,r){var n=4,i=t._getNAFPoints(n);n=i.wnd;for(var a=i.points,o=_G(r,n,this._bitLength),s=this.jpoint(null,null,null),l=o.length-1;l>=0;l--){for(var u=0;l>=0&&o[l]===0;l--)u++;if(l>=0&&u++,s=s.dblp(u),l<0)break;var c=o[l];SG(c!==0),t.type==="affine"?c>0?s=s.mixedAdd(a[c-1>>1]):s=s.mixedAdd(a[-c-1>>1].neg()):c>0?s=s.add(a[c-1>>1]):s=s.add(a[-c-1>>1].neg())}return t.type==="affine"?s.toP():s};E_.prototype._wnafMulAdd=function(t,r,n,i,a){var o=this._wnafT1,s=this._wnafT2,l=this._wnafT3,u=0,c,f,d;for(c=0;c<i;c++){d=r[c];var h=d._getNAFPoints(t);o[c]=h.wnd,s[c]=h.points}for(c=i-1;c>=1;c-=2){var p=c-1,g=c;if(o[p]!==1||o[g]!==1){l[p]=_G(n[p],o[p],this._bitLength),l[g]=_G(n[g],o[g],this._bitLength),u=Math.max(l[p].length,u),u=Math.max(l[g].length,u);continue}var m=[r[p],null,null,r[g]];r[p].y.cmp(r[g].y)===0?(m[1]=r[p].add(r[g]),m[2]=r[p].toJ().mixedAdd(r[g].neg())):r[p].y.cmp(r[g].y.redNeg())===0?(m[1]=r[p].toJ().mixedAdd(r[g]),m[2]=r[p].add(r[g].neg())):(m[1]=r[p].toJ().mixedAdd(r[g]),m[2]=r[p].toJ().mixedAdd(r[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],b=H$t(n[p],n[g]);for(u=Math.max(b[0].length,u),l[p]=new Array(u),l[g]=new Array(u),f=0;f<u;f++){var w=b[0][f]|0,T=b[1][f]|0;l[p][f]=y[(w+1)*3+(T+1)],l[g][f]=0,s[p]=m}}var R=this.jpoint(null,null,null),N=this._wnafT4;for(c=u;c>=0;c--){for(var A=0;c>=0;){var L=!0;for(f=0;f<i;f++)N[f]=l[f][c]|0,N[f]!==0&&(L=!1);if(!L)break;A++,c--}if(c>=0&&A++,R=R.dblp(A),c<0)break;for(f=0;f<i;f++){var O=N[f];O!==0&&(O>0?d=s[f][O-1>>1]:O<0&&(d=s[f][-O-1>>1].neg()),d.type==="affine"?R=R.mixedAdd(d):R=R.add(d))}}for(c=0;c<i;c++)s[c]=null;return a?R:R.toP()};function V0(e,t){this.curve=e,this.type=t,this.precomputed=null}E_.BasePoint=V0;V0.prototype.eq=function(){throw new Error("Not implemented")};V0.prototype.validate=function(){return this.curve.validate(this)};E_.prototype.decodePoint=function(t,r){t=Rh.toArray(t,r);var n=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*n){t[0]===6?SG(t[t.length-1]%2===0):t[0]===7&&SG(t[t.length-1]%2===1);var i=this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));return i}else if((t[0]===2||t[0]===3)&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),t[0]===3);throw new Error("Unknown point format")};V0.prototype.encodeCompressed=function(t){return this.encode(t,!0)};V0.prototype._encode=function(t){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))};V0.prototype.encode=function(t,r){return Rh.encode(this._encode(r),t)};V0.prototype.precompute=function(t){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,t),r.beta=this._getBeta(),this.precomputed=r,this};V0.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((t.bitLength()+1)/r.step):!1};V0.prototype._getDoubles=function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,a=0;a<r;a+=t){for(var o=0;o<t;o++)i=i.dbl();n.push(i)}return{step:t,points:n}};V0.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,i=n===1?null:this.dbl(),a=1;a<n;a++)r[a]=r[a-1].add(i);return{wnd:t,points:r}};V0.prototype._getBeta=function(){return null};V0.prototype.dblp=function(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r};var x2e=Ox(function(e){typeof Object.create=="function"?e.exports=function(r,n){n&&(r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(r,n){if(n){r.super_=n;var i=function(){};i.prototype=n.prototype,r.prototype=new i,r.prototype.constructor=r}}}),G$t=Rh.assert;function W0(e){_A.call(this,"short",e),this.a=new oi(e.a,16).toRed(this.red),this.b=new oi(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}x2e(W0,_A);var V$t=W0;W0.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(t.beta)r=new oi(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);r=i[0].cmp(i[1])<0?i[0]:i[1],r=r.toRed(this.red)}if(t.lambda)n=new oi(t.lambda,16);else{var a=this._getEndoRoots(this.n);this.g.mul(a[0]).x.cmp(this.g.x.redMul(r))===0?n=a[0]:(n=a[1],G$t(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var o;return t.basis?o=t.basis.map(function(s){return{a:new oi(s.a,16),b:new oi(s.b,16)}}):o=this._getEndoBasis(n),{beta:r,lambda:n,basis:o}}};W0.prototype._getEndoRoots=function(t){var r=t===this.p?this.red:oi.mont(t),n=new oi(2).toRed(r).redInvm(),i=n.redNeg(),a=new oi(3).toRed(r).redNeg().redSqrt().redMul(n),o=i.redAdd(a).fromRed(),s=i.redSub(a).fromRed();return[o,s]};W0.prototype._getEndoBasis=function(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,i=this.n.clone(),a=new oi(1),o=new oi(0),s=new oi(0),l=new oi(1),u,c,f,d,h,p,g,m=0,y,b;n.cmpn(0)!==0;){var w=i.div(n);y=i.sub(w.mul(n)),b=s.sub(w.mul(a));var T=l.sub(w.mul(o));if(!f&&y.cmp(r)<0)u=g.neg(),c=a,f=y.neg(),d=b;else if(f&&++m===2)break;g=y,i=n,n=y,s=a,a=b,l=o,o=T}h=y.neg(),p=b;var R=f.sqr().add(d.sqr()),N=h.sqr().add(p.sqr());return N.cmp(R)>=0&&(h=u,p=c),f.negative&&(f=f.neg(),d=d.neg()),h.negative&&(h=h.neg(),p=p.neg()),[{a:f,b:d},{a:h,b:p}]};W0.prototype._endoSplit=function(t){var r=this.endo.basis,n=r[0],i=r[1],a=i.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),s=a.mul(n.a),l=o.mul(i.a),u=a.mul(n.b),c=o.mul(i.b),f=t.sub(s).sub(l),d=u.add(c).neg();return{k1:f,k2:d}};W0.prototype.pointFromX=function(t,r){t=new oi(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var a=i.fromRed().isOdd();return(r&&!a||!r&&a)&&(i=i.redNeg()),this.point(t,i)};W0.prototype.validate=function(t){if(t.inf)return!0;var r=t.x,n=t.y,i=this.a.redMul(r),a=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(a).cmpn(0)===0};W0.prototype._endoWnafMulAdd=function(t,r,n){for(var i=this._endoWnafT1,a=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(r[o]),l=t[o],u=l._getBeta();s.k1.negative&&(s.k1.ineg(),l=l.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),i[o*2]=l,i[o*2+1]=u,a[o*2]=s.k1,a[o*2+1]=s.k2}for(var c=this._wnafMulAdd(1,i,a,o*2,n),f=0;f<o*2;f++)i[f]=null,a[f]=null;return c};function Au(e,t,r,n){_A.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new oi(t,16),this.y=new oi(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}x2e(Au,_A.BasePoint);W0.prototype.point=function(t,r,n){return new Au(this,t,r,n)};W0.prototype.pointFromJSON=function(t,r){return Au.fromJSON(this,t,r)};Au.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,i=function(a){return n.point(a.x.redMul(n.endo.beta),a.y)};t.beta=r,r.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return r}};Au.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Au.fromJSON=function(t,r,n){typeof r=="string"&&(r=JSON.parse(r));var i=t.point(r[0],r[1],n);if(!r[2])return i;function a(s){return t.point(s[0],s[1],n)}var o=r[2];return i.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[i].concat(o.doubles.points.map(a))},naf:o.naf&&{wnd:o.naf.wnd,points:[i].concat(o.naf.points.map(a))}},i};Au.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Au.prototype.isInfinity=function(){return this.inf};Au.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 r=this.y.redSub(t.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Au.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 r=this.curve.a,n=this.x.redSqr(),i=t.redInvm(),a=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=a.redSqr().redISub(this.x.redAdd(this.x)),s=a.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)};Au.prototype.getX=function(){return this.x.fromRed()};Au.prototype.getY=function(){return this.y.fromRed()};Au.prototype.mul=function(t){return t=new oi(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)};Au.prototype.mulAdd=function(t,r,n){var i=[this,r],a=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,a):this.curve._wnafMulAdd(1,i,a,2)};Au.prototype.jmulAdd=function(t,r,n){var i=[this,r],a=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,a,!0):this.curve._wnafMulAdd(1,i,a,2,!0)};Au.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)};Au.prototype.neg=function(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,i=function(a){return a.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Au.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 dc(e,t,r,n){_A.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new oi(0)):(this.x=new oi(t,16),this.y=new oi(r,16),this.z=new oi(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}x2e(dc,_A.BasePoint);W0.prototype.jpoint=function(t,r,n){return new dc(this,t,r,n)};dc.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(t);return this.curve.point(n,i)};dc.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};dc.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),a=t.x.redMul(n),o=this.y.redMul(r.redMul(t.z)),s=t.y.redMul(n.redMul(this.z)),l=i.redSub(a),u=o.redSub(s);if(l.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=l.redSqr(),f=c.redMul(l),d=i.redMul(c),h=u.redSqr().redIAdd(f).redISub(d).redISub(d),p=u.redMul(d.redISub(h)).redISub(o.redMul(f)),g=this.z.redMul(t.z).redMul(l);return this.curve.jpoint(h,p,g)};dc.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=t.x.redMul(r),a=this.y,o=t.y.redMul(r).redMul(this.z),s=n.redSub(i),l=a.redSub(o);if(s.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),f=n.redMul(u),d=l.redSqr().redIAdd(c).redISub(f).redISub(f),h=l.redMul(f.redISub(d)).redISub(a.redMul(c)),p=this.z.redMul(s);return this.curve.jpoint(d,h,p)};dc.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r<t;r++)n=n.dbl();return n}var i=this.curve.a,a=this.curve.tinv,o=this.x,s=this.y,l=this.z,u=l.redSqr().redSqr(),c=s.redAdd(s);for(r=0;r<t;r++){var f=o.redSqr(),d=c.redSqr(),h=d.redSqr(),p=f.redAdd(f).redIAdd(f).redIAdd(i.redMul(u)),g=o.redMul(d),m=p.redSqr().redISub(g.redAdd(g)),y=g.redISub(m),b=p.redMul(y);b=b.redIAdd(b).redISub(h);var w=c.redMul(l);r+1<t&&(u=u.redMul(h)),o=m,l=w,c=b}return this.curve.jpoint(o,c.redMul(a),l)};dc.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};dc.prototype._zeroDbl=function(){var t,r,n;if(this.zOne){var i=this.x.redSqr(),a=this.y.redSqr(),o=a.redSqr(),s=this.x.redAdd(a).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var l=i.redAdd(i).redIAdd(i),u=l.redSqr().redISub(s).redISub(s),c=o.redIAdd(o);c=c.redIAdd(c),c=c.redIAdd(c),t=u,r=l.redMul(s.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),p=this.x.redAdd(d).redSqr().redISub(f).redISub(h);p=p.redIAdd(p);var g=f.redAdd(f).redIAdd(f),m=g.redSqr(),y=h.redIAdd(h);y=y.redIAdd(y),y=y.redIAdd(y),t=m.redISub(p).redISub(p),r=g.redMul(p.redISub(t)).redISub(y),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(t,r,n)};dc.prototype._threeDbl=function(){var t,r,n;if(this.zOne){var i=this.x.redSqr(),a=this.y.redSqr(),o=a.redSqr(),s=this.x.redAdd(a).redSqr().redISub(i).redISub(o);s=s.redIAdd(s);var l=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),u=l.redSqr().redISub(s).redISub(s);t=u;var c=o.redIAdd(o);c=c.redIAdd(c),c=c.redIAdd(c),r=l.redMul(s.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),p=this.x.redSub(f).redMul(this.x.redAdd(f));p=p.redAdd(p).redIAdd(p);var g=h.redIAdd(h);g=g.redIAdd(g);var m=g.redAdd(g);t=p.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(f);var y=d.redSqr();y=y.redIAdd(y),y=y.redIAdd(y),y=y.redIAdd(y),r=p.redMul(g.redISub(t)).redISub(y)}return this.curve.jpoint(t,r,n)};dc.prototype._dbl=function(){var t=this.curve.a,r=this.x,n=this.y,i=this.z,a=i.redSqr().redSqr(),o=r.redSqr(),s=n.redSqr(),l=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(a)),u=r.redAdd(r);u=u.redIAdd(u);var c=u.redMul(s),f=l.redSqr().redISub(c.redAdd(c)),d=c.redISub(f),h=s.redSqr();h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var p=l.redMul(d).redISub(h),g=n.redAdd(n).redMul(i);return this.curve.jpoint(f,p,g)};dc.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),i=r.redSqr(),a=t.redAdd(t).redIAdd(t),o=a.redSqr(),s=this.x.redAdd(r).redSqr().redISub(t).redISub(i);s=s.redIAdd(s),s=s.redAdd(s).redIAdd(s),s=s.redISub(o);var l=s.redSqr(),u=i.redIAdd(i);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var c=a.redIAdd(s).redSqr().redISub(o).redISub(l).redISub(u),f=r.redMul(c);f=f.redIAdd(f),f=f.redIAdd(f);var d=this.x.redMul(l).redISub(f);d=d.redIAdd(d),d=d.redIAdd(d);var h=this.y.redMul(c.redMul(u.redISub(c)).redISub(s.redMul(l)));h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var p=this.z.redAdd(s).redSqr().redISub(n).redISub(l);return this.curve.jpoint(d,h,p)};dc.prototype.mul=function(t,r){return t=new oi(t,r),this.curve._wnafMul(this,t)};dc.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var r=this.z.redSqr(),n=t.z.redSqr();if(this.x.redMul(n).redISub(t.x.redMul(r)).cmpn(0)!==0)return!1;var i=r.redMul(this.z),a=n.redMul(t.z);return this.y.redMul(a).redISub(t.y.redMul(i)).cmpn(0)===0};dc.prototype.eqXToP=function(t){var r=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(r);if(this.x.cmp(n)===0)return!0;for(var i=t.clone(),a=this.curve.redN.redMul(r);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(a),this.x.cmp(n)===0)return!0}};dc.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};dc.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var pF=Ox(function(e,t){var r=t;r.base=_A,r.short=V$t,r.mont=null,r.edwards=null}),vF=Ox(function(e,t){var r=t,n=Rh.assert;function i(s){s.type==="short"?this.curve=new pF.short(s):s.type==="edwards"?this.curve=new pF.edwards(s):this.curve=new pF.mont(s),this.g=this.curve.g,this.n=this.curve.n,this.hash=s.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function a(s,l){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,get:function(){var u=new i(l);return Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:u}),u}})}a("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:hd.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("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:hd.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("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:hd.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("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:hd.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"]}),a("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:hd.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"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hd.sha256,gRed:!1,g:["9"]}),a("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:hd.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}a("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:hd.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Nb(e){if(!(this instanceof Nb))return new Nb(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=qp.toArray(e.entropy,e.entropyEnc||"hex"),r=qp.toArray(e.nonce,e.nonceEnc||"hex"),n=qp.toArray(e.pers,e.persEnc||"hex");R2e(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var xKe=Nb;Nb.prototype._init=function(t,r,n){var i=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a<this.V.length;a++)this.K[a]=0,this.V[a]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656};Nb.prototype._hmac=function(){return new hd.hmac(this.hash,this.K)};Nb.prototype._update=function(t){var r=this._hmac().update(this.V).update([0]);t&&(r=r.update(t)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())};Nb.prototype.reseed=function(t,r,n,i){typeof r!="string"&&(i=n,n=r,r=null),t=qp.toArray(t,r),n=qp.toArray(n,i),R2e(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1};Nb.prototype.generate=function(t,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=qp.toArray(n,i||"hex"),this._update(n));for(var a=[];a.length<t;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var o=a.slice(0,t);return this._update(n),this._reseed++,qp.encode(o,r)};var Mhe=Rh.assert;function Uc(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var I2e=Uc;Uc.fromPublic=function(t,r,n){return r instanceof Uc?r:new Uc(t,{pub:r,pubEnc:n})};Uc.fromPrivate=function(t,r,n){return r instanceof Uc?r:new Uc(t,{priv:r,privEnc:n})};Uc.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Uc.prototype.getPublic=function(t,r){return typeof t=="string"&&(r=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,t):this.pub};Uc.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv};Uc.prototype._importPrivate=function(t,r){this.priv=new oi(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)};Uc.prototype._importPublic=function(t,r){if(t.x||t.y){this.ec.curve.type==="mont"?Mhe(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Mhe(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,r)};Uc.prototype.derive=function(t){return t.validate()||Mhe(t.validate(),"public point not validated"),t.mul(this.priv).getX()};Uc.prototype.sign=function(t,r,n){return this.ec.sign(t,this,r,n)};Uc.prototype.verify=function(t,r){return this.ec.verify(t,r,this)};Uc.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var W$t=Rh.assert;function ez(e,t){if(e instanceof ez)return e;this._importDER(e,t)||(W$t(e.r&&e.s,"Signature without r or s"),this.r=new oi(e.r,16),this.s=new oi(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var tz=ez;function j$t(){this.place=0}function kie(e,t){var r=e[t.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,a=0,o=t.place;a<n;a++,o++)i<<=8,i|=e[o],i>>>=0;return i<=127?!1:(t.place=o,i)}function BRe(e){for(var t=0,r=e.length-1;!e[t]&&!(e[t+1]&128)&&t<r;)t++;return t===0?e:e.slice(t)}ez.prototype._importDER=function(t,r){t=Rh.toArray(t,r);var n=new j$t;if(t[n.place++]!==48)return!1;var i=kie(t,n);if(i===!1||i+n.place!==t.length||t[n.place++]!==2)return!1;var a=kie(t,n);if(a===!1)return!1;var o=t.slice(n.place,a+n.place);if(n.place+=a,t[n.place++]!==2)return!1;var s=kie(t,n);if(s===!1||t.length!==s+n.place)return!1;var l=t.slice(n.place,s+n.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new oi(o),this.s=new oi(l),this.recoveryParam=null,!0};function Bie(e,t){if(t<128){e.push(t);return}var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(r|128);--r;)e.push(t>>>(r<<3)&255);e.push(t)}ez.prototype.toDER=function(t){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=BRe(r),n=BRe(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Bie(i,r.length),i=i.concat(r),i.push(2),Bie(i,n.length);var a=i.concat(n),o=[48];return Bie(o,a.length),o=o.concat(a),Rh.encode(o,t)};var z$t=function(){throw new Error("unsupported")},IKe=Rh.assert;function R0(e){if(!(this instanceof R0))return new R0(e);typeof e=="string"&&(IKe(Object.prototype.hasOwnProperty.call(vF,e),"Unknown curve "+e),e=vF[e]),e instanceof vF.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var Y$t=R0;R0.prototype.keyPair=function(t){return new I2e(this,t)};R0.prototype.keyFromPrivate=function(t,r){return I2e.fromPrivate(this,t,r)};R0.prototype.keyFromPublic=function(t,r){return I2e.fromPublic(this,t,r)};R0.prototype.genKeyPair=function(t){t||(t={});for(var r=new xKe({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||z$t(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new oi(2));;){var a=new oi(r.generate(n));if(!(a.cmp(i)>0))return a.iaddn(1),this.keyFromPrivate(a)}};R0.prototype._truncateToN=function(t,r){var n=t.byteLength()*8-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t};R0.prototype.sign=function(t,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),t=this._truncateToN(new oi(t,16));for(var a=this.n.byteLength(),o=r.getPrivate().toArray("be",a),s=t.toArray("be",a),l=new xKe({hash:this.hash,entropy:o,nonce:s,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new oi(1)),c=0;;c++){var f=i.k?i.k(c):new oi(l.generate(this.n.byteLength()));if(f=this._truncateToN(f,!0),!(f.cmpn(1)<=0||f.cmp(u)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var h=d.getX(),p=h.umod(this.n);if(p.cmpn(0)!==0){var g=f.invm(this.n).mul(p.mul(r.getPrivate()).iadd(t));if(g=g.umod(this.n),g.cmpn(0)!==0){var m=(d.getY().isOdd()?1:0)|(h.cmp(p)!==0?2:0);return i.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),m^=1),new tz({r:p,s:g,recoveryParam:m})}}}}}};R0.prototype.verify=function(t,r,n,i){t=this._truncateToN(new oi(t,16)),n=this.keyFromPublic(n,i),r=new tz(r,"hex");var a=r.r,o=r.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s=o.invm(this.n),l=s.mul(t).umod(this.n),u=s.mul(a).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(l,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(a)):(c=this.g.mulAdd(l,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(a)===0)};R0.prototype.recoverPubKey=function(e,t,r,n){IKe((3&r)===r,"The recovery param is more than two bits"),t=new tz(t,n);var i=this.n,a=new oi(e),o=t.r,s=t.s,l=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var c=t.r.invm(i),f=i.sub(a).mul(c).umod(i),d=s.mul(c).umod(i);return this.g.mulAdd(f,o,d)};R0.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new tz(t,n),t.recoveryParam!==null)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch{continue}if(a.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var q$t=Ox(function(e,t){var r=t;r.version="6.5.4",r.utils=Rh,r.rand=function(){throw new Error("unsupported")},r.curve=pF,r.curves=vF,r.ec=Y$t,r.eddsa=null}),X$t=q$t.ec;const K$t="signing-key/5.7.0",Dhe=new Le(K$t);let Uie=null;function m1(){return Uie||(Uie=new X$t("secp256k1")),Uie}class F3{constructor(t){ot(this,"curve","secp256k1"),ot(this,"privateKey",Kt(t)),_g(this.privateKey)!==32&&Dhe.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=m1().keyFromPrivate(kt(this.privateKey));ot(this,"publicKey","0x"+r.getPublic(!1,"hex")),ot(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ot(this,"_isSigningKey",!0)}_addPoint(t){const r=m1().keyFromPublic(kt(this.publicKey)),n=m1().keyFromPublic(kt(t));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const r=m1().keyFromPrivate(kt(this.privateKey)),n=kt(t);n.length!==32&&Dhe.throwArgumentError("bad digest length","digest",t);const i=r.sign(n,{canonical:!0});return mA({recoveryParam:i.recoveryParam,r:Oo("0x"+i.r.toString(16),32),s:Oo("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const r=m1().keyFromPrivate(kt(this.privateKey)),n=m1().keyFromPublic(kt(O2e(t)));return Oo("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!!(t&&t._isSigningKey)}}function OKe(e,t){const r=mA(t),n={r:kt(r.r),s:kt(r.s)};return"0x"+m1().recoverPubKey(kt(e),n,r.recoveryParam).encode("hex",!1)}function O2e(e,t){const r=kt(e);if(r.length===32){const n=new F3(r);return t?"0x"+m1().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return t?Kt(r):"0x"+m1().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return t?"0x"+m1().keyFromPublic(r).getPublic(!0,"hex"):Kt(r)}return Dhe.throwArgumentError("invalid public or private key","key","[REDACTED]")}const Z$t="transactions/5.7.0",Pc=new Le(Z$t);var $he;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})($he||($he={}));function N2e(e){return e==="0x"?null:ya(e)}function Oc(e){return e==="0x"?m2e:Ut.from(e)}const Q$t=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],J$t={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function nb(e){const t=O2e(e);return ya(ol(co(ol(t,1)),12))}function PM(e,t){return nb(OKe(kt(e),t))}function ih(e,t){const r=X1(Ut.from(e).toHexString());return r.length>32&&Pc.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function Fie(e,t){return{address:ya(e),storageKeys:(t||[]).map((r,n)=>(_g(r)!==32&&Pc.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,r),r.toLowerCase()))}}function b_(e){if(Array.isArray(e))return e.map((r,n)=>Array.isArray(r)?(r.length>2&&Pc.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Fie(r[0],r[1])):Fie(r.address,r.storageKeys));const t=Object.keys(e).map(r=>{const n=e[r].reduce((i,a)=>(i[a]=!0,i),{});return Fie(r,Object.keys(n).sort())});return t.sort((r,n)=>r.address.localeCompare(n.address)),t}function NKe(e){return b_(e).map(t=>[t.address,t.storageKeys])}function LKe(e,t){if(e.gasPrice!=null){const n=Ut.from(e.gasPrice),i=Ut.from(e.maxFeePerGas||0);n.eq(i)||Pc.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ih(e.chainId||0,"chainId"),ih(e.nonce||0,"nonce"),ih(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ih(e.maxFeePerGas||0,"maxFeePerGas"),ih(e.gasLimit||0,"gasLimit"),e.to!=null?ya(e.to):"0x",ih(e.value||0,"value"),e.data||"0x",NKe(e.accessList||[])];if(t){const n=mA(t);r.push(ih(n.recoveryParam,"recoveryParam")),r.push(X1(n.r)),r.push(X1(n.s))}return Af(["0x02",AT(r)])}function PKe(e,t){const r=[ih(e.chainId||0,"chainId"),ih(e.nonce||0,"nonce"),ih(e.gasPrice||0,"gasPrice"),ih(e.gasLimit||0,"gasLimit"),e.to!=null?ya(e.to):"0x",ih(e.value||0,"value"),e.data||"0x",NKe(e.accessList||[])];if(t){const n=mA(t);r.push(ih(n.recoveryParam,"recoveryParam")),r.push(X1(n.r)),r.push(X1(n.s))}return Af(["0x01",AT(r)])}function ekt(e,t){p2e(e,J$t);const r=[];Q$t.forEach(function(o){let s=e[o.name]||[];const l={};o.numeric&&(l.hexPad="left"),s=kt(Kt(s,l)),o.length&&s.length!==o.length&&s.length>0&&Pc.throwArgumentError("invalid length for "+o.name,"transaction:"+o.name,s),o.maxLength&&(s=X1(s),s.length>o.maxLength&&Pc.throwArgumentError("invalid length for "+o.name,"transaction:"+o.name,s)),r.push(Kt(s))});let n=0;if(e.chainId!=null?(n=e.chainId,typeof n!="number"&&Pc.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!IM(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),n!==0&&(r.push(Kt(n)),r.push("0x"),r.push("0x")),!t)return AT(r);const i=mA(t);let a=27+i.recoveryParam;return n!==0?(r.pop(),r.pop(),r.pop(),a+=n*2+8,i.v>28&&i.v!==a&&Pc.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==a&&Pc.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push(Kt(a)),r.push(X1(kt(i.r))),r.push(X1(kt(i.s))),AT(r)}function khe(e,t){if(e.type==null||e.type===0)return e.accessList!=null&&Pc.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),ekt(e,t);switch(e.type){case 1:return PKe(e,t);case 2:return LKe(e,t)}return Pc.throwError(`unsupported transaction type: ${e.type}`,Le.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function MKe(e,t,r){try{const n=Oc(t[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");e.v=n}catch{Pc.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=Oo(t[1],32),e.s=Oo(t[2],32);try{const n=co(r(e));e.from=PM(n,{r:e.r,s:e.s,recoveryParam:e.v})}catch{}}function tkt(e){const t=Xj(e.slice(1));t.length!==9&&t.length!==12&&Pc.throwArgumentError("invalid component count for transaction type: 2","payload",Kt(e));const r=Oc(t[2]),n=Oc(t[3]),i={type:2,chainId:Oc(t[0]).toNumber(),nonce:Oc(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Oc(t[4]),to:N2e(t[5]),value:Oc(t[6]),data:t[7],accessList:b_(t[8])};return t.length===9||(i.hash=co(e),MKe(i,t.slice(9),LKe)),i}function rkt(e){const t=Xj(e.slice(1));t.length!==8&&t.length!==11&&Pc.throwArgumentError("invalid component count for transaction type: 1","payload",Kt(e));const r={type:1,chainId:Oc(t[0]).toNumber(),nonce:Oc(t[1]).toNumber(),gasPrice:Oc(t[2]),gasLimit:Oc(t[3]),to:N2e(t[4]),value:Oc(t[5]),data:t[6],accessList:b_(t[7])};return t.length===8||(r.hash=co(e),MKe(r,t.slice(8),PKe)),r}function nkt(e){const t=Xj(e);t.length!==9&&t.length!==6&&Pc.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:Oc(t[0]).toNumber(),gasPrice:Oc(t[1]),gasLimit:Oc(t[2]),to:N2e(t[3]),value:Oc(t[4]),data:t[5],chainId:0};if(t.length===6)return r;try{r.v=Ut.from(t[6]).toNumber()}catch{return r}if(r.r=Oo(t[7],32),r.s=Oo(t[8],32),Ut.from(r.r).isZero()&&Ut.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=t.slice(0,6);r.chainId!==0&&(i.push(Kt(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const a=co(AT(i));try{r.from=PM(a,{r:Kt(r.r),s:Kt(r.s),recoveryParam:n})}catch{}r.hash=co(e)}return r.type=null,r}function DKe(e){const t=kt(e);if(t[0]>127)return nkt(t);switch(t[0]){case 1:return rkt(t);case 2:return tkt(t)}return Pc.throwError(`unsupported transaction type: ${t[0]}`,Le.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}const ikt="contracts/5.7.0";var Lb=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const lo=new Le(ikt),akt={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function wG(e,t){return Lb(this,void 0,void 0,function*(){const r=yield t;typeof r!="string"&&lo.throwArgumentError("invalid address or ENS name","name",r);try{return ya(r)}catch{}e||lo.throwError("a provider or signer is needed to resolve ENS names",Le.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return n==null&&lo.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function YL(e,t,r){return Lb(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>YL(e,Array.isArray(t)?t[i]:t[n.name],n))):r.type==="address"?yield wG(e,t):r.type==="tuple"?yield YL(e,t,r.components):r.baseType==="array"?Array.isArray(t)?yield Promise.all(t.map(n=>YL(e,n,r.arrayChildren))):Promise.reject(lo.makeError("invalid value for array",Le.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t})}function rz(e,t,r){return Lb(this,void 0,void 0,function*(){let n={};r.length===t.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=Uo(r.pop())),lo.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=Us({override:wG(e.signer,n.from),signer:e.signer.getAddress()}).then(u=>Lb(this,void 0,void 0,function*(){return ya(u.signer)!==u.override&&lo.throwError("Contract with a Signer cannot override from",Le.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=e.signer.getAddress():n.from&&(n.from=wG(e.provider,n.from));const i=yield Us({args:YL(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:Us(n)||{}}),a=e.interface.encodeFunctionData(t,i.args),o={data:a,to:i.address},s=i.overrides;if(s.nonce!=null&&(o.nonce=Ut.from(s.nonce).toNumber()),s.gasLimit!=null&&(o.gasLimit=Ut.from(s.gasLimit)),s.gasPrice!=null&&(o.gasPrice=Ut.from(s.gasPrice)),s.maxFeePerGas!=null&&(o.maxFeePerGas=Ut.from(s.maxFeePerGas)),s.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ut.from(s.maxPriorityFeePerGas)),s.from!=null&&(o.from=s.from),s.type!=null&&(o.type=s.type),s.accessList!=null&&(o.accessList=b_(s.accessList)),o.gasLimit==null&&t.gas!=null){let u=21e3;const c=kt(a);for(let f=0;f<c.length;f++)u+=4,c[f]&&(u+=64);o.gasLimit=Ut.from(t.gas).add(u)}if(s.value){const u=Ut.from(s.value);!u.isZero()&&!t.payable&&lo.throwError("non-payable method cannot override value",Le.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),o.value=u}s.customData&&(o.customData=Uo(s.customData)),s.ccipReadEnabled&&(o.ccipReadEnabled=!!s.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const l=Object.keys(n).filter(u=>n[u]!=null);return l.length&&lo.throwError(`cannot override ${l.map(u=>JSON.stringify(u)).join(",")}`,Le.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function okt(e,t){return function(...r){return rz(e,t,r)}}function skt(e,t){const r=e.signer||e.provider;return function(...n){return Lb(this,void 0,void 0,function*(){r||lo.throwError("estimate require a provider or signer",Le.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield rz(e,t,n);return yield r.estimateGas(i)})}}function $Ke(e,t){const r=t.wait.bind(t);t.wait=n=>r(n).then(i=>(i.events=i.logs.map(a=>{let o=Nf(a),s=null;try{s=e.interface.parseLog(a)}catch{}return s&&(o.args=s.args,o.decode=(l,u)=>e.interface.decodeEventLog(s.eventFragment,l,u),o.event=s.name,o.eventSignature=s.signature),o.removeListener=()=>e.provider,o.getBlock=()=>e.provider.getBlock(i.blockHash),o.getTransaction=()=>e.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function kKe(e,t,r){const n=e.signer||e.provider;return function(...i){return Lb(this,void 0,void 0,function*(){let a;if(i.length===t.inputs.length+1&&typeof i[i.length-1]=="object"){const l=Uo(i.pop());l.blockTag!=null&&(a=yield l.blockTag),delete l.blockTag,i.push(l)}e.deployTransaction!=null&&(yield e._deployed(a));const o=yield rz(e,t,i),s=yield n.call(o,a);try{let l=e.interface.decodeFunctionResult(t,s);return r&&t.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===Le.errors.CALL_EXCEPTION&&(l.address=e.address,l.args=i,l.transaction=o),l}})}}function lkt(e,t){return function(...r){return Lb(this,void 0,void 0,function*(){e.signer||lo.throwError("sending a transaction requires a signer",Le.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),e.deployTransaction!=null&&(yield e._deployed());const n=yield rz(e,t,r),i=yield e.signer.sendTransaction(n);return $Ke(e,i),i})}}function URe(e,t,r){return t.constant?kKe(e,t,r):lkt(e,t)}function BKe(e){return e.address&&(e.topics==null||e.topics.length===0)?"*":(e.address||"*")+"@"+(e.topics?e.topics.map(t=>Array.isArray(t)?t.join("|"):t).join(":"):"")}class L9{constructor(t,r){ot(this,"tag",t),ot(this,"filter",r),this._listeners=[]}addListener(t,r){this._listeners.push({listener:t,once:r})}removeListener(t){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==t?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(t=>t.listener)}listenerCount(){return this._listeners.length}run(t){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=t.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(t){}getEmit(t){return[t]}}class ukt extends L9{constructor(){super("error",null)}}class FRe extends L9{constructor(t,r,n,i){const a={address:t};let o=r.getEventTopic(n);i?(o!==i[0]&&lo.throwArgumentError("topic mismatch","topics",i),a.topics=i.slice()):a.topics=[o],super(BKe(a),a),ot(this,"address",t),ot(this,"interface",r),ot(this,"fragment",n)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(r){t.args=null,t.decodeError=r}}getEmit(t){const r=LXe(t.args);if(r.length)throw r[0].error;const n=(t.args||[]).slice();return n.push(t),n}}class HRe extends L9{constructor(t,r){super("*",{address:t}),ot(this,"address",t),ot(this,"interface",r)}prepareEvent(t){super.prepareEvent(t);try{const r=this.interface.parseLog(t);t.event=r.name,t.eventSignature=r.signature,t.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),t.args=r.args}catch{}}}class UKe{constructor(t,r,n){ot(this,"interface",Ju(new.target,"getInterface")(r)),n==null?(ot(this,"provider",null),ot(this,"signer",null)):y_.isSigner(n)?(ot(this,"provider",n.provider||null),ot(this,"signer",n)):bA.isProvider(n)?(ot(this,"provider",n),ot(this,"signer",null)):lo.throwArgumentError("invalid signer or provider","signerOrProvider",n),ot(this,"callStatic",{}),ot(this,"estimateGas",{}),ot(this,"functions",{}),ot(this,"populateTransaction",{}),ot(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(s=>{const l=this.interface.events[s];ot(this.filters,s,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,u)})),o[l.name]||(o[l.name]=[]),o[l.name].push(s)}),Object.keys(o).forEach(s=>{const l=o[s];l.length===1?ot(this.filters,s,this.filters[l[0]]):lo.warn(`Duplicate definition of ${s} (${l.join(", ")})`)})}if(ot(this,"_runningEvents",{}),ot(this,"_wrappedEmits",{}),t==null&&lo.throwArgumentError("invalid contract address or ENS name","addressOrName",t),ot(this,"address",t),this.provider)ot(this,"resolvedAddress",wG(this.provider,t));else try{ot(this,"resolvedAddress",Promise.resolve(ya(t)))}catch{lo.throwError("provider is required to use ENS name as contract address",Le.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},a={};Object.keys(this.interface.functions).forEach(o=>{const s=this.interface.functions[o];if(a[o]){lo.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}a[o]=!0;{const l=s.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&ot(this,o,URe(this,s,!0)),this.functions[o]==null&&ot(this.functions,o,URe(this,s,!1)),this.callStatic[o]==null&&ot(this.callStatic,o,kKe(this,s,!0)),this.populateTransaction[o]==null&&ot(this.populateTransaction,o,okt(this,s)),this.estimateGas[o]==null&&ot(this.estimateGas,o,skt(this,s))}),Object.keys(i).forEach(o=>{const s=i[o];if(s.length>1)return;o=o.substring(1);const l=s[0];try{this[o]==null&&ot(this,o,this[l])}catch{}this.functions[o]==null&&ot(this.functions,o,this.functions[l]),this.callStatic[o]==null&&ot(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&ot(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&ot(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(t){return Kj(t)}static getInterface(t){return Ohe.isInterface(t)?t:new Ohe(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,t).then(r=>(r==="0x"&&lo.throwError("contract not deployed",Le.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(t){this.signer||lo.throwError("sending a transactions require a signer",Le.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=Uo(t||{});return["from","to"].forEach(function(n){r[n]!=null&&lo.throwError("cannot override "+n,Le.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(t){typeof t=="string"&&(t=new Qj(t,this.provider));const r=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&ot(r,"deployTransaction",this.deployTransaction),r}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return bG.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if(typeof t=="string"){if(t==="error")return this._normalizeRunningEvent(new ukt);if(t==="event")return this._normalizeRunningEvent(new L9("event",null));if(t==="*")return this._normalizeRunningEvent(new HRe(this.address,this.interface));const r=this.interface.getEvent(t);return this._normalizeRunningEvent(new FRe(this.address,this.interface,r))}if(t.topics&&t.topics.length>0){try{const n=t.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new FRe(this.address,this.interface,i,t.topics))}catch{}const r={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new L9(BKe(r),r))}return this._normalizeRunningEvent(new HRe(this.address,this.interface))}_checkRunningEvents(t){if(t.listenerCount()===0){delete this._runningEvents[t.tag];const r=this._wrappedEmits[t.tag];r&&t.filter&&(this.provider.off(t.filter,r),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,r,n){const i=Nf(r);return i.removeListener=()=>{n&&(t.removeListener(n),this._checkRunningEvents(t))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),t.prepareEvent(i),i}_addEventListener(t,r,n){if(this.provider||lo.throwError("events require a provider or a signer with a provider",Le.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(r,n),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const i=a=>{let o=this._wrapEvent(t,a,r);if(o.decodeError==null)try{const s=t.getEmit(o);this.emit(t.filter,...s)}catch(s){o.decodeError=s.error}t.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[t.tag]=i,t.filter!=null&&this.provider.on(t.filter,i)}}queryFilter(t,r,n){const i=this._getRunningEvent(t),a=Uo(i.filter);return typeof r=="string"&&li(r,32)?(n!=null&&lo.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),a.blockHash=r):(a.fromBlock=r??0,a.toBlock=n??"latest"),this.provider.getLogs(a).then(o=>o.map(s=>this._wrapEvent(i,s,null)))}on(t,r){return this._addEventListener(this._getRunningEvent(t),r,!1),this}once(t,r){return this._addEventListener(this._getRunningEvent(t),r,!0),this}emit(t,...r){if(!this.provider)return!1;const n=this._getRunningEvent(t),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(t){return this.provider?t==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(t==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(t==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(t);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(t,r){if(!this.provider)return this;const n=this._getRunningEvent(t);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(t,r){return this.off(t,r)}}class Bhe extends UKe{}class ckt{constructor(t,r,n){let i=null;typeof r=="string"?i=r:m_(r)?i=Kt(r):r&&typeof r.object=="string"?i=r.object:i="!",i.substring(0,2)!=="0x"&&(i="0x"+i),(!li(i)||i.length%2)&&lo.throwArgumentError("invalid bytecode","bytecode",r),n&&!y_.isSigner(n)&&lo.throwArgumentError("invalid signer","signer",n),ot(this,"bytecode",i),ot(this,"interface",Ju(new.target,"getInterface")(t)),ot(this,"signer",n||null)}getDeployTransaction(...t){let r={};if(t.length===this.interface.deploy.inputs.length+1&&typeof t[t.length-1]=="object"){r=Uo(t.pop());for(const n in r)if(!akt[n])throw new Error("unknown transaction override "+n)}return["data","from","to"].forEach(n=>{r[n]!=null&&lo.throwError("cannot override "+n,Le.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.value&&!Ut.from(r.value).isZero()&&!this.interface.deploy.payable&&lo.throwError("non-payable constructor cannot override value",Le.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),lo.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor"),r.data=Kt(xo([this.bytecode,this.interface.encodeDeploy(t)])),r}deploy(...t){return Lb(this,void 0,void 0,function*(){let r={};t.length===this.interface.deploy.inputs.length+1&&(r=t.pop()),lo.checkArgumentCount(t.length,this.interface.deploy.inputs.length," in Contract constructor");const n=yield YL(this.signer,t,this.interface.deploy.inputs);n.push(r);const i=this.getDeployTransaction(...n),a=yield this.signer.sendTransaction(i),o=Ju(this.constructor,"getContractAddress")(a),s=Ju(this.constructor,"getContract")(o,this.interface,this.signer);return $Ke(s,a),ot(s,"deployTransaction",a),s})}attach(t){return this.constructor.getContract(t,this.interface,this.signer)}connect(t){return new this.constructor(this.interface,this.bytecode,t)}static fromSolidity(t,r){t==null&&lo.throwError("missing compiler output",Le.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),typeof t=="string"&&(t=JSON.parse(t));const n=t.abi;let i=null;return t.bytecode?i=t.bytecode:t.evm&&t.evm.bytecode&&(i=t.evm.bytecode),new this(n,i,r)}static getInterface(t){return Bhe.getInterface(t)}static getContractAddress(t){return Kj(t)}static getContract(t,r,n){return new Bhe(t,r,n)}}class FKe{constructor(t){ot(this,"alphabet",t),ot(this,"base",t.length),ot(this,"_alphabetMap",{}),ot(this,"_leader",t.charAt(0));for(let r=0;r<t.length;r++)this._alphabetMap[t.charAt(r)]=r}encode(t){let r=kt(t);if(r.length===0)return"";let n=[0];for(let a=0;a<r.length;++a){let o=r[a];for(let s=0;s<n.length;++s)o+=n[s]<<8,n[s]=o%this.base,o=o/this.base|0;for(;o>0;)n.push(o%this.base),o=o/this.base|0}let i="";for(let a=0;r[a]===0&&a<r.length-1;++a)i+=this._leader;for(let a=n.length-1;a>=0;--a)i+=this.alphabet[n[a]];return i}decode(t){if(typeof t!="string")throw new TypeError("Expected String");let r=[];if(t.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n<t.length;n++){let i=this._alphabetMap[t[n]];if(i===void 0)throw new Error("Non-base"+this.base+" character");let a=i;for(let o=0;o<r.length;++o)a+=r[o]*this.base,r[o]=a&255,a>>=8;for(;a>0;)r.push(a&255),a>>=8}for(let n=0;t[n]===this._leader&&n<t.length-1;++n)r.push(0);return kt(new Uint8Array(r.reverse()))}}new FKe("abcdefghijklmnopqrstuvwxyz234567");const vR=new FKe("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var gR;(function(e){e.sha256="sha256",e.sha512="sha512"})(gR||(gR={}));const fkt="sha2/5.7.0",dkt=new Le(fkt);function HKe(e){return"0x"+hd.ripemd160().update(kt(e)).digest("hex")}function Fy(e){return"0x"+hd.sha256().update(kt(e)).digest("hex")}function hkt(e){return"0x"+hd.sha512().update(kt(e)).digest("hex")}function P9(e,t,r){return gR[e]||dkt.throwError("unsupported algorithm "+e,Le.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+hd.hmac(hd[e],kt(t)).update(kt(r)).digest("hex")}function L2e(e,t,r,n,i){e=kt(e),t=kt(t);let a,o=1;const s=new Uint8Array(n),l=new Uint8Array(t.length+4);l.set(t);let u,c;for(let f=1;f<=o;f++){l[t.length]=f>>24&255,l[t.length+1]=f>>16&255,l[t.length+2]=f>>8&255,l[t.length+3]=f&255;let d=kt(P9(i,e,l));a||(a=d.length,c=new Uint8Array(a),o=Math.ceil(n/a),u=n-(o-1)*a),c.set(d);for(let g=1;g<r;g++){d=kt(P9(i,e,d));for(let m=0;m<a;m++)c[m]^=d[m]}const h=(f-1)*a,p=f===o?u:a;s.set(kt(c).slice(0,p),h)}return Kt(s)}const pkt="wordlists/5.7.0",vkt=new Le(pkt);class Nx{constructor(t){vkt.checkAbstract(new.target,Nx),ot(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const r=[];for(let n=0;n<2048;n++){const i=t.getWord(n);if(n!==t.getWordIndex(i))return"0x";r.push(i)}return ME(r.join(`
|
|
5693
5693
|
`)+`
|
|
5694
5694
|
`)}static register(t,r){r||(r=t.locale)}}const gkt="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo";let qL=null;function GRe(e){if(qL==null&&(qL=gkt.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Nx.check(e)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw qL=null,new Error("BIP39 Wordlist for en (English) FAILED")}class mkt extends Nx{constructor(){super("en")}getWord(t){return GRe(this),qL[t]}getWordIndex(t){return GRe(this),qL.indexOf(t)}}const GKe=new mkt;Nx.register(GKe);const Uhe={en:GKe},ykt="hdnode/5.7.0",M9=new Le(ykt),Ekt=Ut.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),bkt=hl("Bitcoin seed"),vC=2147483648;function VKe(e){return(1<<e)-1<<8-e}function _kt(e){return(1<<e)-1}function G$(e){return Oo(Kt(e),32)}function VRe(e){return vR.encode(xo([e,ol(Fy(Fy(e)),0,4)]))}function P2e(e){if(e==null)return Uhe.en;if(typeof e=="string"){const t=Uhe[e];return t==null&&M9.throwArgumentError("unknown locale","wordlist",e),t}return e}const u5={},mR="m/44'/60'/0'/0/0";class ah{constructor(t,r,n,i,a,o,s,l){if(t!==u5)throw new Error("HDNode constructor cannot be called directly");if(r){const u=new F3(r);ot(this,"privateKey",u.privateKey),ot(this,"publicKey",u.compressedPublicKey)}else ot(this,"privateKey",null),ot(this,"publicKey",Kt(n));ot(this,"parentFingerprint",i),ot(this,"fingerprint",ol(HKe(Fy(this.publicKey)),0,4)),ot(this,"address",nb(this.publicKey)),ot(this,"chainCode",a),ot(this,"index",o),ot(this,"depth",s),l==null?(ot(this,"mnemonic",null),ot(this,"path",null)):typeof l=="string"?(ot(this,"mnemonic",null),ot(this,"path",l)):(ot(this,"mnemonic",l),ot(this,"path",l.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return VRe(xo([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",Kt(this.depth),this.parentFingerprint,Oo(Kt(this.index),4),this.chainCode,this.privateKey!=null?xo(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new ah(u5,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let r=this.path;r&&(r+="/"+(t&~vC));const n=new Uint8Array(37);if(t&vC){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set(kt(this.privateKey),1),r&&(r+="'")}else n.set(kt(this.publicKey));for(let f=24;f>=0;f-=8)n[33+(f>>3)]=t>>24-f&255;const i=kt(P9(gR.sha512,this.chainCode,n)),a=i.slice(0,32),o=i.slice(32);let s=null,l=null;this.privateKey?s=G$(Ut.from(a).add(this.privateKey).mod(Ekt)):l=new F3(Kt(a))._addPoint(this.publicKey);let u=r;const c=this.mnemonic;return c&&(u=Object.freeze({phrase:c.phrase,path:r,locale:c.locale||"en"})),new ah(u5,s,l,this.fingerprint,G$(o),t,this.depth+1,u)}derivePath(t){const r=t.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+t);r[0]==="m"&&r.shift();let n=this;for(let i=0;i<r.length;i++){const a=r[i];if(a.match(/^[0-9]+'$/)){const o=parseInt(a.substring(0,a.length-1));if(o>=vC)throw new Error("invalid path index - "+a);n=n._derive(vC+o)}else if(a.match(/^[0-9]+$/)){const o=parseInt(a);if(o>=vC)throw new Error("invalid path index - "+a);n=n._derive(o)}else throw new Error("invalid path component - "+a)}return n}static _fromSeed(t,r){const n=kt(t);if(n.length<16||n.length>64)throw new Error("invalid seed");const i=kt(P9(gR.sha512,bkt,n));return new ah(u5,G$(i.slice(0,32)),null,"0x00000000",G$(i.slice(32)),0,0,r)}static fromMnemonic(t,r,n){return n=P2e(n),t=iz(nz(t,n),n),ah._fromSeed(WKe(t,r),{phrase:t,path:"m",locale:n.locale})}static fromSeed(t){return ah._fromSeed(t,null)}static fromExtendedKey(t){const r=vR.decode(t);(r.length!==82||VRe(r.slice(0,78))!==t)&&M9.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const n=r[4],i=Kt(r.slice(5,9)),a=parseInt(Kt(r.slice(9,13)).substring(2),16),o=Kt(r.slice(13,45)),s=r.slice(45,78);switch(Kt(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new ah(u5,null,Kt(s),i,o,a,n,null);case"0x0488ade4":case"0x04358394 ":if(s[0]!==0)break;return new ah(u5,Kt(s.slice(1)),null,i,o,a,n,null)}return M9.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function WKe(e,t){t||(t="");const r=hl("mnemonic"+t,Sg.NFKD);return L2e(hl(e,Sg.NFKD),r,2048,64,"sha512")}function nz(e,t){t=P2e(t),M9.checkNormalize();const r=t.split(e);if(r.length%3!==0)throw new Error("invalid mnemonic");const n=kt(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let u=0;u<r.length;u++){let c=t.getWordIndex(r[u].normalize("NFKD"));if(c===-1)throw new Error("invalid mnemonic");for(let f=0;f<11;f++)c&1<<10-f&&(n[i>>3]|=1<<7-i%8),i++}const a=32*r.length/3,o=r.length/3,s=VKe(o);if((kt(Fy(n.slice(0,a/8)))[0]&s)!==(n[n.length-1]&s))throw new Error("invalid checksum");return Kt(n.slice(0,a/8))}function iz(e,t){if(t=P2e(t),e=kt(e),e.length%4!==0||e.length<16||e.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let o=0;o<e.length;o++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=e[o],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[o]>>8-n,r.push(e[o]&_kt(8-n)),n+=3);const i=e.length/4,a=kt(Fy(e))[0]&VKe(i);return r[r.length-1]<<=i,r[r.length-1]|=a>>8-i,t.join(r.map(o=>t.getWord(o)))}function Skt(e,t){try{return nz(e,t),!0}catch{}return!1}function wkt(e){return(typeof e!="number"||e<0||e>=vC||e%1)&&M9.throwArgumentError("invalid account index","index",e),`m/44'/60'/${e}'/0/0`}const Tkt="random/5.7.0",Fhe=new Le(Tkt);function Akt(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof si<"u")return si;throw new Error("unable to locate global object")}const WRe=Akt();let gF=WRe.crypto||WRe.msCrypto;(!gF||!gF.getRandomValues)&&(Fhe.warn("WARNING: Missing strong random number source"),gF={getRandomValues:function(e){return Fhe.throwError("no secure random source avaialble",Le.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function NC(e){(e<=0||e>1024||e%1||e!=e)&&Fhe.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return gF.getRandomValues(t),kt(t)}function jKe(e){e=e.slice();for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}var zKe={exports:{}};(function(e,t){(function(r){function n(B){return parseInt(B)===B}function i(B){if(!n(B.length))return!1;for(var x=0;x<B.length;x++)if(!n(B[x])||B[x]<0||B[x]>255)return!1;return!0}function a(B,x){if(B.buffer&&ArrayBuffer.isView(B)&&B.name==="Uint8Array")return x&&(B.slice?B=B.slice():B=Array.prototype.slice.call(B)),B;if(Array.isArray(B)){if(!i(B))throw new Error("Array contains invalid value: "+B);return new Uint8Array(B)}if(n(B.length)&&i(B))return new Uint8Array(B);throw new Error("unsupported array-like object")}function o(B){return new Uint8Array(B)}function s(B,x,H,q,W){(q!=null||W!=null)&&(B.slice?B=B.slice(q,W):B=Array.prototype.slice.call(B,q,W)),x.set(B,H)}var l=function(){function B(H){var q=[],W=0;for(H=encodeURI(H);W<H.length;){var Y=H.charCodeAt(W++);Y===37?(q.push(parseInt(H.substr(W,2),16)),W+=2):q.push(Y)}return a(q)}function x(H){for(var q=[],W=0;W<H.length;){var Y=H[W];Y<128?(q.push(String.fromCharCode(Y)),W++):Y>191&&Y<224?(q.push(String.fromCharCode((Y&31)<<6|H[W+1]&63)),W+=2):(q.push(String.fromCharCode((Y&15)<<12|(H[W+1]&63)<<6|H[W+2]&63)),W+=3)}return q.join("")}return{toBytes:B,fromBytes:x}}(),u=function(){function B(q){for(var W=[],Y=0;Y<q.length;Y+=2)W.push(parseInt(q.substr(Y,2),16));return W}var x="0123456789abcdef";function H(q){for(var W=[],Y=0;Y<q.length;Y++){var re=q[Y];W.push(x[(re&240)>>4]+x[re&15])}return W.join("")}return{toBytes:B,fromBytes:H}}(),c={16:10,24:12,32:14},f=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],g=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],y=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],b=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],w=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],T=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],R=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],N=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],A=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],L=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],O=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function I(B){for(var x=[],H=0;H<B.length;H+=4)x.push(B[H]<<24|B[H+1]<<16|B[H+2]<<8|B[H+3]);return x}var $=function(B){if(!(this instanceof $))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:a(B,!0)}),this._prepare()};$.prototype._prepare=function(){var B=c[this.key.length];if(B==null)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var x=0;x<=B;x++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var H=(B+1)*4,q=this.key.length/4,W=I(this.key),Y,x=0;x<q;x++)Y=x>>2,this._Ke[Y][x%4]=W[x],this._Kd[B-Y][x%4]=W[x];for(var re=0,Q=q,ie;Q<H;){if(ie=W[q-1],W[0]^=d[ie>>16&255]<<24^d[ie>>8&255]<<16^d[ie&255]<<8^d[ie>>24&255]^f[re]<<24,re+=1,q!=8)for(var x=1;x<q;x++)W[x]^=W[x-1];else{for(var x=1;x<q/2;x++)W[x]^=W[x-1];ie=W[q/2-1],W[q/2]^=d[ie&255]^d[ie>>8&255]<<8^d[ie>>16&255]<<16^d[ie>>24&255]<<24;for(var x=q/2+1;x<q;x++)W[x]^=W[x-1]}for(var x=0,ce,te;x<q&&Q<H;)ce=Q>>2,te=Q%4,this._Ke[ce][te]=W[x],this._Kd[B-ce][te]=W[x++],Q++}for(var ce=1;ce<B;ce++)for(var te=0;te<4;te++)ie=this._Kd[ce][te],this._Kd[ce][te]=N[ie>>24&255]^A[ie>>16&255]^L[ie>>8&255]^O[ie&255]},$.prototype.encrypt=function(B){if(B.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var x=this._Ke.length-1,H=[0,0,0,0],q=I(B),W=0;W<4;W++)q[W]^=this._Ke[0][W];for(var Y=1;Y<x;Y++){for(var W=0;W<4;W++)H[W]=p[q[W]>>24&255]^g[q[(W+1)%4]>>16&255]^m[q[(W+2)%4]>>8&255]^y[q[(W+3)%4]&255]^this._Ke[Y][W];q=H.slice()}for(var re=o(16),Q,W=0;W<4;W++)Q=this._Ke[x][W],re[4*W]=(d[q[W]>>24&255]^Q>>24)&255,re[4*W+1]=(d[q[(W+1)%4]>>16&255]^Q>>16)&255,re[4*W+2]=(d[q[(W+2)%4]>>8&255]^Q>>8)&255,re[4*W+3]=(d[q[(W+3)%4]&255]^Q)&255;return re},$.prototype.decrypt=function(B){if(B.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var x=this._Kd.length-1,H=[0,0,0,0],q=I(B),W=0;W<4;W++)q[W]^=this._Kd[0][W];for(var Y=1;Y<x;Y++){for(var W=0;W<4;W++)H[W]=b[q[W]>>24&255]^w[q[(W+3)%4]>>16&255]^T[q[(W+2)%4]>>8&255]^R[q[(W+1)%4]&255]^this._Kd[Y][W];q=H.slice()}for(var re=o(16),Q,W=0;W<4;W++)Q=this._Kd[x][W],re[4*W]=(h[q[W]>>24&255]^Q>>24)&255,re[4*W+1]=(h[q[(W+3)%4]>>16&255]^Q>>16)&255,re[4*W+2]=(h[q[(W+2)%4]>>8&255]^Q>>8)&255,re[4*W+3]=(h[q[(W+1)%4]&255]^Q)&255;return re};var F=function(B){if(!(this instanceof F))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new $(B)};F.prototype.encrypt=function(B){if(B=a(B),B.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var x=o(B.length),H=o(16),q=0;q<B.length;q+=16)s(B,H,0,q,q+16),H=this._aes.encrypt(H),s(H,x,q);return x},F.prototype.decrypt=function(B){if(B=a(B),B.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var x=o(B.length),H=o(16),q=0;q<B.length;q+=16)s(B,H,0,q,q+16),H=this._aes.decrypt(H),s(H,x,q);return x};var D=function(B,x){if(!(this instanceof D))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!x)x=o(16);else if(x.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=a(x,!0),this._aes=new $(B)};D.prototype.encrypt=function(B){if(B=a(B),B.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var x=o(B.length),H=o(16),q=0;q<B.length;q+=16){s(B,H,0,q,q+16);for(var W=0;W<16;W++)H[W]^=this._lastCipherblock[W];this._lastCipherblock=this._aes.encrypt(H),s(this._lastCipherblock,x,q)}return x},D.prototype.decrypt=function(B){if(B=a(B),B.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var x=o(B.length),H=o(16),q=0;q<B.length;q+=16){s(B,H,0,q,q+16),H=this._aes.decrypt(H);for(var W=0;W<16;W++)x[q+W]=H[W]^this._lastCipherblock[W];s(B,this._lastCipherblock,0,q,q+16)}return x};var E=function(B,x,H){if(!(this instanceof E))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!x)x=o(16);else if(x.length!=16)throw new Error("invalid initialation vector size (must be 16 size)");H||(H=1),this.segmentSize=H,this._shiftRegister=a(x,!0),this._aes=new $(B)};E.prototype.encrypt=function(B){if(B.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var x=a(B,!0),H,q=0;q<x.length;q+=this.segmentSize){H=this._aes.encrypt(this._shiftRegister);for(var W=0;W<this.segmentSize;W++)x[q+W]^=H[W];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(x,this._shiftRegister,16-this.segmentSize,q,q+this.segmentSize)}return x},E.prototype.decrypt=function(B){if(B.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var x=a(B,!0),H,q=0;q<x.length;q+=this.segmentSize){H=this._aes.encrypt(this._shiftRegister);for(var W=0;W<this.segmentSize;W++)x[q+W]^=H[W];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(B,this._shiftRegister,16-this.segmentSize,q,q+this.segmentSize)}return x};var S=function(B,x){if(!(this instanceof S))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!x)x=o(16);else if(x.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=a(x,!0),this._lastPrecipherIndex=16,this._aes=new $(B)};S.prototype.encrypt=function(B){for(var x=a(B,!0),H=0;H<x.length;H++)this._lastPrecipherIndex===16&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),x[H]^=this._lastPrecipher[this._lastPrecipherIndex++];return x},S.prototype.decrypt=S.prototype.encrypt;var C=function(B){if(!(this instanceof C))throw Error("Counter must be instanitated with `new`");B!==0&&!B&&(B=1),typeof B=="number"?(this._counter=o(16),this.setValue(B)):this.setBytes(B)};C.prototype.setValue=function(B){if(typeof B!="number"||parseInt(B)!=B)throw new Error("invalid counter value (must be an integer)");for(var x=15;x>=0;--x)this._counter[x]=B%256,B=B>>8},C.prototype.setBytes=function(B){if(B=a(B,!0),B.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=B},C.prototype.increment=function(){for(var B=15;B>=0;B--)if(this._counter[B]===255)this._counter[B]=0;else{this._counter[B]++;break}};var M=function(B,x){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",x instanceof C||(x=new C(x)),this._counter=x,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new $(B)};M.prototype.encrypt=function(B){for(var x=a(B,!0),H=0;H<x.length;H++)this._remainingCounterIndex===16&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),x[H]^=this._remainingCounter[this._remainingCounterIndex++];return x},M.prototype.decrypt=M.prototype.encrypt;function k(B){B=a(B,!0);var x=16-B.length%16,H=o(B.length+x);s(B,H);for(var q=B.length;q<H.length;q++)H[q]=x;return H}function U(B){if(B=a(B,!0),B.length<16)throw new Error("PKCS#7 invalid length");var x=B[B.length-1];if(x>16)throw new Error("PKCS#7 padding byte out of range");for(var H=B.length-x,q=0;q<x;q++)if(B[H+q]!==x)throw new Error("PKCS#7 invalid padding byte");var W=o(H);return s(B,W,0,0,H),W}var G={AES:$,Counter:C,ModeOfOperation:{ecb:F,cbc:D,cfb:E,ofb:S,ctr:M},utils:{hex:u,utf8:l},padding:{pkcs7:{pad:k,strip:U}},_arrayTest:{coerceArray:a,createArray:o,copyArray:s}};e.exports=G})()})(zKe);var Ckt=zKe.exports;const P1=Nn(Ckt),YKe="json-wallets/5.7.0";function H3(e){return typeof e=="string"&&e.substring(0,2)!=="0x"&&(e="0x"+e),kt(e)}function m8(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function M2e(e){return typeof e=="string"?hl(e,Sg.NFKC):kt(e)}function il(e,t){let r=e;const n=t.toLowerCase().split("/");for(let i=0;i<n.length;i++){let a=null;for(const o in r)if(o.toLowerCase()===n[i]){a=r[o];break}if(a===null)return null;r=a}return r}function Rkt(e){const t=kt(e);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const r=Kt(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const xkt=new Le(YKe);class Ikt extends yA{isCrowdsaleAccount(t){return!!(t&&t._isCrowdsaleAccount)}}function qKe(e,t){const r=JSON.parse(e);t=M2e(t);const n=ya(il(r,"ethaddr")),i=H3(il(r,"encseed"));(!i||i.length%16!==0)&&xkt.throwArgumentError("invalid encseed","json",e);const a=kt(L2e(t,t,2e3,32,"sha256")).slice(0,16),o=i.slice(0,16),s=i.slice(16),l=new P1.ModeOfOperation.cbc(a,o),u=P1.padding.pkcs7.strip(kt(l.decrypt(s)));let c="";for(let h=0;h<u.length;h++)c+=String.fromCharCode(u[h]);const f=hl(c),d=co(f);return new Ikt({_isCrowdsaleAccount:!0,address:n,privateKey:d})}function D2e(e){let t=null;try{t=JSON.parse(e)}catch{return!1}return t.encseed&&t.ethaddr}function $2e(e){let t=null;try{t=JSON.parse(e)}catch{return!1}return!(!t.version||parseInt(t.version)!==t.version||parseInt(t.version)!==3)}function Okt(e){if(D2e(e))try{return ya(JSON.parse(e).ethaddr)}catch{return null}if($2e(e))try{return ya(JSON.parse(e).address)}catch{return null}return null}var XKe={exports:{}};(function(e,t){(function(r){function i(g){const m=new Uint32Array([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]);let y=1779033703,b=3144134277,w=1013904242,T=2773480762,R=1359893119,N=2600822924,A=528734635,L=1541459225;const O=new Uint32Array(64);function I(M){let k=0,U=M.length;for(;U>=64;){let G=y,B=b,x=w,H=T,q=R,W=N,Y=A,re=L,Q,ie,ce,te,J;for(ie=0;ie<16;ie++)ce=k+ie*4,O[ie]=(M[ce]&255)<<24|(M[ce+1]&255)<<16|(M[ce+2]&255)<<8|M[ce+3]&255;for(ie=16;ie<64;ie++)Q=O[ie-2],te=(Q>>>17|Q<<32-17)^(Q>>>19|Q<<32-19)^Q>>>10,Q=O[ie-15],J=(Q>>>7|Q<<32-7)^(Q>>>18|Q<<32-18)^Q>>>3,O[ie]=(te+O[ie-7]|0)+(J+O[ie-16]|0)|0;for(ie=0;ie<64;ie++)te=(((q>>>6|q<<32-6)^(q>>>11|q<<32-11)^(q>>>25|q<<32-25))+(q&W^~q&Y)|0)+(re+(m[ie]+O[ie]|0)|0)|0,J=((G>>>2|G<<32-2)^(G>>>13|G<<32-13)^(G>>>22|G<<32-22))+(G&B^G&x^B&x)|0,re=Y,Y=W,W=q,q=H+te|0,H=x,x=B,B=G,G=te+J|0;y=y+G|0,b=b+B|0,w=w+x|0,T=T+H|0,R=R+q|0,N=N+W|0,A=A+Y|0,L=L+re|0,k+=64,U-=64}}I(g);let $,F=g.length%64,D=g.length/536870912|0,E=g.length<<3,S=F<56?56:120,C=g.slice(g.length-F,g.length);for(C.push(128),$=F+1;$<S;$++)C.push(0);return C.push(D>>>24&255),C.push(D>>>16&255),C.push(D>>>8&255),C.push(D>>>0&255),C.push(E>>>24&255),C.push(E>>>16&255),C.push(E>>>8&255),C.push(E>>>0&255),I(C),[y>>>24&255,y>>>16&255,y>>>8&255,y>>>0&255,b>>>24&255,b>>>16&255,b>>>8&255,b>>>0&255,w>>>24&255,w>>>16&255,w>>>8&255,w>>>0&255,T>>>24&255,T>>>16&255,T>>>8&255,T>>>0&255,R>>>24&255,R>>>16&255,R>>>8&255,R>>>0&255,N>>>24&255,N>>>16&255,N>>>8&255,N>>>0&255,A>>>24&255,A>>>16&255,A>>>8&255,A>>>0&255,L>>>24&255,L>>>16&255,L>>>8&255,L>>>0&255]}function a(g,m,y){g=g.length<=64?g:i(g);const b=64+m.length+4,w=new Array(b),T=new Array(64);let R,N=[];for(R=0;R<64;R++)w[R]=54;for(R=0;R<g.length;R++)w[R]^=g[R];for(R=0;R<m.length;R++)w[64+R]=m[R];for(R=b-4;R<b;R++)w[R]=0;for(R=0;R<64;R++)T[R]=92;for(R=0;R<g.length;R++)T[R]^=g[R];function A(){for(let L=b-1;L>=b-4;L--){if(w[L]++,w[L]<=255)return;w[L]=0}}for(;y>=32;)A(),N=N.concat(i(T.concat(i(w)))),y-=32;return y>0&&(A(),N=N.concat(i(T.concat(i(w))).slice(0,y))),N}function o(g,m,y,b,w){let T;for(c(g,(2*y-1)*16,w,0,16),T=0;T<2*y;T++)u(g,T*16,w,16),l(w,b),c(w,0,g,m+T*16,16);for(T=0;T<y;T++)c(g,m+T*2*16,g,T*16,16);for(T=0;T<y;T++)c(g,m+(T*2+1)*16,g,(T+y)*16,16)}function s(g,m){return g<<m|g>>>32-m}function l(g,m){c(g,0,m,0,16);for(let y=8;y>0;y-=2)m[4]^=s(m[0]+m[12],7),m[8]^=s(m[4]+m[0],9),m[12]^=s(m[8]+m[4],13),m[0]^=s(m[12]+m[8],18),m[9]^=s(m[5]+m[1],7),m[13]^=s(m[9]+m[5],9),m[1]^=s(m[13]+m[9],13),m[5]^=s(m[1]+m[13],18),m[14]^=s(m[10]+m[6],7),m[2]^=s(m[14]+m[10],9),m[6]^=s(m[2]+m[14],13),m[10]^=s(m[6]+m[2],18),m[3]^=s(m[15]+m[11],7),m[7]^=s(m[3]+m[15],9),m[11]^=s(m[7]+m[3],13),m[15]^=s(m[11]+m[7],18),m[1]^=s(m[0]+m[3],7),m[2]^=s(m[1]+m[0],9),m[3]^=s(m[2]+m[1],13),m[0]^=s(m[3]+m[2],18),m[6]^=s(m[5]+m[4],7),m[7]^=s(m[6]+m[5],9),m[4]^=s(m[7]+m[6],13),m[5]^=s(m[4]+m[7],18),m[11]^=s(m[10]+m[9],7),m[8]^=s(m[11]+m[10],9),m[9]^=s(m[8]+m[11],13),m[10]^=s(m[9]+m[8],18),m[12]^=s(m[15]+m[14],7),m[13]^=s(m[12]+m[15],9),m[14]^=s(m[13]+m[12],13),m[15]^=s(m[14]+m[13],18);for(let y=0;y<16;++y)g[y]+=m[y]}function u(g,m,y,b){for(let w=0;w<b;w++)y[w]^=g[m+w]}function c(g,m,y,b,w){for(;w--;)y[b++]=g[m++]}function f(g){if(!g||typeof g.length!="number")return!1;for(let m=0;m<g.length;m++){const y=g[m];if(typeof y!="number"||y%1||y<0||y>=256)return!1}return!0}function d(g,m){if(typeof g!="number"||g%1)throw new Error("invalid "+m);return g}function h(g,m,y,b,w,T,R){if(y=d(y,"N"),b=d(b,"r"),w=d(w,"p"),T=d(T,"dkLen"),y===0||y&y-1)throw new Error("N must be power of 2");if(y>2147483647/128/b)throw new Error("N too large");if(b>2147483647/128/w)throw new Error("r too large");if(!f(g))throw new Error("password must be an array or buffer");if(g=Array.prototype.slice.call(g),!f(m))throw new Error("salt must be an array or buffer");m=Array.prototype.slice.call(m);let N=a(g,m,w*128*b);const A=new Uint32Array(w*32*b);for(let q=0;q<A.length;q++){const W=q*4;A[q]=(N[W+3]&255)<<24|(N[W+2]&255)<<16|(N[W+1]&255)<<8|(N[W+0]&255)<<0}const L=new Uint32Array(64*b),O=new Uint32Array(32*b*y),I=32*b,$=new Uint32Array(16),F=new Uint32Array(16),D=w*y*2;let E=0,S=null,C=!1,M=0,k=0,U,G;const B=R?parseInt(1e3/b):4294967295,x=typeof setImmediate<"u"?setImmediate:setTimeout,H=function(){if(C)return R(new Error("cancelled"),E/D);let q;switch(M){case 0:G=k*32*b,c(A,G,L,0,I),M=1,U=0;case 1:q=y-U,q>B&&(q=B);for(let Y=0;Y<q;Y++)c(L,0,O,(U+Y)*I,I),o(L,I,b,$,F);if(U+=q,E+=q,R){const Y=parseInt(1e3*E/D);if(Y!==S){if(C=R(null,E/D),C)break;S=Y}}if(U<y)break;U=0,M=2;case 2:q=y-U,q>B&&(q=B);for(let Y=0;Y<q;Y++){const re=(2*b-1)*16,Q=L[re]&y-1;u(O,Q*I,L,I),o(L,I,b,$,F)}if(U+=q,E+=q,R){const Y=parseInt(1e3*E/D);if(Y!==S){if(C=R(null,E/D),C)break;S=Y}}if(U<y)break;if(c(L,0,A,G,I),k++,k<w){M=0;break}N=[];for(let Y=0;Y<A.length;Y++)N.push(A[Y]>>0&255),N.push(A[Y]>>8&255),N.push(A[Y]>>16&255),N.push(A[Y]>>24&255);const W=a(g,N,T);return R&&R(null,1,W),W}R&&x(H)};if(!R)for(;;){const q=H();if(q!=null)return q}H()}const p={scrypt:function(g,m,y,b,w,T,R){return new Promise(function(N,A){let L=0;R&&R(0),h(g,m,y,b,w,T,function(O,I,$){if(O)A(O);else if($)R&&L!==1&&R(1),N(new Uint8Array($));else if(R&&I!==L)return L=I,R(I)})})},syncScrypt:function(g,m,y,b,w,T){return new Uint8Array(h(g,m,y,b,w,T))}};e.exports=p})()})(XKe);var Nkt=XKe.exports;const k2e=Nn(Nkt);var Lkt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const Hhe=new Le(YKe);function jRe(e){return e!=null&&e.mnemonic&&e.mnemonic.phrase}class Pkt extends yA{isKeystoreAccount(t){return!!(t&&t._isKeystoreAccount)}}function Mkt(e,t,r){if(il(e,"crypto/cipher")==="aes-128-ctr"){const i=H3(il(e,"crypto/cipherparams/iv")),a=new P1.Counter(i),o=new P1.ModeOfOperation.ctr(t,a);return kt(o.decrypt(r))}return null}function KKe(e,t){const r=H3(il(e,"crypto/ciphertext"));if(Kt(co(xo([t.slice(16,32),r]))).substring(2)!==il(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const i=Mkt(e,t.slice(0,16),r);i||Hhe.throwError("unsupported cipher",Le.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const a=t.slice(32,64),o=nb(i);if(e.address){let l=e.address.toLowerCase();if(l.substring(0,2)!=="0x"&&(l="0x"+l),ya(l)!==o)throw new Error("address mismatch")}const s={_isKeystoreAccount:!0,address:o,privateKey:Kt(i)};if(il(e,"x-ethers/version")==="0.1"){const l=H3(il(e,"x-ethers/mnemonicCiphertext")),u=H3(il(e,"x-ethers/mnemonicCounter")),c=new P1.Counter(u),f=new P1.ModeOfOperation.ctr(a,c),d=il(e,"x-ethers/path")||mR,h=il(e,"x-ethers/locale")||"en",p=kt(f.decrypt(l));try{const g=iz(p,h),m=ah.fromMnemonic(g,null,h).derivePath(d);if(m.privateKey!=s.privateKey)throw new Error("mnemonic mismatch");s.mnemonic=m.mnemonic}catch(g){if(g.code!==Le.errors.INVALID_ARGUMENT||g.argument!=="wordlist")throw g}}return new Pkt(s)}function ZKe(e,t,r,n,i){return kt(L2e(e,t,r,n,i))}function Dkt(e,t,r,n,i){return Promise.resolve(ZKe(e,t,r,n,i))}function QKe(e,t,r,n,i){const a=M2e(t),o=il(e,"crypto/kdf");if(o&&typeof o=="string"){const s=function(l,u){return Hhe.throwArgumentError("invalid key-derivation function parameters",l,u)};if(o.toLowerCase()==="scrypt"){const l=H3(il(e,"crypto/kdfparams/salt")),u=parseInt(il(e,"crypto/kdfparams/n")),c=parseInt(il(e,"crypto/kdfparams/r")),f=parseInt(il(e,"crypto/kdfparams/p"));(!u||!c||!f)&&s("kdf",o),u&u-1&&s("N",u);const d=parseInt(il(e,"crypto/kdfparams/dklen"));return d!==32&&s("dklen",d),n(a,l,u,c,f,64,i)}else if(o.toLowerCase()==="pbkdf2"){const l=H3(il(e,"crypto/kdfparams/salt"));let u=null;const c=il(e,"crypto/kdfparams/prf");c==="hmac-sha256"?u="sha256":c==="hmac-sha512"?u="sha512":s("prf",c);const f=parseInt(il(e,"crypto/kdfparams/c")),d=parseInt(il(e,"crypto/kdfparams/dklen"));return d!==32&&s("dklen",d),r(a,l,f,d,u)}}return Hhe.throwArgumentError("unsupported key-derivation function","kdf",o)}function $kt(e,t){const r=JSON.parse(e),n=QKe(r,t,ZKe,k2e.syncScrypt);return KKe(r,n)}function kkt(e,t,r){return Lkt(this,void 0,void 0,function*(){const n=JSON.parse(e),i=yield QKe(n,t,Dkt,k2e.scrypt,r);return KKe(n,i)})}function Bkt(e,t,r,n){try{if(ya(e.address)!==nb(e.privateKey))throw new Error("address/privateKey mismatch");if(jRe(e)){const m=e.mnemonic;if(ah.fromMnemonic(m.phrase,null,m.locale).derivePath(m.path||mR).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(m){return Promise.reject(m)}typeof r=="function"&&!n&&(n=r,r={}),r||(r={});const i=kt(e.privateKey),a=M2e(t);let o=null,s=null,l=null;if(jRe(e)){const m=e.mnemonic;o=kt(nz(m.phrase,m.locale||"en")),s=m.path||mR,l=m.locale||"en"}let u=r.client;u||(u="ethers.js");let c=null;r.salt?c=kt(r.salt):c=NC(32);let f=null;if(r.iv){if(f=kt(r.iv),f.length!==16)throw new Error("invalid iv")}else f=NC(16);let d=null;if(r.uuid){if(d=kt(r.uuid),d.length!==16)throw new Error("invalid uuid")}else d=NC(16);let h=1<<17,p=8,g=1;return r.scrypt&&(r.scrypt.N&&(h=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(g=r.scrypt.p)),k2e.scrypt(a,c,h,p,g,64,n).then(m=>{m=kt(m);const y=m.slice(0,16),b=m.slice(16,32),w=m.slice(32,64),T=new P1.Counter(f),R=new P1.ModeOfOperation.ctr(y,T),N=kt(R.encrypt(i)),A=co(xo([b,N])),L={address:e.address.substring(2).toLowerCase(),id:Rkt(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Kt(f).substring(2)},ciphertext:Kt(N).substring(2),kdf:"scrypt",kdfparams:{salt:Kt(c).substring(2),n:h,dklen:32,p:g,r:p},mac:A.substring(2)}};if(o){const O=NC(16),I=new P1.Counter(O),$=new P1.ModeOfOperation.ctr(w,I),F=kt($.encrypt(o)),D=new Date,E=D.getUTCFullYear()+"-"+m8(D.getUTCMonth()+1,2)+"-"+m8(D.getUTCDate(),2)+"T"+m8(D.getUTCHours(),2)+"-"+m8(D.getUTCMinutes(),2)+"-"+m8(D.getUTCSeconds(),2)+".0Z";L["x-ethers"]={client:u,gethFilename:"UTC--"+E+"--"+L.address,mnemonicCounter:Kt(O).substring(2),mnemonicCiphertext:Kt(F).substring(2),path:s,locale:l,version:"0.1"}}return JSON.stringify(L)})}function Ukt(e,t,r){if(D2e(e)){r&&r(0);const n=qKe(e,t);return r&&r(1),Promise.resolve(n)}return $2e(e)?kkt(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}function Fkt(e,t){if(D2e(e))return qKe(e,t);if($2e(e))return $kt(e,t);throw new Error("invalid JSON wallet")}const Hkt="wallet/5.7.0";var zRe=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const c5=new Le(Hkt);function Gkt(e){return e!=null&&li(e.privateKey,32)&&e.address!=null}function Vkt(e){const t=e.mnemonic;return t&&t.phrase}class Qw extends y_{constructor(t,r){if(super(),Gkt(t)){const n=new F3(t.privateKey);if(ot(this,"_signingKey",()=>n),ot(this,"address",nb(this.publicKey)),this.address!==ya(t.address)&&c5.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),Vkt(t)){const i=t.mnemonic;ot(this,"_mnemonic",()=>({phrase:i.phrase,path:i.path||mR,locale:i.locale||"en"}));const a=this.mnemonic,o=ah.fromMnemonic(a.phrase,null,a.locale).derivePath(a.path);nb(o.privateKey)!==this.address&&c5.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ot(this,"_mnemonic",()=>null)}else{if(F3.isSigningKey(t))t.curve!=="secp256k1"&&c5.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ot(this,"_signingKey",()=>t);else{typeof t=="string"&&t.match(/^[0-9a-f]*$/i)&&t.length===64&&(t="0x"+t);const n=new F3(t);ot(this,"_signingKey",()=>n)}ot(this,"_mnemonic",()=>null),ot(this,"address",nb(this.publicKey))}r&&!bA.isProvider(r)&&c5.throwArgumentError("invalid provider","provider",r),ot(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new Qw(this,t)}signTransaction(t){return Us(t).then(r=>{r.from!=null&&(ya(r.from)!==this.address&&c5.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete r.from);const n=this._signingKey().signDigest(co(khe(r)));return khe(r,n)})}signMessage(t){return zRe(this,void 0,void 0,function*(){return Rhe(this._signingKey().signDigest(A2e(t)))})}_signTypedData(t,r,n){return zRe(this,void 0,void 0,function*(){const i=yield zu.resolveNames(t,r,n,a=>(this.provider==null&&c5.throwError("cannot resolve ENS names without a provider",Le.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:a}),this.provider.resolveName(a)));return Rhe(this._signingKey().signDigest(zu.hash(i.domain,r,i.value)))})}encrypt(t,r,n){if(typeof r=="function"&&!n&&(n=r,r={}),n&&typeof n!="function")throw new Error("invalid callback");return r||(r={}),Bkt(this,t,r,n)}static createRandom(t){let r=NC(16);t||(t={}),t.extraEntropy&&(r=kt(ol(co(xo([r,t.extraEntropy])),0,16)));const n=iz(r,t.locale);return Qw.fromMnemonic(n,t.path,t.locale)}static fromEncryptedJson(t,r,n){return Ukt(t,r,n).then(i=>new Qw(i))}static fromEncryptedJsonSync(t,r){return new Qw(Fkt(t,r))}static fromMnemonic(t,r,n){return r||(r=mR),new Qw(ah.fromMnemonic(t,null,n).derivePath(r))}}function Wkt(e,t){return PM(A2e(e),t)}function jkt(e,t,r,n){return PM(zu.hash(e,t,r),n)}const zkt="networks/5.7.1",YRe=new Le(zkt);function Ykt(e){return e&&typeof e.renetwork=="function"}function ly(e){const t=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(e,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(e,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(e,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const a=["goerli","ropsten","rinkeby","sepolia"];try{const o=new r.PocketProvider(e,n.pocket);o.network&&a.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(e))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const a=["ropsten"],o=new r.AnkrProvider(e,n.ankr);o.network&&a.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let a=1;return n.quorum!=null?a=n.quorum:e==="homestead"&&(a=2),new r.FallbackProvider(i,a)}return i[0]};return t.renetwork=function(r){return ly(r)},t}function TG(e,t){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null};return r.renetwork=function(n){return TG(e,n)},r}const qRe={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:ly("homestead")},XRe={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:ly("ropsten")},KRe={chainId:63,name:"classicMordor",_defaultProvider:TG("https://www.ethercluster.com/mordor","classicMordor")},V$={unspecified:{chainId:0,name:"unspecified"},homestead:qRe,mainnet:qRe,morden:{chainId:2,name:"morden"},ropsten:XRe,testnet:XRe,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:ly("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:ly("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:ly("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:ly("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:TG("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:KRe,classicTestnet:KRe,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:TG("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:ly("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:ly("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function B2e(e){if(e==null)return null;if(typeof e=="number"){for(const n in V$){const i=V$[n];if(i.chainId===e)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:e,name:"unknown"}}if(typeof e=="string"){const n=V$[e];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const t=V$[e.name];if(!t)return typeof e.chainId!="number"&&YRe.throwArgumentError("invalid network chainId","network",e),e;e.chainId!==0&&e.chainId!==t.chainId&&YRe.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;return r==null&&t._defaultProvider&&(Ykt(t._defaultProvider)?r=t._defaultProvider.renetwork(e):r=t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}const qkt="web/5.7.1";var Xkt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};function Kkt(e,t){return Xkt(this,void 0,void 0,function*(){t==null&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(t.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),t.fetchOptions!=null){const o=t.fetchOptions;o.mode&&(r.mode=o.mode),o.cache&&(r.cache=o.cache),o.credentials&&(r.credentials=o.credentials),o.redirect&&(r.redirect=o.redirect),o.referrer&&(r.referrer=o.referrer)}const n=yield fetch(e,r),i=yield n.arrayBuffer(),a={};return n.headers.forEach?n.headers.forEach((o,s)=>{a[s.toLowerCase()]=o}):n.headers.keys().forEach(o=>{a[o.toLowerCase()]=n.headers.get(o)}),{headers:a,statusCode:n.status,statusMessage:n.statusText,body:kt(new Uint8Array(i))}})}var Zkt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const Np=new Le(qkt);function ZRe(e){return new Promise(t=>{setTimeout(t,e)})}function P2(e,t){if(e==null)return null;if(typeof e=="string")return e;if(IM(e)){if(t&&(t.split("/")[0]==="text"||t.split(";")[0].trim()==="application/json"))try{return EA(e)}catch{}return Kt(e)}return e}function Qkt(e){return hl(e.replace(/%([0-9a-f][0-9a-f])/gi,(t,r)=>String.fromCharCode(parseInt(r,16))))}function JKe(e,t,r){const n=typeof e=="object"&&e.throttleLimit!=null?e.throttleLimit:12;Np.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof e=="object"?e.throttleCallback:null,a=typeof e=="object"&&typeof e.throttleSlotInterval=="number"?e.throttleSlotInterval:100;Np.assertArgument(a>0&&a%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",a);const o=typeof e=="object"?!!e.errorPassThrough:!1,s={};let l=null;const u={method:"GET"};let c=!1,f=2*60*1e3;if(typeof e=="string")l=e;else if(typeof e=="object"){if((e==null||e.url==null)&&Np.throwArgumentError("missing URL","connection.url",e),l=e.url,typeof e.timeout=="number"&&e.timeout>0&&(f=e.timeout),e.headers)for(const y in e.headers)s[y.toLowerCase()]={key:y,value:String(e.headers[y])},["if-none-match","if-modified-since"].indexOf(y.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!e.allowGzip,e.user!=null&&e.password!=null){l.substring(0,6)!=="https:"&&e.allowInsecureAuthentication!==!0&&Np.throwError("basic authentication requires a secure https url",Le.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:e.user,password:"[REDACTED]"});const y=e.user+":"+e.password;s.authorization={key:"Authorization",value:"Basic "+w2e(hl(y))}}e.skipFetchSetup!=null&&(u.skipFetchSetup=!!e.skipFetchSetup),e.fetchOptions!=null&&(u.fetchOptions=Uo(e.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(d):null;if(h)try{const y={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?S2e(h[3]):Qkt(h[3])};let b=y.body;return r&&(b=r(y.body,y)),Promise.resolve(b)}catch(y){Np.throwError("processing response error",Le.errors.SERVER_ERROR,{body:P2(h[1],h[2]),error:y,requestBody:null,requestMethod:"GET",url:l})}t&&(u.method="POST",u.body=t,s["content-type"]==null&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),s["content-length"]==null&&(s["content-length"]={key:"Content-Length",value:String(t.length)}));const p={};Object.keys(s).forEach(y=>{const b=s[y];p[b.key]=b.value}),u.headers=p;const g=function(){let y=null;return{promise:new Promise(function(T,R){f&&(y=setTimeout(()=>{y!=null&&(y=null,R(Np.makeError("timeout",Le.errors.TIMEOUT,{requestBody:P2(u.body,p["content-type"]),requestMethod:u.method,timeout:f,url:l})))},f))}),cancel:function(){y!=null&&(clearTimeout(y),y=null)}}}(),m=function(){return Zkt(this,void 0,void 0,function*(){for(let y=0;y<n;y++){let b=null;try{if(b=yield Kkt(l,u),y<n){if(b.statusCode===301||b.statusCode===302){const T=b.headers.location||"";if(u.method==="GET"&&T.match(/^https:/)){l=b.headers.location;continue}}else if(b.statusCode===429){let T=!0;if(i&&(T=yield i(y,l)),T){let R=0;const N=b.headers["retry-after"];typeof N=="string"&&N.match(/^[1-9][0-9]*$/)?R=parseInt(N)*1e3:R=a*parseInt(String(Math.random()*Math.pow(2,y))),yield ZRe(R);continue}}}}catch(T){b=T.response,b==null&&(g.cancel(),Np.throwError("missing response",Le.errors.SERVER_ERROR,{requestBody:P2(u.body,p["content-type"]),requestMethod:u.method,serverError:T,url:l}))}let w=b.body;if(c&&b.statusCode===304?w=null:!o&&(b.statusCode<200||b.statusCode>=300)&&(g.cancel(),Np.throwError("bad response",Le.errors.SERVER_ERROR,{status:b.statusCode,headers:b.headers,body:P2(w,b.headers?b.headers["content-type"]:null),requestBody:P2(u.body,p["content-type"]),requestMethod:u.method,url:l})),r)try{const T=yield r(w,b);return g.cancel(),T}catch(T){if(T.throttleRetry&&y<n){let R=!0;if(i&&(R=yield i(y,l)),R){const N=a*parseInt(String(Math.random()*Math.pow(2,y)));yield ZRe(N);continue}}g.cancel(),Np.throwError("processing response error",Le.errors.SERVER_ERROR,{body:P2(w,b.headers?b.headers["content-type"]:null),error:T,requestBody:P2(u.body,p["content-type"]),requestMethod:u.method,url:l})}return g.cancel(),w}return Np.throwError("failed response",Le.errors.SERVER_ERROR,{requestBody:P2(u.body,p["content-type"]),requestMethod:u.method,url:l})})}();return Promise.race([g.promise,m])}function Lx(e,t,r){let n=(a,o)=>{let s=null;if(a!=null)try{s=JSON.parse(EA(a))}catch(l){Np.throwError("invalid JSON",Le.errors.SERVER_ERROR,{body:a,error:l})}return r&&(s=r(s,o)),s},i=null;if(t!=null){i=hl(t);const a=typeof e=="string"?{url:e}:Uo(e);a.headers?Object.keys(a.headers).filter(s=>s.toLowerCase()==="content-type").length!==0||(a.headers=Uo(a.headers),a.headers["content-type"]="application/json"):a.headers={"content-type":"application/json"},e=a}return JKe(e,i,n)}function p3(e,t){return t||(t={}),t=Uo(t),t.floor==null&&(t.floor=0),t.ceiling==null&&(t.ceiling=1e4),t.interval==null&&(t.interval=250),new Promise(function(r,n){let i=null,a=!1;const o=()=>a?!1:(a=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout(()=>{o()&&n(new Error("timeout"))},t.timeout));const s=t.retryLimit;let l=0;function u(){return e().then(function(c){if(c!==void 0)o()&&r(c);else if(t.oncePoll)t.oncePoll.once("poll",u);else if(t.onceBlock)t.onceBlock.once("block",u);else if(!a){if(l++,l>s){o()&&n(new Error("retry limit reached"));return}let f=t.interval*parseInt(String(Math.random()*Math.pow(2,l)));f<t.floor&&(f=t.floor),f>t.ceiling&&(f=t.ceiling),setTimeout(u,f)}return null},function(c){o()&&n(c)})}u()})}var AG="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Ghe={};for(var W$=0;W$<AG.length;W$++){var Hie=AG.charAt(W$);if(Ghe[Hie]!==void 0)throw new TypeError(Hie+" is ambiguous");Ghe[Hie]=W$}function s4(e){var t=e>>25;return(e&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function eZe(e){for(var t=1,r=0;r<e.length;++r){var n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=s4(t)^n>>5}for(t=s4(t),r=0;r<e.length;++r){var i=e.charCodeAt(r);t=s4(t)^i&31}return t}function Jkt(e,t,r){if(r=r||90,e.length+7+t.length>r)throw new TypeError("Exceeds length limit");e=e.toLowerCase();var n=eZe(e);if(typeof n=="string")throw new Error(n);for(var i=e+"1",a=0;a<t.length;++a){var o=t[a];if(o>>5)throw new Error("Non 5-bit word");n=s4(n)^o,i+=AG.charAt(o)}for(a=0;a<6;++a)n=s4(n);for(n^=1,a=0;a<6;++a){var s=n>>(5-a)*5&31;i+=AG.charAt(s)}return i}function tZe(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)return"Exceeds length limit";var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)return"Mixed-case string "+e;e=r;var i=e.lastIndexOf("1");if(i===-1)return"No separator character for "+e;if(i===0)return"Missing prefix for "+e;var a=e.slice(0,i),o=e.slice(i+1);if(o.length<6)return"Data too short";var s=eZe(a);if(typeof s=="string")return s;for(var l=[],u=0;u<o.length;++u){var c=o.charAt(u),f=Ghe[c];if(f===void 0)return"Unknown character "+c;s=s4(s)^f,!(u+6>=o.length)&&l.push(f)}return s!==1?"Invalid checksum for "+e:{prefix:a,words:l}}function eBt(){var e=tZe.apply(null,arguments);if(typeof e=="object")return e}function tBt(e){var t=tZe.apply(null,arguments);if(typeof t=="object")return t;throw new Error(t)}function az(e,t,r,n){for(var i=0,a=0,o=(1<<r)-1,s=[],l=0;l<e.length;++l)for(i=i<<t|e[l],a+=t;a>=r;)a-=r,s.push(i>>a&o);if(n)a>0&&s.push(i<<r-a&o);else{if(a>=t)return"Excess padding";if(i<<r-a&o)return"Non-zero padding"}return s}function rBt(e){var t=az(e,8,5,!0);if(Array.isArray(t))return t}function nBt(e){var t=az(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)}function iBt(e){var t=az(e,5,8,!1);if(Array.isArray(t))return t}function aBt(e){var t=az(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}var oBt={decodeUnsafe:eBt,decode:tBt,encode:Jkt,toWordsUnsafe:rBt,toWords:nBt,fromWordsUnsafe:iBt,fromWords:aBt};const QRe=Nn(oBt),Kc="providers/5.7.2",y8=new Le(Kc);let Vhe=class Qr{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},r=this.address.bind(this),n=this.bigNumber.bind(this),i=this.blockTag.bind(this),a=this.data.bind(this),o=this.hash.bind(this),s=this.hex.bind(this),l=this.number.bind(this),u=this.type.bind(this),c=f=>this.data(f,!0);return t.transaction={hash:o,type:u,accessList:Qr.allowNull(this.accessList.bind(this),null),blockHash:Qr.allowNull(o,null),blockNumber:Qr.allowNull(l,null),transactionIndex:Qr.allowNull(l,null),confirmations:Qr.allowNull(l,null),from:r,gasPrice:Qr.allowNull(n),maxPriorityFeePerGas:Qr.allowNull(n),maxFeePerGas:Qr.allowNull(n),gasLimit:n,to:Qr.allowNull(r,null),value:n,nonce:l,data:a,r:Qr.allowNull(this.uint256),s:Qr.allowNull(this.uint256),v:Qr.allowNull(l),creates:Qr.allowNull(r,null),raw:Qr.allowNull(a)},t.transactionRequest={from:Qr.allowNull(r),nonce:Qr.allowNull(l),gasLimit:Qr.allowNull(n),gasPrice:Qr.allowNull(n),maxPriorityFeePerGas:Qr.allowNull(n),maxFeePerGas:Qr.allowNull(n),to:Qr.allowNull(r),value:Qr.allowNull(n),data:Qr.allowNull(c),type:Qr.allowNull(l),accessList:Qr.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:r,topics:Qr.arrayOf(o),data:a,logIndex:l,blockHash:o},t.receipt={to:Qr.allowNull(this.address,null),from:Qr.allowNull(this.address,null),contractAddress:Qr.allowNull(r,null),transactionIndex:l,root:Qr.allowNull(s),gasUsed:n,logsBloom:Qr.allowNull(a),blockHash:o,transactionHash:o,logs:Qr.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:Qr.allowNull(l,null),cumulativeGasUsed:n,effectiveGasPrice:Qr.allowNull(n),status:Qr.allowNull(l),type:u},t.block={hash:Qr.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:Qr.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Qr.allowNull(r),extraData:a,transactions:Qr.allowNull(Qr.arrayOf(o)),baseFeePerGas:Qr.allowNull(n)},t.blockWithTransactions=Uo(t.block),t.blockWithTransactions.transactions=Qr.allowNull(Qr.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Qr.allowNull(i,void 0),toBlock:Qr.allowNull(i,void 0),blockHash:Qr.allowNull(o,void 0),address:Qr.allowNull(r,void 0),topics:Qr.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Qr.allowNull(l),blockHash:Qr.allowNull(o),transactionIndex:l,removed:Qr.allowNull(this.boolean.bind(this)),address:r,data:Qr.allowFalsish(a,"0x"),topics:Qr.arrayOf(o),transactionHash:o,logIndex:l},t}accessList(t){return b_(t||[])}number(t){return t==="0x"?0:Ut.from(t).toNumber()}type(t){return t==="0x"||t==null?0:Ut.from(t).toNumber()}bigNumber(t){return Ut.from(t)}boolean(t){if(typeof t=="boolean")return t;if(typeof t=="string"){if(t=t.toLowerCase(),t==="true")return!0;if(t==="false")return!1}throw new Error("invalid boolean - "+t)}hex(t,r){return typeof t=="string"&&(!r&&t.substring(0,2)!=="0x"&&(t="0x"+t),li(t))?t.toLowerCase():y8.throwArgumentError("invalid hash","value",t)}data(t,r){const n=this.hex(t,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+t);return n}address(t){return ya(t)}callAddress(t){if(!li(t,32))return null;const r=ya(ol(t,12));return r===FXe?null:r}contractAddress(t){return Kj(t)}blockTag(t){if(t==null)return"latest";if(t==="earliest")return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if(typeof t=="number"||li(t))return OM(t);throw new Error("invalid blockTag")}hash(t,r){const n=this.hex(t,r);return _g(n)!==32?y8.throwArgumentError("invalid hash","value",t):n}difficulty(t){if(t==null)return null;const r=Ut.from(t);try{return r.toNumber()}catch{}return null}uint256(t){if(!li(t))throw new Error("invalid uint256");return Oo(t,32)}_block(t,r){t.author!=null&&t.miner==null&&(t.miner=t.author);const n=t._difficulty!=null?t._difficulty:t.difficulty,i=Qr.check(r,t);return i._difficulty=n==null?null:Ut.from(n),i}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Qr.check(this.formats.transactionRequest,t)}transactionResponse(t){t.gas!=null&&t.gasLimit==null&&(t.gasLimit=t.gas),t.to&&Ut.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),t.input!=null&&t.data==null&&(t.data=t.input),t.to==null&&t.creates==null&&(t.creates=this.contractAddress(t)),(t.type===1||t.type===2)&&t.accessList==null&&(t.accessList=[]);const r=Qr.check(this.formats.transaction,t);if(t.chainId!=null){let n=t.chainId;li(n)&&(n=Ut.from(n).toNumber()),r.chainId=n}else{let n=t.networkId;n==null&&r.v==null&&(n=t.chainId),li(n)&&(n=Ut.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(t){return DKe(t)}receiptLog(t){return Qr.check(this.formats.receiptLog,t)}receipt(t){const r=Qr.check(this.formats.receipt,t);if(r.root!=null)if(r.root.length<=4){const n=Ut.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&y8.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):y8.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&y8.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(t){return Array.isArray(t)?t.map(r=>this.topics(r)):t!=null?this.hash(t,!0):null}filter(t){return Qr.check(this.formats.filter,t)}filterLog(t){return Qr.check(this.formats.filterLog,t)}static check(t,r){const n={};for(const i in t)try{const a=t[i](r[i]);a!==void 0&&(n[i]=a)}catch(a){throw a.checkKey=i,a.checkValue=r[i],a}return n}static allowNull(t,r){return function(n){return n==null?r:t(n)}}static allowFalsish(t,r){return function(n){return n?t(n):r}}static arrayOf(t){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(t(i))}),n}}};function rZe(e){return e&&typeof e.isCommunityResource=="function"}function Whe(e){return rZe(e)&&e.isCommunityResource()}let JRe=!1;function MM(){JRe||(JRe=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var qn=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const Di=new Le(Kc),sBt=10;function exe(e){return e==null?"null":(_g(e)!==32&&Di.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function txe(e){for(e=e.slice();e.length>0&&e[e.length-1]==null;)e.pop();return e.map(t=>{if(Array.isArray(t)){const r={};t.forEach(i=>{r[exe(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return exe(t)}).join("&")}function lBt(e){return e===""?[]:e.split(/&/g).map(t=>{if(t==="")return[];const r=t.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function f5(e){if(typeof e=="string"){if(e=e.toLowerCase(),_g(e)===32)return"tx:"+e;if(e.indexOf(":")===-1)return e}else{if(Array.isArray(e))return"filter:*:"+txe(e);if(uDt.isForkEvent(e))throw Di.warn("not implemented"),new Error("not implemented");if(e&&typeof e=="object")return"filter:"+(e.address||"*")+":"+txe(e.topics||[])}throw new Error("invalid event - "+e)}function E8(){return new Date().getTime()}function rxe(e){return new Promise(t=>{setTimeout(t,e)})}const uBt=["block","network","pending","poll"];let cBt=class{constructor(t,r,n){ot(this,"tag",t),ot(this,"listener",r),ot(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return t[0]!=="tx"?null:t[1]}get filter(){const t=this.tag.split(":");if(t[0]!=="filter")return null;const r=t[1],n=lBt(t[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||uBt.indexOf(this.tag)>=0}};const fBt={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Gie(e){return Oo(Ut.from(e).toHexString(),32)}function nxe(e){return vR.encode(xo([e,ol(Fy(Fy(e)),0,4)]))}const nZe=new RegExp("^(ipfs)://(.*)$","i"),ixe=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),nZe,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function mF(e,t){try{return EA(D9(e,t))}catch{}return null}function D9(e,t){if(e==="0x")return null;const r=Ut.from(ol(e,t,t+32)).toNumber(),n=Ut.from(ol(e,r,r+32)).toNumber();return ol(e,r+32,r+32+n)}function Vie(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Di.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function axe(e){const t=kt(e);if(t.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(t,32-t.length),r}function dBt(e){if(e.length%32===0)return e;const t=new Uint8Array(Math.ceil(e.length/32)*32);return t.set(e),t}function iZe(e){const t=[];let r=0;for(let n=0;n<e.length;n++)t.push(null),r+=32;for(let n=0;n<e.length;n++){const i=kt(e[n]);t[n]=axe(r),t.push(axe(i.length)),t.push(dBt(i)),r+=32+Math.ceil(i.length/32)*32}return Af(t)}class jhe{constructor(t,r,n,i){ot(this,"provider",t),ot(this,"name",n),ot(this,"address",t.formatter.address(r)),ot(this,"_resolvedAddress",i)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(t=>Ut.from(t).eq(1)).catch(t=>{if(t.code===Le.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t})),this._supportsEip2544}_fetch(t,r){return qn(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Af([t,zL(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Af(["0x9061b923",iZe([rKe(this.name),n.data])]));try{let a=yield this.provider.call(n);return kt(a).length%32===4&&Di.throwError("resolver threw error",Le.errors.CALL_EXCEPTION,{transaction:n,data:a}),i&&(a=D9(a,0)),a}catch(a){if(a.code===Le.errors.CALL_EXCEPTION)return null;throw a}})}_fetchBytes(t,r){return qn(this,void 0,void 0,function*(){const n=yield this._fetch(t,r);return n!=null?D9(n,0):null})}_getAddress(t,r){const n=fBt[String(t)];if(n==null&&Di.throwError(`unsupported coin type: ${t}`,Le.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=kt(r);if(n.p2pkh!=null){const a=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(a){const o=parseInt(a[1],16);if(a[2].length===o*2&&o>=1&&o<=75)return nxe(xo([[n.p2pkh],"0x"+a[2]]))}}if(n.p2sh!=null){const a=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(a){const o=parseInt(a[1],16);if(a[2].length===o*2&&o>=1&&o<=75)return nxe(xo([[n.p2sh],"0x"+a[2]]))}}if(n.prefix!=null){const a=i[1];let o=i[0];if(o===0?a!==20&&a!==32&&(o=-1):o=-1,o>=0&&i.length===2+a&&a>=1&&a<=75){const s=QRe.toWords(i.slice(2));return s.unshift(o),QRe.encode(n.prefix,s)}}return null}getAddress(t){return qn(this,void 0,void 0,function*(){if(t==null&&(t=60),t===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===y2e?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===Le.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Gie(t));if(r==null||r==="0x")return null;const n=this._getAddress(t,r);return n==null&&Di.throwError("invalid or unsupported coin data",Le.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:r}),n})}getAvatar(){return qn(this,void 0,void 0,function*(){const t=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;n<ixe.length;n++){const i=r.match(ixe[n]);if(i==null)continue;const a=i[1].toLowerCase();switch(a){case"https":return t.push({type:"url",content:r}),{linkage:t,url:r};case"data":return t.push({type:"data",content:r}),{linkage:t,url:r};case"ipfs":return t.push({type:"ipfs",content:r}),{linkage:t,url:Vie(r)};case"erc721":case"erc1155":{const o=a==="erc721"?"0xc87b56dd":"0x0e89341c";t.push({type:a,content:r});const s=this._resolvedAddress||(yield this.getAddress()),l=(i[2]||"").split("/");if(l.length!==2)return null;const u=yield this.provider.formatter.address(l[0]),c=Oo(Ut.from(l[1]).toHexString(),32);if(a==="erc721"){const g=this.provider.formatter.callAddress(yield this.provider.call({to:u,data:Af(["0x6352211e",c])}));if(s!==g)return null;t.push({type:"owner",content:g})}else if(a==="erc1155"){const g=Ut.from(yield this.provider.call({to:u,data:Af(["0x00fdd58e",Oo(s,32),c])}));if(g.isZero())return null;t.push({type:"balance",content:g.toString()})}const f={to:this.provider.formatter.address(l[0]),data:Af([o,c])};let d=mF(yield this.provider.call(f),0);if(d==null)return null;t.push({type:"metadata-url-base",content:d}),a==="erc1155"&&(d=d.replace("{id}",c.substring(2)),t.push({type:"metadata-url-expanded",content:d})),d.match(/^ipfs:/i)&&(d=Vie(d)),t.push({type:"metadata-url",content:d});const h=yield Lx(d);if(!h)return null;t.push({type:"metadata",content:JSON.stringify(h)});let p=h.image;if(typeof p!="string")return null;if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(nZe)==null)return null;t.push({type:"url-ipfs",content:p}),p=Vie(p)}return t.push({type:"url",content:p}),{linkage:t,url:p}}}}}catch{}return null})}getContentHash(){return qn(this,void 0,void 0,function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(t==null||t==="0x")return null;const r=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const o=parseInt(r[3],16);if(r[4].length===o*2)return"ipfs://"+vR.encode("0x"+r[1])}const n=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const o=parseInt(n[3],16);if(n[4].length===o*2)return"ipns://"+vR.encode("0x"+n[1])}const i=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(i&&i[1].length===32*2)return"bzz://"+i[1];const a=t.match(/^0x90b2c605([0-9a-f]*)$/);if(a&&a[1].length===34*2){const o={"=":"","+":"-","/":"_"};return"sia://"+w2e("0x"+a[1]).replace(/[=+\/]/g,l=>o[l])}return Di.throwError("invalid or unsupported content hash data",Le.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})})}getText(t){return qn(this,void 0,void 0,function*(){let r=hl(t);r=xo([Gie(64),Gie(r.length),r]),r.length%32!==0&&(r=xo([r,Oo("0x",32-t.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",Kt(r));return n==null||n==="0x"?null:EA(n)})}}let Wie=null,hBt=1;class oz extends bA{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ot(this,"anyNetwork",t==="any"),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch(r=>{}),this._ready().catch(r=>{});else{const r=Ju(new.target,"getNetwork")(t);r?(ot(this,"_network",r),this.emit("network",r,null)):Di.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return qn(this,void 0,void 0,function*(){if(this._network==null){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch{}t==null&&(t=yield this.detectNetwork()),t||Di.throwError("no network detected",Le.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=t:ot(this,"_network",t),this.emit("network",t,null))}return this._network})}get ready(){return p3(()=>this._ready().then(t=>t,t=>{if(!(t.code===Le.errors.NETWORK_ERROR&&t.event==="noNetwork"))throw t}))}static getFormatter(){return Wie==null&&(Wie=new Vhe),Wie}static getNetwork(t){return B2e(t??"homestead")}ccipReadFetch(t,r,n){return qn(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=t.to.toLowerCase(),a=r.toLowerCase(),o=[];for(let s=0;s<n.length;s++){const l=n[s],u=l.replace("{sender}",i).replace("{data}",a),c=l.indexOf("{data}")>=0?null:JSON.stringify({data:a,sender:i}),f=yield Lx({url:u,errorPassThrough:!0},c,(h,p)=>(h.status=p.statusCode,h));if(f.data)return f.data;const d=f.message||"unknown error";if(f.status>=400&&f.status<500)return Di.throwError(`response not found during CCIP fetch: ${d}`,Le.errors.SERVER_ERROR,{url:l,errorMessage:d});o.push(d)}return Di.throwError(`error encountered during CCIP fetch: ${o.map(s=>JSON.stringify(s)).join(", ")}`,Le.errors.SERVER_ERROR,{urls:n,errorMessages:o})})}_getInternalBlockNumber(t){return qn(this,void 0,void 0,function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const a=yield i;if(E8()-a.respTime<=t)return a.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=E8(),n=Us({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:a})=>{if(a)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),a;const o=E8();return i=Ut.from(i).toNumber(),i<this._maxInternalBlockNumber&&(i=this._maxInternalBlockNumber),this._maxInternalBlockNumber=i,this._setFastBlockNumber(i),{blockNumber:i,reqTime:r,respTime:o}});return this._internalBlockNumber=n,n.catch(i=>{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return qn(this,void 0,void 0,function*(){const t=hBt++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",t,n),n===this._lastBlockNumber){this.emit("didPoll",t);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)Di.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",Di.makeError("network block skew detected",Le.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const a=this._emitted[i];a!=="pending"&&n-a>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const a=i.hash;let o=this.getTransactionReceipt(a).then(s=>(!s||s.blockNumber==null||(this._emitted["t:"+a]=s.blockNumber,this.emit(a,s)),null)).catch(s=>{this.emit("error",s)});r.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const a=i.filter;a.fromBlock=i._lastBlockNumber+1,a.toBlock=n;const o=a.toBlock-this._maxFilterBlockRange;o>a.fromBlock&&(a.fromBlock=o),a.fromBlock<0&&(a.fromBlock=0);const s=this.getLogs(a).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(a,u)})}).catch(l=>{this.emit("error",l),i._inflight=!1});r.push(s)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",t)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return qn(this,void 0,void 0,function*(){return Di.throwError("provider does not support network detection",Le.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return qn(this,void 0,void 0,function*(){const t=yield this._ready(),r=yield this.detectNetwork();if(t.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,t),yield rxe(0),this._network;const n=Di.makeError("underlying network changed",Le.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:r});throw this.emit("error",n),n}return t})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(t=>{this._setFastBlockNumber(t)},t=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(t){t&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if(typeof t!="number"||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const t=E8();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(t){this._fastBlockNumber!=null&&t<this._fastBlockNumber||(this._fastQueryDate=E8(),(this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,r,n){return qn(this,void 0,void 0,function*(){return this._waitForTransaction(t,r??1,n||0,null)})}_waitForTransaction(t,r,n,i){return qn(this,void 0,void 0,function*(){const a=yield this.getTransactionReceipt(t);return(a?a.confirmations:0)>=r?a:new Promise((o,s)=>{const l=[];let u=!1;const c=function(){return u?!0:(u=!0,l.forEach(d=>{d()}),!1)},f=d=>{d.confirmations<r||c()||o(d)};if(this.on(t,f),l.push(()=>{this.removeListener(t,f)}),i){let d=i.startBlock,h=null;const p=g=>qn(this,void 0,void 0,function*(){u||(yield rxe(1e3),this.getTransactionCount(i.from).then(m=>qn(this,void 0,void 0,function*(){if(!u){if(m<=i.nonce)d=g;else{{const y=yield this.getTransaction(t);if(y&&y.blockNumber!=null)return}for(h==null&&(h=d-3,h<i.startBlock&&(h=i.startBlock));h<=g;){if(u)return;const y=yield this.getBlockWithTransactions(h);for(let b=0;b<y.transactions.length;b++){const w=y.transactions[b];if(w.hash===t)return;if(w.from===i.from&&w.nonce===i.nonce){if(u)return;const T=yield this.waitForTransaction(w.hash,r);if(c())return;let R="replaced";w.data===i.data&&w.to===i.to&&w.value.eq(i.value)?R="repriced":w.data==="0x"&&w.from===w.to&&w.value.isZero()&&(R="cancelled"),s(Di.makeError("transaction was replaced",Le.errors.TRANSACTION_REPLACED,{cancelled:R==="replaced"||R==="cancelled",reason:R,replacement:this._wrapTransaction(w),hash:t,receipt:T}));return}}h++}}u||this.once("block",p)}}),m=>{u||this.once("block",p)}))});if(u)return;this.once("block",p),l.push(()=>{this.removeListener("block",p)})}if(typeof n=="number"&&n>0){const d=setTimeout(()=>{c()||s(Di.makeError("timeout exceeded",Le.errors.TIMEOUT,{timeout:n}))},n);d.unref&&d.unref(),l.push(()=>{clearTimeout(d)})}})})}getBlockNumber(){return qn(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return Ut.from(t)}catch(r){return Di.throwError("bad result from backend",Le.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:r})}})}getBalance(t,r){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Us({address:this._getAddress(t),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return Ut.from(i)}catch(a){return Di.throwError("bad result from backend",Le.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:a})}})}getTransactionCount(t,r){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Us({address:this._getAddress(t),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return Ut.from(i).toNumber()}catch(a){return Di.throwError("bad result from backend",Le.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:a})}})}getCode(t,r){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Us({address:this._getAddress(t),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return Kt(i)}catch(a){return Di.throwError("bad result from backend",Le.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:a})}})}getStorageAt(t,r,n){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield Us({address:this._getAddress(t),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(o=>OM(o))}),a=yield this.perform("getStorageAt",i);try{return Kt(a)}catch(o){return Di.throwError("bad result from backend",Le.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:a,error:o})}})}_wrapTransaction(t,r,n){if(r!=null&&_g(r)!==32)throw new Error("invalid response - sendTransaction");const i=t;return r!=null&&t.hash!==r&&Di.throwError("Transaction hash mismatch from Provider.sendTransaction.",Le.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:r}),i.wait=(a,o)=>qn(this,void 0,void 0,function*(){a==null&&(a=1),o==null&&(o=0);let s;a!==0&&n!=null&&(s={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:n});const l=yield this._waitForTransaction(t.hash,a,o,s);return l==null&&a===0?null:(this._emitted["t:"+t.hash]=l.blockNumber,l.status===0&&Di.throwError("transaction failed",Le.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:l}),l)}),i}sendTransaction(t){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(t).then(a=>Kt(a)),n=this.formatter.transaction(t);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const a=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,a,i)}catch(a){throw a.transaction=n,a.transactionHash=n.hash,a}})}_getTransactionRequest(t){return qn(this,void 0,void 0,function*(){const r=yield t,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(a=>a?this._getAddress(a):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(a=>a?Ut.from(a):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(a=>a??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(a=>a?Kt(a):null))}),this.formatter.transactionRequest(yield Us(n))})}_getFilter(t){return qn(this,void 0,void 0,function*(){t=yield t;const r={};return t.address!=null&&(r.address=this._getAddress(t.address)),["blockHash","topics"].forEach(n=>{t[n]!=null&&(r[n]=t[n])}),["fromBlock","toBlock"].forEach(n=>{t[n]!=null&&(r[n]=this._getBlockTag(t[n]))}),this.formatter.filter(yield Us(r))})}_call(t,r,n){return qn(this,void 0,void 0,function*(){n>=sBt&&Di.throwError("CCIP read exceeded maximum redirections",Le.errors.SERVER_ERROR,{redirects:n,transaction:t});const i=t.to,a=yield this.perform("call",{transaction:t,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&a.substring(0,10)==="0x556f1830"&&_g(a)%32===4)try{const o=ol(a,4),s=ol(o,0,32);Ut.from(s).eq(i)||Di.throwError("CCIP Read sender did not match",Le.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:a});const l=[],u=Ut.from(ol(o,32,64)).toNumber(),c=Ut.from(ol(o,u,u+32)).toNumber(),f=ol(o,u+32);for(let y=0;y<c;y++){const b=mF(f,y*32);b==null&&Di.throwError("CCIP Read contained corrupt URL string",Le.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:a}),l.push(b)}const d=D9(o,64);Ut.from(ol(o,100,128)).isZero()||Di.throwError("CCIP Read callback selector included junk",Le.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:a});const h=ol(o,96,100),p=D9(o,128),g=yield this.ccipReadFetch(t,d,l);g==null&&Di.throwError("CCIP Read disabled or provided no URLs",Le.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:a});const m={to:i,data:Af([h,iZe([g,p])])};return this._call(m,r,n+1)}catch(o){if(o.code===Le.errors.SERVER_ERROR)throw o}try{return Kt(a)}catch(o){return Di.throwError("bad result from backend",Le.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:r},result:a,error:o})}})}call(t,r){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Us({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(r),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(n.transaction,n.blockTag,n.ccipReadEnabled?0:-1)})}estimateGas(t){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Us({transaction:this._getTransactionRequest(t)}),n=yield this.perform("estimateGas",r);try{return Ut.from(n)}catch(i){return Di.throwError("bad result from backend",Le.errors.SERVER_ERROR,{method:"estimateGas",params:r,result:n,error:i})}})}_getAddress(t){return qn(this,void 0,void 0,function*(){t=yield t,typeof t!="string"&&Di.throwArgumentError("invalid address or ENS name","name",t);const r=yield this.resolveName(t);return r==null&&Di.throwError("ENS name not configured",Le.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),r})}_getBlock(t,r){return qn(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;let n=-128;const i={includeTransactions:!!r};if(li(t,32))i.blockHash=t;else try{i.blockTag=yield this._getBlockTag(t),li(i.blockTag)&&(n=parseInt(i.blockTag.substring(2),16))}catch{Di.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return p3(()=>qn(this,void 0,void 0,function*(){const a=yield this.perform("getBlock",i);if(a==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let o=null;for(let l=0;l<a.transactions.length;l++){const u=a.transactions[l];if(u.blockNumber==null)u.confirmations=0;else if(u.confirmations==null){o==null&&(o=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let c=o-u.blockNumber+1;c<=0&&(c=1),u.confirmations=c}}const s=this.formatter.blockWithTransactions(a);return s.transactions=s.transactions.map(l=>this._wrapTransaction(l)),s}return this.formatter.block(a)}),{oncePoll:this})})}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return qn(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const r={transactionHash:this.formatter.hash(t,!0)};return p3(()=>qn(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+t]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(t){return qn(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const r={transactionHash:this.formatter.hash(t,!0)};return p3(()=>qn(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+t]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(t){return qn(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Us({filter:this._getFilter(t)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),Vhe.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return qn(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(t){return qn(this,void 0,void 0,function*(){if(t=yield t,typeof t=="number"&&t<0){t%1&&Di.throwArgumentError("invalid BlockTag","blockTag",t);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=t,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(t)})}getResolver(t){return qn(this,void 0,void 0,function*(){let r=t;for(;;){if(r===""||r==="."||t!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new jhe(this,n,t);return r!==t&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(t,r){return qn(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||Di.throwError("network does not support ENS",Le.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+zL(t).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(t){return qn(this,void 0,void 0,function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(n){if(li(t))throw n}typeof t!="string"&&Di.throwArgumentError("invalid ENS name","name",t);const r=yield this.getResolver(t);return r?yield r.getAddress():null})}lookupAddress(t){return qn(this,void 0,void 0,function*(){t=yield t,t=this.formatter.address(t);const r=t.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=mF(yield this.call({to:n,data:"0x691f3431"+zL(r).substring(2)}),0);return(yield this.resolveName(i))!=t?null:i})}getAvatar(t){return qn(this,void 0,void 0,function*(){let r=null;if(li(t)){const a=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(a,"getAvatar");if(!o)return null;r=new jhe(this,o,a);try{const s=yield r.getAvatar();if(s)return s.url}catch(s){if(s.code!==Le.errors.CALL_EXCEPTION)throw s}try{const s=mF(yield this.call({to:o,data:"0x691f3431"+zL(a).substring(2)}),0);r=yield this.getResolver(s)}catch(s){if(s.code!==Le.errors.CALL_EXCEPTION)throw s;return null}}else if(r=yield this.getResolver(t),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(t,r){return Di.throwError(t+" not implemented",Le.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(t){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(t,r,n){const i=new cBt(f5(t),r,n);return this._events.push(i),this._startEvent(i),this}on(t,r){return this._addEventListener(t,r,!1)}once(t,r){return this._addEventListener(t,r,!0)}emit(t,...r){let n=!1,i=[],a=f5(t);return this._events=this._events.filter(o=>o.tag!==a?!0:(setTimeout(()=>{o.listener.apply(this,r)},0),n=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),n}listenerCount(t){if(!t)return this._events.length;let r=f5(t);return this._events.filter(n=>n.tag===r).length}listeners(t){if(t==null)return this._events.map(n=>n.listener);let r=f5(t);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(t,r){if(r==null)return this.removeAllListeners(t);const n=[];let i=!1,a=f5(t);return this._events=this._events.filter(o=>o.tag!==a||o.listener!=r||i?!0:(i=!0,n.push(o),!1)),n.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(t){let r=[];if(t==null)r=this._events,this._events=[];else{const n=f5(t);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var ry=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const xl=new Le(Kc),pBt=["call","estimateGas"];function XL(e,t){if(e==null)return null;if(typeof e.message=="string"&&e.message.match("reverted")){const r=li(e.data)?e.data:null;if(!t||r)return{message:e.message,data:r}}if(typeof e=="object"){for(const r in e){const n=XL(e[r],t);if(n)return n}return null}if(typeof e=="string")try{return XL(JSON.parse(e),t)}catch{}return null}function aZe(e,t,r){const n=r.transaction||r.signedTransaction;if(e==="call"){const a=XL(t,!0);if(a)return a.data;xl.throwError("missing revert data in call exception; Transaction reverted without a reason string",Le.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if(e==="estimateGas"){let a=XL(t.body,!1);a==null&&(a=XL(t,!1)),a&&xl.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Le.errors.UNPREDICTABLE_GAS_LIMIT,{reason:a.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===Le.errors.SERVER_ERROR&&t.error&&typeof t.error.message=="string"?i=t.error.message:typeof t.body=="string"?i=t.body:typeof t.responseText=="string"&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&xl.throwError("insufficient funds for intrinsic transaction cost",Le.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&xl.throwError("nonce has already been used",Le.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&xl.throwError("replacement fee too low",Le.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&xl.throwError("legacy pre-eip-155 transactions not supported",Le.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),pBt.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&xl.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Le.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function oxe(e){return new Promise(function(t){setTimeout(t,e)})}function vBt(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function b8(e){return e&&e.toLowerCase()}const zhe={};class U2e extends y_{constructor(t,r,n){if(super(),t!==zhe)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ot(this,"provider",r),n==null&&(n=0),typeof n=="string"?(ot(this,"_address",this.provider.formatter.address(n)),ot(this,"_index",null)):typeof n=="number"?(ot(this,"_index",n),ot(this,"_address",null)):xl.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(t){return xl.throwError("cannot alter JSON-RPC Signer connection",Le.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new gBt(zhe,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(t=>(t.length<=this._index&&xl.throwError("unknown account #"+this._index,Le.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index])))}sendUncheckedTransaction(t){t=Uo(t);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(t.gasLimit==null){const n=Uo(t);n.from=r,t.gasLimit=this.provider.estimateGas(n)}return t.to!=null&&(t.to=Promise.resolve(t.to).then(n=>ry(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&xl.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),Us({tx:Us(t),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&xl.throwArgumentError("from address mismatch","transaction",t):n.from=i;const a=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[a]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&xl.throwError("user rejected transaction",Le.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),aZe("sendTransaction",o,a)))})}signTransaction(t){return xl.throwError("signing transactions is unsupported",Le.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return ry(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(t);try{return yield p3(()=>ry(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(t){return ry(this,void 0,void 0,function*(){const r=typeof t=="string"?hl(t):t,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Kt(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&xl.throwError("user rejected signing",Le.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:t}),i}})}_legacySignMessage(t){return ry(this,void 0,void 0,function*(){const r=typeof t=="string"?hl(t):t,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),Kt(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&xl.throwError("user rejected signing",Le.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:t}),i}})}_signTypedData(t,r,n){return ry(this,void 0,void 0,function*(){const i=yield zu.resolveNames(t,r,n,o=>this.provider.resolveName(o)),a=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[a.toLowerCase(),JSON.stringify(zu.getPayload(i.domain,r,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&xl.throwError("user rejected signing",Le.errors.ACTION_REJECTED,{action:"_signTypedData",from:a,messageData:{domain:i.domain,types:r,value:i.value}}),o}})}unlock(t){return ry(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),t,null])})}}class gBt extends U2e{sendTransaction(t){return this.sendUncheckedTransaction(t).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const mBt={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Pb extends oz{constructor(t,r){let n=r;n==null&&(n=new Promise((i,a)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{a(o)})},0)})),super(n),t||(t=Ju(this.constructor,"defaultUrl")()),typeof t=="string"?ot(this,"connection",Object.freeze({url:t})):ot(this,"connection",Object.freeze(Uo(t))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return ry(this,void 0,void 0,function*(){yield oxe(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch{try{t=yield this.send("net_version",[])}catch{}}if(t!=null){const r=Ju(this.constructor,"getNetwork");try{return r(Ut.from(t).toNumber())}catch(n){return xl.throwError("could not detect network",Le.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:n})}}return xl.throwError("could not detect network",Le.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(t){return new U2e(zhe,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(t=>t.map(r=>this.formatter.address(r)))}send(t,r){const n={method:t,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Nf(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(i&&this._cache[t])return this._cache[t];const a=Lx(this.connection,JSON.stringify(n),vBt).then(o=>(this.emit("debug",{action:"response",request:n,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:n,provider:this}),o});return i&&(this._cache[t]=a,setTimeout(()=>{this._cache[t]=null},0)),a}prepareRequest(t,r){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[b8(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[b8(r.address),r.blockTag]];case"getCode":return["eth_getCode",[b8(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[b8(r.address),Oo(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[Ju(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[Ju(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=b8(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(t,r){return ry(this,void 0,void 0,function*(){if(t==="call"||t==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&Ut.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const a=yield this.getFeeData();a.maxFeePerGas==null&&a.maxPriorityFeePerGas==null&&(r=Uo(r),r.transaction=Uo(i),delete r.transaction.type)}}const n=this.prepareRequest(t,r);n==null&&xl.throwError(t+" not implemented",Le.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(n[0],n[1])}catch(i){return aZe(t,i,r)}})}_startEvent(t){t.tag==="pending"&&this._startPending(),super._startEvent(t)}_startPending(){if(this._pendingFilter!=null)return;const t=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){t.send("eth_getFilterChanges",[n]).then(function(a){if(t._pendingFilter!=r)return null;let o=Promise.resolve();return a.forEach(function(s){t._emitted["t:"+s.toLowerCase()]="pending",o=o.then(function(){return t.getTransaction(s).then(function(l){return t.emit("pending",l),null})})}),o.then(function(){return oxe(1e3)})}).then(function(){if(t._pendingFilter!=r){t.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(a=>{})}return i(),n}).catch(n=>{})}_stopEvent(t){t.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,r){const n=Uo(mBt);if(r)for(const a in r)r[a]&&(n[a]=!0);p2e(t,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(a){if(t[a]==null)return;const o=OM(Ut.from(t[a]));a==="gasLimit"&&(a="gas"),i[a]=o}),["from","to","data"].forEach(function(a){t[a]!=null&&(i[a]=Kt(t[a]))}),t.accessList&&(i.accessList=b_(t.accessList)),i}}let KL=null;try{if(KL=WebSocket,KL==null)throw new Error("inject please")}catch{const t=new Le(Kc);KL=function(){t.throwError("WebSockets not supported in this environment",Le.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var jie=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const j$=new Le(Kc);let yBt=1;class sz extends Pb{constructor(t,r){r==="any"&&j$.throwError("WebSocketProvider does not support 'any' network yet",Le.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof t=="string"?super(t,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof t=="string"?ot(this,"_websocket",new KL(this.connection.url)):ot(this,"_websocket",t),ot(this,"_requests",{}),ot(this,"_subs",{}),ot(this,"_subIds",{}),ot(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const a=i.data,o=JSON.parse(a);if(o.id!=null){const s=String(o.id),l=this._requests[s];if(delete this._requests[s],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let u=null;o.error?(u=new Error(o.error.message||"unknown error"),ot(u,"code",o.error.code||null),ot(u,"response",a)):u=new Error("unknown error"),l.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const s=this._subs[o.params.subscription];s&&s.processFunc(o.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(t){j$.throwError("cannot reset events block on WebSocketProvider",Le.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(t){j$.throwError("cannot set polling interval on WebSocketProvider",Le.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return jie(this,void 0,void 0,function*(){return null})}set polling(t){t&&j$.throwError("cannot set polling on WebSocketProvider",Le.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(t,r){const n=yBt++;return new Promise((i,a)=>{function o(l,u){return l?a(l):i(u)}const s=JSON.stringify({method:t,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(s),provider:this}),this._requests[String(n)]={callback:o,payload:s},this._wsReady&&this.websocket.send(s)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(t,r,n){return jie(this,void 0,void 0,function*(){let i=this._subIds[t];i==null&&(i=Promise.all(r).then(o=>this.send("eth_subscribe",o)),this._subIds[t]=i);const a=yield i;this._subs[a]={tag:t,processFunc:n}})}_startEvent(t){switch(t.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=Ut.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(t.tag,["logs",this._getFilter(t.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(t.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(a=>{a&&this.emit(i,a)})};r(t),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",t);break}}_stopEvent(t){let r=t.tag;if(t.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(t.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return jie(this,void 0,void 0,function*(){this.websocket.readyState===KL.CONNECTING&&(yield new Promise(t=>{this.websocket.onopen=function(){t(!0)},this.websocket.onerror=function(){t(!1)}})),this.websocket.close(1e3)})}}var EBt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const oL=new Le(Kc);class oZe extends Pb{detectNetwork(){const t=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return EBt(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield t.detectNetwork.call(this),r||oL.throwError("no network detected",Le.errors.UNKNOWN_ERROR,{}),this._network==null&&(ot(this,"_network",r),this.emit("network",r,null))),r})}}class f2 extends oZe{constructor(t,r){oL.checkAbstract(new.target,f2),t=Ju(new.target,"getNetwork")(t),r=Ju(new.target,"getApiKey")(r);const n=Ju(new.target,"getUrl")(t,r);super(n,t),typeof r=="string"?ot(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{ot(this,i,r[i])})}_startPending(){oL.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(t){return oL.throwError("API provider does not support signing",Le.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(t){return t}static getUrl(t,r){return oL.throwError("not implemented; sub-classes must override getUrl",Le.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const sxe=new Le(Kc),yF="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class sZe extends sz{constructor(t,r){const n=new F2e(t,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),ot(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===yF}}class F2e extends f2{static getWebSocketProvider(t,r){return new sZe(t,r)}static getApiKey(t){return t==null?yF:(t&&typeof t!="string"&&sxe.throwArgumentError("invalid apiKey","apiKey",t),t)}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:sxe.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,a)=>(r===yF&&MM(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===yF}}const bBt=new Le(Kc),z$="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function _Bt(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return bBt.throwArgumentError("unsupported network","name",e)}class lZe extends f2{isCommunityResource(){return this.apiKey===z$}static getApiKey(t){return t??z$}static getUrl(t,r){r==null&&(r=z$);const n={allowGzip:!0,url:"https://"+_Bt(t.name)+r,throttleCallback:(i,a)=>(r.apiKey===z$&&MM(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var SBt=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const lxe=new Le(Kc);class uZe extends f2{static getApiKey(t){return t!=null&&lxe.throwArgumentError("apiKey not supported for cloudflare","apiKey",t),null}static getUrl(t,r){let n=null;switch(t.name){case"homestead":n="https://cloudflare-eth.com/";break;default:lxe.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return SBt(this,void 0,void 0,function*(){return t==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,t,r)})}}var Y$=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const TE=new Le(Kc);function uxe(e){const t={};for(let r in e){if(e[r]==null)continue;let n=e[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=OM(Kt(n)):r==="accessList"?n="["+b_(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=Kt(n),t[r]=n)}return t}function wBt(e){if(e.status==0&&(e.message==="No records found"||e.message==="No transactions found"))return e.result;if(e.status!=1||typeof e.message!="string"||!e.message.match(/^OK/)){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function cxe(e){if(e&&e.status==0&&e.message=="NOTOK"&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if(e.jsonrpc!="2.0"){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function fxe(e){if(e==="pending")throw new Error("pending not supported");return e==="latest"?e:parseInt(e.substring(2),16)}function zie(e,t,r){if(e==="call"&&t.code===Le.errors.SERVER_ERROR){const i=t.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let a=i.data;if(a&&(a="0x"+a.replace(/^.*0x/i,"")),li(a))return a;TE.throwError("missing revert data in call exception",Le.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===Le.errors.SERVER_ERROR&&(t.error&&typeof t.error.message=="string"?n=t.error.message:typeof t.body=="string"?n=t.body:typeof t.responseText=="string"&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&TE.throwError("insufficient funds for intrinsic transaction cost",Le.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&TE.throwError("nonce has already been used",Le.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&TE.throwError("replacement fee too low",Le.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&TE.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Le.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class cZe extends oz{constructor(t,r){super(t),ot(this,"baseUrl",this.getBaseUrl()),ot(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return TE.throwArgumentError("unsupported network","network",this.network.name)}getUrl(t,r){const n=Object.keys(r).reduce((a,o)=>{const s=r[o];return s!=null&&(a+=`&${o}=${s}`),a},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${t}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}fetch(t,r,n){return Y$(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(t,r),a=n?this.getPostData(t,r):null,o=t==="proxy"?cxe:wBt;this.emit("debug",{action:"request",request:i,provider:this});const s={url:i,throttleSlotInterval:1e3,throttleCallback:(c,f)=>(this.isCommunityResource()&&MM(),Promise.resolve(!0))};let l=null;a&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(a).map(c=>`${c}=${a[c]}`).join("&"));const u=yield Lx(s,l,o||cxe);return this.emit("debug",{action:"response",request:i,response:Nf(u),provider:this}),u})}detectNetwork(){return Y$(this,void 0,void 0,function*(){return this.network})}perform(t,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Y$(this,void 0,void 0,function*(){switch(t){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>zie("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=uxe(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(a){return zie("call",a,r.transaction)}}case"estimateGas":{const i=uxe(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(a){return zie("estimateGas",a,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=fxe(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=fxe(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&TE.throwError("unsupported topic count",Le.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const s=r.filter.topics[0];(typeof s!="string"||s.length!==66)&&TE.throwError("unsupported topic format",Le.errors.UNSUPPORTED_OPERATION,{topic0:s}),i.topic0=s}const a=yield this.fetch("logs",i);let o={};for(let s=0;s<a.length;s++){const l=a[s];if(l.blockHash==null){if(o[l.blockNumber]==null){const u=yield this.getBlock(l.blockNumber);u&&(o[l.blockNumber]=u.hash)}l.blockHash=o[l.blockNumber]}}return a}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd)}return n.perform.call(this,t,r)})}getHistory(t,r,n){return Y$(this,void 0,void 0,function*(){const i={action:"txlist",address:yield this.resolveName(t),startblock:r??0,endblock:n??99999999,sort:"asc"};return(yield this.fetch("account",i)).map(o=>{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const s=this.formatter.transactionResponse(o);return o.timeStamp&&(s.timestamp=parseInt(o.timeStamp)),s})})}isCommunityResource(){return this.apiKey==null}}var CG=globalThis&&globalThis.__awaiter||function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{u(n.next(c))}catch(f){o(f)}}function l(c){try{u(n.throw(c))}catch(f){o(f)}}function u(c){c.done?a(c.value):i(c.value).then(s,l)}u((n=n.apply(e,t||[])).next())})};const Jw=new Le(Kc);function q$(){return new Date().getTime()}function dxe(e){let t=null;for(let r=0;r<e.length;r++){const n=e[r];if(n==null)return null;t?t.name===n.name&&t.chainId===n.chainId&&(t.ensAddress===n.ensAddress||t.ensAddress==null&&n.ensAddress==null)||Jw.throwArgumentError("provider mismatch","networks",e):t=n}return t}function hxe(e,t){e=e.slice().sort();const r=Math.floor(e.length/2);if(e.length%2)return e[r];const n=e[r-1],i=e[r];return t!=null&&Math.abs(n-i)>t?null:(n+i)/2}function LC(e){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return JSON.stringify(e);if(typeof e=="string")return e;if(Ut.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map(t=>LC(t)));if(typeof e=="object"){const t=Object.keys(e);return t.sort(),"{"+t.map(r=>{let n=e[r];return typeof n=="function"?n="[function]":n=LC(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let TBt=1;function pxe(e){let t=null,r=null,n=new Promise(o=>{t=function(){r&&(clearTimeout(r),r=null),o()},r=setTimeout(t,e)});const i=o=>(n=n.then(o),n);function a(){return n}return{cancel:t,getPromise:a,wait:i}}const ABt=[Le.errors.CALL_EXCEPTION,Le.errors.INSUFFICIENT_FUNDS,Le.errors.NONCE_EXPIRED,Le.errors.REPLACEMENT_UNDERPRICED,Le.errors.UNPREDICTABLE_GAS_LIMIT],CBt=["address","args","errorArgs","errorSignature","method","transaction"];function X$(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function RBt(e,t){return function(r){const n={};r.forEach(a=>{const o=e(a.result);n[o]||(n[o]={count:0,result:a.result}),n[o].count++});const i=Object.keys(n);for(let a=0;a<i.length;a++){const o=n[i[a]];if(o.count>=t)return o.result}}}function xBt(e,t,r){let n=LC;switch(t){case"getBlockNumber":return function(i){const a=i.map(s=>s.result);let o=hxe(i.map(s=>s.result),2);if(o!=null)return o=Math.ceil(o),a.indexOf(o+1)>=0&&o++,o>=e._highestBlockNumber&&(e._highestBlockNumber=o),e._highestBlockNumber};case"getGasPrice":return function(i){const a=i.map(o=>o.result);return a.sort(),a[Math.floor(a.length/2)]};case"getEtherPrice":return function(i){return hxe(i.map(a=>a.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=Uo(i),i.confirmations=-1,LC(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=Uo(i),i.transactions=i.transactions.map(a=>(a=Uo(a),a.confirmations=-1,a)),LC(i))}:n=function(i){return i==null?null:LC(i)};break;default:throw new Error("unknown method: "+t)}return RBt(n,e.quorum)}function _8(e,t){return CG(this,void 0,void 0,function*(){const r=e.provider;return r.blockNumber!=null&&r.blockNumber>=t||t===-1?r:p3(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function IBt(e,t,r,n){return CG(this,void 0,void 0,function*(){let i=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&li(n.blockTag)&&(i=yield _8(e,t)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&li(n.blockTag)&&(i=yield _8(e,t)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&li(n.blockTag)&&(i=yield _8(e,t)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&li(n.blockTag)&&(i=yield _8(e,t)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let a=n.filter;return(a.fromBlock&&li(a.fromBlock)||a.toBlock&&li(a.toBlock))&&(i=yield _8(e,t)),i.getLogs(a)}}return Jw.throwError("unknown method error",Le.errors.UNKNOWN_ERROR,{method:r,params:n})})}class fZe extends oz{constructor(t,r){t.length===0&&Jw.throwArgumentError("missing providers","providers",t);const n=t.map((o,s)=>{if(bA.isProvider(o)){const c=Whe(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=Uo(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=Whe(o)?2e3:750),l.weight==null&&(l.weight=1);const u=l.weight;return(u%1||u>512||u<1)&&Jw.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${s}].weight`,u),Object.freeze(l)}),i=n.reduce((o,s)=>o+s.weight,0);r==null?r=i/2:r>i&&Jw.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let a=dxe(n.map(o=>o.provider.network));a==null&&(a=new Promise((o,s)=>{setTimeout(()=>{this.detectNetwork().then(o,s)},0)})),super(a),ot(this,"providerConfigs",Object.freeze(n)),ot(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return CG(this,void 0,void 0,function*(){const t=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return dxe(t)})}perform(t,r){return CG(this,void 0,void 0,function*(){if(t==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;u<l.length;u++){const c=l[u];if(typeof c=="string")return c}throw l[0]}this._highestBlockNumber===-1&&t!=="getBlockNumber"&&(yield this.getBlockNumber());const n=xBt(this,t,r),i=jKe(this.providerConfigs.map(Uo));i.sort((l,u)=>l.priority-u.priority);const a=this._highestBlockNumber;let o=0,s=!0;for(;;){const l=q$();let u=i.filter(h=>h.runner&&l-h.start<h.stallTimeout).reduce((h,p)=>h+p.weight,0);for(;u<this.quorum&&o<i.length;){const h=i[o++],p=TBt++;h.start=q$(),h.staller=pxe(h.stallTimeout),h.staller.wait(()=>{h.staller=null}),h.runner=IBt(h,a,t,r).then(g=>{h.done=!0,h.result=g,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:X$(h,q$()),request:{method:t,params:Nf(r)},provider:this})},g=>{h.done=!0,h.error=g,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:X$(h,q$()),request:{method:t,params:Nf(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:X$(h,null),request:{method:t,params:Nf(r)},provider:this}),u+=h.weight}const c=[];i.forEach(h=>{h.done||!h.runner||(c.push(h.runner),h.staller&&c.push(h.staller.getPromise()))}),c.length&&(yield Promise.race(c));const f=i.filter(h=>h.done&&h.error==null);if(f.length>=this.quorum){const h=n(f);if(h!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),h;s||(yield pxe(100).getPromise()),s=!1}const d=i.reduce((h,p)=>{if(!p.done||p.error==null)return h;const g=p.error.code;return ABt.indexOf(g)>=0&&(h[g]||(h[g]={error:p.error,weight:0}),h[g].weight+=p.weight),h},{});if(Object.keys(d).forEach(h=>{const p=d[h];if(p.weight<this.quorum)return;i.forEach(y=>{y.staller&&y.staller.cancel(),y.cancelled=!0});const g=p.error,m={};CBt.forEach(y=>{g[y]!=null&&(m[y]=g[y])}),Jw.throwError(g.reason||g.message,h,m)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),Jw.throwError("failed to meet quorum",Le.errors.SERVER_ERROR,{method:t,params:r,results:i.map(l=>X$(l)),provider:this})})}}const dZe=null,EF=new Le(Kc),sL="84842078b09946638c03157f83405213";class hZe extends sz{constructor(t,r){const n=new lz(t,r),i=n.connection;i.password&&EF.throwError("INFURA WebSocket project secrets unsupported",Le.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const a=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(a,t),ot(this,"apiKey",n.projectId),ot(this,"projectId",n.projectId),ot(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===sL}}class lz extends f2{static getWebSocketProvider(t,r){return new hZe(t,r)}static getApiKey(t){const r={apiKey:sL,projectId:sL,projectSecret:null};return t==null||(typeof t=="string"?r.projectId=t:t.projectSecret!=null?(EF.assertArgument(typeof t.projectId=="string","projectSecret requires a projectId","projectId",t.projectId),EF.assertArgument(typeof t.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=t.projectId,r.projectSecret=t.projectSecret):t.projectId&&(r.projectId=t.projectId),r.apiKey=r.projectId),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:EF.throwError("unsupported network",Le.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(a,o)=>(r.projectId===sL&&MM(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===sL}}class OBt extends Pb{send(t,r){const n={method:t,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},a=new Promise((o,s)=>{i.resolve=o,i.reject=s});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const o=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const s=o.map(l=>l.request);return this.emit("debug",{action:"requestBatch",request:Nf(s),provider:this}),Lx(this.connection,JSON.stringify(s)).then(l=>{this.emit("debug",{action:"response",request:s,response:l,provider:this}),o.forEach((u,c)=>{const f=l[c];if(f.error){const d=new Error(f.error.message);d.code=f.error.code,d.data=f.error.data,u.reject(d)}else u.resolve(f.result)})},l=>{this.emit("debug",{action:"response",error:l,request:s,provider:this}),o.forEach(u=>{u.reject(l)})})},10)),a}}const Yie=new Le(Kc),NBt="ETHERS_JS_SHARED";class pZe extends f2{static getApiKey(t){return t&&typeof t!="string"&&Yie.throwArgumentError("invalid apiKey","apiKey",t),t||NBt}static getUrl(t,r){Yie.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(t.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Yie.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const vxe=new Le(Kc),gxe="62e1ad51b37b8e00394bda3b";class vZe extends f2{static getApiKey(t){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return t==null?r.applicationId=gxe:typeof t=="string"?r.applicationId=t:t.applicationSecretKey!=null?(r.applicationId=t.applicationId,r.applicationSecretKey=t.applicationSecretKey):t.applicationId?r.applicationId=t.applicationId:vxe.throwArgumentError("unsupported PocketProvider apiKey","apiKey",t),r}static getUrl(t,r){let n=null;switch(t?t.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:vxe.throwError("unsupported network",Le.errors.INVALID_ARGUMENT,{argument:"network",value:t})}const i=`https://${n}/v1/lb/${r.applicationId}`,a={headers:{},url:i};return r.applicationSecretKey!=null&&(a.user="",a.password=r.applicationSecretKey),a}isCommunityResource(){return this.applicationId===gxe}}const mxe=new Le(Kc);let LBt=1;function yxe(e,t){const r="Web3LegacyFetcher";return function(n,i){const a={method:n,params:i,id:LBt++,jsonrpc:"2.0"};return new Promise((o,s)=>{this.emit("debug",{action:"request",fetcher:r,request:Nf(a),provider:this}),t(a,(l,u)=>{if(l)return this.emit("debug",{action:"response",fetcher:r,error:l,request:a,provider:this}),s(l);if(this.emit("debug",{action:"response",fetcher:r,request:a,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,s(c)}o(u.result)})})}}function PBt(e){return function(t,r){r==null&&(r=[]);const n={method:t,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Nf(n),provider:this}),e.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class H2e extends Pb{constructor(t,r){t==null&&mxe.throwArgumentError("missing provider","provider",t);let n=null,i=null,a=null;typeof t=="function"?(n="unknown:",i=t):(n=t.host||t.path||"",!n&&t.isMetaMask&&(n="metamask"),a=t,t.request?(n===""&&(n="eip-1193:"),i=PBt(t)):t.sendAsync?i=yxe(t,t.sendAsync.bind(t)):t.send?i=yxe(t,t.send.bind(t)):mxe.throwArgumentError("unsupported provider","provider",t),n||(n="unknown:")),super(n,r),ot(this,"jsonRpcFetchFunc",i),ot(this,"provider",a)}send(t,r){return this.jsonRpcFetchFunc(t,r)}}const Exe=new Le(Kc);function gZe(e,t){if(e==null&&(e="homestead"),typeof e=="string"){const n=e.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new Pb(e);case"ws":case"wss":return new sz(e);default:Exe.throwArgumentError("unsupported URL scheme","network",e)}}const r=B2e(e);return(!r||!r._defaultProvider)&&Exe.throwError("unsupported getDefaultProvider network",Le.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:fZe,AlchemyProvider:F2e,AnkrProvider:lZe,CloudflareProvider:uZe,EtherscanProvider:cZe,InfuraProvider:lz,JsonRpcProvider:Pb,NodesmithProvider:pZe,PocketProvider:vZe,Web3Provider:H2e,IpcProvider:dZe},t)}const MBt=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:F2e,AlchemyWebSocketProvider:sZe,AnkrProvider:lZe,BaseProvider:oz,CloudflareProvider:uZe,EtherscanProvider:cZe,FallbackProvider:fZe,Formatter:Vhe,InfuraProvider:lz,InfuraWebSocketProvider:hZe,IpcProvider:dZe,JsonRpcBatchProvider:OBt,JsonRpcProvider:Pb,JsonRpcSigner:U2e,NodesmithProvider:pZe,PocketProvider:vZe,Provider:bA,Resolver:jhe,StaticJsonRpcProvider:oZe,UrlJsonRpcProvider:f2,Web3Provider:H2e,WebSocketProvider:sz,getDefaultProvider:gZe,getNetwork:B2e,isCommunityResourcable:rZe,isCommunityResource:Whe,showThrottleMessage:MM},Symbol.toStringTag,{value:"Module"})),DBt="solidity/5.7.0",$Bt=new RegExp("^bytes([0-9]+)$"),kBt=new RegExp("^(u?int)([0-9]*)$"),BBt=new RegExp("^(.*)\\[([0-9]*)\\]$"),UBt="0000000000000000000000000000000000000000000000000000000000000000",gC=new Le(DBt);function mZe(e,t,r){switch(e){case"address":return r?VL(t,32):kt(t);case"string":return hl(t);case"bytes":return kt(t);case"bool":return t=t?"0x01":"0x00",r?VL(t,32):kt(t)}let n=e.match(kBt);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&gC.throwArgumentError("invalid number type","type",e),r&&(i=256),t=Ut.from(t).toTwos(i),VL(t,i/8)}if(n=e.match($Bt),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&gC.throwArgumentError("invalid bytes type","type",e),kt(t).byteLength!==i&&gC.throwArgumentError(`invalid value for ${e}`,"value",t),r?kt((t+UBt).substring(0,66)):t}if(n=e.match(BBt),n&&Array.isArray(t)){const i=n[1];parseInt(n[2]||String(t.length))!=t.length&&gC.throwArgumentError(`invalid array length for ${e}`,"value",t);const o=[];return t.forEach(function(s){o.push(mZe(i,s,!0))}),xo(o)}return gC.throwArgumentError("invalid type","type",e)}function G2e(e,t){e.length!=t.length&&gC.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach(function(n,i){r.push(mZe(n,t[i]))}),Kt(xo(r))}function FBt(e,t){return co(G2e(e,t))}function HBt(e,t){return Fy(G2e(e,t))}const GBt="units/5.7.0",yZe=new Le(GBt),EZe=["wei","kwei","mwei","gwei","szabo","finney","ether"];function VBt(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||e==="."||e==="-.")&&yZe.throwArgumentError("invalid value","value",e);let r=t[0],n="";for(r.substring(0,1)==="-"&&(n="-",r=r.substring(1));r.substring(0,1)==="0";)r=r.substring(1);r===""&&(r="0");let i="";for(t.length===2&&(i="."+(t[1]||"0"));i.length>2&&i[i.length-1]==="0";)i=i.substring(0,i.length-1);const a=[];for(;r.length;)if(r.length<=3){a.unshift(r);break}else{const o=r.length-3;a.unshift(r.substring(o)),r=r.substring(0,o)}return n+a.join(",")+i}function bZe(e,t){if(typeof t=="string"){const r=EZe.indexOf(t);r!==-1&&(t=3*r)}return dF(e,t??18)}function _Ze(e,t){if(typeof e!="string"&&yZe.throwArgumentError("value must be a string","value",e),typeof t=="string"){const r=EZe.indexOf(t);r!==-1&&(t=3*r)}return s1(e,t??18)}function SZe(e){return bZe(e,18)}function WBt(e){return _Ze(e,18)}const jBt=Object.freeze(Object.defineProperty({__proto__:null,AbiCoder:qXe,ConstructorFragment:Vp,ErrorFragment:py,EventFragment:_1,FormatTypes:ga,Fragment:L1,FunctionFragment:Wp,HDNode:ah,Indexed:bG,Interface:Ohe,LogDescription:oKe,Logger:Le,ParamType:Kl,RLP:$Pt,SigningKey:F3,get SupportedAlgorithm(){return gR},TransactionDescription:sKe,get TransactionTypes(){return $he},get UnicodeNormalizationForm(){return Sg},Utf8ErrorFuncs:zXe,get Utf8ErrorReason(){return pd},_TypedDataEncoder:zu,_fetchData:JKe,_toEscapedUtf8String:oMt,accessListify:b_,arrayify:kt,base58:vR,base64:AMt,checkProperties:p2e,checkResultErrors:LXe,commify:VBt,computeAddress:nb,computeHmac:P9,computePublicKey:O2e,concat:xo,deepCopy:Nf,defaultAbiCoder:XXe,defaultPath:mR,defineReadOnly:ot,dnsEncode:rKe,entropyToMnemonic:iz,fetchJson:Lx,formatBytes32String:sMt,formatEther:SZe,formatUnits:bZe,getAccountPath:wkt,getAddress:ya,getContractAddress:Kj,getCreate2Address:GPt,getIcapAddress:HPt,getJsonWalletAddress:Okt,getStatic:Ju,hashMessage:A2e,hexConcat:Af,hexDataLength:_g,hexDataSlice:ol,hexStripZeros:wXe,hexValue:OM,hexZeroPad:Oo,hexlify:Kt,id:ME,isAddress:FPt,isBytes:m_,isBytesLike:IM,isHexString:li,isValidMnemonic:Skt,isValidName:XMt,joinSignature:Rhe,keccak256:co,mnemonicToEntropy:nz,mnemonicToSeed:WKe,namehash:zL,nameprep:_Mt,parseBytes32String:lMt,parseEther:WBt,parseTransaction:DKe,parseUnits:_Ze,poll:p3,randomBytes:NC,recoverAddress:PM,recoverPublicKey:OKe,resolveProperties:Us,ripemd160:HKe,serializeTransaction:khe,sha256:Fy,sha512:hkt,shallowCopy:Uo,shuffled:jKe,solidityKeccak256:FBt,solidityPack:G2e,soliditySha256:HBt,splitSignature:mA,stripZeros:X1,toUtf8Bytes:hl,toUtf8CodePoints:yG,toUtf8String:EA,verifyMessage:Wkt,verifyTypedData:jkt,zeroPad:VL},Symbol.toStringTag,{value:"Module"})),wZe="ethers/5.7.2",zBt=new Le(wZe),YBt=Object.freeze(Object.defineProperty({__proto__:null,BaseContract:UKe,BigNumber:Ut,Contract:Bhe,ContractFactory:ckt,FixedNumber:pu,Signer:y_,VoidSigner:Qj,Wallet:Qw,Wordlist:Nx,constants:tMt,get errors(){return e0},getDefaultProvider:gZe,logger:zBt,providers:MBt,utils:jBt,version:wZe,wordlists:Uhe},Symbol.toStringTag,{value:"Module"}));try{const e=window;e._ethers==null&&(e._ethers=YBt)}catch{}const wa={WALLET_ID:"@w3m/wallet_id",ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3},hu={getCaipDefaultChain(e){if(e)return{id:`${Gr.EIP155}:${e.chainId}`,name:e.name,imageId:Tc.EIP155NetworkImageIds[e.chainId]}},hexStringToNumber(e){const t=e.startsWith("0x")?e.slice(2):e;return parseInt(t,16)},numberToHexString(e){return`0x${e.toString(16)}`},async getUserInfo(e){const[t,r]=await Promise.all([hu.getAddress(e),hu.getChainId(e)]);return{chainId:r,address:t}},async getChainId(e){const t=await e.request({method:"eth_chainId"});return Number(t)},async getAddress(e){const[t]=await e.request({method:"eth_accounts"});return t},async addEthereumChain(e,t){await e.request({method:"wallet_addEthereumChain",params:[{chainId:hu.numberToHexString(t.chainId),rpcUrls:[t.rpcUrl],chainName:t.name,nativeCurrency:{name:t.currency,decimals:18,symbol:t.currency},blockExplorerUrls:[t.explorerUrl],iconUrls:[Tc.EIP155NetworkImageIds[t.chainId]]}]})}},gc=qc({provider:void 0,providerType:void 0,address:void 0,chainId:void 0,isConnected:!1}),Pr={state:gc,subscribeKey(e,t){return F0(gc,e,t)},subscribe(e){return Cv(gc,()=>e(gc))},setProvider(e){e&&(gc.provider=G4(e))},setProviderType(e){gc.providerType=e},setAddress(e){gc.address=e},setChainId(e){gc.chainId=e},setIsConnected(e){gc.isConnected=e},setError(e){gc.error=e},reset(){gc.provider=void 0,gc.address=void 0,gc.chainId=void 0,gc.providerType=void 0,gc.isConnected=!1,gc.error=void 0}};class qBt extends fAt{constructor(t){const{ethersConfig:r,siweConfig:n,chains:i,defaultChain:a,tokens:o,chainImages:s,_sdkVersion:l,...u}=t;if(!r)throw new Error("web3modal:constructor - ethersConfig is undefined");if(!u.projectId)throw new Error("web3modal:constructor - projectId is undefined");const c={switchCaipNetwork:async d=>{const h=R$.caipNetworkIdToNumber(d==null?void 0:d.id);if(h)try{await this.switchNetwork(h)}catch(p){Pr.setError(p)}},getApprovedCaipNetworksData:async()=>new Promise(async d=>{var p,g,m,y;const h=localStorage.getItem(wa.WALLET_ID);if(h!=null&&h.includes(Gr.WALLET_CONNECT_CONNECTOR_ID)){const b=await this.getWalletConnectProvider();if(!b)throw new Error("networkControllerClient:getApprovedCaipNetworks - provider is undefined");const w=(g=(p=b.signer)==null?void 0:p.session)==null?void 0:g.namespaces,T=(m=w==null?void 0:w[Gr.EIP155])==null?void 0:m.methods,R=(y=w==null?void 0:w[Gr.EIP155])==null?void 0:y.chains,N={supportsAllNetworks:(T==null?void 0:T.includes(Gr.ADD_CHAIN_METHOD))??!1,approvedCaipNetworkIds:R};d(N)}else d({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},f={connectWalletConnect:async d=>{const h=await this.getWalletConnectProvider();if(!h)throw new Error("connectionControllerClient:getWalletConnectUri - provider is undefined");h.on("display_uri",p=>{d(p)}),await h.connect(),await this.setWalletConnectProvider()},connectExternal:async({id:d,info:h,provider:p})=>{if(d===Gr.INJECTED_CONNECTOR_ID){const g=r.injected;if(!g)throw new Error("connectionControllerClient:connectInjected - provider is undefined");try{await g.request({method:"eth_requestAccounts"}),this.setInjectedProvider(r)}catch(m){Pr.setError(m)}}else if(d===Gr.EIP6963_CONNECTOR_ID&&h&&p){try{await p.request({method:"eth_requestAccounts"})}catch(g){Pr.setError(g)}this.setEIP6963Provider(p,h.name)}else if(d===Gr.COINBASE_CONNECTOR_ID){const g=r.coinbase;if(!g)throw new Error("connectionControllerClient:connectCoinbase - connector is undefined");try{this.setCoinbaseProvider(r),await g.request({method:"eth_requestAccounts"})}catch(m){Pr.setError(m)}}},checkInstalled(d){return d?r.injected&&!(window!=null&&window.ethereum)?!1:d.some(h=>{var p;return!!((p=window.ethereum)!=null&&p[String(h)])}):!!window.ethereum},disconnect:async()=>{var p;const d=Pr.state.provider,h=Pr.state.providerType;localStorage.removeItem(wa.WALLET_ID),Pr.reset(),(p=n==null?void 0:n.options)!=null&&p.signOutOnDisconnect&&await n.signOut(),h===Gr.WALLET_CONNECT_CONNECTOR_ID?await d.disconnect():d&&d.emit("disconnect")},signMessage:async d=>{const h=Pr.state.provider;if(!h)throw new Error("connectionControllerClient:signMessage - provider is undefined");return await h.request({method:"personal_sign",params:[d,this.getAddress()]})}};super({networkControllerClient:c,connectionControllerClient:f,siweControllerClient:n,defaultChain:hu.getCaipDefaultChain(a),tokens:R$.getCaipTokens(o),_sdkVersion:l??`html-ethers5-${Gr.VERSION}`,...u}),this.hasSyncedConnectedAccount=!1,this.EIP6963Providers=[],this.options=void 0,this.options=t,this.metadata=r.metadata,this.projectId=u.projectId,this.chains=i,this.createProvider(),Pr.subscribeKey("address",()=>{this.syncAccount()}),Pr.subscribeKey("chainId",()=>{this.syncNetwork(s)}),this.syncRequestedNetworks(i,s),this.syncConnectors(r),r.EIP6963&&typeof window<"u"&&(this.listenConnectors(r.EIP6963),this.checkActive6963Provider()),r.injected&&this.checkActiveInjectedProvider(r),r.coinbase&&this.checkActiveCoinbaseProvider(r)}getState(){const t=super.getState();return{...t,selectedNetworkId:R$.caipNetworkIdToNumber(t.selectedNetworkId)}}subscribeState(t){return super.subscribeState(r=>t({...r,selectedNetworkId:R$.caipNetworkIdToNumber(r.selectedNetworkId)}))}setAddress(t){const r=t?ya(t):void 0;Pr.setAddress(r)}getAddress(){const{address:t}=Pr.state;return t&&ya(t)}getError(){return Pr.state.error}getChainId(){return Pr.state.chainId}getIsConnected(){return Pr.state.isConnected}getWalletProvider(){return Pr.state.provider}getWalletProviderType(){return Pr.state.providerType}subscribeProvider(t){return Pr.subscribe(t)}async disconnect(){const{provider:t,providerType:r}=Pr.state;localStorage.removeItem(wa.WALLET_ID),Pr.reset(),r==="injected"||r==="eip6963"?t==null||t.emit("disconnect"):await t.disconnect()}createProvider(){return!this.walletConnectProviderInitPromise&&typeof window<"u"&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider()),this.walletConnectProviderInitPromise}async initWalletConnectProvider(){const t={projectId:this.projectId,showQrModal:!1,rpcMap:this.chains?this.chains.reduce((r,n)=>(r[n.chainId]=n.rpcUrl,r),{}):{},optionalChains:[...this.chains.map(r=>r.chainId)],metadata:{name:this.metadata?this.metadata.name:"",description:this.metadata?this.metadata.description:"",url:this.metadata?this.metadata.url:"",icons:this.metadata?this.metadata.icons:[""]}};this.walletConnectProvider=await pPt.init(t),await this.checkActiveWalletConnectProvider()}async getWalletConnectProvider(){if(!this.walletConnectProvider)try{await this.createProvider()}catch(t){Pr.setError(t)}return this.walletConnectProvider}syncRequestedNetworks(t,r){const n=t==null?void 0:t.map(i=>({id:`${Gr.EIP155}:${i.chainId}`,name:i.name,imageId:Tc.EIP155NetworkImageIds[i.chainId],imageUrl:r==null?void 0:r[i.chainId]}));this.setRequestedCaipNetworks(n??[])}async checkActiveWalletConnectProvider(){const t=await this.getWalletConnectProvider(),r=localStorage.getItem(wa.WALLET_ID);t&&r===Gr.WALLET_CONNECT_CONNECTOR_ID&&await this.setWalletConnectProvider()}checkActiveInjectedProvider(t){const r=t.injected,n=localStorage.getItem(wa.WALLET_ID);r&&n===Gr.INJECTED_CONNECTOR_ID&&(this.setInjectedProvider(t),this.watchInjected(t))}checkActiveCoinbaseProvider(t){var i;const r=t.coinbase,n=localStorage.getItem(wa.WALLET_ID);r&&n===Gr.COINBASE_CONNECTOR_ID&&(r._addresses&&((i=r._addresses)==null?void 0:i.length)>0?(this.setCoinbaseProvider(t),this.watchCoinbase(t)):(localStorage.removeItem(wa.WALLET_ID),Pr.reset()))}checkActive6963Provider(){const t=window==null?void 0:window.localStorage.getItem(wa.WALLET_ID);if(t){const r=this.EIP6963Providers.find(n=>n.name===t);r&&this.setEIP6963Provider(r.provider,r.name)}}async setWalletConnectProvider(){var r;window==null||window.localStorage.setItem(wa.WALLET_ID,Gr.WALLET_CONNECT_CONNECTOR_ID);const t=await this.getWalletConnectProvider();t&&(Pr.setChainId(t.chainId),Pr.setProviderType("walletConnect"),Pr.setProvider(t),Pr.setIsConnected(!0),this.setAddress((r=t.accounts)==null?void 0:r[0]),this.watchWalletConnect())}async setInjectedProvider(t){window==null||window.localStorage.setItem(wa.WALLET_ID,Gr.INJECTED_CONNECTOR_ID);const r=t.injected;if(r){const{address:n,chainId:i}=await hu.getUserInfo(r);n&&i&&(Pr.setChainId(i),Pr.setProviderType("injected"),Pr.setProvider(t.injected),Pr.setIsConnected(!0),this.setAddress(n),this.watchCoinbase(t))}}async setEIP6963Provider(t,r){if(window==null||window.localStorage.setItem(wa.WALLET_ID,r),t){const{address:n,chainId:i}=await hu.getUserInfo(t);n&&i&&(Pr.setChainId(i),Pr.setProviderType("eip6963"),Pr.setProvider(t),Pr.setIsConnected(!0),this.setAddress(n),this.watchEIP6963(t))}}async setCoinbaseProvider(t){window==null||window.localStorage.setItem(wa.WALLET_ID,Gr.COINBASE_CONNECTOR_ID);const r=t.coinbase;if(r){const{address:n,chainId:i}=await hu.getUserInfo(r);n&&i&&(Pr.setChainId(i),Pr.setProviderType("coinbaseWallet"),Pr.setProvider(t.coinbase),Pr.setIsConnected(!0),this.setAddress(n),this.watchCoinbase(t))}}async watchWalletConnect(){const t=await this.getWalletConnectProvider();function r(){localStorage.removeItem(wa.WALLET_ID),Pr.reset(),t==null||t.removeListener("disconnect",r),t==null||t.removeListener("accountsChanged",i),t==null||t.removeListener("chainChanged",n)}function n(a){if(a){const o=hu.hexStringToNumber(a);Pr.setChainId(o)}}const i=async a=>{a.length>0&&await this.setWalletConnectProvider()};t&&(t.on("disconnect",r),t.on("accountsChanged",i),t.on("chainChanged",n))}watchInjected(t){const r=t.injected;function n(){localStorage.removeItem(wa.WALLET_ID),Pr.reset(),r==null||r.removeListener("disconnect",n),r==null||r.removeListener("accountsChanged",i),r==null||r.removeListener("chainChanged",a)}function i(o){const s=o==null?void 0:o[0];s?Pr.setAddress(ya(s)):(localStorage.removeItem(wa.WALLET_ID),Pr.reset())}function a(o){if(o){const s=typeof o=="string"?hu.hexStringToNumber(o):Number(o);Pr.setChainId(s)}}r&&(r.on("disconnect",n),r.on("accountsChanged",i),r.on("chainChanged",a))}watchEIP6963(t){function r(){localStorage.removeItem(wa.WALLET_ID),Pr.reset(),t.removeListener("disconnect",r),t.removeListener("accountsChanged",n),t.removeListener("chainChanged",i)}function n(a){const o=a==null?void 0:a[0];o?Pr.setAddress(ya(o)):(localStorage.removeItem(wa.WALLET_ID),Pr.reset())}function i(a){if(a){const o=typeof a=="string"?hu.hexStringToNumber(a):Number(a);Pr.setChainId(o)}}t.on("disconnect",r),t.on("accountsChanged",n),t.on("chainChanged",i)}watchCoinbase(t){const r=t.coinbase,n=localStorage.getItem(wa.WALLET_ID);function i(){localStorage.removeItem(wa.WALLET_ID),Pr.reset(),r==null||r.removeListener("disconnect",i),r==null||r.removeListener("accountsChanged",a),r==null||r.removeListener("chainChanged",o)}function a(s){s.length===0?(localStorage.removeItem(wa.WALLET_ID),Pr.reset()):Pr.setAddress(s[0])}function o(s){if(s&&n===Gr.COINBASE_CONNECTOR_ID){const l=Number(s);Pr.setChainId(l)}}r&&(r.on("disconnect",i),r.on("accountsChanged",a),r.on("chainChanged",o))}async syncAccount(){const t=Pr.state.address,r=Pr.state.chainId,n=Pr.state.isConnected;if(this.resetAccount(),n&&t&&r){const i=`${Gr.EIP155}:${r}:${t}`;this.setIsConnected(n),this.setCaipAddress(i),await Promise.all([this.syncProfile(t),this.syncBalance(t),this.getApprovedCaipNetworksData()]),this.hasSyncedConnectedAccount=!0}else!n&&this.hasSyncedConnectedAccount&&(this.resetWcConnection(),this.resetNetwork())}async syncNetwork(t){const r=Pr.state.address,n=Pr.state.chainId,i=Pr.state.isConnected;if(this.chains){const a=this.chains.find(o=>o.chainId===n);if(a){const o=`${Gr.EIP155}:${a.chainId}`;if(this.setCaipNetwork({id:o,name:a.name,imageId:Tc.EIP155NetworkImageIds[a.chainId],imageUrl:t==null?void 0:t[a.chainId]}),i&&r){const s=`${Gr.EIP155}:${n}:${r}`;if(this.setCaipAddress(s),a.explorerUrl){const l=`${a.explorerUrl}/address/${r}`;this.setAddressExplorerUrl(l)}else this.setAddressExplorerUrl(void 0);this.hasSyncedConnectedAccount&&await this.syncBalance(r)}}}}async syncProfile(t){if(Pr.state.chainId===1){const n=new lz("mainnet"),i=await n.lookupAddress(t),a=await n.getAvatar(t);i&&this.setProfileName(i),a&&this.setProfileImage(a)}else this.setProfileName(null),this.setProfileImage(null)}async syncBalance(t){const r=Pr.state.chainId;if(r&&this.chains){const n=this.chains.find(i=>i.chainId===r);if(n){const i=new Pb(n.rpcUrl,{chainId:r,name:n.name});if(i){const a=await i.getBalance(t),o=SZe(a);this.setBalance(o,n.currency)}}}}async switchNetwork(t){var i,a,o,s,l,u,c,f;const r=Pr.state.provider,n=Pr.state.providerType;if(this.chains){const d=this.chains.find(h=>h.chainId===t);if(n===Gr.WALLET_CONNECT_CONNECTOR_ID&&d){const h=r;if(h)try{await h.request({method:"wallet_switchEthereumChain",params:[{chainId:hu.numberToHexString(d.chainId)}]}),Pr.setChainId(t)}catch(p){if(p.code===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||p.code===wa.ERROR_CODE_DEFAULT||((a=(i=p==null?void 0:p.data)==null?void 0:i.originalError)==null?void 0:a.code)===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await hu.addEthereumChain(h,d);else throw new Error("Chain is not supported")}}else if(n===Gr.INJECTED_CONNECTOR_ID&&d){const h=r;if(h)try{await h.request({method:"wallet_switchEthereumChain",params:[{chainId:hu.numberToHexString(d.chainId)}]}),Pr.setChainId(d.chainId)}catch(p){if(p.code===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||p.code===wa.ERROR_CODE_DEFAULT||((s=(o=p==null?void 0:p.data)==null?void 0:o.originalError)==null?void 0:s.code)===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await hu.addEthereumChain(h,d);else throw new Error("Chain is not supported")}}else if(n===Gr.EIP6963_CONNECTOR_ID&&d){const h=r;if(h)try{await h.request({method:"wallet_switchEthereumChain",params:[{chainId:hu.numberToHexString(d.chainId)}]}),Pr.setChainId(d.chainId)}catch(p){if(p.code===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||p.code===wa.ERROR_CODE_DEFAULT||((u=(l=p==null?void 0:p.data)==null?void 0:l.originalError)==null?void 0:u.code)===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await hu.addEthereumChain(h,d);else throw new Error("Chain is not supported")}}else if(n===Gr.COINBASE_CONNECTOR_ID&&d){const h=r;if(h)try{await h.request({method:"wallet_switchEthereumChain",params:[{chainId:hu.numberToHexString(d.chainId)}]}),Pr.setChainId(d.chainId)}catch(p){(p.code===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||p.code===wa.ERROR_CODE_DEFAULT||((f=(c=p==null?void 0:p.data)==null?void 0:c.originalError)==null?void 0:f.code)===wa.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)&&await hu.addEthereumChain(h,d)}}}}syncConnectors(t){var i,a,o,s,l,u;const r=[],n=Tc.ConnectorTypesMap[Gr.WALLET_CONNECT_CONNECTOR_ID];if(r.push({id:Gr.WALLET_CONNECT_CONNECTOR_ID,explorerId:Tc.ConnectorExplorerIds[Gr.WALLET_CONNECT_CONNECTOR_ID],imageId:Tc.ConnectorImageIds[Gr.WALLET_CONNECT_CONNECTOR_ID],imageUrl:(a=(i=this.options)==null?void 0:i.connectorImages)==null?void 0:a[Gr.WALLET_CONNECT_CONNECTOR_ID],name:Tc.ConnectorNamesMap[Gr.WALLET_CONNECT_CONNECTOR_ID],type:n}),t.injected){const c=Tc.ConnectorTypesMap[Gr.INJECTED_CONNECTOR_ID];r.push({id:Gr.INJECTED_CONNECTOR_ID,explorerId:Tc.ConnectorExplorerIds[Gr.INJECTED_CONNECTOR_ID],imageId:Tc.ConnectorImageIds[Gr.INJECTED_CONNECTOR_ID],imageUrl:(s=(o=this.options)==null?void 0:o.connectorImages)==null?void 0:s[Gr.INJECTED_CONNECTOR_ID],name:Tc.ConnectorNamesMap[Gr.INJECTED_CONNECTOR_ID],type:c})}t.coinbase&&r.push({id:Gr.COINBASE_CONNECTOR_ID,explorerId:Tc.ConnectorExplorerIds[Gr.COINBASE_CONNECTOR_ID],imageId:Tc.ConnectorImageIds[Gr.COINBASE_CONNECTOR_ID],imageUrl:(u=(l=this.options)==null?void 0:l.connectorImages)==null?void 0:u[Gr.COINBASE_CONNECTOR_ID],name:Tc.ConnectorNamesMap[Gr.COINBASE_CONNECTOR_ID],type:"EXTERNAL"}),this.setConnectors(r)}eip6963EventHandler(t){var r,n;if(t.detail){const{info:i,provider:a}=t.detail;if(!this.getConnectors().find(l=>l.name===i.name)){const l=Tc.ConnectorTypesMap[Gr.EIP6963_CONNECTOR_ID];{this.addConnector({id:Gr.EIP6963_CONNECTOR_ID,type:l,imageUrl:i.icon??((n=(r=this.options)==null?void 0:r.connectorImages)==null?void 0:n[Gr.EIP6963_CONNECTOR_ID]),name:i.name,provider:a,info:i});const u={name:i.name,provider:a};this.EIP6963Providers.push(u)}}}}listenConnectors(t){if(typeof window<"u"&&t){const r=this.eip6963EventHandler.bind(this);window.addEventListener(Gr.EIP6963_ANNOUNCE_EVENT,r),window.dispatchEvent(new Event(Gr.EIP6963_REQUEST_EVENT))}}}let sE;function XBt(e){e&&(sE=e)}function rri(){if(!sE)throw new Error('Please call "createWeb3Modal" before using "useWeb3Modal" hook');async function e(r){await(sE==null?void 0:sE.open(r))}async function t(){await(sE==null?void 0:sE.close())}return{open:e,close:t}}var Px={},uz={};uz.byteLength=QBt;uz.toByteArray=eUt;uz.fromByteArray=nUt;var S1=[],Xh=[],KBt=typeof Uint8Array<"u"?Uint8Array:Array,qie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var d5=0,ZBt=qie.length;d5<ZBt;++d5)S1[d5]=qie[d5],Xh[qie.charCodeAt(d5)]=d5;Xh["-".charCodeAt(0)]=62;Xh["_".charCodeAt(0)]=63;function TZe(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function QBt(e){var t=TZe(e),r=t[0],n=t[1];return(r+n)*3/4-n}function JBt(e,t,r){return(t+r)*3/4-r}function eUt(e){var t,r=TZe(e),n=r[0],i=r[1],a=new KBt(JBt(e,n,i)),o=0,s=i>0?n-4:n,l;for(l=0;l<s;l+=4)t=Xh[e.charCodeAt(l)]<<18|Xh[e.charCodeAt(l+1)]<<12|Xh[e.charCodeAt(l+2)]<<6|Xh[e.charCodeAt(l+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=Xh[e.charCodeAt(l)]<<2|Xh[e.charCodeAt(l+1)]>>4,a[o++]=t&255),i===1&&(t=Xh[e.charCodeAt(l)]<<10|Xh[e.charCodeAt(l+1)]<<4|Xh[e.charCodeAt(l+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function tUt(e){return S1[e>>18&63]+S1[e>>12&63]+S1[e>>6&63]+S1[e&63]}function rUt(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(tUt(n));return i.join("")}function nUt(e){for(var t,r=e.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(rUt(e,o,o+a>s?s:o+a));return n===1?(t=e[r-1],i.push(S1[t>>2]+S1[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(S1[t>>10]+S1[t>>4&63]+S1[t<<2&63]+"=")),i.join("")}var V2e={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */V2e.read=function(e,t,r,n,i){var a,o,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,a=h&(1<<-c)-1,h>>=-c,c+=s;c>0;a=a*256+e[t+f],f+=d,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=o*256+e[t+f],f+=d,c-=8);if(a===0)a=1-u;else{if(a===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-u}return(h?-1:1)*o*Math.pow(2,a-n)};V2e.write=function(e,t,r,n,i,a){var o,s,l,u=a*8-i-1,c=(1<<u)-1,f=c>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,p=n?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?t+=d/l:t+=d*Math.pow(2,1-f),t*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*l-1)*Math.pow(2,i),o=o+f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+h]=s&255,h+=p,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+h]=o&255,h+=p,o/=256,u-=8);e[r+h-p]|=g*128};/*!
|
|
@@ -18379,7 +18379,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
18379
18379
|
* LICENSE file in the root directory of this source tree.
|
|
18380
18380
|
*/var wX=se,pvn=hvn;function vvn(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gvn=typeof Object.is=="function"?Object.is:vvn,mvn=pvn.useSyncExternalStore,yvn=wX.useRef,Evn=wX.useEffect,bvn=wX.useMemo,_vn=wX.useDebugValue;Pct.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var a=yvn(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=bvn(function(){function l(h){if(!u){if(u=!0,c=h,h=n(h),i!==void 0&&o.hasValue){var p=o.value;if(i(p,h))return f=p}return f=h}if(p=f,gvn(c,h))return p;var g=n(h);return i!==void 0&&i(p,g)?(c=h,p):(c=h,f=g)}var u=!1,c,f,d=r===void 0?null:r;return[function(){return l(t())},d===null?void 0:function(){return l(d())}]},[t,r,n,i]);var s=mvn(e,a[0],a[1]);return Evn(function(){o.hasValue=!0,o.value=s},[s]),_vn(s),s};Lct.exports=Pct;var Svn=Lct.exports;const wvn=Nn(Svn),{useDebugValue:Tvn}=fn,{useSyncExternalStoreWithSelector:Avn}=wvn;const Cvn=e=>e;function Rvn(e,t=Cvn,r){const n=Avn(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Tvn(n),n}const vDe=e=>{const t=typeof e=="function"?nvn(e):e,r=(n,i)=>Rvn(t,n,i);return Object.assign(r,t),r},XSe=e=>e?vDe(e):vDe;var M_=e=>XSe(e);const xvn={toaster:{},tags:[],tagsListLoading:!1,queriesResult:{},authCode:"",accessTokenExpires:"",walletAddress:"",isLoggedIn:!1,schemaExpansions:{expanded:{[Jo.sxtDatasets]:!0}},datasetData:[],userDetail:{},chains:{},biscuitList:[],subscriptionDetail:{},showLoginDrawer:!1,showLoginDrawerWalletOpen:!1,showTrialExpiredModal:!1,LoginDrawerTab:v4.permissionSecret,biscuitsLoading:!1,accessToken:"",refreshToken:"",isRefreshLoading:!1,keySharing:"",subscriptionUserList:{loading:!1,list:{}},userResources:{loading:!1,resources:{}},biscuitResources:{loading:!1,resources:{}},selectedTableHighlighter:{},toggleERDTable:{},ERDNodeOpacity:{},tableInfoPanelId:"",tokenLastUpdatedOn:"",amazonCustomerInfo:{CustomerAWSAccountId:"",CustomerIdentifier:"",ProductCode:""},amazonFormFields:{"co-name":"","co-hq":"","co-url":"","usr-name":"","usr-email":"","usr2-name":"","usr2-email":"","usr-addr":"","usr-billaddr":"",isEmailvalidate:!0,isUrlvalidate:!0,isEmailvalidateOptional:!0},apiKeysList:[],apiKeysLoading:!1,userDataUsage:{loading:!1,data:{}},userSubscriptionDataUsage:{loading:!1,data:{}},memberDataUsage:{loading:!1,data:{}},loadingUsage:!1,canUpdateUserId:!1,productCampaignDetails:{},keychainDetails:{keychain:[]},isAuthLoading:!1,isEmptyVizClicked:!1,subscriptionCount:{defaultQueriesCount:0,freeQueriesCount:0},paymentConfigData:{},isCurrentPointsResponseLoading:!1,isHistoricalPointsResponseLoading:!1,isBalanceHistoryLoading:!1,isZealyPointsLoading:!1,isCurrentTokenBalanceLoading:!1,currentWallet:"",apiHistory:[],balanceHistory:[],pointsHistory:[],currentPoints:0,zealyPointsValue:{},cumulativeDeposits:{},currentTokenBalance:{tokens:{}},showProfileModal:!1,showBiscuitsModal:!1},Qi=M_(()=>({...xvn}));function coi(){return Qi(e=>e.toaster)}function foi(){return Qi(e=>e.tags)}function doi(){return Qi(e=>e.showBiscuitsModal)}function hoi(e){return Qi(t=>t.queriesResult[e]||{})}function poi(){return Qi(e=>e.schemaExpansions)}function voi(){return Qi(e=>e.userDetail)}function goi(){return Qi(e=>e.datasetData)}function moi(){return Qi(e=>e.biscuitList)}function yoi(){return Qi(e=>e.subscriptionDetail)}function Ivn(){return Qi(e=>e.showLoginDrawer)}function Eoi(){return Qi(e=>e.showTrialExpiredModal)}function boi(){return Qi(e=>e.paymentConfigData)}function _oi(){return Qi(e=>e.biscuitsLoading)}function Soi(){return Qi(e=>e.keySharing)}function woi(){return Qi(e=>e.subscriptionUserList)}function Toi(){return Qi(e=>e.userResources)}function Aoi(){return Qi(e=>e.biscuitResources)}function Coi(){return Qi(e=>e.selectedTableHighlighter)}function Roi(e){return Qi(t=>t.toggleERDTable[e]||!1)}function xoi(e){return Qi(t=>t.ERDNodeOpacity[e]||!1)}function Ioi(){return Qi(e=>e.tableInfoPanelId)}function Ooi(){return Qi(e=>e.amazonFormFields)}function Noi(){return Qi(e=>e.apiKeysList)}function Loi(){return Qi(e=>e.apiKeysLoading)}function Poi(){return Qi(e=>e.userDataUsage)}function Moi(){return Qi(e=>e.memberDataUsage)}function Doi(){return Qi(e=>e.userSubscriptionDataUsage)}function $oi(){return Qi(e=>e.loadingUsage)}function koi(){return Qi(e=>e.productCampaignDetails)}function Boi(){return Qi(e=>e.isAuthLoading)}function Uoi(){return Qi(e=>e.isEmptyVizClicked)}function Foi(){return Qi(e=>e.subscriptionCount)}function $ct(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var a;const o=l=>l===null?null:JSON.parse(l,t==null?void 0:t.reviver),s=(a=r.getItem(i))!=null?a:null;return s instanceof Promise?s.then(o):o(s)},setItem:(i,a)=>r.setItem(i,JSON.stringify(a,t==null?void 0:t.replacer)),removeItem:i=>r.removeItem(i)}}const oP=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return oP(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return oP(n)(r)}}}},Ovn=(e,t)=>(r,n,i)=>{let a={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:m=>m,version:0,merge:(m,y)=>({...y,...m}),...t},o=!1;const s=new Set,l=new Set;let u;try{u=a.getStorage()}catch{}if(!u)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...m)},n,i);const c=oP(a.serialize),f=()=>{const m=a.partialize({...n()});let y;const b=c({state:m,version:a.version}).then(w=>u.setItem(a.name,w)).catch(w=>{y=w});if(y)throw y;return b},d=i.setState;i.setState=(m,y)=>{d(m,y),f()};const h=e((...m)=>{r(...m),f()},n,i);let p;const g=()=>{var m;if(!u)return;o=!1,s.forEach(b=>b(n()));const y=((m=a.onRehydrateStorage)==null?void 0:m.call(a,n()))||void 0;return oP(u.getItem.bind(u))(a.name).then(b=>{if(b)return a.deserialize(b)}).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==a.version){if(a.migrate)return a.migrate(b.state,b.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return b.state}).then(b=>{var w;return p=a.merge(b,(w=n())!=null?w:h),r(p,!0),f()}).then(()=>{y==null||y(p,void 0),o=!0,l.forEach(b=>b(p))}).catch(b=>{y==null||y(void 0,b)})};return i.persist={setOptions:m=>{a={...a,...m},m.getStorage&&(u=m.getStorage())},clearStorage:()=>{u==null||u.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>g(),hasHydrated:()=>o,onHydrate:m=>(s.add(m),()=>{s.delete(m)}),onFinishHydration:m=>(l.add(m),()=>{l.delete(m)})},g(),p||h},Nvn=(e,t)=>(r,n,i)=>{let a={storage:$ct(()=>localStorage),partialize:g=>g,version:0,merge:(g,m)=>({...m,...g}),...t},o=!1;const s=new Set,l=new Set;let u=a.storage;if(!u)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...g)},n,i);const c=()=>{const g=a.partialize({...n()});return u.setItem(a.name,{state:g,version:a.version})},f=i.setState;i.setState=(g,m)=>{f(g,m),c()};const d=e((...g)=>{r(...g),c()},n,i);i.getInitialState=()=>d;let h;const p=()=>{var g,m;if(!u)return;o=!1,s.forEach(b=>{var w;return b((w=n())!=null?w:d)});const y=((m=a.onRehydrateStorage)==null?void 0:m.call(a,(g=n())!=null?g:d))||void 0;return oP(u.getItem.bind(u))(a.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==a.version){if(a.migrate)return[!0,a.migrate(b.state,b.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var w;const[T,R]=b;if(h=a.merge(R,(w=n())!=null?w:d),r(h,!0),T)return c()}).then(()=>{y==null||y(h,void 0),h=n(),o=!0,l.forEach(b=>b(h))}).catch(b=>{y==null||y(void 0,b)})};return i.persist={setOptions:g=>{a={...a,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u==null||u.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>p(),hasHydrated:()=>o,onHydrate:g=>(s.add(g),()=>{s.delete(g)}),onFinishHydration:g=>(l.add(g),()=>{l.delete(g)})},a.skipHydration||p(),h||d},Lvn=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?Ovn(e,t):Nvn(e,t),Pvn=Lvn,ro=XSe()(Pvn((e,t)=>({_hasHydrated:!1,setHasHydrated:r=>e({_hasHydrated:r}),isLoggedIn:!1,userId:null,walletName:null,walletAddress:null,setIsLoggedIn:r=>e({isLoggedIn:r}),setUserId:r=>e({userId:r}),setWalletName:r=>e({walletName:r}),setWalletAddress:r=>e({walletAddress:r}),resetStore:()=>{e({isLoggedIn:!1,userId:null,walletName:null,walletAddress:null})}}),{name:"auth-store",storage:$ct(()=>localStorage),onRehydrateStorage:()=>(e,t)=>{t&&console.error(`Failure to hydrate auth store: ${t}`),e==null||e.setHasHydrated(!0)}})),Hoi={CRON_EXPRESSION_ERROR:"Please Enter Cron Expression",INVALID_CRON_EXPRESSION:"Please Enter a Valid Cron Expression",ENTER_CRON_EXPRESSION:"Please Enter a Cron Expression",CONNECTED_TO:e=>`Connected to ${e} network`,SOMETHING_WENT_WRONG:"Something went wrong! try again later",UNABLE_TO_CREATE_SUBSCRIPTION:"Unable to create subscription. Please try again later",DELETE:"Delete",FUND:"Fund",ADD_CONSUMER:"Add Consumer",ADD_FUND:"Add Fund",EDIT:"Edit",CANCEL:"Cancel",CANCEL_SUBSRIPTION:"Cancel Subscription",SUBSCRIPTION_ID:"SubscriptionId (unit64)",CONSUMER_ADDRESS:"Consumer (address)",WRITE:"Write",CREATE:"Create",CHAINLINK_SUBSCRIPTIONS_TITLE:"Chainlink Subscriptions",OWNER_ADDRESS:"Owner Address",BACK:"Back",TO_ADDRESS:"to (address)",SCHEDULE_JOB:"Schedule your job",EXAMPLE_OPTIONS:"Example options:",ORACLE_JOB_CREATED:"Oracle Job Created",FUND_ADDED:"Fund Added",ORACLE_JOB_PAUSED:"Oracle Job Paused",ORACLE_JOB_CANCELLED:"Oracle Job Cancelled",ORACLE_JOB_RESUME:"Oracle Job Resumed",ORACLE_JOB_UPDATED:"Oracle Job Updated",LINK:"Link",MY_SAVED_ORACLE_JOBS:"My Saved Oracle Jobs",REFRESH:"Refresh",POLYGON:"Polygon",ETHEREUM:"Ethereum",SEPOLIA:"Sepolia",MUMBAI:"Mumbai",PLEASE_ENTER_FUND_AMOUNT:"Please enter fund amount",PLEASE_ENTER_CONSUMER_ADDRESS:"Please enter consumer address",PLEASE_ENTER_VALID_CONSUMER_ADDRESS:"Please enter a valid consumer address",CRON_EXPRESSION_PLACEHOLDER:"*/15 * * * *",EVERY_15:"Every 15 minutes",EVERY_HOUR:"Every hour",EVERY_MONTH:"First of every month",EVERY_WEEKDAY:"30 minutes past every two hours on every weekday",MON_WED_FRI:"Monday, Wednesday, Friday at 8:00 and 16:00",EVERY_15_VALUE:"*/15 * * * *",EVERY_HOUR_VALUE:"0 * * * *",EVERY_MONTH_VALUE:"0 0 1 * *",EVERY_WEEKDAY_VALUE:"30 */2 * * 1-5",MON_WED_FRI_VALUE:"0 8,16 * * 1,3,5",WHAT_IS_CRON_EXPRESSION:"What is a CRON expression?",CRON_DESCRIPTION:"The CRON expression is a shorthand way to create a time schedule. Use the provided example buttons to experiment with different schedules and then create your own.",ACCORDING_TO_FORMAT:"Cron schedules are interpreted according to this format:",MINUTE:"minute (0 - 59)",HOUR:"hour (0 - 23)",DAY_OF_MONTH:"day of the month (1 - 31)",MONTHS:"month (1 - 12)",DAY_OF_WEEK:"day of the week (0 - 6) (Sunday to Saturday)",ALL_TIME:"All times are in UTC",RANGE_EXP:'- can be used for range e.g. "0 8-16 *"',INTERVAL_EXP:'/ can be used for interval e.g. "0 /2"',LIST_EXP:'can be used for list e.g. "0 17 0,2,4"',SPECIAL_LIMIT:"Special limitations:",NO_SPECIAL_CHAR:"no special characters: ? L W # lists can",MAX_LENGTH_WORDS:"have a max length of 26 no words",ENTER_FUND_AMOUNT_ERROR_MSG:"Please enter a fund amount",SELECT_NETWORK:"Select Network",SEPOLIA_FUND_PLACEHOLDER:"1.7",MUMBAI_FUND_PLACEHOLDER:"0.5",SHOW_MY_QUERIES:"Show My Queries",NEW_QUERY:"New Query",MY_QUERIES:"My Saved Queries",QUERY:"Query",RUN_VIEW_REQUEST:"runViewRequest",VIEW_NAME:"View Name",NFT_BALANCE:"NFT-balance",JOB_ID:"Job ID",RESOURCE_ID:"Resource ID",FUNCTION_NAME:"Function Name",RUN_QUERY_REQUEST:"runQueryRequest",BINANCE:"Binance",REMOVE_CONSUMER:"Remove Consumer",SELECT_CONSUMER_ADDRESS:"Select Consumer Address",VIEW:"view",QUERY_BODY:"query",PLEASE_CONFIRM_LINK_TRANSFER_TRANSACTION:"Please confirm LINK transfer transaction",PLEASE_WAIT_FOR_TRANSACTION_CONFIRMATION:"Please wait until the transfer is confirmed",VIEW_YOUR_TRANSACTION_HERE:"View your transaction here",CONFIRM_LINK_TRANSFER:"Confirm LINK transfer",WAITING_FOR_CONFIRMATION:"Waiting for Confirmation",SUBSCRIPTION_CREATED_SUCCESSFULLY:"Subscription Created Successfully",SUBSCRIPTION_DELETED_SUCCESSFULLY:"Subscription Deleted Successfully",FUND_ADDED_SUCCESSFULLY:"Fund Added Successfully",CONSUMER_ADDED_SUCCESSFULLY:"Consumer Added Successfully",CONSUMER_REMOVED_SUCCESSFULLY:"Consumer Removed Successfully",TRANSACTION_REJECTED:"Transaction Rejected",STATUS_CODE_400:400,STATUS_CODE_4001:4001,STATUS_CODE_4902:4902,STATUS_CODE_200:200,STATUS_CODE_201:201,STATUS_CODE_204:204,CONFIRM_CREATE_SUBSCRIPTION:"Confirm Create New Subscription",UPKEEP_ID:"The upkeep id",IS:"is",PLEASE_ENTER_VALID_AMOUNT:"Please enter valid amount",PLEASE_SELECT_CONSUMER_ADDRESS:"Please select consumer address",OPTIMIZE_GAS_HEADING:"Optimize Gas (Choose Datatype)",PIPE_ADDED__FOR_STRING_AND_BYTE:'a "|" (pipe) was added to your payload to ensure comma separation',PLEASE_SELECT_NETWORK:"Please select network",ADD_FUND_ORACLE_JOB_DESCRIPTION:"To ensure uninterrupted operation of your oracle jobs, please make sure to add LINK tokens",WALLET_NOT_WHITELISTED:"Wallet not Whitelisted",WALLET_NOT_WHITELISTED_SUBTITLE:"Your wallet is not whitelisted to use Chainlink functions subscription. ",WALLET_NOT_WHITELISTED_SUBTITLE_2:" to get the beta access of the Chainlink functions.",CHECK_WALLET_WHITELIST:"Check Wallet Whitelist",BETA_ACCESS_LINK:"Beta Access Link",BETA_ACCESS_URL:"https://chainlinkcommunity.typeform.com/requestaccess?typeform-source=chain.link",CHECK_WALLET_WHITELIST_SUBTITLE:"Please wait while we are checking if your wallet is whitelisted for chainlink functions subscription or not",OPTIMIZE_GAS_INFO_TEXT:"We only send the first row data to chain from the query results retrieved to keep the gas fee minimal.",QUERY_EDITOR_HEAD_TEXT:"Query result to send to your contract"},Goi={list:"list",editor:"editor"},Voi={MAX_STRING2D_BUFFER_SIZE:256,MAX_STRING_BUFFER_SIZE:256,MAX_UINT_VALUE:1157e74},Woi={uint256:{key:"uint256",message:"Concatenate to Integer (Max Length: 32 bytes)",label:"Integer"},bytes:{key:"bytes",message:"Concatenate to Bytes (Max Length: 256 bytes)",label:"Bytes"},string:{key:"string",message:"Concatenate to String (Max Length: 256 bytes)",label:"String"}},Mvn={loading:{},dashboardId:null,selectedDashboardDetails:null,dashboardDetail:null,queriesResult:{},layoutStateIndex:0,dashboardViewLoading:!1,layouts:[],layoutStates:[],savedLayouts:[],dragItem:null,breakPoint:"md",loadLayout:!1,infoView:!1,imgMetadata:{imgUrl:"",useImgColors:!1,chartColors:[],chartBackground:[],titleColor:""},queryError:"",isRunning:!1,durationMs:"",queryResult:"",toggleVisTable:Fc.table,isOfficialDashboard:!1,isChatGPTLoading:!1,chatGPTResult:"",chatGPTError:"",saveSuggestedQuery:{queryText:"",resourceId:"",queryId:""},isWidgetConfigSet:!1,chatGptPrompt:"",isChartAddedToDash:[],isCounterAddedToDash:[],dashboardDetailLoading:!1,dashboardVisualsContent:[],dashboardAllVisualsLoading:!1,dashboardVisualLoading:!1,dashboardDetailError:void 0,dashboardDetailStatus:void 0,dashboardLoader:!1,dashDqlRunCount:0,chatGPTContext:"",widgetsDashLoader:!1,isErrOpen:!1,isEmptyRowCount:!1,isSetAsHome:{},slugName:"",isVisibilitySet:!1,slugNameError:"",isTableAddedToDash:!1,isUnsavedChangesDash:!1,visibility:"",isForkDashboard:!1},Ei=M_(()=>({...Mvn}));function joi(){return Ei(e=>e.dashboardViewLoading)}function zoi(){return Ei(e=>e.selectedDashboardDetails)}function Yoi(){return Ei(e=>e.dashboardDetail)}function qoi(){return Ei(e=>{let t=e.layoutStates[e.layoutStateIndex]||[];return t=t.sort((r,n)=>r.i-n.i),t})}function Xoi(){return Ei(e=>{let t=e.layoutStates[e.layoutStateIndex]||[];t=t.sort((n,i)=>n.i-i.i);const r=t.map(n=>{if(n){const{h:i,w:a,x:o,y:s,i:l,id:u,visualId:c,isResizable:f,type:d}=n;return{h:i,w:a,x:o,y:s,i:l,visualId:u,minH:n.type==="markdown"?2:ZSe(n),minW:4,maxH:QSe(n),maxW:JSe(n),isResizable:(f||!!u||!!c)&&d!=="header"}}return[]});return{[e.breakPoint]:r}})}function Koi(){return Ei(e=>e.dragItem)}function Zoi(){return Ei(e=>e.layoutStates)}function Qoi(){return Ei(e=>e.layoutStateIndex)}function Joi(){return Ei(e=>e.breakPoint)}function esi(){return Ei(e=>e.infoView)}function tsi(){return Ei(e=>e.isRunning)}function Dvn(){return Ei(e=>e.imgMetadata||{})}function rsi(){return Ei(e=>e.toggleVisTable)}function nsi(){return Ei(e=>e.queryResult)}function isi(){return Ei(e=>e.queryError)}function asi(){return Ei(e=>e.isOfficialDashboard)}function osi(){return Ei(e=>e.chatGPTResult||"")}function ssi(){return Ei(e=>e.chatGPTError||"")}function lsi(){return Ei(e=>e.isChatGPTLoading||!1)}function usi(){return Ei(e=>e.isWidgetConfigSet||!1)}function csi(){return Ei(e=>e.chatGptPrompt||"")}function fsi(){return Ei(e=>e.isChartAddedToDash||[])}function dsi(){return Ei(e=>e.isCounterAddedToDash||[])}function hsi(){return Ei(e=>e.dashboardLoader||!1)}function psi(){return Ei(e=>e.widgetsDashLoader||!1)}function vsi(){return Ei(e=>e.dashboardDetailError||void 0)}function gsi(){return Ei(e=>e.dashboardDetailLoading||!1)}function msi(){return Ei(e=>e.dashboardVisualLoading||!1)}function ysi(){return Ei(e=>e.dashboardDetailStatus||void 0)}function Esi(){return Ei(e=>e.dashDqlRunCount||0)}function bsi(){return Ei(e=>e.isErrOpen)}function _si(){return Ei(e=>e.isEmptyRowCount||!1)}function Ssi(){return Ei(e=>e.isSetAsHome)}function wsi(){return Ei(e=>e.slugName)}function Tsi(){return Ei(e=>e.isVisibilitySet)}function Asi(){return Ei(e=>e.slugNameError)}function Csi(){return Ei(e=>e.isTableAddedToDash)}function Rsi(){return Ei(e=>e.isUnsavedChangesDash)}function xsi(){return Ei(e=>e.visibility)}function Isi(){return Ei(e=>e.isForkDashboard)}const $vn=[],kct={visualId:"",connectionUrl:null,queryId:null,loading:!1,chartLoading:!1,chartFields:{},tableFields:{},counterFields:{},extraChartSeries:[],selectedQueryText:null,chartType:null,queryResult:{},chartDetailStatus:void 0,selectedChartDetailsError:void 0,queryError:void 0,queryRunning:!1,columns:[],chartState:"",savedQueryIdDetails:{},selectedChartDetails:null,showTableSaveModal:!1,confirmDialogLoading:!1,viewModal:{name:"",chartName:"",chartTags:[],chartDescription:"",viewName:"",refreshInterval:null},isCounterDecimal:!0,userSetVisibility:"",isMaterializedViewChecked:!1,isAutoRefreshedVisual:!1,isFork:!1},Do=M_(()=>({...kct}));function Osi(){return Do(e=>e.chartFields)}function Nsi(){return Do(e=>e.tableFields)}function Lsi(){return Do(e=>e.counterFields)}function Psi(){return Do(e=>e.selectedChartDetails)}function Msi(){return Do(e=>e.savedQueryIdDetails||{})}function Dsi(){return Do(e=>e.chartType)}function $si(){return Do(e=>e.extraChartSeries)}function ksi(){return Do(e=>e.queryError)}function Bsi(){return Do(e=>e.queryRunning)}function Usi(){return Do(e=>e.chartDetailStatus||void 0)}function Fsi(){return Do(e=>e.selectedChartDetailsError||void 0)}function Hsi(){return Do(e=>{const t=e.queryResult;return Dr.isEmpty(t)?"":"finished"})}function Gsi(){return Do(e=>{const t=e.queryResult;return Dr.isEmpty(t)?$vn:t==null?void 0:t.fieldsMetadata})}function Vsi(){return Do(e=>{const t=e.queryResult;return Dr.isEmpty(t)?[]:t==null?void 0:t.items})}function Wsi(){return Do(e=>{var r;const t=e.queryResult;return Dr.isEmpty(t)?0:(r=t==null?void 0:t.items)==null?void 0:r.length})}function jsi(){return Do(e=>{var t;return((t=e.queryResult)==null?void 0:t.dataframesObject)||{}})}function zsi(){return Do(e=>e.confirmDialogLoading)}function Ysi(){return Do(e=>e.viewModal)}function qsi(){return Do(e=>e.isCounterDecimal)}function Xsi(){return Do(e=>e.userSetVisibility)}function Ksi(){return Do(e=>e.isMaterializedViewChecked)}function Zsi(){return Do(e=>e.isAutoRefreshedVisual)}function Qsi(){return Do(e=>e.isFork)}var Bct={},Uct={},Fct={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];if(typeof window<"u"){var s;typeof window.gtag>"u"&&(window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)}),(s=window).gtag.apply(s,a)}},r=t;e.default=r})(Fct);var Hct={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var t=/^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;function r(s){return s.toString().trim().replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g,function(l,u,c){return u>0&&u+l.length!==c.length&&l.search(t)>-1&&c.charAt(u-2)!==":"&&(c.charAt(u+l.length)!=="-"||c.charAt(u-1)==="-")&&c.charAt(u-1).search(/[^\s-]/)<0?l.toLowerCase():l.substr(1).search(/[A-Z]|\../)>-1?l:l.charAt(0).toUpperCase()+l.substr(1)})}function n(s){return typeof s=="string"&&s.indexOf("@")!==-1}var i="REDACTED (Potential Email Address)";function a(s){return n(s)?(console.warn("This arg looks like an email address, redacting."),i):s}function o(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,c=s||"";return l&&(c=r(s)),u&&(c=a(c)),c}})(Hct);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.GA4=void 0;var t=o(Fct),r=o(Hct),n=["eventCategory","eventAction","eventLabel","eventValue","hitType"],i=["title","location"],a=["page","hitType"];function o(E){return E&&E.__esModule?E:{default:E}}function s(E,S){if(E==null)return{};var C=l(E,S),M,k;if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(E);for(k=0;k<U.length;k++)M=U[k],!(S.indexOf(M)>=0)&&Object.prototype.propertyIsEnumerable.call(E,M)&&(C[M]=E[M])}return C}function l(E,S){if(E==null)return{};var C={},M=Object.keys(E),k,U;for(U=0;U<M.length;U++)k=M[U],!(S.indexOf(k)>=0)&&(C[k]=E[k]);return C}function u(E){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S},u(E)}function c(E){return h(E)||d(E)||b(E)||f()}function f(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
18381
18381
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d(E){if(typeof Symbol<"u"&&E[Symbol.iterator]!=null||E["@@iterator"]!=null)return Array.from(E)}function h(E){if(Array.isArray(E))return w(E)}function p(E,S){var C=Object.keys(E);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(E);S&&(M=M.filter(function(k){return Object.getOwnPropertyDescriptor(E,k).enumerable})),C.push.apply(C,M)}return C}function g(E){for(var S=1;S<arguments.length;S++){var C=arguments[S]!=null?arguments[S]:{};S%2?p(Object(C),!0).forEach(function(M){O(E,M,C[M])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(C)):p(Object(C)).forEach(function(M){Object.defineProperty(E,M,Object.getOwnPropertyDescriptor(C,M))})}return E}function m(E,S){return R(E)||T(E,S)||b(E,S)||y()}function y(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
18382
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(E,S){if(E){if(typeof E=="string")return w(E,S);var C=Object.prototype.toString.call(E).slice(8,-1);if(C==="Object"&&E.constructor&&(C=E.constructor.name),C==="Map"||C==="Set")return Array.from(E);if(C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C))return w(E,S)}}function w(E,S){(S==null||S>E.length)&&(S=E.length);for(var C=0,M=new Array(S);C<S;C++)M[C]=E[C];return M}function T(E,S){var C=E==null?null:typeof Symbol<"u"&&E[Symbol.iterator]||E["@@iterator"];if(C!=null){var M,k,U,G,B=[],x=!0,H=!1;try{if(U=(C=C.call(E)).next,S===0){if(Object(C)!==C)return;x=!1}else for(;!(x=(M=U.call(C)).done)&&(B.push(M.value),B.length!==S);x=!0);}catch(q){H=!0,k=q}finally{try{if(!x&&C.return!=null&&(G=C.return(),Object(G)!==G))return}finally{if(H)throw k}}return B}}function R(E){if(Array.isArray(E))return E}function N(E,S){if(!(E instanceof S))throw new TypeError("Cannot call a class as a function")}function A(E,S){for(var C=0;C<S.length;C++){var M=S[C];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(E,I(M.key),M)}}function L(E,S,C){return S&&A(E.prototype,S),C&&A(E,C),Object.defineProperty(E,"prototype",{writable:!1}),E}function O(E,S,C){return S=I(S),S in E?Object.defineProperty(E,S,{value:C,enumerable:!0,configurable:!0,writable:!0}):E[S]=C,E}function I(E){var S=$(E,"string");return u(S)==="symbol"?S:String(S)}function $(E,S){if(u(E)!=="object"||E===null)return E;var C=E[Symbol.toPrimitive];if(C!==void 0){var M=C.call(E,S||"default");if(u(M)!=="object")return M;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(E)}var F=function(){function E(){var S=this;N(this,E),O(this,"reset",function(){S.isInitialized=!1,S._testMode=!1,S._currentMeasurementId,S._hasLoadedGA=!1,S._isQueuing=!1,S._queueGtag=[]}),O(this,"_gtag",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];S._testMode||S._isQueuing?S._queueGtag.push(M):t.default.apply(void 0,M)}),O(this,"_loadGA",function(C,M){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"https://www.googletagmanager.com/gtag/js";if(!(typeof window>"u"||typeof document>"u")&&!S._hasLoadedGA){var U=document.createElement("script");U.async=!0,U.src="".concat(k,"?id=").concat(C),M&&U.setAttribute("nonce",M),document.body.appendChild(U),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},S._hasLoadedGA=!0}}),O(this,"_toGtagOptions",function(C){if(C){var M={cookieUpdate:"cookie_update",cookieExpires:"cookie_expires",cookieDomain:"cookie_domain",cookieFlags:"cookie_flags",userId:"user_id",clientId:"client_id",anonymizeIp:"anonymize_ip",contentGroup1:"content_group1",contentGroup2:"content_group2",contentGroup3:"content_group3",contentGroup4:"content_group4",contentGroup5:"content_group5",allowAdFeatures:"allow_google_signals",allowAdPersonalizationSignals:"allow_ad_personalization_signals",nonInteraction:"non_interaction",page:"page_path",hitCallback:"event_callback"},k=Object.entries(C).reduce(function(U,G){var B=m(G,2),x=B[0],H=B[1];return M[x]?U[M[x]]=H:U[x]=H,U},{});return k}}),O(this,"initialize",function(C){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!C)throw new Error("Require GA_MEASUREMENT_ID");var k=typeof C=="string"?[{trackingId:C}]:C;S._currentMeasurementId=k[0].trackingId;var U=M.gaOptions,G=M.gtagOptions,B=M.nonce,x=M.testMode,H=x===void 0?!1:x,q=M.gtagUrl;if(S._testMode=H,H||S._loadGA(S._currentMeasurementId,B,q),S.isInitialized||(S._gtag("js",new Date),k.forEach(function(re){var Q=g(g(g({},S._toGtagOptions(g(g({},U),re.gaOptions))),G),re.gtagOptions);Object.keys(Q).length?S._gtag("config",re.trackingId,Q):S._gtag("config",re.trackingId)})),S.isInitialized=!0,!H){var W=c(S._queueGtag);for(S._queueGtag=[],S._isQueuing=!1;W.length;){var Y=W.shift();S._gtag.apply(S,c(Y)),Y[0]==="get"&&(S._isQueuing=!0)}}}),O(this,"set",function(C){if(!C){console.warn("`fieldsObject` is required in .set()");return}if(u(C)!=="object"){console.warn("Expected `fieldsObject` arg to be an Object");return}Object.keys(C).length===0&&console.warn("empty `fieldsObject` given to .set()"),S._gaCommand("set",C)}),O(this,"_gaCommandSendEvent",function(C,M,k,U,G){S._gtag("event",M,g(g({event_category:C,event_label:k,value:U},G&&{non_interaction:G.nonInteraction}),S._toGtagOptions(G)))}),O(this,"_gaCommandSendEventParameters",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];if(typeof M[0]=="string")S._gaCommandSendEvent.apply(S,c(M.slice(1)));else{var U=M[0],G=U.eventCategory,B=U.eventAction,x=U.eventLabel,H=U.eventValue;U.hitType;var q=s(U,n);S._gaCommandSendEvent(G,B,x,H,q)}}),O(this,"_gaCommandSendTiming",function(C,M,k,U){S._gtag("event","timing_complete",{name:M,value:k,event_category:C,event_label:U})}),O(this,"_gaCommandSendPageview",function(C,M){if(M&&Object.keys(M).length){var k=S._toGtagOptions(M),U=k.title,G=k.location,B=s(k,i);S._gtag("event","page_view",g(g(g(g({},C&&{page_path:C}),U&&{page_title:U}),G&&{page_location:G}),B))}else C?S._gtag("event","page_view",{page_path:C}):S._gtag("event","page_view")}),O(this,"_gaCommandSendPageviewParameters",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];if(typeof M[0]=="string")S._gaCommandSendPageview.apply(S,c(M.slice(1)));else{var U=M[0],G=U.page;U.hitType;var B=s(U,a);S._gaCommandSendPageview(G,B)}}),O(this,"_gaCommandSend",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];var U=typeof M[0]=="string"?M[0]:M[0].hitType;switch(U){case"event":S._gaCommandSendEventParameters.apply(S,M);break;case"pageview":S._gaCommandSendPageviewParameters.apply(S,M);break;case"timing":S._gaCommandSendTiming.apply(S,c(M.slice(1)));break;case"screenview":case"transaction":case"item":case"social":case"exception":console.warn("Unsupported send command: ".concat(U));break;default:console.warn("Send command doesn't exist: ".concat(U))}}),O(this,"_gaCommandSet",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];typeof M[0]=="string"&&(M[0]=O({},M[0],M[1])),S._gtag("set",S._toGtagOptions(M[0]))}),O(this,"_gaCommand",function(C){for(var M=arguments.length,k=new Array(M>1?M-1:0),U=1;U<M;U++)k[U-1]=arguments[U];switch(C){case"send":S._gaCommandSend.apply(S,k);break;case"set":S._gaCommandSet.apply(S,k);break;default:console.warn("Command doesn't exist: ".concat(C))}}),O(this,"ga",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];if(typeof M[0]=="string")S._gaCommand.apply(S,M);else{var U=M[0];S._gtag("get",S._currentMeasurementId,"client_id",function(G){S._isQueuing=!1;var B=S._queueGtag;for(U({get:function(q){return q==="clientId"?G:q==="trackingId"?S._currentMeasurementId:q==="apiVersion"?"1":void 0}});B.length;){var x=B.shift();S._gtag.apply(S,c(x))}}),S._isQueuing=!0}return S.ga}),O(this,"event",function(C,M){if(typeof C=="string")S._gtag("event",C,S._toGtagOptions(M));else{var k=C.action,U=C.category,G=C.label,B=C.value,x=C.nonInteraction,H=C.transport;if(!U||!k){console.warn("args.category AND args.action are required in event()");return}var q={hitType:"event",eventCategory:(0,r.default)(U),eventAction:(0,r.default)(k)};G&&(q.eventLabel=(0,r.default)(G)),typeof B<"u"&&(typeof B!="number"?console.warn("Expected `args.value` arg to be a Number."):q.eventValue=B),typeof x<"u"&&(typeof x!="boolean"?console.warn("`args.nonInteraction` must be a boolean."):q.nonInteraction=x),typeof H<"u"&&(typeof H!="string"?console.warn("`args.transport` must be a string."):(["beacon","xhr","image"].indexOf(H)===-1&&console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`"),q.transport=H)),S._gaCommand("send",q)}}),O(this,"send",function(C){S._gaCommand("send",C)}),this.reset()}return L(E,[{key:"gtag",value:function(){this._gtag.apply(this,arguments)}}]),E}();e.GA4=F;var D=new F;e.default=D})(Uct);(function(e){function t(s){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},t(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.ReactGAImplementation=void 0;var r=i(Uct);function n(s){if(typeof WeakMap!="function")return null;var l=new WeakMap,u=new WeakMap;return(n=function(f){return f?u:l})(s)}function i(s,l){if(!l&&s&&s.__esModule)return s;if(s===null||t(s)!=="object"&&typeof s!="function")return{default:s};var u=n(l);if(u&&u.has(s))return u.get(s);var c={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var h=f?Object.getOwnPropertyDescriptor(s,d):null;h&&(h.get||h.set)?Object.defineProperty(c,d,h):c[d]=s[d]}return c.default=s,u&&u.set(s,c),c}var a=r.GA4;e.ReactGAImplementation=a;var o=r.default;e.default=o})(Bct);const Gct=Nn(Bct),Jsi={login:{methods:{metamask:"metamask",username_password:"username_password",google_oauth:"google_oauth",twitter_oauth:"twitter_oauth"}},signup:{methods:{metamask:"metamask",username_password:"username_password",twitter_oauth:"twitter_oauth"}}};var $n=(e=>(e.user_logged_in="user_logged_in",e.user_registered="user_registered",e.user_logged_out="user_logged_out",e.user_profile_updated="user_profile_updated",e.user_password_reset="user_password_reset",e.page_view="page_view",e.page_error="page_error",e.button_click="button_click",e.submit_success="submit_success",e.submit_failed="submit_failed",e.chatbot_visibility="chatbot_visibility",e.chatbot_prompt_input="chatbot_prompt_input",e.outbound_links="outbound_links",e.search_datasets="search_datasets",e.selected_chain_on_erd="selected_chain_on_erd",e.selected_namespace_on_erd="selected_namespace_on_erd",e.selected_erd_layout_view="selected_erd_layout_view",e.contract_submission="contract_submission",e.contract_submission_success="contract_submission_success",e.contract_submission_error="contract_submission_error",e.dashboard_created="dashboard_created",e.dashboard_updated="dashboard_updated",e.dashboard_deleted="dashboard_deleted",e.dashboard_published="dashboard_published",e.query_execution="query_execution",e.query_execution_success="query_execution_success",e.query_execution_error="query_execution_error",e.query_aborted="query_aborted",e.query_saved="query_saved",e.query_updated="query_updated",e.query_deleted="query_deleted",e.query_published="query_published",e.visualizations_filter="visualizations_filter",e.visualizations_created="visualizations_created",e.visualizations_updated="visualizations_updated",e.visualizations_deleted="visualizations_deleted",e.visualizations_published="visualizations_published",e.card_added="card_added",e.card_deleted="card_deleted",e.default_card="default_card",e.subscription_created="subscription_created",e.subscription_updated="subscription_updated",e.subscription_cancelled="subscription_cancelled",e.subscription_joined="subscription_joined",e.credit_purchase="purchase",e.subscribe="subscribe",e.pay_balance="custom_revenue",e.subscription_leave="subscription_leave",e))($n||{});const An=(e,t)=>{const r={userId:JSON.stringify(ro.getState().userId??""),...t};Gct.gtag("event",e,r)},rN=e=>{const{GOOGLE_ADS_ID:t}=P_();t&&typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:`${t}/${e}`})},Io={login:e=>{An($n.user_logged_in,e),Gct.gtag("set",e)},signup:e=>{An($n.user_registered,e)},logout:()=>{An($n.user_logged_out)},userProfileUpdated:e=>{An($n.user_profile_updated,e)},passwordReset:()=>{An($n.user_password_reset)},pageView:e=>{An($n.page_view,e)},pageError:e=>{An($n.page_error,e)},buttonClick:e=>{An($n.button_click,e)},chatbotVisibility:e=>{An($n.chatbot_visibility,e)},chatbotInput:e=>{An($n.chatbot_prompt_input,e)},searchDataset:e=>{An($n.search_datasets,e)},selectedChainOnERD:e=>{An($n.selected_chain_on_erd,e)},selectedNamespaceOnERD:e=>{An($n.selected_namespace_on_erd,e)},selectedERDLayout:e=>{An($n.selected_erd_layout_view,e)},contractSubmission:e=>{An($n.contract_submission,e)},contractSubmissionSuccess:e=>{An($n.contract_submission_success,e)},contractSubmissionError:e=>{An($n.contract_submission_error,e)},dashboardCreated:e=>{An($n.dashboard_created,e)},dashboardUpdated:e=>{An($n.dashboard_updated,e)},dashboardDeleted:e=>{An($n.dashboard_deleted,e)},dashboardPublished:e=>{An($n.dashboard_published,e)},queryExecution:e=>{An($n.query_execution,e)},queryExecutionSuccess:e=>{An($n.query_execution_success,e)},queryExecutionError:e=>{An($n.query_execution_error,e)},queryAborted:e=>{An($n.query_aborted,e)},querySaved:e=>{An($n.query_saved,e)},queryUpdate:e=>{An($n.query_updated,e)},queryDelete:e=>{An($n.query_deleted,e)},queryPublish:e=>{An($n.query_published,e)},visualizationFilter:e=>{An($n.visualizations_filter,e)},visualizationCreated:e=>{An($n.visualizations_created,e)},visualizationUpdated:e=>{An($n.visualizations_updated,e)},visualizationDeleted:e=>{An($n.visualizations_deleted,e)},visualizationPublished:e=>{An($n.visualizations_published,e)},outboundLinks:e=>{An($n.outbound_links,e)},cardAdded:e=>{An($n.card_added,e)},cardDeleted:e=>{An($n.card_deleted,e)},defaultCard:e=>{An($n.default_card,e)},subscriptionCreated:e=>{An($n.subscription_created,e)},subscriptionJoined:e=>{An($n.subscription_joined,e)},subscriptionCardUpdated:e=>{An($n.subscription_updated,e)},subscriptionCanceled:e=>{An($n.subscription_cancelled,e)},creditPurchase:e=>{An($n.credit_purchase,e)},subscribe:e=>{An($n.subscribe,e)},payBalance:e=>{An($n.pay_balance,e)},subscriptionLeave:e=>{An($n.subscription_leave,e)}},eli={loginClick:()=>{An("login_button_click"),rN("LOGIN_CLICK")},signupClick:()=>{An("signup_button_click"),rN("SIGNUP_CLICK")},startCreatingClick:()=>{An("start_creating_button_click"),rN("START_CREATING_CLICK")},blankProjectClick:()=>{An("blank_project_button_click"),rN("START_CREATING_CLICK")},proCreatorSubscription:()=>{An("procreator_subscription_click"),rN("PROCREATOR_SUB")}},{getState:gDe}=Qi,kvn=e=>{const{graphType:t,...r}=e;return{chartType:t||"",...r}},Bvn=e=>{const{graphType:t="",counterValue:r=0,columnName:n="",metric:i="",prefix:a="",suffix:o="",label:s="",title:l="",decimal:u=""}=e;return{chartType:t,counterValue:r,columnName:n,metric:i,prefix:a,suffix:o,label:s,title:l,decimal:u}},Vct=e=>{var g,m,y,b,w,T;const{graphType:t,graphMeta:r}=e,{axis:n,dateFormat:i,legendEnabled:a,sliderEnabled:o,metricEnabled:s}=r||{},{x:l,y:u,seriesField:c,...f}=n||{};if(t===Fc.table)return kvn(e);if(t===Fc.counter)return Bvn(e);const d={},h={title:((g=u==null?void 0:u.labelName)==null?void 0:g.toUpperCase())||((m=u==null?void 0:u.columnName)==null?void 0:m.toUpperCase())},p={title:((y=l==null?void 0:l.labelName)==null?void 0:y.toUpperCase())||((b=l==null?void 0:l.columnName)==null?void 0:b.toUpperCase())};return i&&(p.dateFormat=i),l!=null&&l.tickLayout&&(p.tickLayout=l.tickLayout),l!=null&&l.spacing&&(p.spacing=l.spacing),l!=null&&l.unformatted&&(p.unformatted=l.unformatted),u!=null&&u.spacing&&(h.spacing=u.spacing),u!=null&&u.unformatted&&(h.unformatted=u.unformatted),u!=null&&u.position&&(h.position=u.position),u!=null&&u.metric&&(h.metric=u.metric),Object.keys(f).forEach((R,N)=>{var A,L;d[`y${N+1}Field`]={value:f[R].columnName||"",chartType:f[R].graphType||"",yAxisIndex:f[R].yAxisIndex},h[`y${N+1}Title`]=((A=f[R])==null?void 0:A.labelName)||((L=f[R])==null?void 0:L.columnName)}),{chartType:t||"",fields:{xField:((w=l==null?void 0:l.columnName)==null?void 0:w.toUpperCase())||"",yField:((T=u==null?void 0:u.columnName)==null?void 0:T.toUpperCase())||"",seriesField:(c==null?void 0:c.columnName)||null,...d,xAxisData:{...p},yAxisData:{...h},legendEnabled:a||"",sliderEnabled:o||"",metricEnabled:s||""}}},{getState:TI,setState:Fn}=Do,tli=(e,t,r)=>{let n="";const{chartFields:i}=TI();t==="xField"||t==="yField"?n="title":t==="y1Field"&&(n="y1Title"),Fn({chartFields:{...i,...Odn(i,e,n,(r==null?void 0:r.toString())||""),[t]:r}})},rli=(e,t,r)=>{const{chartType:n}=r,{xField:i,yField:a,axisLabels:o,...s}=r.fields||{},l=r.fields||{},u=Dr.keys(s),c=[];u.forEach(f=>{const d={fieldId:f,inputType:"field-dropdown",label:f.replaceAll("Field","-axis"),required:!1};c.push(d)}),n===Fc.counter?Fn({visualId:e,queryId:t,chartType:n,counterFields:r}):n===Fc.table?Fn({visualId:e,queryId:t,chartType:n,tableFields:r}):Fn({visualId:e,queryId:t,chartType:n,extraChartSeries:c,chartFields:l})},nli=e=>{Fn({selectedChartDetails:e})},ili=e=>{Fn({chartType:e})},ali=e=>{Fn({chartFields:e})},oli=e=>{Fn({tableFields:e})},sli=e=>{Fn({counterFields:e})},Wct=e=>{const{chart:t,type:r,metadata:n}=e,{chartType:i,fields:a}=t||e,{xField:o,yField:s,xAxisData:l,yAxisData:u,seriesField:c,legendEnabled:f,sliderEnabled:d,metricEnabled:h,...p}=a||{},g={};if(r===tc.TABLE)return{...n,graphType:"table"};if(r===tc.COUNTERCARD)return{...n,graphType:"counter"};Object.keys(p).forEach((y,b)=>{g[`y${b+1}`]={axisType:"",columnName:p[y].value||"",graphType:p[y].chartType||"",yAxisIndex:p[y].yAxisIndex,labelName:u&&b===0?u==null?void 0:u.y1Title:""}});const m=c&&{seriesField:{columnName:c}};return{graphType:i||"",graphMeta:{axis:{x:{axisType:"",columnName:o||"",labelName:l&&(l==null?void 0:l.title)||o||"",spacing:l&&(l==null?void 0:l.spacing),tickLayout:l&&(l==null?void 0:l.tickLayout),unformatted:l&&(l==null?void 0:l.unformatted)},y:{axisType:"",columnName:s||"",labelName:u&&(u==null?void 0:u.title)||s||"",spacing:u&&(u==null?void 0:u.spacing),position:u&&(u==null?void 0:u.position),metric:u&&(u==null?void 0:u.metric),unformatted:u&&(u==null?void 0:u.unformatted)},...g,...m},dateFormat:l&&(l==null?void 0:l.dateFormat)||"",numberFormat:"",legendEnabled:f||"",sliderEnabled:d||"",metricEnabled:h||"",showDataLabels:!1}}},Uve=e=>{if(e&&(e!=null&&e.metadata)){let{metadata:t}=e;t=t?JSON.parse(t):{},t=Vct(t);const r={...e,metadata:t};Fn({selectedChartDetails:r})}},lli=async(e,t,r="false",n)=>{var R;const i=SI(),{queryResult:a,isMaterializedViewChecked:o,savedQueryIdDetails:s}=TI(),{chartName:l,chartTags:u,chartDescription:c,type:f,queryName:d,viewName:h,refreshInterval:p}=t,g=Wct(t),m=ro.getState().userId,{data:y={}}=s,{slug:b,queryText:w}=y;let{id:T=""}=y;if((R=Object.keys(s==null?void 0:s.data))!=null&&R.length){let{metadata:N}=s.data;const{scope:A,userId:L="",apiAlert:O}=s.data;if((N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(N=JSON.stringify({sourceNetwork:n})),!T||r==="true"){const I={metadata:N||"",...sH(u),description:c||"",name:d||"Untitled Query",scope:A,queryText:w,visibility:Ts.private},{data:$,error:F}=await _t.createQuery(I);if(F)throw lr(F||"",O),F;T=$==null?void 0:$.id}else if(L!==m){const{data:I,error:$}=await _t.forkQuery(b);if($)throw lr($||"",O),$;I!=null&&I.id&&(T=(I==null?void 0:I.id)||"")}}if(o&&T){const N=await M4n(h,T,p),{data:A,error:L}=N||{};if(A){const{data:O}=await _t.getQuery(T,!0);await awe(O||{});const I={queryId:T,name:l,visualType:f,...sH(u),description:c||"",metadata:JSON.stringify(g)};let $=null;if(e?(I.id=e,$=await _t.updateVisual(e,I)):$=await _t.saveVisual(I),Fn({chartState:kw.loading}),$!=null&&$.data){J1e(),e?(Io.visualizationUpdated({vizId:e,vizName:(I==null?void 0:I.name)||"",vizType:(I==null?void 0:I.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_UPDATED_SUCCESS(Kp[f]))},300)):(Io.visualizationCreated({vizId:$==null?void 0:$.data,vizName:(I==null?void 0:I.name)||"",vizType:(I==null?void 0:I.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_SAVED_SUCCESS(Kp[f]))},300));const{data:F}=$;F&&Uve(F),Xs(T,{data:a.items,columns:a.fieldsMetadata,warning:!1,error:!1,message:!1,filteredDataFrames:a.filteredDataFrames,dataframesObject:a.dataframesObject,dataFrames:a.dataFrame}),Fn({chartState:kw.saved});const D=cL[f]||cL.GRAPH;i==null||i.push(`${Nc.charts}?activeTab=${D}&visualType=${f}&widgetTypeEnum=${f}`)}else $!=null&&$.error&&(lr($==null?void 0:$.error),Fn({chartState:kw.error}))}L&&lr(L||"Something went wrong")}else{const N={queryId:T,name:l,visualType:f,...sH(u),description:c||"",metadata:JSON.stringify(g)};let A=null;if(e?(N.id=e,A=await _t.updateVisual(e,N)):A=await _t.saveVisual(N),Fn({chartState:kw.loading}),A!=null&&A.data){J1e(),e?(Io.visualizationUpdated({vizId:e,vizName:(N==null?void 0:N.name)||"",vizType:(N==null?void 0:N.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_UPDATED_SUCCESS(Kp[f]))},300)):(Io.visualizationCreated({vizId:A==null?void 0:A.data,vizName:(N==null?void 0:N.name)||"",vizType:(N==null?void 0:N.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_SAVED_SUCCESS(Kp[f]))},300));const{data:L}=A;L&&Uve(L),Xs(T,{data:a.items,columns:a.fieldsMetadata,warning:!1,error:!1,message:!1,filteredDataFrames:a.filteredDataFrames,dataframesObject:a.dataframesObject,dataFrames:a.dataFrame}),Fn({chartState:kw.saved});const O=cL[f]||cL.GRAPH;i==null||i.push(`${Nc.charts}?activeTab=${O}&visualType=${f}&widgetTypeEnum=${f}`)}else A!=null&&A.error&&(lr(A==null?void 0:A.error),Fn({chartState:kw.error}))}},uli=async(e,t,r,n)=>{const{selectedChartDetails:i}=TI();try{Fn({confirmDialogLoading:!0});const{status:a,error:o}=await _t.deleteVisual(e);a===204?(Io.visualizationDeleted({vizId:e,vizName:n||"",vizType:t||"",timestamp:Date.now()}),kn(xe.WIDGET_DELETED_SUCCESS(Kp[t])),(i==null?void 0:i.id)===e&&Fn({selectedChartDetails:null}),r()):lr(o||"")}catch(a){lr((a==null?void 0:a.message)||"")}finally{Fn({confirmDialogLoading:!1})}},Uvn=e=>e===Ts.subscription?Zbe.myOrgVisuals:(e===Ts.private,"GRAPH"),cli=async(e,t,r)=>{try{Fn({confirmDialogLoading:!0});const{selectedChartDetails:n,userSetVisibility:i}=TI(),a=SI(),o=()=>i===Ts.public?{slug:r,visibility:i}:{visibility:i},s=cs.stringify(o()),{status:l,error:u}=await _t.publishVisual(e,s);if(l===204)Io.visualizationPublished({vizId:e,vizName:(n==null?void 0:n.name)||"",vizType:t||"",slug:r,timestamp:Date.now()}),kn(xe.WIDGET_PUBLISH_SUCCESS(Kp[t])),Fn({selectedChartDetails:{...n,visibility:i},confirmDialogLoading:!1}),a==null||a.push(J1.charts(Uvn(i)));else return u&&lr(u),xe.RESPONSE_ERROR_STATUS;return xe.RESPONSE_SUCCESS_STATUS}catch(n){return lr(n==null?void 0:n.message),xe.RESPONSE_ERROR_STATUS}finally{Fn({confirmDialogLoading:!1})}},fli=async(e,t)=>{try{const{data:r,status:n,error:i}=await _t.getVisual(e,t)||{};Dr.isEmpty(r)?Fn({selectedChartDetailsError:xe.RECORD_NOT_FOUND,chartDetailStatus:n}):(Uve(r),Fn({selectedChartDetailsError:void 0})),i&&Fn({selectedChartDetailsError:i,chartDetailStatus:n})}catch{}},dli=(e,t,r,n)=>{const{chartFields:i}=TI(),a={...i[e]};n&&(a.chartType=n==null?void 0:n.replace("_chart","")),a[t]=r,Fn({chartFields:{...i,[e]:{...a}}})},hli=()=>{Fn({visualId:"",queryId:"",chartType:"",counterFields:{},queryResult:{},extraChartSeries:[],chartFields:{},savedQueryIdDetails:{}})},pli=e=>{Fn({extraChartSeries:[...e]})},vli=async(e,t)=>{var f,d,h,p;const{queriesResult:r}=gDe(),{queryId:n,referencedResources:i,authorizationResources:a,requiresAuthorization:o}=t;if((d=(f=r[n])==null?void 0:f.data)!=null&&d.length)return Fn({queryResult:{...r[n],items:r[n].data,fieldsMetadata:r[n].columns||[]}}),null;Fn({queryRunning:!0});let s={data:null};const{biscuitList:l}=gDe(),u=NI(l,QX({resources:o?a:i}));try{s=await _t.executeQuery({queryId:n,biscuits:u},((h=r[n])==null?void 0:h.visibility)===Ts.public?!1:e)}catch{}const c=((p=s==null?void 0:s.data)==null?void 0:p.error)||(s==null?void 0:s.error);if(c)return Fn({queryError:c==null?void 0:c.title,queryRunning:!1,loading:!1,chartLoading:!1});if(s.data){const g=YT(s==null?void 0:s.data);Fn({queryResult:g,queryRunning:!1,loading:!1,chartLoading:!1}),Xs(n,{data:g.items,columns:g.fieldsMetadata,warning:!1,error:!1,message:!1,filteredDataFrames:g.filteredDataFrames,dataframesObject:g.dataframesObject,dataFrames:g.dataFrame})}return!1},gli=()=>{Fn({queryResult:[],columns:[],loading:!0})},mli=e=>{Fn({loading:e})},yli=()=>{Fn({...kct})},Eli=async(e,t,r)=>{try{const{data:n}=await _t.getQuery(e,t);if(Fn(n?{savedQueryIdDetails:{data:n},queryId:e}:{savedQueryIdDetails:{error:xe.RECORD_NOT_FOUND}}),r)return(n==null?void 0:n.name)||""}catch(n){if(Fn({savedQueryIdDetails:{error:n}}),r)return""}return""},bli=async(e,t,r,n,i)=>{const{data:a}=await _t.getDashboardById(e==null?void 0:e.id,r),{data:o}=await _t.getDashboardVisualsContent(e==null?void 0:e.id,r),s=a&&JSON.stringify(Kht(a,o||[],n)),l=o==null?void 0:o.map(f=>({visualId:f.id,metadata:f.dashboardVisualMetadata})),u=Dr.map(o,f=>f.id);if(!!t&&u.includes(t))return lr(xe.WIDGET_ALREADY_PRESENT);try{const{data:f,error:d="",apiAlert:h}=await _t.putDashboardVisuals(e==null?void 0:e.id,[{visualId:t,metadata:s},...l]);return f?(kn(xe.WIDGET_PINNED_TO_DASHBOARD),ert(()=>_t.getDashboardVisualsContent(e==null?void 0:e.id,r)),i(!0),!1):lr(d,h)}catch(f){let d="Unknown Error";return f instanceof Error&&(d=f.message),lr(d)}},_li=e=>{Fn({queryResult:e})},Sli=e=>{const{viewModal:t}=TI();if(typeof e=="function"){const r=e(t);Fn({viewModal:r})}else Fn({viewModal:{...t,...e}})},wli=e=>{Fn({isCounterDecimal:e})},Tli=e=>{Fn({userSetVisibility:e})},Ali=e=>{Fn({isMaterializedViewChecked:e})},Cli=e=>{Fn({isAutoRefreshedVisual:e})},Rli=async e=>{try{const{status:t,error:r}=await _t.forkVisual(e);if(t===201)return kn(xe.VISUAL_CLONE_SUCCESS),xe.RESPONSE_SUCCESS_STATUS;if(r)return lr(r),xe.RESPONSE_ERROR_STATUS}catch(t){lr((t==null?void 0:t.message)||"")}return""},xli=e=>{Fn({isFork:e})},{getState:Ns,setState:br}=Ei,KSe=e=>{br({layouts:e})},sP=Do.setState,Fvn=async(e,t,r,n,i)=>{const{loadLayout:a}=Ns(),o=t[n-1]||[];(zht(r,t[n]||[]).filter(l=>{var u,c,f,d,h;return((u=l.x)==null?void 0:u.toString())||((c=l.y)==null?void 0:c.toString())||((f=l.i)==null?void 0:f.toString())||((d=l.h)==null?void 0:d.toString())||((h=l.w)==null?void 0:h.toString())||l.name}).length>0||i)&&(a&&!i&&(e.pop(),await br({loadLayout:!1})),o.length>0&&o.length>r.length&&!i&&(e.pop(),await br({layoutStates:e})),e.push(r),await br({layoutStates:e,layoutStateIndex:e.length-1}))},FT=(e,t=!1)=>{if(!(e!=null&&e.length)){br({layoutStates:[],layoutStateIndex:0});return}const{layoutStates:r,layoutStateIndex:n}=Ns();let i=[];const a=e.sort((o,s)=>Number(o.i)-Number(s.i));i=r.slice(0,n+1),Fvn(i,r,a,n,t)},Hvn=e=>{br({layoutStates:[e],layoutStateIndex:0})},Ili=async()=>{const{layoutStateIndex:e}=Ns();await br({layoutStateIndex:Math.max(0,Number(e)-1)})},Oli=async()=>{const{layoutStates:e,layoutStateIndex:t}=Ns();await br({layoutStateIndex:Math.min(e.length,t+1)})},jct=e=>{br({isSetAsHome:{...e}})},Gvn=async(e,t,r,n)=>{const i=SI(),{settings:a,userName:o,displayName:s,emailAddress:l,bio:u}=r,f={...a?JSON.parse(a):{},dashboardHomeId:t},d=JSON.stringify(f),h={userId:e,userName:o||null,displayName:s||null,emailAddress:l||null,bio:u,settings:d};try{await sft(e,h)===xe.RESPONSE_SUCCESS_STATUS&&(kn(n),Hvn([]),await D1n(e),t&&(jct({[t]:!0}),i==null||i.push({pathname:Nc.landingPage,state:{id:t}})))}catch(p){lr(p==null?void 0:p.message)}},Nli=async(e,t,r)=>{const n=ro.getState().userId,{settings:i}=r||{},a=i?JSON.parse(i):{},{dashboardHomeId:o=""}=a;try{sP({confirmDialogLoading:!0});const{status:s,error:l,apiAlert:u}=await _t.deleteDashboard(e);o&&o===e&&await Gvn(n??"","",r,xe.DASHBOARD_UNSET_AS_HOME_SUCCESS),s===204?(Io.dashboardDeleted({dashId:e,timestamp:Date.now()}),kn(xe.DASHBOARD_DELETED_SUCCESS),t&&t()):lr(l||"",u)}catch(s){lr((s==null?void 0:s.message)||"")}finally{sP({confirmDialogLoading:!1})}},zct=()=>{const{visibility:e,dashboardDetail:t}=Ns();if(e)switch(e){case Ts.public:return Jm.exploreDashboard;case Ts.subscription:return Jm.myOrgDashboard;case Ts.private:return Jm.myDashboard;default:return Jm.myDashboard}else switch(t==null?void 0:t.visibility){case Ts.public:return Jm.exploreDashboard;case Ts.subscription:return Jm.myOrgDashboard;case Ts.private:return Jm.myDashboard;default:return Jm.myDashboard}},Vvn=async(e,t)=>{try{const{selectedDashboardDetails:r}=Ns(),{slug:n}=t,i=cs.stringify(t),a=SI(),{status:o,error:s,apiAlert:l}=await _t.publishDashboard(e,i);if(o===204)kn(xe.DASHBOARD_PUBLISH_SUCCESS),br({selectedDashboardDetails:{...r,visibility:(t==null?void 0:t.visibility)||"",slug:n||null}}),a==null||a.push(`${J1.dashboards(zct())}`),Io.dashboardPublished({dashId:e,dashName:r==null?void 0:r.name,slug:n||null,timestamp:Date.now()});else return lr(s||xe.SLUG_NAME_ERROR("Slug"),l),!1;return!0}catch(r){return lr(r==null?void 0:r.message),!1}},Lli=e=>{var t;br({selectedDashboardDetails:e,imgMetadata:((t=e==null?void 0:e.metadata)==null?void 0:t.customImg)||{}})},Pli=e=>{br({dashboardDetail:e})},Wvn=e=>{const t=o=>({markdown:8,row:5})[o]||1,r=o=>({markdown:4})[o]||12,n=o=>({markdown:12,row:5})[o]||1,i=o=>({markdown:12})[o]||12;return{...e,w:r(e.type),h:t(e.type),x:e.x||0,y:e.y||0,minH:1,minW:3,maxH:n(e.type),maxW:i(e.type),isResizable:e.type==="markdown"}},Yct=e=>e.metadata.chartType===Kp.COUNTERCARD.toLowerCase()?6:8,ZSe=e=>e.metadata.chartType===Kp.COUNTERCARD.toLowerCase()?6:(e==null?void 0:e.type)==="divider"?1:8,qct=e=>e.metadata.chartType===Kp.COUNTERCARD.toLowerCase()?5:6,QSe=e=>e.metadata.chartType==="counter"?8:(e==null?void 0:e.type)==="divider"?1:12,JSe=e=>e.metadata.chartType==="counter"?7:12,Mli=e=>{FT([{...e,w:qct(e),h:Yct(e),x:e.x||0,y:e.y||0,minH:ZSe(e),minW:4,maxH:QSe(e),maxW:JSe(e)}])},Dli=(e,t,r)=>{const{layoutStateIndex:n,layoutStates:i}=Ns(),a=i[n]||[],o=a==null?void 0:a.map(s=>({...s,x:t[s.i].x,y:t[s.i].y}));r?Dr.isEmpty(Dr.filter(a,s=>s.visualId===e.visualId))&&FT([...o,{...e,w:qct(e),h:Yct(e),x:e.x||0,y:e.y||0,minH:ZSe(e),minW:4,maxH:QSe(e),maxW:JSe(e)}]):FT([...o,Wvn(e)])},$li=e=>{const{layoutStates:t,layoutStateIndex:r}=Ns(),n=[...t[r]];Dr.remove(n,a=>a.i.toString()===(e==null?void 0:e.toString()));const i=n.map((a,o)=>({...a,i:o.toString()}));FT([...i],!0)},kli=()=>{KSe([]),br({layoutStates:[],layoutStateIndex:0})},jvn=async e=>{const{dashboardVisualMetadata:t,...r}=e;if(e){const n=e.metadata&&nBe(e.metadata),i={...r,metadata:Vct(n)};return{...t&&nBe(t),...i,type:"visual"}}return{}},ewe=async e=>{const t=[];br({dashboardVisualLoading:!0});for(let n=0;n<e.length;n+=1){const i=e&&jvn(e[n]);t.push(i)}const r=await Promise.all(t);return r&&br({dashboardVisualLoading:!1}),r},Xct=e=>{br({dashboardVisualsContent:e})},Bli=async(e,t,r,n)=>{var i;try{br({dashboardViewLoading:!0,dashboardDetailLoading:!0,dashboardAllVisualsLoading:!0,dashboardDetailError:void 0});const{data:a,error:o,status:s}=await _t.getDashboardById(e,t,r);if(Dr.isEmpty(a)||br({dashboardDetail:null,dashboardDetailError:xe.RECORD_NOT_FOUND,dashboardDetailStatus:s}),a){if(a.visibility==="public"&&t===!0){const u=await _t.getDashboardFilteredByMyLikes(t);u!==void 0&&u.data&&Array.isArray(u.data)&&(a.liked=u.data.indexOf(a==null?void 0:a.id)>-1)}const l=(a==null?void 0:a.metadata)&&JSON.parse(a.metadata)||[];if(br({dashboardDetail:a,dashboardDetailLoading:!1,imgMetadata:(l==null?void 0:l.customImg)||{}}),a){const{data:u}=await _t.getDashboardVisualsContent(a==null?void 0:a.id,t);Xct(u||[]);let f=[...(u==null?void 0:u.length)&&await ewe(u||[])||[]];(i=l==null?void 0:l.components)!=null&&i.length&&f.push(...l.components),f=Dr.reject(f,d=>Dr.isEmpty(d)),f=f.map((d,h)=>(d.i=h.toString(),d)),f=f==null?void 0:f.sort((d,h)=>d.i-h.i),KSe([...f]),FT([...f]),br({loadLayout:!0,savedLayouts:[...f],dashboardViewLoading:!1,dashboardAllVisualsLoading:!1,dashboardDetailError:void 0})}br({dashboardViewLoading:!1,dashboardDetailLoading:!1,dashboardAllVisualsLoading:!1})}o&&(br({dashboardViewLoading:!1,dashboardDetailLoading:!1,dashboardDetailError:o,dashboardDetailStatus:s}),n&&n()),s===404&&n&&n()}catch{}finally{br({dashboardViewLoading:!1,dashboardDetailLoading:!1})}return null};async function zvn(e){br({chatGPTResult:e})}const Uli=e=>{br({dashDqlRunCount:e})};async function Yvn(e,t,r,n){var a,o,s;const i={prompt:e,metadata:{context:r,error:n}};br({isChatGPTLoading:!0,chatGptPrompt:e});try{const l=await _t.postGPT(i,t);(l==null?void 0:l.error)===xe.QUERY_PROMPT_ABORT&&lr(xe.QUERY_PROMPT_ABORT),l!=null&&l.data&&br({isChatGPTLoading:!1,chatGPTResult:(a=l==null?void 0:l.data)==null?void 0:a.SQL,chatGPTContext:(s=(o=l==null?void 0:l.data)==null?void 0:o.metadata)==null?void 0:s.context,chatGPTError:""}),l!=null&&l.error&&(l==null?void 0:l.error)!==xe.QUERY_PROMPT_ABORT&&br({chatGPTError:l==null?void 0:l.error})}catch(l){console.error(l)}finally{br({isChatGPTLoading:!1})}}function Fli(){const{isErrOpen:e}=Ns();br({isErrOpen:!e})}function qvn(e){br({isErrOpen:e})}const Hli=async(e,t,r,n,i,a,o)=>{var h,p,g,m,y;e=qht(e),n||br({isRunning:!0});const{dashDqlRunCount:s,chatGPTResult:l,chatGPTContext:u}=Ns(),{resourceId:c="ETH:BLOCK"}=t?Yht(e,t):{};let f={data:null};const d=new Date;try{const b={sqlText:e.trimEnd(),validate:!0,...o};f=await _t.executeSQL(b,r,n);const{data:w,error:T,status:R}=f,N=(w==null?void 0:w.error)||T;if(w&&R===200){(w==null?void 0:w.length)===0&&br({isEmptyRowCount:!0});const A=f==null?void 0:f.data;f={data:{error:null,response:YT(f.data),successStatus:0}};const L=new Date-d;if(n)return{success:{queryResult:(h=f.data)==null?void 0:h.response,durationMs:L,rawQueryResult:A,isRunning:!1}};br({queryResult:(p=f.data)==null?void 0:p.response,durationMs:L,isRunning:!1,saveSuggestedQuery:{queryText:e.replace(/\n$/,"").trim()||"",resourceId:c||""},toggleVisTable:"table",isChartAddedToDash:[],isCounterAddedToDash:[],queryError:""})}if(R===422){const{commandType:A,requiredCapabilities:L}=N,O=Zht(L),I=NI(a,L);if(L!=null&&L.length&&Dr.isEmpty(I)&&!((g=O==null?void 0:O.create)!=null&&g.length))return YF(!0),qF(v4.permissionSecret),br({queryError:"Biscuit required",isRunning:!1});if(A.toLowerCase()==="dql"){let $={data:null,error:null};try{const F={sqlText:e.trimEnd(),resources:[c],biscuits:I,...o};$=await _t.runQuery(F,r,n);const{data:D,error:E,status:S}=$,C=(w==null?void 0:w.error)||E;if(D&&S===200){(D==null?void 0:D.length)===0&&br({isEmptyRowCount:!0});const M=f==null?void 0:f.data;f={data:{error:null,response:YT(f.data),successStatus:0}};const k=new Date-d;if(n)return{success:{queryResult:(m=f.data)==null?void 0:m.response,durationMs:k,rawQueryResult:M,isRunning:!1}};br({queryResult:(y=f.data)==null?void 0:y.response,durationMs:k,isRunning:!1,saveSuggestedQuery:{queryText:e.replace(/\n$/,"").trim()||"",resourceId:c||""},toggleVisTable:"table",isChartAddedToDash:[],isCounterAddedToDash:[],queryError:""})}if(C)return C===xe.NETWORK_ERROR?br({queryError:C,isRunning:!1}):n?{error:{queryError:C,isRunning:!1}}:(C===xe.QUERY_ABORT&&lr(xe.QUERY_PROMPT_ABPRT),br({queryError:C,isRunning:!1}))}catch{}}}if(N)return N===xe.NETWORK_ERROR?br({queryError:N,isRunning:!1}):(s<3&&l&&N!==xe.QUERY_ABORT?(zvn(""),qvn(!1),Yvn(i,r,u,N==null?void 0:N.detail)):s>=3&&N!==xe.QUERY_ABORT&&lr(xe.NLP_MESSAGE),n?{error:{queryError:N,isRunning:!1}}:(N===xe.QUERY_ABORT&&lr(xe.QUERY_PROMPT_ABPRT),br({queryError:N,isRunning:!1})))}catch(b){console.error("An error occurred for dashboard sql api:",b),br({queryError:b||"",isRunning:!1})}return null},Xvn=async(e,t)=>{var l;const{id:r,metadata:n}=e,{dashboardVisualsContent:i}=Ns(),a=n&&JSON.parse(n)||[],o=JSON.stringify(Kht(e,i)),s=i==null?void 0:i.map(u=>({visualId:u.id,metadata:u.dashboardVisualMetadata}));try{br({widgetsDashLoader:!0});const{data:u,error:c="",apiAlert:f}=await _t.putDashboardVisuals(r,[{visualId:t,metadata:o},...s]),{data:d}=await _t.getDashboardVisualsContent(r,!0);if(u&&d){Xct(d),kn(xe.WIDGET_ADDED),br({isWidgetConfigSet:!1,chatGPTResult:""});let p=[...d&&await ewe(d)||[]];(l=a==null?void 0:a.components)!=null&&l.length&&p.push(...a.components),p=p.map((g,m)=>(g.i=m.toString(),g)),p=p==null?void 0:p.sort((g,m)=>g.i-m.i),KSe([...p]),FT([...p]),br({loadLayout:!0,savedLayouts:[...p],widgetsDashLoader:!1,dashboardDetailError:void 0})}return lr(c,f)}catch(u){let c="Unknown Error";return u instanceof Error&&(c=u.message),lr(c)}finally{br({widgetsDashLoader:!1})}},Gli=async e=>{const{type:t,name:r,description:n}=e,{saveSuggestedQuery:i,dashboardDetail:a}=Ns(),{queryId:o}=i,s=Wct(e),l={queryId:o,name:r,visualType:t,description:n||"",metadata:JSON.stringify(s)},u=await _t.saveVisual(l),{data:c}=u;c!=null&&c.id&&(kn(xe.WIDGET_SAVED_SUCCESS(Kp[t])),Xvn(a,c==null?void 0:c.id))},Vli=()=>{br({saveSuggestedQuery:{queryText:"",resourceId:"",queryId:""}})},Wli=async e=>{const{saveSuggestedQuery:t}=Ns(),r={...t,...e};if(!(t!=null&&t.queryId)){const{data:n,error:i,apiAlert:a}=await _t.createQuery(r);if(i){lr(i,a);return}n&&(br({saveSuggestedQuery:{queryId:n.id||""}}),kn(xe.QUERY_SAVED_SUCCESS))}},jli=()=>{br({isWidgetConfigSet:!1,isCounterAddedToDash:[]})},zli=(e,t,r)=>{const{saveSuggestedQuery:n,isCounterAddedToDash:i}=Ns(),{queryId:a}=n;sP({visualId:a||"",queryId:a,chartType:Fc.counter,counterFields:e,queryResult:t}),br({isWidgetConfigSet:!0,isCounterAddedToDash:[...i,r]})},Yli=(e,t,r)=>{const{saveSuggestedQuery:n,isChartAddedToDash:i}=Ns(),{queryId:a}=n,{type:o,config:s}=e,{xField:l,yField:u,xAxisData:c,yAxisData:f,axisLabels:d,seriesField:h,legendEnabled:p,sliderEnabled:g,...m}=s.configItem||{},y=Dr.keys(m),b={xField:s.xField||s.colorField,yField:s.yField||s.angleField};s.axisLabels&&(b.axisLabels=s.axisLabels);const w=[];return!h&&y.forEach(T=>{b[T]={value:typeof m[T]=="object"?m[T].value:m[T],chartType:typeof m[T]=="object"?m[T].chartType:o==null?void 0:o.replace("_chart","")};const R={fieldId:T,inputType:"field-dropdown",label:T.replaceAll("Field","-axis"),required:!1};w.push(R)}),h&&(b.seriesField=h),b.legendEnabled=p,b.sliderEnabled=g,sP({chartType:e.type,extraChartSeries:w,chartFields:b,queryResult:t,savedQueryIdDetails:{data:t},queryId:a}),br({isWidgetConfigSet:!0,isChartAddedToDash:[...i,r]}),null};function qli(){br({queryResult:{},isRunning:!1,queryError:"",isEmptyRowCount:!1,chatGptPrompt:"",toggleVisTable:"table"})}function Xli(e){br({isOfficialDashboard:e})}function Kli(e){br({toggleVisTable:e})}const Kvn=()=>{const{layoutStates:e,layoutStateIndex:t}=Ns(),r=e[t];return Dr.partition(r,n=>!!n.visualId||n.type==="visual")},Zvn=(e,t,r)=>{Dr.isEmpty(e)?Io.dashboardUpdated({dashId:t||`${DC.uuid()}`,dashName:(r==null?void 0:r.name)||"",timestamp:Date.now()}):Io.dashboardCreated({dashId:`${DC.uuid()}`,dashName:(r==null?void 0:r.name)||"",timestamp:Date.now()})},Qvn=e=>{const{visibility:t,dashboardDetail:r}=Ns();return t===Ts.public||(r==null?void 0:r.visibility)===Ts.public?{slug:e,visibility:t||(r==null?void 0:r.visibility)}:{visibility:t||(r==null?void 0:r.visibility)}},Jvn=()=>{const{dashboardDetail:e,visibility:t,isVisibilitySet:r,slugName:n}=Ns();return r&&t===Ts.public||t===Ts.subscription||r&&(e==null?void 0:e.visibility)===Ts.subscription&&(t===Ts.private||t===Ts.public)||!r&&(e==null?void 0:e.visibility)===Ts.public&&n!==(e==null?void 0:e.slug)},Zli=async(e,t,r,n,i,a)=>{const[o,s]=Kvn(),l={...e,metadata:JSON.stringify({components:s,customImg:t,textAreaHeight:i||0})};br({dashboardLoader:!0});let u=null;try{r?u=await _t.updateDashboard(l,r):u=await _t.saveDashboard(l);const{data:c,error:f}=u||{},d=SI();if(c){const h=Dr.isEmpty(c==null?void 0:c.id)?r:c==null?void 0:c.id,p=o==null?void 0:o.map(b=>{const{h:w,maxH:T,minH:R,maxW:N,minW:A,w:L,x:O,y:I,i:$,boxHeight:F}=b;return{visualId:(b==null?void 0:b.visualId)||(b==null?void 0:b.id),metadata:JSON.stringify({i:$,h:w,maxH:T,minH:R,maxW:N,minW:A,w:L,x:O,y:I,boxHeight:F})}}),{data:g,error:m="",apiAlert:y}=await _t.putDashboardVisuals(h,p);if(br({dashboardLoader:!1}),g){let b=!0;Jvn()&&(b=await Vvn(h,Qvn(a))),Zvn(c,h,l),kn(r?xe.WIDGET_UPDATED_SUCCESS("Dashboard"):xe.DASHBOARD_SAVED_SUCCESS),setTimeout(()=>{b?n&&n(h,zct()):d&&d.push(J1.updateDashboard(h))},200)}m&&lr(m,y)}else f&&lr(f)}catch(c){lr(c.message)}finally{br({dashboardLoader:!1,slugName:""})}},e1n=(e,t)=>{if(e.type===Lnt.header){const r=t.headerWeight==="h2"?1.4:1;e.h=t.headerWeight==="h1"?1.6:r}},Qli=(e,t)=>{var s;const{layoutStates:r,layoutStateIndex:n}=Ns(),i=r[n],a=i.map(l=>l.id===e.id?(e1n(l,t),{...l,metadata:t}):l),o=(s=i.find(l=>l.i===e.i))==null?void 0:s.metadata;if(!Dr.isEmpty(zht(t,o))){const l=r.slice(0,n+1);l.push(a),br({layoutStates:l,layoutStateIndex:l.length-1})}},Jli=async e=>{const{layoutStateIndex:t,layoutStates:r}=Ns(),n=r[t]||[],i=n.find(o=>o.i==="__dropping-elem__"),a=n.map((o,s)=>{var l,u;return{...o,...e[s],maxH:o.maxH||((l=e[s])==null?void 0:l.maxH),maxW:o.maxW||((u=e[s])==null?void 0:u.maxW)}});if(i){const o=r;o.pop(),await br({layoutStates:o})}FT([...a])},eui=e=>{br({dragItem:e})},tui=()=>{br({dashboardDetail:null,imgMetadata:{chartColors:[],chartBackground:[],imgUrl:"",useImgColors:!1,titleColor:""}})},rui=async(e,t)=>{var a;const r=e.metadata&&(typeof e.metadata=="object"?e.metadata:JSON.parse(e.metadata))||[];let i=[...t&&await ewe(t)||[]];return(a=r==null?void 0:r.components)!=null&&a.length&&i.push(...r.components),i=Dr.reject(i,o=>Dr.isEmpty(o)),i=i==null?void 0:i.sort((o,s)=>Number(o.i)-Number(s.i)),i},nui=e=>{br({breakPoint:e})},iui=()=>{br({loadLayout:!1})},aui=e=>{br({infoView:e})},oui=e=>{const{imgMetadata:t}=Ns();br({imgMetadata:{...t,useImgColors:e}})},sui=(e,t,r,n)=>{const{imgMetadata:i}=Ns();br({imgMetadata:{...i,chartColors:e,chartBackground:t,imgUrl:r,titleColor:n}})},lui=()=>{br({imgMetadata:{chartColors:[],chartBackground:[],imgUrl:"",useImgColors:!1,titleColor:""}})},uui=()=>{br({isChartAddedToDash:[],isCounterAddedToDash:[],isTableAddedToDash:!1})},cui=e=>{br({slugName:e})},fui=e=>{br({isVisibilitySet:e})},dui=e=>{br({slugNameError:e})},hui=e=>{const{saveSuggestedQuery:t}=Ns(),{queryId:r=""}=t;sP({visualId:r,queryId:r,chartType:Fc.table,queryResult:e}),br({isWidgetConfigSet:!0,isTableAddedToDash:!0})},pui=e=>{br({isUnsavedChangesDash:e})},vui=e=>{br({visibility:e})},gui=async e=>{try{const{status:t,error:r,apiAlert:n}=await _t.forkDashboard(e);if(t===201)return kn(xe.DASHBOARD_CLONE_SUCCESS),xe.RESPONSE_SUCCESS_STATUS;if(r)return lr(r,n),xe.RESPONSE_ERROR_STATUS}catch(t){lr((t==null?void 0:t.message)||"")}return""},mui=e=>{br({isForkDashboard:e})},yui="https://azuremarketplace.microsoft.com/en-us/marketplace/apps/spaceandtimelabsinc1674586360724.spaceandtimedb?tab=PlansAndPrice",Kct="https://azuremarketplace.microsoft.com/view/appPricing/spaceandtimelabsinc1674586360724.spaceandtimedb/us?ReviewsMyCommentsFilter=true",Eui=[{label:"Subscription ID",dataKey:"subscriptionId",width:310},{label:"Provider",dataKey:"provider",width:310},{label:"Amount",dataKey:"amount",width:120},{label:"Currency",dataKey:"currency",width:120},{label:"Date & Time",dataKey:"timestamp",width:180}],bui={iconStyle:"solid",showIcon:!0,style:{base:{color:ss.custom.white.A1,fontFamily:ss.typography.fontFamily,fontSize:ss.custom.fontSize.font12,fontSmoothing:"antialiased",":-webkit-autofill":{color:"black"},"::placeholder":{color:"#b2b3bdcc"}},invalid:{color:ss.custom.red}}},_ui={iconStyle:"solid",showIcon:!0,style:{base:{color:ss.custom.white.A1,fontFamily:ss.typography.fontFamily,fontSize:ss.custom.fontSize.font12,fontSmoothing:"antialiased",":-webkit-autofill":{color:"black"},"::placeholder":{color:"#b2b3bdcc"}},invalid:{color:ss.custom.red}}},Sui=[{id:"faq1",ques:"What will I be charged for?",ans:`Regardless of which pricing model you choose, you only
|
|
18382
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(E,S){if(E){if(typeof E=="string")return w(E,S);var C=Object.prototype.toString.call(E).slice(8,-1);if(C==="Object"&&E.constructor&&(C=E.constructor.name),C==="Map"||C==="Set")return Array.from(E);if(C==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C))return w(E,S)}}function w(E,S){(S==null||S>E.length)&&(S=E.length);for(var C=0,M=new Array(S);C<S;C++)M[C]=E[C];return M}function T(E,S){var C=E==null?null:typeof Symbol<"u"&&E[Symbol.iterator]||E["@@iterator"];if(C!=null){var M,k,U,G,B=[],x=!0,H=!1;try{if(U=(C=C.call(E)).next,S===0){if(Object(C)!==C)return;x=!1}else for(;!(x=(M=U.call(C)).done)&&(B.push(M.value),B.length!==S);x=!0);}catch(q){H=!0,k=q}finally{try{if(!x&&C.return!=null&&(G=C.return(),Object(G)!==G))return}finally{if(H)throw k}}return B}}function R(E){if(Array.isArray(E))return E}function N(E,S){if(!(E instanceof S))throw new TypeError("Cannot call a class as a function")}function A(E,S){for(var C=0;C<S.length;C++){var M=S[C];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(E,I(M.key),M)}}function L(E,S,C){return S&&A(E.prototype,S),C&&A(E,C),Object.defineProperty(E,"prototype",{writable:!1}),E}function O(E,S,C){return S=I(S),S in E?Object.defineProperty(E,S,{value:C,enumerable:!0,configurable:!0,writable:!0}):E[S]=C,E}function I(E){var S=$(E,"string");return u(S)==="symbol"?S:String(S)}function $(E,S){if(u(E)!=="object"||E===null)return E;var C=E[Symbol.toPrimitive];if(C!==void 0){var M=C.call(E,S||"default");if(u(M)!=="object")return M;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(E)}var F=function(){function E(){var S=this;N(this,E),O(this,"reset",function(){S.isInitialized=!1,S._testMode=!1,S._currentMeasurementId,S._hasLoadedGA=!1,S._isQueuing=!1,S._queueGtag=[]}),O(this,"_gtag",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];S._testMode||S._isQueuing?S._queueGtag.push(M):t.default.apply(void 0,M)}),O(this,"_loadGA",function(C,M){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"https://www.googletagmanager.com/gtag/js";if(!(typeof window>"u"||typeof document>"u")&&!S._hasLoadedGA){var U=document.createElement("script");U.async=!0,U.src="".concat(k,"?id=").concat(C),M&&U.setAttribute("nonce",M),document.body.appendChild(U),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},S._hasLoadedGA=!0}}),O(this,"_toGtagOptions",function(C){if(C){var M={cookieUpdate:"cookie_update",cookieExpires:"cookie_expires",cookieDomain:"cookie_domain",cookieFlags:"cookie_flags",userId:"user_id",clientId:"client_id",anonymizeIp:"anonymize_ip",contentGroup1:"content_group1",contentGroup2:"content_group2",contentGroup3:"content_group3",contentGroup4:"content_group4",contentGroup5:"content_group5",allowAdFeatures:"allow_google_signals",allowAdPersonalizationSignals:"allow_ad_personalization_signals",nonInteraction:"non_interaction",page:"page_path",hitCallback:"event_callback"},k=Object.entries(C).reduce(function(U,G){var B=m(G,2),x=B[0],H=B[1];return M[x]?U[M[x]]=H:U[x]=H,U},{});return k}}),O(this,"initialize",function(C){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!C)throw new Error("Require GA_MEASUREMENT_ID");var k=typeof C=="string"?[{trackingId:C}]:C;S._currentMeasurementId=k[0].trackingId;var U=M.gaOptions,G=M.gtagOptions,B=M.nonce,x=M.testMode,H=x===void 0?!1:x,q=M.gtagUrl;if(S._testMode=H,H||S._loadGA(S._currentMeasurementId,B,q),S.isInitialized||(S._gtag("js",new Date),k.forEach(function(re){var Q=g(g(g({},S._toGtagOptions(g(g({},U),re.gaOptions))),G),re.gtagOptions);Object.keys(Q).length?S._gtag("config",re.trackingId,Q):S._gtag("config",re.trackingId)})),S.isInitialized=!0,!H){var W=c(S._queueGtag);for(S._queueGtag=[],S._isQueuing=!1;W.length;){var Y=W.shift();S._gtag.apply(S,c(Y)),Y[0]==="get"&&(S._isQueuing=!0)}}}),O(this,"set",function(C){if(!C){console.warn("`fieldsObject` is required in .set()");return}if(u(C)!=="object"){console.warn("Expected `fieldsObject` arg to be an Object");return}Object.keys(C).length===0&&console.warn("empty `fieldsObject` given to .set()"),S._gaCommand("set",C)}),O(this,"_gaCommandSendEvent",function(C,M,k,U,G){S._gtag("event",M,g(g({event_category:C,event_label:k,value:U},G&&{non_interaction:G.nonInteraction}),S._toGtagOptions(G)))}),O(this,"_gaCommandSendEventParameters",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];if(typeof M[0]=="string")S._gaCommandSendEvent.apply(S,c(M.slice(1)));else{var U=M[0],G=U.eventCategory,B=U.eventAction,x=U.eventLabel,H=U.eventValue;U.hitType;var q=s(U,n);S._gaCommandSendEvent(G,B,x,H,q)}}),O(this,"_gaCommandSendTiming",function(C,M,k,U){S._gtag("event","timing_complete",{name:M,value:k,event_category:C,event_label:U})}),O(this,"_gaCommandSendPageview",function(C,M){if(M&&Object.keys(M).length){var k=S._toGtagOptions(M),U=k.title,G=k.location,B=s(k,i);S._gtag("event","page_view",g(g(g(g({},C&&{page_path:C}),U&&{page_title:U}),G&&{page_location:G}),B))}else C?S._gtag("event","page_view",{page_path:C}):S._gtag("event","page_view")}),O(this,"_gaCommandSendPageviewParameters",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];if(typeof M[0]=="string")S._gaCommandSendPageview.apply(S,c(M.slice(1)));else{var U=M[0],G=U.page;U.hitType;var B=s(U,a);S._gaCommandSendPageview(G,B)}}),O(this,"_gaCommandSend",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];var U=typeof M[0]=="string"?M[0]:M[0].hitType;switch(U){case"event":S._gaCommandSendEventParameters.apply(S,M);break;case"pageview":S._gaCommandSendPageviewParameters.apply(S,M);break;case"timing":S._gaCommandSendTiming.apply(S,c(M.slice(1)));break;case"screenview":case"transaction":case"item":case"social":case"exception":console.warn("Unsupported send command: ".concat(U));break;default:console.warn("Send command doesn't exist: ".concat(U))}}),O(this,"_gaCommandSet",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];typeof M[0]=="string"&&(M[0]=O({},M[0],M[1])),S._gtag("set",S._toGtagOptions(M[0]))}),O(this,"_gaCommand",function(C){for(var M=arguments.length,k=new Array(M>1?M-1:0),U=1;U<M;U++)k[U-1]=arguments[U];switch(C){case"send":S._gaCommandSend.apply(S,k);break;case"set":S._gaCommandSet.apply(S,k);break;default:console.warn("Command doesn't exist: ".concat(C))}}),O(this,"ga",function(){for(var C=arguments.length,M=new Array(C),k=0;k<C;k++)M[k]=arguments[k];if(typeof M[0]=="string")S._gaCommand.apply(S,M);else{var U=M[0];S._gtag("get",S._currentMeasurementId,"client_id",function(G){S._isQueuing=!1;var B=S._queueGtag;for(U({get:function(q){return q==="clientId"?G:q==="trackingId"?S._currentMeasurementId:q==="apiVersion"?"1":void 0}});B.length;){var x=B.shift();S._gtag.apply(S,c(x))}}),S._isQueuing=!0}return S.ga}),O(this,"event",function(C,M){if(typeof C=="string")S._gtag("event",C,S._toGtagOptions(M));else{var k=C.action,U=C.category,G=C.label,B=C.value,x=C.nonInteraction,H=C.transport;if(!U||!k){console.warn("args.category AND args.action are required in event()");return}var q={hitType:"event",eventCategory:(0,r.default)(U),eventAction:(0,r.default)(k)};G&&(q.eventLabel=(0,r.default)(G)),typeof B<"u"&&(typeof B!="number"?console.warn("Expected `args.value` arg to be a Number."):q.eventValue=B),typeof x<"u"&&(typeof x!="boolean"?console.warn("`args.nonInteraction` must be a boolean."):q.nonInteraction=x),typeof H<"u"&&(typeof H!="string"?console.warn("`args.transport` must be a string."):(["beacon","xhr","image"].indexOf(H)===-1&&console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`"),q.transport=H)),S._gaCommand("send",q)}}),O(this,"send",function(C){S._gaCommand("send",C)}),this.reset()}return L(E,[{key:"gtag",value:function(){this._gtag.apply(this,arguments)}}]),E}();e.GA4=F;var D=new F;e.default=D})(Uct);(function(e){function t(s){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},t(s)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.ReactGAImplementation=void 0;var r=i(Uct);function n(s){if(typeof WeakMap!="function")return null;var l=new WeakMap,u=new WeakMap;return(n=function(f){return f?u:l})(s)}function i(s,l){if(!l&&s&&s.__esModule)return s;if(s===null||t(s)!=="object"&&typeof s!="function")return{default:s};var u=n(l);if(u&&u.has(s))return u.get(s);var c={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var h=f?Object.getOwnPropertyDescriptor(s,d):null;h&&(h.get||h.set)?Object.defineProperty(c,d,h):c[d]=s[d]}return c.default=s,u&&u.set(s,c),c}var a=r.GA4;e.ReactGAImplementation=a;var o=r.default;e.default=o})(Bct);const Gct=Nn(Bct),Jsi={login:{methods:{metamask:"metamask",username_password:"username_password",google_oauth:"google_oauth",twitter_oauth:"twitter_oauth"}},signup:{methods:{metamask:"metamask",username_password:"username_password",twitter_oauth:"twitter_oauth"}}};var $n=(e=>(e.user_logged_in="user_logged_in",e.user_registered="user_registered",e.user_logged_out="user_logged_out",e.user_profile_updated="user_profile_updated",e.user_password_reset="user_password_reset",e.page_view="page_view",e.page_error="page_error",e.button_click="button_click",e.submit_success="submit_success",e.submit_failed="submit_failed",e.chatbot_visibility="chatbot_visibility",e.chatbot_prompt_input="chatbot_prompt_input",e.outbound_links="outbound_links",e.search_datasets="search_datasets",e.selected_chain_on_erd="selected_chain_on_erd",e.selected_namespace_on_erd="selected_namespace_on_erd",e.selected_erd_layout_view="selected_erd_layout_view",e.contract_submission="contract_submission",e.contract_submission_success="contract_submission_success",e.contract_submission_error="contract_submission_error",e.dashboard_created="dashboard_created",e.dashboard_updated="dashboard_updated",e.dashboard_deleted="dashboard_deleted",e.dashboard_published="dashboard_published",e.query_execution="query_execution",e.query_execution_success="query_execution_success",e.query_execution_error="query_execution_error",e.query_aborted="query_aborted",e.query_saved="query_saved",e.query_updated="query_updated",e.query_deleted="query_deleted",e.query_published="query_published",e.visualizations_filter="visualizations_filter",e.visualizations_created="visualizations_created",e.visualizations_updated="visualizations_updated",e.visualizations_deleted="visualizations_deleted",e.visualizations_published="visualizations_published",e.card_added="card_added",e.card_deleted="card_deleted",e.default_card="default_card",e.subscription_created="subscription_created",e.subscription_updated="subscription_updated",e.subscription_cancelled="subscription_cancelled",e.subscription_joined="subscription_joined",e.credit_purchase="purchase",e.subscribe="subscribe",e.pay_balance="custom_revenue",e.subscription_leave="subscription_leave",e))($n||{});const An=(e,t)=>{const r={userId:JSON.stringify(ro.getState().userId??""),...t};Gct.gtag("event",e,r)},rN=e=>{const{GOOGLE_ADS_ID:t}=P_();t&&typeof window<"u"&&window.gtag&&window.gtag("event","conversion",{send_to:`${t}/${e}`})},Io={login:e=>{An($n.user_logged_in,e),Gct.gtag("set",e)},signup:e=>{An($n.user_registered,e)},logout:()=>{An($n.user_logged_out)},userProfileUpdated:e=>{An($n.user_profile_updated,e)},passwordReset:()=>{An($n.user_password_reset)},pageView:e=>{An($n.page_view,e)},pageError:e=>{An($n.page_error,e)},buttonClick:e=>{An($n.button_click,e)},chatbotVisibility:e=>{An($n.chatbot_visibility,e)},chatbotInput:e=>{An($n.chatbot_prompt_input,e)},searchDataset:e=>{An($n.search_datasets,e)},selectedChainOnERD:e=>{An($n.selected_chain_on_erd,e)},selectedNamespaceOnERD:e=>{An($n.selected_namespace_on_erd,e)},selectedERDLayout:e=>{An($n.selected_erd_layout_view,e)},contractSubmission:e=>{An($n.contract_submission,e)},contractSubmissionSuccess:e=>{An($n.contract_submission_success,e)},contractSubmissionError:e=>{An($n.contract_submission_error,e)},dashboardCreated:e=>{An($n.dashboard_created,e)},dashboardUpdated:e=>{An($n.dashboard_updated,e)},dashboardDeleted:e=>{An($n.dashboard_deleted,e)},dashboardPublished:e=>{An($n.dashboard_published,e)},queryExecution:e=>{An($n.query_execution,e)},queryExecutionSuccess:e=>{An($n.query_execution_success,e)},queryExecutionError:e=>{An($n.query_execution_error,e)},queryAborted:e=>{An($n.query_aborted,e)},querySaved:e=>{An($n.query_saved,e)},queryUpdate:e=>{An($n.query_updated,e)},queryDelete:e=>{An($n.query_deleted,e)},queryPublish:e=>{An($n.query_published,e)},visualizationFilter:e=>{An($n.visualizations_filter,e)},visualizationCreated:e=>{An($n.visualizations_created,e)},visualizationUpdated:e=>{An($n.visualizations_updated,e)},visualizationDeleted:e=>{An($n.visualizations_deleted,e)},visualizationPublished:e=>{An($n.visualizations_published,e)},outboundLinks:e=>{An($n.outbound_links,e)},cardAdded:e=>{An($n.card_added,e)},cardDeleted:e=>{An($n.card_deleted,e)},defaultCard:e=>{An($n.default_card,e)},subscriptionCreated:e=>{An($n.subscription_created,e)},subscriptionJoined:e=>{An($n.subscription_joined,e)},subscriptionCardUpdated:e=>{An($n.subscription_updated,e)},subscriptionCanceled:e=>{An($n.subscription_cancelled,e)},creditPurchase:e=>{An($n.credit_purchase,e)},subscribe:e=>{An($n.subscribe,e)},payBalance:e=>{An($n.pay_balance,e)},subscriptionLeave:e=>{An($n.subscription_leave,e)}},eli={loginClick:()=>{An("login_button_click"),rN("LOGIN_CLICK")},signupClick:()=>{An("signup_button_click"),rN("L7glCNOgp6AbEKCbipZB")},startCreatingClick:()=>{An("start_creating_button_click"),rN("START_CREATING_CLICK")},blankProjectClick:()=>{An("blank_project_button_click"),rN("START_CREATING_CLICK")},proCreatorSubscription:()=>{An("procreator_subscription_click"),rN("ex2vCLiYwp8bEKCbipZB")}},{getState:gDe}=Qi,kvn=e=>{const{graphType:t,...r}=e;return{chartType:t||"",...r}},Bvn=e=>{const{graphType:t="",counterValue:r=0,columnName:n="",metric:i="",prefix:a="",suffix:o="",label:s="",title:l="",decimal:u=""}=e;return{chartType:t,counterValue:r,columnName:n,metric:i,prefix:a,suffix:o,label:s,title:l,decimal:u}},Vct=e=>{var g,m,y,b,w,T;const{graphType:t,graphMeta:r}=e,{axis:n,dateFormat:i,legendEnabled:a,sliderEnabled:o,metricEnabled:s}=r||{},{x:l,y:u,seriesField:c,...f}=n||{};if(t===Fc.table)return kvn(e);if(t===Fc.counter)return Bvn(e);const d={},h={title:((g=u==null?void 0:u.labelName)==null?void 0:g.toUpperCase())||((m=u==null?void 0:u.columnName)==null?void 0:m.toUpperCase())},p={title:((y=l==null?void 0:l.labelName)==null?void 0:y.toUpperCase())||((b=l==null?void 0:l.columnName)==null?void 0:b.toUpperCase())};return i&&(p.dateFormat=i),l!=null&&l.tickLayout&&(p.tickLayout=l.tickLayout),l!=null&&l.spacing&&(p.spacing=l.spacing),l!=null&&l.unformatted&&(p.unformatted=l.unformatted),u!=null&&u.spacing&&(h.spacing=u.spacing),u!=null&&u.unformatted&&(h.unformatted=u.unformatted),u!=null&&u.position&&(h.position=u.position),u!=null&&u.metric&&(h.metric=u.metric),Object.keys(f).forEach((R,N)=>{var A,L;d[`y${N+1}Field`]={value:f[R].columnName||"",chartType:f[R].graphType||"",yAxisIndex:f[R].yAxisIndex},h[`y${N+1}Title`]=((A=f[R])==null?void 0:A.labelName)||((L=f[R])==null?void 0:L.columnName)}),{chartType:t||"",fields:{xField:((w=l==null?void 0:l.columnName)==null?void 0:w.toUpperCase())||"",yField:((T=u==null?void 0:u.columnName)==null?void 0:T.toUpperCase())||"",seriesField:(c==null?void 0:c.columnName)||null,...d,xAxisData:{...p},yAxisData:{...h},legendEnabled:a||"",sliderEnabled:o||"",metricEnabled:s||""}}},{getState:TI,setState:Fn}=Do,tli=(e,t,r)=>{let n="";const{chartFields:i}=TI();t==="xField"||t==="yField"?n="title":t==="y1Field"&&(n="y1Title"),Fn({chartFields:{...i,...Odn(i,e,n,(r==null?void 0:r.toString())||""),[t]:r}})},rli=(e,t,r)=>{const{chartType:n}=r,{xField:i,yField:a,axisLabels:o,...s}=r.fields||{},l=r.fields||{},u=Dr.keys(s),c=[];u.forEach(f=>{const d={fieldId:f,inputType:"field-dropdown",label:f.replaceAll("Field","-axis"),required:!1};c.push(d)}),n===Fc.counter?Fn({visualId:e,queryId:t,chartType:n,counterFields:r}):n===Fc.table?Fn({visualId:e,queryId:t,chartType:n,tableFields:r}):Fn({visualId:e,queryId:t,chartType:n,extraChartSeries:c,chartFields:l})},nli=e=>{Fn({selectedChartDetails:e})},ili=e=>{Fn({chartType:e})},ali=e=>{Fn({chartFields:e})},oli=e=>{Fn({tableFields:e})},sli=e=>{Fn({counterFields:e})},Wct=e=>{const{chart:t,type:r,metadata:n}=e,{chartType:i,fields:a}=t||e,{xField:o,yField:s,xAxisData:l,yAxisData:u,seriesField:c,legendEnabled:f,sliderEnabled:d,metricEnabled:h,...p}=a||{},g={};if(r===tc.TABLE)return{...n,graphType:"table"};if(r===tc.COUNTERCARD)return{...n,graphType:"counter"};Object.keys(p).forEach((y,b)=>{g[`y${b+1}`]={axisType:"",columnName:p[y].value||"",graphType:p[y].chartType||"",yAxisIndex:p[y].yAxisIndex,labelName:u&&b===0?u==null?void 0:u.y1Title:""}});const m=c&&{seriesField:{columnName:c}};return{graphType:i||"",graphMeta:{axis:{x:{axisType:"",columnName:o||"",labelName:l&&(l==null?void 0:l.title)||o||"",spacing:l&&(l==null?void 0:l.spacing),tickLayout:l&&(l==null?void 0:l.tickLayout),unformatted:l&&(l==null?void 0:l.unformatted)},y:{axisType:"",columnName:s||"",labelName:u&&(u==null?void 0:u.title)||s||"",spacing:u&&(u==null?void 0:u.spacing),position:u&&(u==null?void 0:u.position),metric:u&&(u==null?void 0:u.metric),unformatted:u&&(u==null?void 0:u.unformatted)},...g,...m},dateFormat:l&&(l==null?void 0:l.dateFormat)||"",numberFormat:"",legendEnabled:f||"",sliderEnabled:d||"",metricEnabled:h||"",showDataLabels:!1}}},Uve=e=>{if(e&&(e!=null&&e.metadata)){let{metadata:t}=e;t=t?JSON.parse(t):{},t=Vct(t);const r={...e,metadata:t};Fn({selectedChartDetails:r})}},lli=async(e,t,r="false",n)=>{var R;const i=SI(),{queryResult:a,isMaterializedViewChecked:o,savedQueryIdDetails:s}=TI(),{chartName:l,chartTags:u,chartDescription:c,type:f,queryName:d,viewName:h,refreshInterval:p}=t,g=Wct(t),m=ro.getState().userId,{data:y={}}=s,{slug:b,queryText:w}=y;let{id:T=""}=y;if((R=Object.keys(s==null?void 0:s.data))!=null&&R.length){let{metadata:N}=s.data;const{scope:A,userId:L="",apiAlert:O}=s.data;if((N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(N=JSON.stringify({sourceNetwork:n})),!T||r==="true"){const I={metadata:N||"",...sH(u),description:c||"",name:d||"Untitled Query",scope:A,queryText:w,visibility:Ts.private},{data:$,error:F}=await _t.createQuery(I);if(F)throw lr(F||"",O),F;T=$==null?void 0:$.id}else if(L!==m){const{data:I,error:$}=await _t.forkQuery(b);if($)throw lr($||"",O),$;I!=null&&I.id&&(T=(I==null?void 0:I.id)||"")}}if(o&&T){const N=await M4n(h,T,p),{data:A,error:L}=N||{};if(A){const{data:O}=await _t.getQuery(T,!0);await awe(O||{});const I={queryId:T,name:l,visualType:f,...sH(u),description:c||"",metadata:JSON.stringify(g)};let $=null;if(e?(I.id=e,$=await _t.updateVisual(e,I)):$=await _t.saveVisual(I),Fn({chartState:kw.loading}),$!=null&&$.data){J1e(),e?(Io.visualizationUpdated({vizId:e,vizName:(I==null?void 0:I.name)||"",vizType:(I==null?void 0:I.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_UPDATED_SUCCESS(Kp[f]))},300)):(Io.visualizationCreated({vizId:$==null?void 0:$.data,vizName:(I==null?void 0:I.name)||"",vizType:(I==null?void 0:I.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_SAVED_SUCCESS(Kp[f]))},300));const{data:F}=$;F&&Uve(F),Xs(T,{data:a.items,columns:a.fieldsMetadata,warning:!1,error:!1,message:!1,filteredDataFrames:a.filteredDataFrames,dataframesObject:a.dataframesObject,dataFrames:a.dataFrame}),Fn({chartState:kw.saved});const D=cL[f]||cL.GRAPH;i==null||i.push(`${Nc.charts}?activeTab=${D}&visualType=${f}&widgetTypeEnum=${f}`)}else $!=null&&$.error&&(lr($==null?void 0:$.error),Fn({chartState:kw.error}))}L&&lr(L||"Something went wrong")}else{const N={queryId:T,name:l,visualType:f,...sH(u),description:c||"",metadata:JSON.stringify(g)};let A=null;if(e?(N.id=e,A=await _t.updateVisual(e,N)):A=await _t.saveVisual(N),Fn({chartState:kw.loading}),A!=null&&A.data){J1e(),e?(Io.visualizationUpdated({vizId:e,vizName:(N==null?void 0:N.name)||"",vizType:(N==null?void 0:N.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_UPDATED_SUCCESS(Kp[f]))},300)):(Io.visualizationCreated({vizId:A==null?void 0:A.data,vizName:(N==null?void 0:N.name)||"",vizType:(N==null?void 0:N.visualType)||"",timestamp:Date.now()}),setTimeout(()=>{kn(xe.WIDGET_SAVED_SUCCESS(Kp[f]))},300));const{data:L}=A;L&&Uve(L),Xs(T,{data:a.items,columns:a.fieldsMetadata,warning:!1,error:!1,message:!1,filteredDataFrames:a.filteredDataFrames,dataframesObject:a.dataframesObject,dataFrames:a.dataFrame}),Fn({chartState:kw.saved});const O=cL[f]||cL.GRAPH;i==null||i.push(`${Nc.charts}?activeTab=${O}&visualType=${f}&widgetTypeEnum=${f}`)}else A!=null&&A.error&&(lr(A==null?void 0:A.error),Fn({chartState:kw.error}))}},uli=async(e,t,r,n)=>{const{selectedChartDetails:i}=TI();try{Fn({confirmDialogLoading:!0});const{status:a,error:o}=await _t.deleteVisual(e);a===204?(Io.visualizationDeleted({vizId:e,vizName:n||"",vizType:t||"",timestamp:Date.now()}),kn(xe.WIDGET_DELETED_SUCCESS(Kp[t])),(i==null?void 0:i.id)===e&&Fn({selectedChartDetails:null}),r()):lr(o||"")}catch(a){lr((a==null?void 0:a.message)||"")}finally{Fn({confirmDialogLoading:!1})}},Uvn=e=>e===Ts.subscription?Zbe.myOrgVisuals:(e===Ts.private,"GRAPH"),cli=async(e,t,r)=>{try{Fn({confirmDialogLoading:!0});const{selectedChartDetails:n,userSetVisibility:i}=TI(),a=SI(),o=()=>i===Ts.public?{slug:r,visibility:i}:{visibility:i},s=cs.stringify(o()),{status:l,error:u}=await _t.publishVisual(e,s);if(l===204)Io.visualizationPublished({vizId:e,vizName:(n==null?void 0:n.name)||"",vizType:t||"",slug:r,timestamp:Date.now()}),kn(xe.WIDGET_PUBLISH_SUCCESS(Kp[t])),Fn({selectedChartDetails:{...n,visibility:i},confirmDialogLoading:!1}),a==null||a.push(J1.charts(Uvn(i)));else return u&&lr(u),xe.RESPONSE_ERROR_STATUS;return xe.RESPONSE_SUCCESS_STATUS}catch(n){return lr(n==null?void 0:n.message),xe.RESPONSE_ERROR_STATUS}finally{Fn({confirmDialogLoading:!1})}},fli=async(e,t)=>{try{const{data:r,status:n,error:i}=await _t.getVisual(e,t)||{};Dr.isEmpty(r)?Fn({selectedChartDetailsError:xe.RECORD_NOT_FOUND,chartDetailStatus:n}):(Uve(r),Fn({selectedChartDetailsError:void 0})),i&&Fn({selectedChartDetailsError:i,chartDetailStatus:n})}catch{}},dli=(e,t,r,n)=>{const{chartFields:i}=TI(),a={...i[e]};n&&(a.chartType=n==null?void 0:n.replace("_chart","")),a[t]=r,Fn({chartFields:{...i,[e]:{...a}}})},hli=()=>{Fn({visualId:"",queryId:"",chartType:"",counterFields:{},queryResult:{},extraChartSeries:[],chartFields:{},savedQueryIdDetails:{}})},pli=e=>{Fn({extraChartSeries:[...e]})},vli=async(e,t)=>{var f,d,h,p;const{queriesResult:r}=gDe(),{queryId:n,referencedResources:i,authorizationResources:a,requiresAuthorization:o}=t;if((d=(f=r[n])==null?void 0:f.data)!=null&&d.length)return Fn({queryResult:{...r[n],items:r[n].data,fieldsMetadata:r[n].columns||[]}}),null;Fn({queryRunning:!0});let s={data:null};const{biscuitList:l}=gDe(),u=NI(l,QX({resources:o?a:i}));try{s=await _t.executeQuery({queryId:n,biscuits:u},((h=r[n])==null?void 0:h.visibility)===Ts.public?!1:e)}catch{}const c=((p=s==null?void 0:s.data)==null?void 0:p.error)||(s==null?void 0:s.error);if(c)return Fn({queryError:c==null?void 0:c.title,queryRunning:!1,loading:!1,chartLoading:!1});if(s.data){const g=YT(s==null?void 0:s.data);Fn({queryResult:g,queryRunning:!1,loading:!1,chartLoading:!1}),Xs(n,{data:g.items,columns:g.fieldsMetadata,warning:!1,error:!1,message:!1,filteredDataFrames:g.filteredDataFrames,dataframesObject:g.dataframesObject,dataFrames:g.dataFrame})}return!1},gli=()=>{Fn({queryResult:[],columns:[],loading:!0})},mli=e=>{Fn({loading:e})},yli=()=>{Fn({...kct})},Eli=async(e,t,r)=>{try{const{data:n}=await _t.getQuery(e,t);if(Fn(n?{savedQueryIdDetails:{data:n},queryId:e}:{savedQueryIdDetails:{error:xe.RECORD_NOT_FOUND}}),r)return(n==null?void 0:n.name)||""}catch(n){if(Fn({savedQueryIdDetails:{error:n}}),r)return""}return""},bli=async(e,t,r,n,i)=>{const{data:a}=await _t.getDashboardById(e==null?void 0:e.id,r),{data:o}=await _t.getDashboardVisualsContent(e==null?void 0:e.id,r),s=a&&JSON.stringify(Kht(a,o||[],n)),l=o==null?void 0:o.map(f=>({visualId:f.id,metadata:f.dashboardVisualMetadata})),u=Dr.map(o,f=>f.id);if(!!t&&u.includes(t))return lr(xe.WIDGET_ALREADY_PRESENT);try{const{data:f,error:d="",apiAlert:h}=await _t.putDashboardVisuals(e==null?void 0:e.id,[{visualId:t,metadata:s},...l]);return f?(kn(xe.WIDGET_PINNED_TO_DASHBOARD),ert(()=>_t.getDashboardVisualsContent(e==null?void 0:e.id,r)),i(!0),!1):lr(d,h)}catch(f){let d="Unknown Error";return f instanceof Error&&(d=f.message),lr(d)}},_li=e=>{Fn({queryResult:e})},Sli=e=>{const{viewModal:t}=TI();if(typeof e=="function"){const r=e(t);Fn({viewModal:r})}else Fn({viewModal:{...t,...e}})},wli=e=>{Fn({isCounterDecimal:e})},Tli=e=>{Fn({userSetVisibility:e})},Ali=e=>{Fn({isMaterializedViewChecked:e})},Cli=e=>{Fn({isAutoRefreshedVisual:e})},Rli=async e=>{try{const{status:t,error:r}=await _t.forkVisual(e);if(t===201)return kn(xe.VISUAL_CLONE_SUCCESS),xe.RESPONSE_SUCCESS_STATUS;if(r)return lr(r),xe.RESPONSE_ERROR_STATUS}catch(t){lr((t==null?void 0:t.message)||"")}return""},xli=e=>{Fn({isFork:e})},{getState:Ns,setState:br}=Ei,KSe=e=>{br({layouts:e})},sP=Do.setState,Fvn=async(e,t,r,n,i)=>{const{loadLayout:a}=Ns(),o=t[n-1]||[];(zht(r,t[n]||[]).filter(l=>{var u,c,f,d,h;return((u=l.x)==null?void 0:u.toString())||((c=l.y)==null?void 0:c.toString())||((f=l.i)==null?void 0:f.toString())||((d=l.h)==null?void 0:d.toString())||((h=l.w)==null?void 0:h.toString())||l.name}).length>0||i)&&(a&&!i&&(e.pop(),await br({loadLayout:!1})),o.length>0&&o.length>r.length&&!i&&(e.pop(),await br({layoutStates:e})),e.push(r),await br({layoutStates:e,layoutStateIndex:e.length-1}))},FT=(e,t=!1)=>{if(!(e!=null&&e.length)){br({layoutStates:[],layoutStateIndex:0});return}const{layoutStates:r,layoutStateIndex:n}=Ns();let i=[];const a=e.sort((o,s)=>Number(o.i)-Number(s.i));i=r.slice(0,n+1),Fvn(i,r,a,n,t)},Hvn=e=>{br({layoutStates:[e],layoutStateIndex:0})},Ili=async()=>{const{layoutStateIndex:e}=Ns();await br({layoutStateIndex:Math.max(0,Number(e)-1)})},Oli=async()=>{const{layoutStates:e,layoutStateIndex:t}=Ns();await br({layoutStateIndex:Math.min(e.length,t+1)})},jct=e=>{br({isSetAsHome:{...e}})},Gvn=async(e,t,r,n)=>{const i=SI(),{settings:a,userName:o,displayName:s,emailAddress:l,bio:u}=r,f={...a?JSON.parse(a):{},dashboardHomeId:t},d=JSON.stringify(f),h={userId:e,userName:o||null,displayName:s||null,emailAddress:l||null,bio:u,settings:d};try{await sft(e,h)===xe.RESPONSE_SUCCESS_STATUS&&(kn(n),Hvn([]),await D1n(e),t&&(jct({[t]:!0}),i==null||i.push({pathname:Nc.landingPage,state:{id:t}})))}catch(p){lr(p==null?void 0:p.message)}},Nli=async(e,t,r)=>{const n=ro.getState().userId,{settings:i}=r||{},a=i?JSON.parse(i):{},{dashboardHomeId:o=""}=a;try{sP({confirmDialogLoading:!0});const{status:s,error:l,apiAlert:u}=await _t.deleteDashboard(e);o&&o===e&&await Gvn(n??"","",r,xe.DASHBOARD_UNSET_AS_HOME_SUCCESS),s===204?(Io.dashboardDeleted({dashId:e,timestamp:Date.now()}),kn(xe.DASHBOARD_DELETED_SUCCESS),t&&t()):lr(l||"",u)}catch(s){lr((s==null?void 0:s.message)||"")}finally{sP({confirmDialogLoading:!1})}},zct=()=>{const{visibility:e,dashboardDetail:t}=Ns();if(e)switch(e){case Ts.public:return Jm.exploreDashboard;case Ts.subscription:return Jm.myOrgDashboard;case Ts.private:return Jm.myDashboard;default:return Jm.myDashboard}else switch(t==null?void 0:t.visibility){case Ts.public:return Jm.exploreDashboard;case Ts.subscription:return Jm.myOrgDashboard;case Ts.private:return Jm.myDashboard;default:return Jm.myDashboard}},Vvn=async(e,t)=>{try{const{selectedDashboardDetails:r}=Ns(),{slug:n}=t,i=cs.stringify(t),a=SI(),{status:o,error:s,apiAlert:l}=await _t.publishDashboard(e,i);if(o===204)kn(xe.DASHBOARD_PUBLISH_SUCCESS),br({selectedDashboardDetails:{...r,visibility:(t==null?void 0:t.visibility)||"",slug:n||null}}),a==null||a.push(`${J1.dashboards(zct())}`),Io.dashboardPublished({dashId:e,dashName:r==null?void 0:r.name,slug:n||null,timestamp:Date.now()});else return lr(s||xe.SLUG_NAME_ERROR("Slug"),l),!1;return!0}catch(r){return lr(r==null?void 0:r.message),!1}},Lli=e=>{var t;br({selectedDashboardDetails:e,imgMetadata:((t=e==null?void 0:e.metadata)==null?void 0:t.customImg)||{}})},Pli=e=>{br({dashboardDetail:e})},Wvn=e=>{const t=o=>({markdown:8,row:5})[o]||1,r=o=>({markdown:4})[o]||12,n=o=>({markdown:12,row:5})[o]||1,i=o=>({markdown:12})[o]||12;return{...e,w:r(e.type),h:t(e.type),x:e.x||0,y:e.y||0,minH:1,minW:3,maxH:n(e.type),maxW:i(e.type),isResizable:e.type==="markdown"}},Yct=e=>e.metadata.chartType===Kp.COUNTERCARD.toLowerCase()?6:8,ZSe=e=>e.metadata.chartType===Kp.COUNTERCARD.toLowerCase()?6:(e==null?void 0:e.type)==="divider"?1:8,qct=e=>e.metadata.chartType===Kp.COUNTERCARD.toLowerCase()?5:6,QSe=e=>e.metadata.chartType==="counter"?8:(e==null?void 0:e.type)==="divider"?1:12,JSe=e=>e.metadata.chartType==="counter"?7:12,Mli=e=>{FT([{...e,w:qct(e),h:Yct(e),x:e.x||0,y:e.y||0,minH:ZSe(e),minW:4,maxH:QSe(e),maxW:JSe(e)}])},Dli=(e,t,r)=>{const{layoutStateIndex:n,layoutStates:i}=Ns(),a=i[n]||[],o=a==null?void 0:a.map(s=>({...s,x:t[s.i].x,y:t[s.i].y}));r?Dr.isEmpty(Dr.filter(a,s=>s.visualId===e.visualId))&&FT([...o,{...e,w:qct(e),h:Yct(e),x:e.x||0,y:e.y||0,minH:ZSe(e),minW:4,maxH:QSe(e),maxW:JSe(e)}]):FT([...o,Wvn(e)])},$li=e=>{const{layoutStates:t,layoutStateIndex:r}=Ns(),n=[...t[r]];Dr.remove(n,a=>a.i.toString()===(e==null?void 0:e.toString()));const i=n.map((a,o)=>({...a,i:o.toString()}));FT([...i],!0)},kli=()=>{KSe([]),br({layoutStates:[],layoutStateIndex:0})},jvn=async e=>{const{dashboardVisualMetadata:t,...r}=e;if(e){const n=e.metadata&&nBe(e.metadata),i={...r,metadata:Vct(n)};return{...t&&nBe(t),...i,type:"visual"}}return{}},ewe=async e=>{const t=[];br({dashboardVisualLoading:!0});for(let n=0;n<e.length;n+=1){const i=e&&jvn(e[n]);t.push(i)}const r=await Promise.all(t);return r&&br({dashboardVisualLoading:!1}),r},Xct=e=>{br({dashboardVisualsContent:e})},Bli=async(e,t,r,n)=>{var i;try{br({dashboardViewLoading:!0,dashboardDetailLoading:!0,dashboardAllVisualsLoading:!0,dashboardDetailError:void 0});const{data:a,error:o,status:s}=await _t.getDashboardById(e,t,r);if(Dr.isEmpty(a)||br({dashboardDetail:null,dashboardDetailError:xe.RECORD_NOT_FOUND,dashboardDetailStatus:s}),a){if(a.visibility==="public"&&t===!0){const u=await _t.getDashboardFilteredByMyLikes(t);u!==void 0&&u.data&&Array.isArray(u.data)&&(a.liked=u.data.indexOf(a==null?void 0:a.id)>-1)}const l=(a==null?void 0:a.metadata)&&JSON.parse(a.metadata)||[];if(br({dashboardDetail:a,dashboardDetailLoading:!1,imgMetadata:(l==null?void 0:l.customImg)||{}}),a){const{data:u}=await _t.getDashboardVisualsContent(a==null?void 0:a.id,t);Xct(u||[]);let f=[...(u==null?void 0:u.length)&&await ewe(u||[])||[]];(i=l==null?void 0:l.components)!=null&&i.length&&f.push(...l.components),f=Dr.reject(f,d=>Dr.isEmpty(d)),f=f.map((d,h)=>(d.i=h.toString(),d)),f=f==null?void 0:f.sort((d,h)=>d.i-h.i),KSe([...f]),FT([...f]),br({loadLayout:!0,savedLayouts:[...f],dashboardViewLoading:!1,dashboardAllVisualsLoading:!1,dashboardDetailError:void 0})}br({dashboardViewLoading:!1,dashboardDetailLoading:!1,dashboardAllVisualsLoading:!1})}o&&(br({dashboardViewLoading:!1,dashboardDetailLoading:!1,dashboardDetailError:o,dashboardDetailStatus:s}),n&&n()),s===404&&n&&n()}catch{}finally{br({dashboardViewLoading:!1,dashboardDetailLoading:!1})}return null};async function zvn(e){br({chatGPTResult:e})}const Uli=e=>{br({dashDqlRunCount:e})};async function Yvn(e,t,r,n){var a,o,s;const i={prompt:e,metadata:{context:r,error:n}};br({isChatGPTLoading:!0,chatGptPrompt:e});try{const l=await _t.postGPT(i,t);(l==null?void 0:l.error)===xe.QUERY_PROMPT_ABORT&&lr(xe.QUERY_PROMPT_ABORT),l!=null&&l.data&&br({isChatGPTLoading:!1,chatGPTResult:(a=l==null?void 0:l.data)==null?void 0:a.SQL,chatGPTContext:(s=(o=l==null?void 0:l.data)==null?void 0:o.metadata)==null?void 0:s.context,chatGPTError:""}),l!=null&&l.error&&(l==null?void 0:l.error)!==xe.QUERY_PROMPT_ABORT&&br({chatGPTError:l==null?void 0:l.error})}catch(l){console.error(l)}finally{br({isChatGPTLoading:!1})}}function Fli(){const{isErrOpen:e}=Ns();br({isErrOpen:!e})}function qvn(e){br({isErrOpen:e})}const Hli=async(e,t,r,n,i,a,o)=>{var h,p,g,m,y;e=qht(e),n||br({isRunning:!0});const{dashDqlRunCount:s,chatGPTResult:l,chatGPTContext:u}=Ns(),{resourceId:c="ETH:BLOCK"}=t?Yht(e,t):{};let f={data:null};const d=new Date;try{const b={sqlText:e.trimEnd(),validate:!0,...o};f=await _t.executeSQL(b,r,n);const{data:w,error:T,status:R}=f,N=(w==null?void 0:w.error)||T;if(w&&R===200){(w==null?void 0:w.length)===0&&br({isEmptyRowCount:!0});const A=f==null?void 0:f.data;f={data:{error:null,response:YT(f.data),successStatus:0}};const L=new Date-d;if(n)return{success:{queryResult:(h=f.data)==null?void 0:h.response,durationMs:L,rawQueryResult:A,isRunning:!1}};br({queryResult:(p=f.data)==null?void 0:p.response,durationMs:L,isRunning:!1,saveSuggestedQuery:{queryText:e.replace(/\n$/,"").trim()||"",resourceId:c||""},toggleVisTable:"table",isChartAddedToDash:[],isCounterAddedToDash:[],queryError:""})}if(R===422){const{commandType:A,requiredCapabilities:L}=N,O=Zht(L),I=NI(a,L);if(L!=null&&L.length&&Dr.isEmpty(I)&&!((g=O==null?void 0:O.create)!=null&&g.length))return YF(!0),qF(v4.permissionSecret),br({queryError:"Biscuit required",isRunning:!1});if(A.toLowerCase()==="dql"){let $={data:null,error:null};try{const F={sqlText:e.trimEnd(),resources:[c],biscuits:I,...o};$=await _t.runQuery(F,r,n);const{data:D,error:E,status:S}=$,C=(w==null?void 0:w.error)||E;if(D&&S===200){(D==null?void 0:D.length)===0&&br({isEmptyRowCount:!0});const M=f==null?void 0:f.data;f={data:{error:null,response:YT(f.data),successStatus:0}};const k=new Date-d;if(n)return{success:{queryResult:(m=f.data)==null?void 0:m.response,durationMs:k,rawQueryResult:M,isRunning:!1}};br({queryResult:(y=f.data)==null?void 0:y.response,durationMs:k,isRunning:!1,saveSuggestedQuery:{queryText:e.replace(/\n$/,"").trim()||"",resourceId:c||""},toggleVisTable:"table",isChartAddedToDash:[],isCounterAddedToDash:[],queryError:""})}if(C)return C===xe.NETWORK_ERROR?br({queryError:C,isRunning:!1}):n?{error:{queryError:C,isRunning:!1}}:(C===xe.QUERY_ABORT&&lr(xe.QUERY_PROMPT_ABPRT),br({queryError:C,isRunning:!1}))}catch{}}}if(N)return N===xe.NETWORK_ERROR?br({queryError:N,isRunning:!1}):(s<3&&l&&N!==xe.QUERY_ABORT?(zvn(""),qvn(!1),Yvn(i,r,u,N==null?void 0:N.detail)):s>=3&&N!==xe.QUERY_ABORT&&lr(xe.NLP_MESSAGE),n?{error:{queryError:N,isRunning:!1}}:(N===xe.QUERY_ABORT&&lr(xe.QUERY_PROMPT_ABPRT),br({queryError:N,isRunning:!1})))}catch(b){console.error("An error occurred for dashboard sql api:",b),br({queryError:b||"",isRunning:!1})}return null},Xvn=async(e,t)=>{var l;const{id:r,metadata:n}=e,{dashboardVisualsContent:i}=Ns(),a=n&&JSON.parse(n)||[],o=JSON.stringify(Kht(e,i)),s=i==null?void 0:i.map(u=>({visualId:u.id,metadata:u.dashboardVisualMetadata}));try{br({widgetsDashLoader:!0});const{data:u,error:c="",apiAlert:f}=await _t.putDashboardVisuals(r,[{visualId:t,metadata:o},...s]),{data:d}=await _t.getDashboardVisualsContent(r,!0);if(u&&d){Xct(d),kn(xe.WIDGET_ADDED),br({isWidgetConfigSet:!1,chatGPTResult:""});let p=[...d&&await ewe(d)||[]];(l=a==null?void 0:a.components)!=null&&l.length&&p.push(...a.components),p=p.map((g,m)=>(g.i=m.toString(),g)),p=p==null?void 0:p.sort((g,m)=>g.i-m.i),KSe([...p]),FT([...p]),br({loadLayout:!0,savedLayouts:[...p],widgetsDashLoader:!1,dashboardDetailError:void 0})}return lr(c,f)}catch(u){let c="Unknown Error";return u instanceof Error&&(c=u.message),lr(c)}finally{br({widgetsDashLoader:!1})}},Gli=async e=>{const{type:t,name:r,description:n}=e,{saveSuggestedQuery:i,dashboardDetail:a}=Ns(),{queryId:o}=i,s=Wct(e),l={queryId:o,name:r,visualType:t,description:n||"",metadata:JSON.stringify(s)},u=await _t.saveVisual(l),{data:c}=u;c!=null&&c.id&&(kn(xe.WIDGET_SAVED_SUCCESS(Kp[t])),Xvn(a,c==null?void 0:c.id))},Vli=()=>{br({saveSuggestedQuery:{queryText:"",resourceId:"",queryId:""}})},Wli=async e=>{const{saveSuggestedQuery:t}=Ns(),r={...t,...e};if(!(t!=null&&t.queryId)){const{data:n,error:i,apiAlert:a}=await _t.createQuery(r);if(i){lr(i,a);return}n&&(br({saveSuggestedQuery:{queryId:n.id||""}}),kn(xe.QUERY_SAVED_SUCCESS))}},jli=()=>{br({isWidgetConfigSet:!1,isCounterAddedToDash:[]})},zli=(e,t,r)=>{const{saveSuggestedQuery:n,isCounterAddedToDash:i}=Ns(),{queryId:a}=n;sP({visualId:a||"",queryId:a,chartType:Fc.counter,counterFields:e,queryResult:t}),br({isWidgetConfigSet:!0,isCounterAddedToDash:[...i,r]})},Yli=(e,t,r)=>{const{saveSuggestedQuery:n,isChartAddedToDash:i}=Ns(),{queryId:a}=n,{type:o,config:s}=e,{xField:l,yField:u,xAxisData:c,yAxisData:f,axisLabels:d,seriesField:h,legendEnabled:p,sliderEnabled:g,...m}=s.configItem||{},y=Dr.keys(m),b={xField:s.xField||s.colorField,yField:s.yField||s.angleField};s.axisLabels&&(b.axisLabels=s.axisLabels);const w=[];return!h&&y.forEach(T=>{b[T]={value:typeof m[T]=="object"?m[T].value:m[T],chartType:typeof m[T]=="object"?m[T].chartType:o==null?void 0:o.replace("_chart","")};const R={fieldId:T,inputType:"field-dropdown",label:T.replaceAll("Field","-axis"),required:!1};w.push(R)}),h&&(b.seriesField=h),b.legendEnabled=p,b.sliderEnabled=g,sP({chartType:e.type,extraChartSeries:w,chartFields:b,queryResult:t,savedQueryIdDetails:{data:t},queryId:a}),br({isWidgetConfigSet:!0,isChartAddedToDash:[...i,r]}),null};function qli(){br({queryResult:{},isRunning:!1,queryError:"",isEmptyRowCount:!1,chatGptPrompt:"",toggleVisTable:"table"})}function Xli(e){br({isOfficialDashboard:e})}function Kli(e){br({toggleVisTable:e})}const Kvn=()=>{const{layoutStates:e,layoutStateIndex:t}=Ns(),r=e[t];return Dr.partition(r,n=>!!n.visualId||n.type==="visual")},Zvn=(e,t,r)=>{Dr.isEmpty(e)?Io.dashboardUpdated({dashId:t||`${DC.uuid()}`,dashName:(r==null?void 0:r.name)||"",timestamp:Date.now()}):Io.dashboardCreated({dashId:`${DC.uuid()}`,dashName:(r==null?void 0:r.name)||"",timestamp:Date.now()})},Qvn=e=>{const{visibility:t,dashboardDetail:r}=Ns();return t===Ts.public||(r==null?void 0:r.visibility)===Ts.public?{slug:e,visibility:t||(r==null?void 0:r.visibility)}:{visibility:t||(r==null?void 0:r.visibility)}},Jvn=()=>{const{dashboardDetail:e,visibility:t,isVisibilitySet:r,slugName:n}=Ns();return r&&t===Ts.public||t===Ts.subscription||r&&(e==null?void 0:e.visibility)===Ts.subscription&&(t===Ts.private||t===Ts.public)||!r&&(e==null?void 0:e.visibility)===Ts.public&&n!==(e==null?void 0:e.slug)},Zli=async(e,t,r,n,i,a)=>{const[o,s]=Kvn(),l={...e,metadata:JSON.stringify({components:s,customImg:t,textAreaHeight:i||0})};br({dashboardLoader:!0});let u=null;try{r?u=await _t.updateDashboard(l,r):u=await _t.saveDashboard(l);const{data:c,error:f}=u||{},d=SI();if(c){const h=Dr.isEmpty(c==null?void 0:c.id)?r:c==null?void 0:c.id,p=o==null?void 0:o.map(b=>{const{h:w,maxH:T,minH:R,maxW:N,minW:A,w:L,x:O,y:I,i:$,boxHeight:F}=b;return{visualId:(b==null?void 0:b.visualId)||(b==null?void 0:b.id),metadata:JSON.stringify({i:$,h:w,maxH:T,minH:R,maxW:N,minW:A,w:L,x:O,y:I,boxHeight:F})}}),{data:g,error:m="",apiAlert:y}=await _t.putDashboardVisuals(h,p);if(br({dashboardLoader:!1}),g){let b=!0;Jvn()&&(b=await Vvn(h,Qvn(a))),Zvn(c,h,l),kn(r?xe.WIDGET_UPDATED_SUCCESS("Dashboard"):xe.DASHBOARD_SAVED_SUCCESS),setTimeout(()=>{b?n&&n(h,zct()):d&&d.push(J1.updateDashboard(h))},200)}m&&lr(m,y)}else f&&lr(f)}catch(c){lr(c.message)}finally{br({dashboardLoader:!1,slugName:""})}},e1n=(e,t)=>{if(e.type===Lnt.header){const r=t.headerWeight==="h2"?1.4:1;e.h=t.headerWeight==="h1"?1.6:r}},Qli=(e,t)=>{var s;const{layoutStates:r,layoutStateIndex:n}=Ns(),i=r[n],a=i.map(l=>l.id===e.id?(e1n(l,t),{...l,metadata:t}):l),o=(s=i.find(l=>l.i===e.i))==null?void 0:s.metadata;if(!Dr.isEmpty(zht(t,o))){const l=r.slice(0,n+1);l.push(a),br({layoutStates:l,layoutStateIndex:l.length-1})}},Jli=async e=>{const{layoutStateIndex:t,layoutStates:r}=Ns(),n=r[t]||[],i=n.find(o=>o.i==="__dropping-elem__"),a=n.map((o,s)=>{var l,u;return{...o,...e[s],maxH:o.maxH||((l=e[s])==null?void 0:l.maxH),maxW:o.maxW||((u=e[s])==null?void 0:u.maxW)}});if(i){const o=r;o.pop(),await br({layoutStates:o})}FT([...a])},eui=e=>{br({dragItem:e})},tui=()=>{br({dashboardDetail:null,imgMetadata:{chartColors:[],chartBackground:[],imgUrl:"",useImgColors:!1,titleColor:""}})},rui=async(e,t)=>{var a;const r=e.metadata&&(typeof e.metadata=="object"?e.metadata:JSON.parse(e.metadata))||[];let i=[...t&&await ewe(t)||[]];return(a=r==null?void 0:r.components)!=null&&a.length&&i.push(...r.components),i=Dr.reject(i,o=>Dr.isEmpty(o)),i=i==null?void 0:i.sort((o,s)=>Number(o.i)-Number(s.i)),i},nui=e=>{br({breakPoint:e})},iui=()=>{br({loadLayout:!1})},aui=e=>{br({infoView:e})},oui=e=>{const{imgMetadata:t}=Ns();br({imgMetadata:{...t,useImgColors:e}})},sui=(e,t,r,n)=>{const{imgMetadata:i}=Ns();br({imgMetadata:{...i,chartColors:e,chartBackground:t,imgUrl:r,titleColor:n}})},lui=()=>{br({imgMetadata:{chartColors:[],chartBackground:[],imgUrl:"",useImgColors:!1,titleColor:""}})},uui=()=>{br({isChartAddedToDash:[],isCounterAddedToDash:[],isTableAddedToDash:!1})},cui=e=>{br({slugName:e})},fui=e=>{br({isVisibilitySet:e})},dui=e=>{br({slugNameError:e})},hui=e=>{const{saveSuggestedQuery:t}=Ns(),{queryId:r=""}=t;sP({visualId:r,queryId:r,chartType:Fc.table,queryResult:e}),br({isWidgetConfigSet:!0,isTableAddedToDash:!0})},pui=e=>{br({isUnsavedChangesDash:e})},vui=e=>{br({visibility:e})},gui=async e=>{try{const{status:t,error:r,apiAlert:n}=await _t.forkDashboard(e);if(t===201)return kn(xe.DASHBOARD_CLONE_SUCCESS),xe.RESPONSE_SUCCESS_STATUS;if(r)return lr(r,n),xe.RESPONSE_ERROR_STATUS}catch(t){lr((t==null?void 0:t.message)||"")}return""},mui=e=>{br({isForkDashboard:e})},yui="https://azuremarketplace.microsoft.com/en-us/marketplace/apps/spaceandtimelabsinc1674586360724.spaceandtimedb?tab=PlansAndPrice",Kct="https://azuremarketplace.microsoft.com/view/appPricing/spaceandtimelabsinc1674586360724.spaceandtimedb/us?ReviewsMyCommentsFilter=true",Eui=[{label:"Subscription ID",dataKey:"subscriptionId",width:310},{label:"Provider",dataKey:"provider",width:310},{label:"Amount",dataKey:"amount",width:120},{label:"Currency",dataKey:"currency",width:120},{label:"Date & Time",dataKey:"timestamp",width:180}],bui={iconStyle:"solid",showIcon:!0,style:{base:{color:ss.custom.white.A1,fontFamily:ss.typography.fontFamily,fontSize:ss.custom.fontSize.font12,fontSmoothing:"antialiased",":-webkit-autofill":{color:"black"},"::placeholder":{color:"#b2b3bdcc"}},invalid:{color:ss.custom.red}}},_ui={iconStyle:"solid",showIcon:!0,style:{base:{color:ss.custom.white.A1,fontFamily:ss.typography.fontFamily,fontSize:ss.custom.fontSize.font12,fontSmoothing:"antialiased",":-webkit-autofill":{color:"black"},"::placeholder":{color:"#b2b3bdcc"}},invalid:{color:ss.custom.red}}},Sui=[{id:"faq1",ques:"What will I be charged for?",ans:`Regardless of which pricing model you choose, you only
|
|
18383
18383
|
pay for compute. Storage, indexed blockchain data, the
|
|
18384
18384
|
Space and Time Studio, the API gateway, and more are
|
|
18385
18385
|
always included. When you choose Pay per Compute, you
|