graz 0.0.42-alpha.2 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var ns=Object.create;var ge=Object.defineProperty;var rs=Object.getOwnPropertyDescriptor;var ss=Object.getOwnPropertyNames;var is=Object.getPrototypeOf,os=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),as=(t,e)=>{for(var n in e)ge(t,n,{get:e[n],enumerable:!0})},$t=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ss(e))!os.call(t,s)&&s!==n&&ge(t,s,{get:()=>e[s],enumerable:!(r=rs(e,s))||r.enumerable});return t};var Le=(t,e,n)=>(n=t!=null?ns(is(t)):{},$t(e||!t||!t.__esModule?ge(n,"default",{value:t,enumerable:!0}):n,t)),cs=t=>$t(ge({},"__esModule",{value:!0}),t);var oe=g((Dc,Kt)=>{var Us="2.0.0",Bs=Number.MAX_SAFE_INTEGER||9007199254740991,ks=16,Ms=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Kt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:ks,MAX_SAFE_INTEGER:Bs,RELEASE_TYPES:Ms,SEMVER_SPEC_VERSION:Us,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ae=g((Pc,zt)=>{var Ws=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};zt.exports=Ws});var Y=g((F,Vt)=>{var{MAX_SAFE_COMPONENT_LENGTH:nt}=oe(),Qs=ae();F=Vt.exports={};var Ks=F.re=[],l=F.src=[],p=F.t={},zs=0,y=(t,e,n)=>{let r=zs++;Qs(t,r,e),p[t]=r,l[r]=e,Ks[r]=new RegExp(e,n?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*");y("NUMERICIDENTIFIERLOOSE","[0-9]+");y("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");y("MAINVERSION",`(${l[p.NUMERICIDENTIFIER]})\\.(${l[p.NUMERICIDENTIFIER]})\\.(${l[p.NUMERICIDENTIFIER]})`);y("MAINVERSIONLOOSE",`(${l[p.NUMERICIDENTIFIERLOOSE]})\\.(${l[p.NUMERICIDENTIFIERLOOSE]})\\.(${l[p.NUMERICIDENTIFIERLOOSE]})`);y("PRERELEASEIDENTIFIER",`(?:${l[p.NUMERICIDENTIFIER]}|${l[p.NONNUMERICIDENTIFIER]})`);y("PRERELEASEIDENTIFIERLOOSE",`(?:${l[p.NUMERICIDENTIFIERLOOSE]}|${l[p.NONNUMERICIDENTIFIER]})`);y("PRERELEASE",`(?:-(${l[p.PRERELEASEIDENTIFIER]}(?:\\.${l[p.PRERELEASEIDENTIFIER]})*))`);y("PRERELEASELOOSE",`(?:-?(${l[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[p.PRERELEASEIDENTIFIERLOOSE]})*))`);y("BUILDIDENTIFIER","[0-9A-Za-z-]+");y("BUILD",`(?:\\+(${l[p.BUILDIDENTIFIER]}(?:\\.${l[p.BUILDIDENTIFIER]})*))`);y("FULLPLAIN",`v?${l[p.MAINVERSION]}${l[p.PRERELEASE]}?${l[p.BUILD]}?`);y("FULL",`^${l[p.FULLPLAIN]}$`);y("LOOSEPLAIN",`[v=\\s]*${l[p.MAINVERSIONLOOSE]}${l[p.PRERELEASELOOSE]}?${l[p.BUILD]}?`);y("LOOSE",`^${l[p.LOOSEPLAIN]}$`);y("GTLT","((?:<|>)?=?)");y("XRANGEIDENTIFIERLOOSE",`${l[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);y("XRANGEIDENTIFIER",`${l[p.NUMERICIDENTIFIER]}|x|X|\\*`);y("XRANGEPLAIN",`[v=\\s]*(${l[p.XRANGEIDENTIFIER]})(?:\\.(${l[p.XRANGEIDENTIFIER]})(?:\\.(${l[p.XRANGEIDENTIFIER]})(?:${l[p.PRERELEASE]})?${l[p.BUILD]}?)?)?`);y("XRANGEPLAINLOOSE",`[v=\\s]*(${l[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[p.XRANGEIDENTIFIERLOOSE]})(?:${l[p.PRERELEASELOOSE]})?${l[p.BUILD]}?)?)?`);y("XRANGE",`^${l[p.GTLT]}\\s*${l[p.XRANGEPLAIN]}$`);y("XRANGELOOSE",`^${l[p.GTLT]}\\s*${l[p.XRANGEPLAINLOOSE]}$`);y("COERCE",`(^|[^\\d])(\\d{1,${nt}})(?:\\.(\\d{1,${nt}}))?(?:\\.(\\d{1,${nt}}))?(?:$|[^\\d])`);y("COERCERTL",l[p.COERCE],!0);y("LONETILDE","(?:~>?)");y("TILDETRIM",`(\\s*)${l[p.LONETILDE]}\\s+`,!0);F.tildeTrimReplace="$1~";y("TILDE",`^${l[p.LONETILDE]}${l[p.XRANGEPLAIN]}$`);y("TILDELOOSE",`^${l[p.LONETILDE]}${l[p.XRANGEPLAINLOOSE]}$`);y("LONECARET","(?:\\^)");y("CARETTRIM",`(\\s*)${l[p.LONECARET]}\\s+`,!0);F.caretTrimReplace="$1^";y("CARET",`^${l[p.LONECARET]}${l[p.XRANGEPLAIN]}$`);y("CARETLOOSE",`^${l[p.LONECARET]}${l[p.XRANGEPLAINLOOSE]}$`);y("COMPARATORLOOSE",`^${l[p.GTLT]}\\s*(${l[p.LOOSEPLAIN]})$|^$`);y("COMPARATOR",`^${l[p.GTLT]}\\s*(${l[p.FULLPLAIN]})$|^$`);y("COMPARATORTRIM",`(\\s*)${l[p.GTLT]}\\s*(${l[p.LOOSEPLAIN]}|${l[p.XRANGEPLAIN]})`,!0);F.comparatorTrimReplace="$1$2$3";y("HYPHENRANGE",`^\\s*(${l[p.XRANGEPLAIN]})\\s+-\\s+(${l[p.XRANGEPLAIN]})\\s*$`);y("HYPHENRANGELOOSE",`^\\s*(${l[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[p.XRANGEPLAINLOOSE]})\\s*$`);y("STAR","(<|>)?=?\\s*\\*");y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ae=g((jc,Ht)=>{var Vs=Object.freeze({loose:!0}),Hs=Object.freeze({}),Xs=t=>t?typeof t!="object"?Vs:t:Hs;Ht.exports=Xs});var rt=g((Gc,Zt)=>{var Xt=/^[0-9]+$/,Yt=(t,e)=>{let n=Xt.test(t),r=Xt.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:t<e?-1:1},Ys=(t,e)=>Yt(e,t);Zt.exports={compareIdentifiers:Yt,rcompareIdentifiers:Ys}});var v=g((Fc,nn)=>{var ve=ae(),{MAX_LENGTH:Jt,MAX_SAFE_INTEGER:Re}=oe(),{re:en,t:tn}=Y(),Zs=Ae(),{compareIdentifiers:Z}=rt(),T=class{constructor(e,n){if(n=Zs(n),e instanceof T){if(e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Jt)throw new TypeError(`version is longer than ${Jt} characters`);ve("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=e.trim().match(n.loose?en[tn.LOOSE]:en[tn.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Re||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Re||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Re||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<Re)return i}return s}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(ve("SemVer.compare",this.version,this.options,e),!(e instanceof T)){if(typeof e=="string"&&e===this.version)return 0;e=new T(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof T||(e=new T(e,this.options)),Z(this.major,e.major)||Z(this.minor,e.minor)||Z(this.patch,e.patch)}comparePre(e){if(e instanceof T||(e=new T(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let n=0;do{let r=this.prerelease[n],s=e.prerelease[n];if(ve("prerelease compare",n,r,s),r===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(r===void 0)return-1;if(r===s)continue;return Z(r,s)}while(++n)}compareBuild(e){e instanceof T||(e=new T(e,this.options));let n=0;do{let r=this.build[n],s=e.build[n];if(ve("prerelease compare",n,r,s),r===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(r===void 0)return-1;if(r===s)continue;return Z(r,s)}while(++n)}inc(e,n,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(r)?1:0;if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(n){let i=[n,s];r===!1&&(i=[n]),Z(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};nn.exports=T});var B=g((Uc,sn)=>{var rn=v(),Js=(t,e,n=!1)=>{if(t instanceof rn)return t;try{return new rn(t,e)}catch(r){if(!n)return null;throw r}};sn.exports=Js});var an=g((Bc,on)=>{var ei=B(),ti=(t,e)=>{let n=ei(t,e);return n?n.version:null};on.exports=ti});var un=g((kc,cn)=>{var ni=B(),ri=(t,e)=>{let n=ni(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null};cn.exports=ri});var hn=g((Mc,pn)=>{var ln=v(),si=(t,e,n,r,s)=>{typeof n=="string"&&(s=r,r=n,n=void 0);try{return new ln(t instanceof ln?t.version:t,n).inc(e,r,s).version}catch{return null}};pn.exports=si});var dn=g((Wc,mn)=>{var fn=B(),ii=(t,e)=>{let n=fn(t,null,!0),r=fn(e,null,!0),s=n.compare(r);if(s===0)return null;let i=s>0,o=i?n:r,c=i?r:n,a=!!o.prerelease.length,u=a?"pre":"";return n.major!==r.major?u+"major":n.minor!==r.minor?u+"minor":n.patch!==r.patch?u+"patch":a?"prerelease":c.patch?"patch":c.minor?"minor":"major"};mn.exports=ii});var En=g((Qc,gn)=>{var oi=v(),ai=(t,e)=>new oi(t,e).major;gn.exports=ai});var Cn=g((Kc,yn)=>{var ci=v(),ui=(t,e)=>new ci(t,e).minor;yn.exports=ui});var Sn=g((zc,xn)=>{var li=v(),pi=(t,e)=>new li(t,e).patch;xn.exports=pi});var vn=g((Vc,An)=>{var hi=B(),fi=(t,e)=>{let n=hi(t,e);return n&&n.prerelease.length?n.prerelease:null};An.exports=fi});var b=g((Hc,In)=>{var Rn=v(),mi=(t,e,n)=>new Rn(t,n).compare(new Rn(e,n));In.exports=mi});var Tn=g((Xc,wn)=>{var di=b(),gi=(t,e,n)=>di(e,t,n);wn.exports=gi});var On=g((Yc,bn)=>{var Ei=b(),yi=(t,e)=>Ei(t,e,!0);bn.exports=yi});var Ie=g((Zc,$n)=>{var Nn=v(),Ci=(t,e,n)=>{let r=new Nn(t,n),s=new Nn(e,n);return r.compare(s)||r.compareBuild(s)};$n.exports=Ci});var _n=g((Jc,qn)=>{var xi=Ie(),Si=(t,e)=>t.sort((n,r)=>xi(n,r,e));qn.exports=Si});var Dn=g((eu,Ln)=>{var Ai=Ie(),vi=(t,e)=>t.sort((n,r)=>Ai(r,n,e));Ln.exports=vi});var ce=g((tu,Pn)=>{var Ri=b(),Ii=(t,e,n)=>Ri(t,e,n)>0;Pn.exports=Ii});var we=g((nu,jn)=>{var wi=b(),Ti=(t,e,n)=>wi(t,e,n)<0;jn.exports=Ti});var st=g((ru,Gn)=>{var bi=b(),Oi=(t,e,n)=>bi(t,e,n)===0;Gn.exports=Oi});var it=g((su,Fn)=>{var Ni=b(),$i=(t,e,n)=>Ni(t,e,n)!==0;Fn.exports=$i});var Te=g((iu,Un)=>{var qi=b(),_i=(t,e,n)=>qi(t,e,n)>=0;Un.exports=_i});var be=g((ou,Bn)=>{var Li=b(),Di=(t,e,n)=>Li(t,e,n)<=0;Bn.exports=Di});var ot=g((au,kn)=>{var Pi=st(),ji=it(),Gi=ce(),Fi=Te(),Ui=we(),Bi=be(),ki=(t,e,n,r)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t===n;case"!==":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t!==n;case"":case"=":case"==":return Pi(t,n,r);case"!=":return ji(t,n,r);case">":return Gi(t,n,r);case">=":return Fi(t,n,r);case"<":return Ui(t,n,r);case"<=":return Bi(t,n,r);default:throw new TypeError(`Invalid operator: ${e}`)}};kn.exports=ki});var Wn=g((cu,Mn)=>{var Mi=v(),Wi=B(),{re:Oe,t:Ne}=Y(),Qi=(t,e)=>{if(t instanceof Mi)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let n=null;if(!e.rtl)n=t.match(Oe[Ne.COERCE]);else{let r;for(;(r=Oe[Ne.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)(!n||r.index+r[0].length!==n.index+n[0].length)&&(n=r),Oe[Ne.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;Oe[Ne.COERCERTL].lastIndex=-1}return n===null?null:Wi(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,e)};Mn.exports=Qi});var Kn=g((uu,Qn)=>{"use strict";Qn.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var Vn=g((lu,zn)=>{"use strict";zn.exports=C;C.Node=k;C.create=C;function C(t){var e=this;if(e instanceof C||(e=new C),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var n=0,r=arguments.length;n<r;n++)e.push(arguments[n]);return e}C.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,n=t.prev;return e&&(e.prev=n),n&&(n.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=n),t.list.length--,t.next=null,t.prev=null,t.list=null,e};C.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};C.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};C.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)zi(this,arguments[t]);return this.length};C.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)Vi(this,arguments[t]);return this.length};C.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}};C.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}};C.prototype.forEach=function(t,e){e=e||this;for(var n=this.head,r=0;n!==null;r++)t.call(e,n.value,r,this),n=n.next};C.prototype.forEachReverse=function(t,e){e=e||this;for(var n=this.tail,r=this.length-1;n!==null;r--)t.call(e,n.value,r,this),n=n.prev};C.prototype.get=function(t){for(var e=0,n=this.head;n!==null&&e<t;e++)n=n.next;if(e===t&&n!==null)return n.value};C.prototype.getReverse=function(t){for(var e=0,n=this.tail;n!==null&&e<t;e++)n=n.prev;if(e===t&&n!==null)return n.value};C.prototype.map=function(t,e){e=e||this;for(var n=new C,r=this.head;r!==null;)n.push(t.call(e,r.value,this)),r=r.next;return n};C.prototype.mapReverse=function(t,e){e=e||this;for(var n=new C,r=this.tail;r!==null;)n.push(t.call(e,r.value,this)),r=r.prev;return n};C.prototype.reduce=function(t,e){var n,r=this.head;if(arguments.length>1)n=e;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;r!==null;s++)n=t(n,r.value,s),r=r.next;return n};C.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;r!==null;s--)n=t(n,r.value,s),r=r.prev;return n};C.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;n!==null;e++)t[e]=n.value,n=n.next;return t};C.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;n!==null;e++)t[e]=n.value,n=n.prev;return t};C.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var n=new C;if(e<t||e<0)return n;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(;s!==null&&r<e;r++,s=s.next)n.push(s.value);return n};C.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var n=new C;if(e<t||e<0)return n;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=this.length,s=this.tail;s!==null&&r>e;r--)s=s.prev;for(;s!==null&&r>t;r--,s=s.prev)n.push(s.value);return n};C.prototype.splice=function(t,e,...n){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(var i=[],r=0;s&&r<e;r++)i.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var r=0;r<n.length;r++)s=Ki(this,s,n[r]);return i};C.prototype.reverse=function(){for(var t=this.head,e=this.tail,n=t;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=e,this.tail=t,this};function Ki(t,e,n){var r=e===t.head?new k(n,null,e,t):new k(n,e,e.next,t);return r.next===null&&(t.tail=r),r.prev===null&&(t.head=r),t.length++,r}function zi(t,e){t.tail=new k(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function Vi(t,e){t.head=new k(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function k(t,e,n,r){if(!(this instanceof k))return new k(t,e,n,r);this.list=r,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Kn()(C)}catch{}});var Jn=g((pu,Zn)=>{"use strict";var Hi=Vn(),M=Symbol("max"),L=Symbol("length"),J=Symbol("lengthCalculator"),le=Symbol("allowStale"),W=Symbol("maxAge"),_=Symbol("dispose"),Hn=Symbol("noDisposeOnSet"),A=Symbol("lruList"),$=Symbol("cache"),Yn=Symbol("updateAgeOnGet"),at=()=>1,ut=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let n=this[M]=e.max||1/0,r=e.length||at;if(this[J]=typeof r!="function"?at:r,this[le]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[W]=e.maxAge||0,this[_]=e.dispose,this[Hn]=e.noDisposeOnSet||!1,this[Yn]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[M]=e||1/0,ue(this)}get max(){return this[M]}set allowStale(e){this[le]=!!e}get allowStale(){return this[le]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[W]=e,ue(this)}get maxAge(){return this[W]}set lengthCalculator(e){typeof e!="function"&&(e=at),e!==this[J]&&(this[J]=e,this[L]=0,this[A].forEach(n=>{n.length=this[J](n.value,n.key),this[L]+=n.length})),ue(this)}get lengthCalculator(){return this[J]}get length(){return this[L]}get itemCount(){return this[A].length}rforEach(e,n){n=n||this;for(let r=this[A].tail;r!==null;){let s=r.prev;Xn(this,e,r,n),r=s}}forEach(e,n){n=n||this;for(let r=this[A].head;r!==null;){let s=r.next;Xn(this,e,r,n),r=s}}keys(){return this[A].toArray().map(e=>e.key)}values(){return this[A].toArray().map(e=>e.value)}reset(){this[_]&&this[A]&&this[A].length&&this[A].forEach(e=>this[_](e.key,e.value)),this[$]=new Map,this[A]=new Hi,this[L]=0}dump(){return this[A].map(e=>$e(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[A]}set(e,n,r){if(r=r||this[W],r&&typeof r!="number")throw new TypeError("maxAge must be a number");let s=r?Date.now():0,i=this[J](n,e);if(this[$].has(e)){if(i>this[M])return ee(this,this[$].get(e)),!1;let a=this[$].get(e).value;return this[_]&&(this[Hn]||this[_](e,a.value)),a.now=s,a.maxAge=r,a.value=n,this[L]+=i-a.length,a.length=i,this.get(e),ue(this),!0}let o=new lt(e,n,i,s,r);return o.length>this[M]?(this[_]&&this[_](e,n),!1):(this[L]+=o.length,this[A].unshift(o),this[$].set(e,this[A].head),ue(this),!0)}has(e){if(!this[$].has(e))return!1;let n=this[$].get(e).value;return!$e(this,n)}get(e){return ct(this,e,!0)}peek(e){return ct(this,e,!1)}pop(){let e=this[A].tail;return e?(ee(this,e),e.value):null}del(e){ee(this,this[$].get(e))}load(e){this.reset();let n=Date.now();for(let r=e.length-1;r>=0;r--){let s=e[r],i=s.e||0;if(i===0)this.set(s.k,s.v);else{let o=i-n;o>0&&this.set(s.k,s.v,o)}}}prune(){this[$].forEach((e,n)=>ct(this,n,!1))}},ct=(t,e,n)=>{let r=t[$].get(e);if(r){let s=r.value;if($e(t,s)){if(ee(t,r),!t[le])return}else n&&(t[Yn]&&(r.value.now=Date.now()),t[A].unshiftNode(r));return s.value}},$e=(t,e)=>{if(!e||!e.maxAge&&!t[W])return!1;let n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[W]&&n>t[W]},ue=t=>{if(t[L]>t[M])for(let e=t[A].tail;t[L]>t[M]&&e!==null;){let n=e.prev;ee(t,e),e=n}},ee=(t,e)=>{if(e){let n=e.value;t[_]&&t[_](n.key,n.value),t[L]-=n.length,t[$].delete(n.key),t[A].removeNode(e)}},lt=class{constructor(e,n,r,s,i){this.key=e,this.value=n,this.length=r,this.now=s,this.maxAge=i||0}},Xn=(t,e,n,r)=>{let s=n.value;$e(t,s)&&(ee(t,n),t[le]||(s=void 0)),s&&e.call(r,s.value,s.key,t)};Zn.exports=ut});var O=g((hu,rr)=>{var Q=class{constructor(e,n){if(n=Yi(n),e instanceof Q)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new Q(e.raw,n);if(e instanceof pt)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e,this.set=e.split("||").map(r=>this.parseRange(r.trim())).filter(r=>r.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter(s=>!tr(s[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&so(s[0])){this.set=[s];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let r=((this.options.includePrerelease&&no)|(this.options.loose&&ro))+":"+e,s=er.get(r);if(s)return s;let i=this.options.loose,o=i?w[R.HYPHENRANGELOOSE]:w[R.HYPHENRANGE];e=e.replace(o,mo(this.options.includePrerelease)),S("hyphen replace",e),e=e.replace(w[R.COMPARATORTRIM],Ji),S("comparator trim",e),e=e.replace(w[R.TILDETRIM],eo),e=e.replace(w[R.CARETTRIM],to),e=e.split(/\s+/).join(" ");let c=e.split(" ").map(h=>io(h,this.options)).join(" ").split(/\s+/).map(h=>fo(h,this.options));i&&(c=c.filter(h=>(S("loose invalid filter",h,this.options),!!h.match(w[R.COMPARATORLOOSE])))),S("range list",c);let a=new Map,u=c.map(h=>new pt(h,this.options));for(let h of u){if(tr(h))return[h];a.set(h.value,h)}a.size>1&&a.has("")&&a.delete("");let d=[...a.values()];return er.set(r,d),d}intersects(e,n){if(!(e instanceof Q))throw new TypeError("a Range is required");return this.set.some(r=>nr(r,n)&&e.set.some(s=>nr(s,n)&&r.every(i=>s.every(o=>i.intersects(o,n)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Zi(e,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(go(this.set[n],e,this.options))return!0;return!1}};rr.exports=Q;var Xi=Jn(),er=new Xi({max:1e3}),Yi=Ae(),pt=pe(),S=ae(),Zi=v(),{re:w,t:R,comparatorTrimReplace:Ji,tildeTrimReplace:eo,caretTrimReplace:to}=Y(),{FLAG_INCLUDE_PRERELEASE:no,FLAG_LOOSE:ro}=oe(),tr=t=>t.value==="<0.0.0-0",so=t=>t.value==="",nr=(t,e)=>{let n=!0,r=t.slice(),s=r.pop();for(;n&&r.length;)n=r.every(i=>s.intersects(i,e)),s=r.pop();return n},io=(t,e)=>(S("comp",t,e),t=co(t,e),S("caret",t),t=oo(t,e),S("tildes",t),t=lo(t,e),S("xrange",t),t=ho(t,e),S("stars",t),t),I=t=>!t||t.toLowerCase()==="x"||t==="*",oo=(t,e)=>t.trim().split(/\s+/).map(n=>ao(n,e)).join(" "),ao=(t,e)=>{let n=e.loose?w[R.TILDELOOSE]:w[R.TILDE];return t.replace(n,(r,s,i,o,c)=>{S("tilde",t,r,s,i,o,c);let a;return I(s)?a="":I(i)?a=`>=${s}.0.0 <${+s+1}.0.0-0`:I(o)?a=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:c?(S("replaceTilde pr",c),a=`>=${s}.${i}.${o}-${c} <${s}.${+i+1}.0-0`):a=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,S("tilde return",a),a})},co=(t,e)=>t.trim().split(/\s+/).map(n=>uo(n,e)).join(" "),uo=(t,e)=>{S("caret",t,e);let n=e.loose?w[R.CARETLOOSE]:w[R.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(s,i,o,c,a)=>{S("caret",t,s,i,o,c,a);let u;return I(i)?u="":I(o)?u=`>=${i}.0.0${r} <${+i+1}.0.0-0`:I(c)?i==="0"?u=`>=${i}.${o}.0${r} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${r} <${+i+1}.0.0-0`:a?(S("replaceCaret pr",a),i==="0"?o==="0"?u=`>=${i}.${o}.${c}-${a} <${i}.${o}.${+c+1}-0`:u=`>=${i}.${o}.${c}-${a} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${c}-${a} <${+i+1}.0.0-0`):(S("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${c}${r} <${i}.${o}.${+c+1}-0`:u=`>=${i}.${o}.${c}${r} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${c} <${+i+1}.0.0-0`),S("caret return",u),u})},lo=(t,e)=>(S("replaceXRanges",t,e),t.split(/\s+/).map(n=>po(n,e)).join(" ")),po=(t,e)=>{t=t.trim();let n=e.loose?w[R.XRANGELOOSE]:w[R.XRANGE];return t.replace(n,(r,s,i,o,c,a)=>{S("xRange",t,r,s,i,o,c,a);let u=I(i),d=u||I(o),h=d||I(c),x=h;return s==="="&&x&&(s=""),a=e.includePrerelease?"-0":"",u?s===">"||s==="<"?r="<0.0.0-0":r="*":s&&x?(d&&(o=0),c=0,s===">"?(s=">=",d?(i=+i+1,o=0,c=0):(o=+o+1,c=0)):s==="<="&&(s="<",d?i=+i+1:o=+o+1),s==="<"&&(a="-0"),r=`${s+i}.${o}.${c}${a}`):d?r=`>=${i}.0.0${a} <${+i+1}.0.0-0`:h&&(r=`>=${i}.${o}.0${a} <${i}.${+o+1}.0-0`),S("xRange return",r),r})},ho=(t,e)=>(S("replaceStars",t,e),t.trim().replace(w[R.STAR],"")),fo=(t,e)=>(S("replaceGTE0",t,e),t.trim().replace(w[e.includePrerelease?R.GTE0PRE:R.GTE0],"")),mo=t=>(e,n,r,s,i,o,c,a,u,d,h,x,f)=>(I(r)?n="":I(s)?n=`>=${r}.0.0${t?"-0":""}`:I(i)?n=`>=${r}.${s}.0${t?"-0":""}`:o?n=`>=${n}`:n=`>=${n}${t?"-0":""}`,I(u)?a="":I(d)?a=`<${+u+1}.0.0-0`:I(h)?a=`<${u}.${+d+1}.0-0`:x?a=`<=${u}.${d}.${h}-${x}`:t?a=`<${u}.${d}.${+h+1}-0`:a=`<=${a}`,`${n} ${a}`.trim()),go=(t,e,n)=>{for(let r=0;r<t.length;r++)if(!t[r].test(e))return!1;if(e.prerelease.length&&!n.includePrerelease){for(let r=0;r<t.length;r++)if(S(t[r].semver),t[r].semver!==pt.ANY&&t[r].semver.prerelease.length>0){let s=t[r].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var pe=g((fu,ur)=>{var he=Symbol("SemVer ANY"),te=class{static get ANY(){return he}constructor(e,n){if(n=sr(n),e instanceof te){if(e.loose===!!n.loose)return e;e=e.value}ft("comparator",e,n),this.options=n,this.loose=!!n.loose,this.parse(e),this.semver===he?this.value="":this.value=this.operator+this.semver.version,ft("comp",this)}parse(e){let n=this.options.loose?ir[or.COMPARATORLOOSE]:ir[or.COMPARATOR],r=e.match(n);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new ar(r[2],this.options.loose):this.semver=he}toString(){return this.value}test(e){if(ft("Comparator.test",e,this.options.loose),this.semver===he||e===he)return!0;if(typeof e=="string")try{e=new ar(e,this.options)}catch{return!1}return ht(e,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof te))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new cr(e.value,n).test(this.value):e.operator===""?e.value===""?!0:new cr(this.value,n).test(e.semver):(n=sr(n),n.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||ht(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||ht(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};ur.exports=te;var sr=Ae(),{re:ir,t:or}=Y(),ht=ot(),ft=ae(),ar=v(),cr=O()});var fe=g((mu,lr)=>{var Eo=O(),yo=(t,e,n)=>{try{e=new Eo(e,n)}catch{return!1}return e.test(t)};lr.exports=yo});var hr=g((du,pr)=>{var Co=O(),xo=(t,e)=>new Co(t,e).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));pr.exports=xo});var mr=g((gu,fr)=>{var So=v(),Ao=O(),vo=(t,e,n)=>{let r=null,s=null,i=null;try{i=new Ao(e,n)}catch{return null}return t.forEach(o=>{i.test(o)&&(!r||s.compare(o)===-1)&&(r=o,s=new So(r,n))}),r};fr.exports=vo});var gr=g((Eu,dr)=>{var Ro=v(),Io=O(),wo=(t,e,n)=>{let r=null,s=null,i=null;try{i=new Io(e,n)}catch{return null}return t.forEach(o=>{i.test(o)&&(!r||s.compare(o)===1)&&(r=o,s=new Ro(r,n))}),r};dr.exports=wo});var Cr=g((yu,yr)=>{var mt=v(),To=O(),Er=ce(),bo=(t,e)=>{t=new To(t,e);let n=new mt("0.0.0");if(t.test(n)||(n=new mt("0.0.0-0"),t.test(n)))return n;n=null;for(let r=0;r<t.set.length;++r){let s=t.set[r],i=null;s.forEach(o=>{let c=new mt(o.semver.version);switch(o.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!i||Er(c,i))&&(i=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!n||Er(n,i))&&(n=i)}return n&&t.test(n)?n:null};yr.exports=bo});var Sr=g((Cu,xr)=>{var Oo=O(),No=(t,e)=>{try{return new Oo(t,e).range||"*"}catch{return null}};xr.exports=No});var qe=g((xu,Ir)=>{var $o=v(),Rr=pe(),{ANY:qo}=Rr,_o=O(),Lo=fe(),Ar=ce(),vr=we(),Do=be(),Po=Te(),jo=(t,e,n,r)=>{t=new $o(t,r),e=new _o(e,r);let s,i,o,c,a;switch(n){case">":s=Ar,i=Do,o=vr,c=">",a=">=";break;case"<":s=vr,i=Po,o=Ar,c="<",a="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Lo(t,e,r))return!1;for(let u=0;u<e.set.length;++u){let d=e.set[u],h=null,x=null;if(d.forEach(f=>{f.semver===qo&&(f=new Rr(">=0.0.0")),h=h||f,x=x||f,s(f.semver,h.semver,r)?h=f:o(f.semver,x.semver,r)&&(x=f)}),h.operator===c||h.operator===a||(!x.operator||x.operator===c)&&i(t,x.semver))return!1;if(x.operator===a&&o(t,x.semver))return!1}return!0};Ir.exports=jo});var Tr=g((Su,wr)=>{var Go=qe(),Fo=(t,e,n)=>Go(t,e,">",n);wr.exports=Fo});var Or=g((Au,br)=>{var Uo=qe(),Bo=(t,e,n)=>Uo(t,e,"<",n);br.exports=Bo});var qr=g((vu,$r)=>{var Nr=O(),ko=(t,e,n)=>(t=new Nr(t,n),e=new Nr(e,n),t.intersects(e,n));$r.exports=ko});var Lr=g((Ru,_r)=>{var Mo=fe(),Wo=b();_r.exports=(t,e,n)=>{let r=[],s=null,i=null,o=t.sort((d,h)=>Wo(d,h,n));for(let d of o)Mo(d,e,n)?(i=d,s||(s=d)):(i&&r.push([s,i]),i=null,s=null);s&&r.push([s,null]);let c=[];for(let[d,h]of r)d===h?c.push(d):!h&&d===o[0]?c.push("*"):h?d===o[0]?c.push(`<=${h}`):c.push(`${d} - ${h}`):c.push(`>=${d}`);let a=c.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return a.length<u.length?a:e}});var Ur=g((Iu,Fr)=>{var Dr=O(),gt=pe(),{ANY:dt}=gt,me=fe(),Et=b(),Qo=(t,e,n={})=>{if(t===e)return!0;t=new Dr(t,n),e=new Dr(e,n);let r=!1;e:for(let s of t.set){for(let i of e.set){let o=zo(s,i,n);if(r=r||o!==null,o)continue e}if(r)return!1}return!0},Ko=[new gt(">=0.0.0-0")],Pr=[new gt(">=0.0.0")],zo=(t,e,n)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===dt){if(e.length===1&&e[0].semver===dt)return!0;n.includePrerelease?t=Ko:t=Pr}if(e.length===1&&e[0].semver===dt){if(n.includePrerelease)return!0;e=Pr}let r=new Set,s,i;for(let f of t)f.operator===">"||f.operator===">="?s=jr(s,f,n):f.operator==="<"||f.operator==="<="?i=Gr(i,f,n):r.add(f.semver);if(r.size>1)return null;let o;if(s&&i){if(o=Et(s.semver,i.semver,n),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let f of r){if(s&&!me(f,String(s),n)||i&&!me(f,String(i),n))return null;for(let D of e)if(!me(f,String(D),n))return!1;return!0}let c,a,u,d,h=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,x=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;h&&h.prerelease.length===1&&i.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(d=d||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",s){if(x&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===x.major&&f.semver.minor===x.minor&&f.semver.patch===x.patch&&(x=!1),f.operator===">"||f.operator===">="){if(c=jr(s,f,n),c===f&&c!==s)return!1}else if(s.operator===">="&&!me(s.semver,String(f),n))return!1}if(i){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(a=Gr(i,f,n),a===f&&a!==i)return!1}else if(i.operator==="<="&&!me(i.semver,String(f),n))return!1}if(!f.operator&&(i||s)&&o!==0)return!1}return!(s&&u&&!i&&o!==0||i&&d&&!s&&o!==0||x||h)},jr=(t,e,n)=>{if(!t)return e;let r=Et(t.semver,e.semver,n);return r>0?t:r<0||e.operator===">"&&t.operator===">="?e:t},Gr=(t,e,n)=>{if(!t)return e;let r=Et(t.semver,e.semver,n);return r<0?t:r>0||e.operator==="<"&&t.operator==="<="?e:t};Fr.exports=Qo});var Ct=g((wu,Mr)=>{var yt=Y(),Br=oe(),Vo=v(),kr=rt(),Ho=B(),Xo=an(),Yo=un(),Zo=hn(),Jo=dn(),ea=En(),ta=Cn(),na=Sn(),ra=vn(),sa=b(),ia=Tn(),oa=On(),aa=Ie(),ca=_n(),ua=Dn(),la=ce(),pa=we(),ha=st(),fa=it(),ma=Te(),da=be(),ga=ot(),Ea=Wn(),ya=pe(),Ca=O(),xa=fe(),Sa=hr(),Aa=mr(),va=gr(),Ra=Cr(),Ia=Sr(),wa=qe(),Ta=Tr(),ba=Or(),Oa=qr(),Na=Lr(),$a=Ur();Mr.exports={parse:Ho,valid:Xo,clean:Yo,inc:Zo,diff:Jo,major:ea,minor:ta,patch:na,prerelease:ra,compare:sa,rcompare:ia,compareLoose:oa,compareBuild:aa,sort:ca,rsort:ua,gt:la,lt:pa,eq:ha,neq:fa,gte:ma,lte:da,cmp:ga,coerce:Ea,Comparator:ya,Range:Ca,satisfies:xa,toComparators:Sa,maxSatisfying:Aa,minSatisfying:va,minVersion:Ra,validRange:Ia,outside:wa,gtr:Ta,ltr:ba,intersects:Oa,simplifyRange:Na,subset:$a,SemVer:Vo,re:yt.re,src:yt.src,tokens:yt.t,SEMVER_SPEC_VERSION:Br.SEMVER_SPEC_VERSION,RELEASE_TYPES:Br.RELEASE_TYPES,compareIdentifiers:kr.compareIdentifiers,rcompareIdentifiers:kr.rcompareIdentifiers}});var _a={};as(_a,{ConsensusType:()=>Hr,ExtraCodec:()=>Yr,GrazEvents:()=>tt,GrazProvider:()=>Ps,ICSEnabled:()=>Xr,KeyAlgo:()=>Zr,NetworkType:()=>Jr,Ordering:()=>ts,Status:()=>es,TraceType:()=>zr,TypeAsset:()=>Vr,WALLET_TYPES:()=>Pe,WalletType:()=>De,checkWallet:()=>z,clearRecentChain:()=>Be,configureGraz:()=>We,connect:()=>H,createClients:()=>re,createQueryClient:()=>Ge,createSigningClients:()=>se,defineAsset:()=>js,defineAssetList:()=>Gs,defineChain:()=>fs,defineChainInfo:()=>ms,defineChains:()=>hs,defineRegistryChain:()=>Fs,disconnect:()=>ye,executeContract:()=>Xe,getActiveChainCurrency:()=>ke,getAvailableWallets:()=>ls,getBalanceStaked:()=>Ke,getBalances:()=>Qe,getCosmostation:()=>jt,getKeplr:()=>Dt,getLeap:()=>Pt,getQueryRaw:()=>Ze,getQuerySmart:()=>Ye,getRecentChain:()=>ps,getWallet:()=>V,instantiateContract:()=>He,reconnect:()=>q,registryToChainInfo:()=>qa,sendIbcTokens:()=>Ve,sendTokens:()=>ze,suggestChain:()=>Ce,suggestChainAndConnect:()=>Me,useAccount:()=>j,useActiveChain:()=>xs,useActiveChainCurrency:()=>Ss,useActiveChainValidators:()=>As,useBalance:()=>ds,useBalanceStaked:()=>Cs,useBalances:()=>kt,useCheckWallet:()=>ie,useClients:()=>Ts,useConnect:()=>gs,useDisconnect:()=>Es,useExecuteContract:()=>qs,useGrazEvents:()=>Qt,useInstantiateContract:()=>$s,useOfflineSigners:()=>Mt,useQueryClient:()=>ws,useQueryRaw:()=>Ls,useQuerySmart:()=>_s,useRecentChain:()=>vs,useSendIbcTokens:()=>Ns,useSendTokens:()=>Os,useSigners:()=>ys,useSigningClients:()=>bs,useSuggestChain:()=>Rs,useSuggestChainAndConnect:()=>Is});module.exports=cs(_a);var Gt=require("@cosmjs/stargate");var ne="graz-reconnect-session";var qt=require("zustand"),Ee=require("zustand/middleware");var De=(r=>(r.KEPLR="keplr",r.LEAP="leap",r.COSMOSTATION="cosmostation",r))(De||{}),Pe=["keplr","leap","cosmostation"];var je={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},us={name:"graz",partialize:t=>({activeChain:t.activeChain,recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:2},m=(0,qt.create)((0,Ee.subscribeWithSelector)((0,Ee.persist)(()=>je,us)));var Fe=require("@cosmjs/cosmwasm-stargate"),Ue=require("@cosmjs/stargate"),Lt=require("@cosmjs/tendermint-rpc");var _t=require("@cosmjs/stargate"),K=require("@cosmjs/utils");var Ge=(...t)=>{let{tendermint:e}=m.getState().clients,n=new _t.QueryClient(e),r=t.map(s=>s(n));for(let s of r){(0,K.assert)((0,K.isNonNullObject)(s),"Extension must be a non-null object");for(let[i,o]of Object.entries(s)){(0,K.assert)((0,K.isNonNullObject)(o),`Module must be a non-null object. Found type ${typeof o} for module "${i}".`);let c=n[i]||{};n[i]={...c,...o}}}return n};var re=async({rpc:t,rpcHeaders:e})=>{let n={url:t,headers:{...e||{}}},[r,s,i]=await Promise.all([Fe.SigningCosmWasmClient.connect(n),Ue.SigningStargateClient.connect(n),Lt.Tendermint34Client.connect(t)]);return{cosmWasm:r,stargate:s,tendermint:i}},se=async t=>{let{rpc:e,rpcHeaders:n,offlineSignerAuto:r,cosmWasmSignerOptions:s={},stargateSignerOptions:i={}}=t,o={url:e,headers:{...n||{}}},[c,a]=await Promise.all([Fe.SigningCosmWasmClient.connectWithSigner(o,r,s),Ue.SigningStargateClient.connectWithSigner(o,r,i)]);return{cosmWasm:c,stargate:a}};var z=(t=m.getState().walletType)=>{try{return V(t),!0}catch(e){return console.error(e),!1}},Dt=()=>{if(typeof window.keplr<"u")return window.keplr;throw m.getState()._notFoundFn(),new Error("window.keplr is not defined")},Pt=()=>{if(typeof window.leap<"u")return window.leap;throw m.getState()._notFoundFn(),new Error("window.leap is not defined")},jt=()=>{if(typeof window.cosmostation.providers.keplr<"u")return window.cosmostation.providers.keplr;throw m.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")},V=(t=m.getState().walletType)=>{switch(t){case"keplr":return Dt();case"leap":return Pt();case"cosmostation":return jt();default:throw new Error("Unknown wallet type")}},ls=()=>Object.fromEntries(Pe.map(t=>[t,z(t)]));var H=async t=>{try{let{defaultChain:e,recentChain:n,walletType:r}=m.getState(),s=(t==null?void 0:t.walletType)||r,i=V(s),o=(t==null?void 0:t.chain)||n||e;if(!o)throw new Error("No last known connected chain, connect action requires chain info");m.setState(D=>{let At=D._reconnect||!!D._reconnectConnector||!!o;return D.activeChain&&D.activeChain.chainId!==o.chainId?{status:"connecting"}:At?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(o.chainId);let c=i.getOfflineSigner(o.chainId),a=i.getOfflineSignerOnlyAmino(o.chainId),u=await i.getOfflineSignerAuto(o.chainId),d=o.gas?Gt.GasPrice.fromString(`${o.gas.price}${o.gas.denom}`):void 0,[h,x,f]=await Promise.all([i.getKey(o.chainId),re(o),se({...o,offlineSignerAuto:u,cosmWasmSignerOptions:{gasPrice:d,...(t==null?void 0:t.signerOpts)||{}}})]);return m.setState({account:h,activeChain:o,clients:x,offlineSigner:c,offlineSignerAmino:a,offlineSignerAuto:u,recentChain:o,signingClients:f,status:"connected",walletType:s,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:s}),typeof window<"u"&&window.sessionStorage.setItem(ne,"Active"),{account:h,walletType:s,chain:o}}catch(e){throw m.getState().account===null&&m.setState({status:"disconnected"}),e}},ye=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(ne),m.setState(e=>({...je,recentChain:t?null:e.recentChain})),Promise.resolve()),q=async t=>{var i;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=m.getState(),s=z(n||void 0);try{if(e&&s&&n)return await H({chain:e,walletType:n,autoReconnect:r})}catch(o){(i=t==null?void 0:t.onError)==null||i.call(t,o),ye()}};var Be=()=>{m.setState({recentChain:null})},ke=t=>{let{activeChain:e}=m.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},ps=()=>m.getState().recentChain,Ce=async t=>(await V().experimentalSuggestChain(t),t),Me=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...s})=>{let i=await Ce(t);return{...await H({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...s}),chain:i}};var We=(t={})=>(m.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var Qe=async t=>{let{activeChain:e,signingClients:n}=m.getState();if(!e||!n)throw new Error("No connected account detected");let{defaultSigningClient:r}=m.getState();return await Promise.all(e.currencies.map(async i=>{let o=i.coinMinimalDenom.startsWith("cw20:");return n[r].getBalance(t,o?i.coinMinimalDenom.replace("cw20:",""):i.coinMinimalDenom)}))},Ke=async t=>{let{clients:e}=m.getState();if(!(e!=null&&e.stargate))throw new Error("Stargate client is not ready");return e.stargate.getBalanceStaked(t)},ze=async({senderAddress:t,recipientAddress:e,amount:n,fee:r,memo:s})=>{let{signingClients:i,defaultSigningClient:o}=m.getState();if(!i)throw new Error("No connected account detected");if(!t)throw new Error("senderAddress is not defined");return i[o].sendTokens(t,e,n,r,s)},Ve=async({senderAddress:t,recipientAddress:e,transferAmount:n,sourcePort:r,sourceChannel:s,timeoutHeight:i,timeoutTimestamp:o,fee:c,memo:a})=>{let{signingClients:u}=m.getState();if(!(u!=null&&u.stargate))throw new Error("Stargate signing client is not ready");if(!t)throw new Error("senderAddress is not defined");return u.stargate.sendIbcTokens(t,e,n,r,s,i,o,c,a)},He=async({senderAddress:t,msg:e,fee:n,options:r,label:s,codeId:i})=>{let{signingClients:o}=m.getState();if(!(o!=null&&o.cosmWasm))throw new Error("CosmWasm signing client is not ready");return o.cosmWasm.instantiate(t,i,e,s,n,r)},Xe=async({senderAddress:t,msg:e,fee:n,contractAddress:r,funds:s,memo:i})=>{let{signingClients:o}=m.getState();if(!(o!=null&&o.cosmWasm))throw new Error("CosmWasm signing client is not ready");return o.cosmWasm.execute(t,r,e,n,i,s)},Ye=async(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");return await n.cosmWasm.queryContractSmart(t,e)},Ze=(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.cosmWasm.queryContractRaw(t,r)};var hs=t=>t,fs=t=>t,ms=t=>t;var U=require("@tanstack/react-query"),Ut=require("react"),Bt=Le(require("zustand/shallow"));var Ft=require("@tanstack/react-query");var ie=t=>{let n=["USE_CHECK_WALLET",m(s=>t||s.walletType)];return(0,Ft.useQuery)(n,({queryKey:[,s]})=>z(s))};var j=({onConnect:t,onDisconnect:e}={})=>{let n=m(s=>s.account),r=m(s=>s.status);return(0,Ut.useEffect)(()=>m.subscribe(s=>s.status,(s,i)=>{if(s==="connected"){let o=m.getState();t==null||t({account:o.account,chain:o.activeChain,walletType:o.walletType,isReconnect:i==="reconnecting"})}s==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:q,status:r}},kt=t=>{let{data:e}=j(),n=t||(e==null?void 0:e.bech32Address);return(0,U.useQuery)(["USE_BALANCES",n],({queryKey:[,i]})=>Qe(i),{enabled:!!n})},ds=(t,e)=>{let{data:n}=kt(e);return(0,U.useQuery)(["USE_BALANCE",n,t,e],({queryKey:[,i]})=>i==null?void 0:i.find(o=>o.denom===t),{enabled:!!n})},gs=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,U.useMutation)(["USE_CONNECT",t,e,n],H,{onError:(o,c)=>Promise.resolve(t==null?void 0:t(o,c)),onMutate:e,onSuccess:o=>Promise.resolve(n==null?void 0:n(o))}),{data:i}=ie();return{connect:o=>s.mutate(o),connectAsync:o=>s.mutateAsync(o),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:!!i,status:s.status}},Es=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,U.useMutation)(["USE_DISCONNECT",t,e,n],ye,{onError:i=>Promise.resolve(t==null?void 0:t(i,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>s.mutate(i),disconnectAsync:i=>s.mutateAsync(i),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,status:s.status}},Mt=()=>m(t=>({signer:t.offlineSigner,signerAmino:t.offlineSignerAmino,signerAuto:t.offlineSignerAuto}),Bt.default),ys=()=>Mt(),Cs=t=>{let{data:e}=j(),n=t||(e==null?void 0:e.bech32Address);return(0,U.useQuery)(["USE_BALANCE_STAKED",n],({queryKey:[,i]})=>Ke(n),{enabled:!!n})};var X=require("@tanstack/react-query");var xs=()=>m(t=>t.activeChain),Ss=t=>(0,X.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>ke(r)),As=(t,e="BOND_STATUS_BONDED")=>(0,X.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],({queryKey:[,s,i]})=>s.staking.validators(i),{enabled:typeof t<"u"}),vs=()=>({data:m(e=>e.recentChain),clear:Be}),Rs=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,X.useMutation)(["USE_SUGGEST_CHAIN",t,e,n],Ce,{onError:(i,o)=>Promise.resolve(t==null?void 0:t(i,o)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,suggest:s.mutate,suggestAsync:s.mutateAsync,status:s.status}},Is=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=(0,X.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],Me,{onError:(o,c)=>Promise.resolve(t==null?void 0:t(o,c)),onMutate:o=>e==null?void 0:e(o),onSuccess:o=>Promise.resolve(n==null?void 0:n(o))}),{data:i}=ie();return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:!!i,status:s.status,suggestAndConnect:s.mutate,suggestAndConnectAsync:s.mutateAsync}};var Je=require("@tanstack/react-query");var Wt=require("@tanstack/react-query");var ws=(...t)=>{let e=["USE_QUERY_CLIENT",...t];return(0,Wt.useQuery)(e,({queryKey:[,...r]})=>Ge(...t),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var Ts=t=>{let e=m(s=>s.clients);return(0,Je.useQuery)(["USE_CLIENTS",t,e],({queryKey:[,s,i]})=>s!=null&&s.rpc?re(s):i,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:s=>{m.setState({clients:s})}})},bs=t=>{let e=m(s=>s.signingClients);return(0,Je.useQuery)(["USE_SIGNING_CLIENTS",t,e],({queryKey:[,s,i]})=>s!=null&&s.rpc?se(s):i,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:s=>{m.setState({signingClients:s})}})};var G=require("@tanstack/react-query");var Os=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=j(),s=r==null?void 0:r.bech32Address,o=(0,G.useMutation)(["USE_SEND_TOKENS",t,e,n,s],c=>ze({senderAddress:s,...c}),{onError:(c,a)=>Promise.resolve(t==null?void 0:t(c,a)),onMutate:e,onSuccess:c=>Promise.resolve(n==null?void 0:n(c))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendTokens:o.mutate,sendTokensAsync:o.mutateAsync,status:o.status}},Ns=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=j(),s=r==null?void 0:r.bech32Address,o=(0,G.useMutation)(["USE_SEND_IBC_TOKENS",t,e,n,s],c=>Ve({senderAddress:s,...c}),{onError:(c,a)=>Promise.resolve(t==null?void 0:t(c,a)),onMutate:e,onSuccess:c=>Promise.resolve(n==null?void 0:n(c))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendIbcTokens:o.mutate,sendIbcTokensAsync:o.mutateAsync,status:o.status}},$s=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:s}=j(),i=s==null?void 0:s.bech32Address,a=(0,G.useMutation)(["USE_INSTANTIATE_CONTRACT",e,n,r,t,i],u=>{if(!i)throw new Error("senderAddress is undefined");let d={...u,fee:u.fee??"auto",senderAddress:i,codeId:t};return He(d)},{onError:(u,d)=>Promise.resolve(e==null?void 0:e(u,d)),onMutate:n,onSuccess:u=>Promise.resolve(r==null?void 0:r(u))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,instantiateContract:a.mutate,instantiateContractAsync:a.mutateAsync,status:a.status}},qs=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:s}=j(),i=s==null?void 0:s.bech32Address,a=(0,G.useMutation)(["USE_EXECUTE_CONTRACT",e,n,r,t,i],u=>{if(!i)throw new Error("senderAddress is undefined");let d={...u,fee:u.fee??"auto",senderAddress:i,contractAddress:t,memo:u.memo??"",funds:u.funds??[]};return Xe(d)},{onError:(u,d)=>Promise.resolve(e==null?void 0:e(u,d)),onMutate:n,onSuccess:u=>Promise.resolve(r==null?void 0:r(u))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,executeContract:a.mutate,executeContractAsync:a.mutateAsync,status:a.status}},_s=(t,e)=>(0,G.useQuery)(["USE_QUERY_SMART",t,e],({queryKey:[,s]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return Ye(t,e)},{enabled:!!t&&!!e}),Ls=(t,e)=>(0,G.useQuery)(["USE_QUERY_RAW",e,t],({queryKey:[,s]})=>{if(!t||!e)throw new Error("address or key undefined");return Ze(t,e)},{enabled:!!t&&!!e});var xe=require("@tanstack/react-query");var et=require("react");var Qt=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(ne)==="Active",{activeChain:e,_reconnect:n,_onReconnectFailed:r,_reconnectConnector:s}=m();return(0,et.useEffect)(()=>{t&&e?q({onError:r}):!t&&n&&q({onError:r})},[]),(0,et.useEffect)(()=>{if(s&&(s==="cosmostation"&&window.cosmostation.cosmos.on("accountChanged",()=>void q({onError:r})),s==="keplr"||s==="leap"))return window.addEventListener(s==="keplr"?"keplr_keystorechange":"leap_keystorechange",()=>void q({onError:r})),()=>{window.removeEventListener(s==="keplr"?"keplr_keystorechange":"leap_keystorechange",()=>void q({onError:r}))}},[s]),null},tt=()=>(Qt(),null);var Se=require("react/jsx-runtime"),Ds=new xe.QueryClient({}),Ps=({children:t,grazOptions:e,...n})=>(e&&We(e),(0,Se.jsxs)(xe.QueryClientProvider,{client:Ds,...n,children:[(0,Se.jsx)(tt,{}),t]}));var js=t=>t,Gs=t=>t,Fs=t=>t;var Kr=require("@keplr-wallet/cosmos"),de=Le(Ct());function Wr(t,e){if(t)return;if(process.env.NODE_ENV==="production")throw new Error(xt);let n=typeof e=="function"?e():e,r=n?`${xt}: ${n}`:xt;throw new Error(r)}var xt="Invariant failed";var Qr=Le(Ct()),St=t=>{if(!(0,Qr.valid)(t))switch(t.split(".").length){case 1:return`${t}.0.0`;case 2:return`${t}.0`;case 3:default:throw new Error("invalid semver")}return t};var qa=t=>{var _e,vt,Rt,It,wt,Tt;let{chain:e,getRestEndpoint:n=({apis:E})=>{var N,P;return((P=(N=E==null?void 0:E.rest)==null?void 0:N[0])==null?void 0:P.address)??""},getRpcEndpoint:r=({apis:E})=>{var N,P;return((P=(N=E==null?void 0:E.rpc)==null?void 0:N[0])==null?void 0:P.address)??""}}=t,s=[],i=St(((_e=e.codebase)==null?void 0:_e.cosmos_sdk_version)??"0.4");if((0,de.satisfies)(i,">=0.4")&&s.push("stargate"),(0,de.satisfies)(i,">=0.43")&&s.push("no-legacy-stdTx"),s.push("ibc-transfer"),(0,de.satisfies)(i,">=0.45")&&s.push("ibc-go"),(vt=e.codebase)!=null&&vt.cosmwasm_enabled){s.push("cosmwasm");let E=St(e.codebase.cosmwasm_version??"0.24");(0,de.satisfies)(E,">=0.24")&&s.push("wasmd_0.24+")}let o=[];"assetlists"in t&&Array.isArray(t.assetlists)&&(o=((Rt=t.assetlists.find(E=>E.chain_name===e.chain_name))==null?void 0:Rt.assets)||[]),"assetlist"in t&&Array.isArray(t.assetlist.assets)&&(o=t.assetlist.assets),"assets"in t&&Array.isArray(t.assets)&&(o=t.assets);let c=((It=e.fees)==null?void 0:It.fee_tokens.map(E=>E.denom))||[],a={};for(let E of((wt=e.fees)==null?void 0:wt.fee_tokens)||[])a[E.denom]={low:E.low_gas_price??.01,average:E.average_gas_price??.025,high:E.high_gas_price??.04};let u=((Tt=e.staking)==null?void 0:Tt.staking_tokens.map(E=>E.denom))||[],d=o.map(E=>{var P,bt;let N=E.denom_units.reduce((Ot,Nt)=>Nt.exponent>Ot.exponent?Nt:Ot);return{coinDenom:E.symbol,coinMinimalDenom:E.base,coinDecimals:N.exponent,coinGeckoId:E.coingecko_id,coinImageUrl:((P=E.logo_URIs)==null?void 0:P.svg)??((bt=E.logo_URIs)==null?void 0:bt.png)}}),h=d[0];Wr(h,`chain '${e.chain_name}' has no assets`);let x=d.find(E=>u.includes(E.coinDenom))??h,f=d.filter(E=>c.includes(E.coinMinimalDenom)).map(E=>{if(!a.hasOwnProperty(E.coinMinimalDenom))return E;let N=a[E.coinMinimalDenom];return{...E,gasPriceStep:N}}),D=d.filter(E=>x.coinDenom===E.coinDenom).map(E=>{if(!a.hasOwnProperty(E.coinMinimalDenom))return E;let N=a[E.coinMinimalDenom];return{...E,gasPriceStep:N}});return{rpc:r(e),rest:n(e),chainId:e.chain_id,chainName:e.pretty_name||"",bip44:{coinType:e.slip44||118},bech32Config:Kr.Bech32Address.defaultBech32Config(e.bech32_prefix),currencies:d,stakeCurrency:x,feeCurrencies:f.length!==0?f:D,features:s}};var zr=(o=>(o.Bridge="bridge",o.Ibc="ibc",o.IbcCw20="ibc-cw20",o.LiquidStake="liquid-stake",o.Synthetic="synthetic",o.Wrapped="wrapped",o))(zr||{}),Vr=(o=>(o.Cw20="cw20",o.Erc20="erc20",o.Ics20="ics20",o.SDKCoin="sdk.coin",o.Snip20="snip20",o.Snip25="snip25",o))(Vr||{}),Hr=(n=>(n.Cometbft="cometbft",n.Tendermint="tendermint",n))(Hr||{}),Xr=(r=>(r.Ics201="ics20-1",r.Ics271="ics27-1",r.Mauth="mauth",r))(Xr||{}),Yr=(n=>(n.Ethermint="ethermint",n.Injective="injective",n))(Yr||{}),Zr=(s=>(s.Ed25519="ed25519",s.Ethsecp256K1="ethsecp256k1",s.Secp256K1="secp256k1",s.Sr25519="sr25519",s))(Zr||{}),Jr=(r=>(r.Devnet="devnet",r.Mainnet="mainnet",r.Testnet="testnet",r))(Jr||{}),es=(r=>(r.Killed="killed",r.Live="live",r.Upcoming="upcoming",r))(es||{}),ts=(n=>(n.Ordered="ordered",n.Unordered="unordered",n))(ts||{});0&&(module.exports={ConsensusType,ExtraCodec,GrazEvents,GrazProvider,ICSEnabled,KeyAlgo,NetworkType,Ordering,Status,TraceType,TypeAsset,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineAsset,defineAssetList,defineChain,defineChainInfo,defineChains,defineRegistryChain,disconnect,executeContract,getActiveChainCurrency,getAvailableWallets,getBalanceStaked,getBalances,getCosmostation,getKeplr,getLeap,getQueryRaw,getQuerySmart,getRecentChain,getWallet,instantiateContract,reconnect,registryToChainInfo,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useBalance,useBalanceStaked,useBalances,useCheckWallet,useClients,useConnect,useDisconnect,useExecuteContract,useGrazEvents,useInstantiateContract,useOfflineSigners,useQueryClient,useQueryRaw,useQuerySmart,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});
1
+ "use strict";var un=Object.create;var ae=Object.defineProperty;var ln=Object.getOwnPropertyDescriptor;var pn=Object.getOwnPropertyNames;var mn=Object.getPrototypeOf,gn=Object.prototype.hasOwnProperty;var fn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),dn=(t,e)=>{for(var n in e)ae(t,n,{get:e[n],enumerable:!0})},it=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pn(e))!gn.call(t,o)&&o!==n&&ae(t,o,{get:()=>e[o],enumerable:!(r=ln(e,o))||r.enumerable});return t};var ct=(t,e,n)=>(n=t!=null?un(mn(t)):{},it(e||!t||!t.__esModule?ae(n,"default",{value:t,enumerable:!0}):n,t)),hn=t=>it(ae({},"__esModule",{value:!0}),t);var xt=fn((To,St)=>{St.exports=w;var v=null;try{v=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function w(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}w.prototype.__isLong__;Object.defineProperty(w.prototype,"__isLong__",{value:!0});function j(t){return(t&&t.__isLong__)===!0}w.isLong=j;var pt={},mt={};function P(t,e){var n,r,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(r=mt[t],r)?r:(n=S(t,(t|0)<0?-1:0,!0),o&&(mt[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(r=pt[t],r)?r:(n=S(t,t<0?-1:0,!1),o&&(pt[t]=n),n))}w.fromInt=P;function _(t,e){if(isNaN(t))return e?q:F;if(e){if(t<0)return q;if(t>=ht)return wt}else{if(t<=-ft)return D;if(t+1>=ft)return Ct}return t<0?_(-t,e).neg():S(t%Z|0,t/Z|0,e)}w.fromNumber=_;function S(t,e,n){return new w(t,e,n)}w.fromBits=S;var ue=Math.pow;function De(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return F;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return De(t.substring(1),e,n).neg();for(var o=_(ue(n,8)),s=F,i=0;i<t.length;i+=8){var a=Math.min(8,t.length-i),u=parseInt(t.substring(i,i+a),n);if(a<8){var f=_(ue(n,a));s=s.mul(f).add(_(u))}else s=s.mul(o),s=s.add(_(u))}return s.unsigned=e,s}w.fromString=De;function O(t,e){return typeof t=="number"?_(t,e):typeof t=="string"?De(t,e):S(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}w.fromValue=O;var gt=65536,Sn=1<<24,Z=gt*gt,ht=Z*Z,ft=ht/2,dt=P(Sn),F=P(0);w.ZERO=F;var q=P(0,!0);w.UZERO=q;var $=P(1);w.ONE=$;var yt=P(1,!0);w.UONE=yt;var Te=P(-1);w.NEG_ONE=Te;var Ct=S(-1,2147483647,!1);w.MAX_VALUE=Ct;var wt=S(-1,-1,!0);w.MAX_UNSIGNED_VALUE=wt;var D=S(0,-2147483648,!1);w.MIN_VALUE=D;var c=w.prototype;c.toInt=function(){return this.unsigned?this.low>>>0:this.low};c.toNumber=function(){return this.unsigned?(this.high>>>0)*Z+(this.low>>>0):this.high*Z+(this.low>>>0)};c.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(D)){var n=_(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=_(ue(e,6),this.unsigned),i=this,a="";;){var u=i.div(s),f=i.sub(u.mul(s)).toInt()>>>0,d=f.toString(e);if(i=u,i.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}};c.getHighBits=function(){return this.high};c.getHighBitsUnsigned=function(){return this.high>>>0};c.getLowBits=function(){return this.low};c.getLowBitsUnsigned=function(){return this.low>>>0};c.getNumBitsAbs=function(){if(this.isNegative())return this.eq(D)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};c.isZero=function(){return this.high===0&&this.low===0};c.eqz=c.isZero;c.isNegative=function(){return!this.unsigned&&this.high<0};c.isPositive=function(){return this.unsigned||this.high>=0};c.isOdd=function(){return(this.low&1)===1};c.isEven=function(){return(this.low&1)===0};c.equals=function(e){return j(e)||(e=O(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};c.eq=c.equals;c.notEquals=function(e){return!this.eq(e)};c.neq=c.notEquals;c.ne=c.notEquals;c.lessThan=function(e){return this.comp(e)<0};c.lt=c.lessThan;c.lessThanOrEqual=function(e){return this.comp(e)<=0};c.lte=c.lessThanOrEqual;c.le=c.lessThanOrEqual;c.greaterThan=function(e){return this.comp(e)>0};c.gt=c.greaterThan;c.greaterThanOrEqual=function(e){return this.comp(e)>=0};c.gte=c.greaterThanOrEqual;c.ge=c.greaterThanOrEqual;c.compare=function(e){if(j(e)||(e=O(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};c.comp=c.compare;c.negate=function(){return!this.unsigned&&this.eq(D)?D:this.not().add($)};c.neg=c.negate;c.add=function(e){j(e)||(e=O(e));var n=this.high>>>16,r=this.high&65535,o=this.low>>>16,s=this.low&65535,i=e.high>>>16,a=e.high&65535,u=e.low>>>16,f=e.low&65535,d=0,A=0,C=0,E=0;return E+=s+f,C+=E>>>16,E&=65535,C+=o+u,A+=C>>>16,C&=65535,A+=r+a,d+=A>>>16,A&=65535,d+=n+i,d&=65535,S(C<<16|E,d<<16|A,this.unsigned)};c.subtract=function(e){return j(e)||(e=O(e)),this.add(e.neg())};c.sub=c.subtract;c.multiply=function(e){if(this.isZero())return F;if(j(e)||(e=O(e)),v){var n=v.mul(this.low,this.high,e.low,e.high);return S(n,v.get_high(),this.unsigned)}if(e.isZero())return F;if(this.eq(D))return e.isOdd()?D:F;if(e.eq(D))return this.isOdd()?D:F;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(dt)&&e.lt(dt))return _(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=this.high&65535,s=this.low>>>16,i=this.low&65535,a=e.high>>>16,u=e.high&65535,f=e.low>>>16,d=e.low&65535,A=0,C=0,E=0,k=0;return k+=i*d,E+=k>>>16,k&=65535,E+=s*d,C+=E>>>16,E&=65535,E+=i*f,C+=E>>>16,E&=65535,C+=o*d,A+=C>>>16,C&=65535,C+=s*f,A+=C>>>16,C&=65535,C+=i*u,A+=C>>>16,C&=65535,A+=r*d+o*f+s*u+i*a,A&=65535,S(E<<16|k,A<<16|C,this.unsigned)};c.mul=c.multiply;c.divide=function(e){if(j(e)||(e=O(e)),e.isZero())throw Error("division by zero");if(v){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?v.div_u:v.div_s)(this.low,this.high,e.low,e.high);return S(n,v.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?q:F;var r,o,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return q;if(e.gt(this.shru(1)))return yt;s=q}else{if(this.eq(D)){if(e.eq($)||e.eq(Te))return D;if(e.eq(D))return $;var i=this.shr(1);return r=i.div(e).shl(1),r.eq(F)?e.isNegative()?$:Te:(o=this.sub(e.mul(r)),s=r.add(o.div(e)),s)}else if(e.eq(D))return this.unsigned?q:F;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=F}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),u=a<=48?1:ue(2,a-48),f=_(r),d=f.mul(e);d.isNegative()||d.gt(o);)r-=u,f=_(r,this.unsigned),d=f.mul(e);f.isZero()&&(f=$),s=s.add(f),o=o.sub(d)}return s};c.div=c.divide;c.modulo=function(e){if(j(e)||(e=O(e)),v){var n=(this.unsigned?v.rem_u:v.rem_s)(this.low,this.high,e.low,e.high);return S(n,v.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};c.mod=c.modulo;c.rem=c.modulo;c.not=function(){return S(~this.low,~this.high,this.unsigned)};c.and=function(e){return j(e)||(e=O(e)),S(this.low&e.low,this.high&e.high,this.unsigned)};c.or=function(e){return j(e)||(e=O(e)),S(this.low|e.low,this.high|e.high,this.unsigned)};c.xor=function(e){return j(e)||(e=O(e)),S(this.low^e.low,this.high^e.high,this.unsigned)};c.shiftLeft=function(e){return j(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?S(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):S(0,this.low<<e-32,this.unsigned)};c.shl=c.shiftLeft;c.shiftRight=function(e){return j(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?S(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):S(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};c.shr=c.shiftRight;c.shiftRightUnsigned=function(e){if(j(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return S(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?S(n,0,this.unsigned):S(n>>>e-32,0,this.unsigned)};c.shru=c.shiftRightUnsigned;c.shr_u=c.shiftRightUnsigned;c.toSigned=function(){return this.unsigned?S(this.low,this.high,!1):this};c.toUnsigned=function(){return this.unsigned?this:S(this.low,this.high,!0)};c.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};c.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};c.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};w.fromBytes=function(e,n,r){return r?w.fromBytesLE(e,n):w.fromBytesBE(e,n)};w.fromBytesLE=function(e,n){return new w(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};w.fromBytesBE=function(e,n){return new w(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});var ho={};dn(ho,{GrazEvents:()=>et,GrazProvider:()=>fo,WALLET_TYPES:()=>xe,WalletType:()=>Se,checkWallet:()=>z,clearRecentChain:()=>ve,configureGraz:()=>Oe,connect:()=>X,createClients:()=>oe,createQueryClient:()=>Ee,createSigningClients:()=>re,defineChain:()=>Pn,defineChainInfo:()=>Gn,defineChains:()=>Ye,disconnect:()=>ge,executeContract:()=>Ue,getActiveChainCurrency:()=>_e,getAvailableWallets:()=>xn,getBalanceStaked:()=>Be,getBalances:()=>ke,getCosmostation:()=>me,getKeplr:()=>le,getLeap:()=>pe,getQueryRaw:()=>qe,getQuerySmart:()=>Me,getRecentChain:()=>An,getWCCosmostation:()=>_t,getWCKeplr:()=>jt,getWCLeap:()=>vt,getWallet:()=>Y,getWalletConnect:()=>K,instantiateContract:()=>Re,mainnetChains:()=>Ln,mainnetChainsArray:()=>zn,reconnect:()=>B,sendIbcTokens:()=>We,sendTokens:()=>Ne,suggestChain:()=>fe,suggestChainAndConnect:()=>Fe,testnetChains:()=>Kn,testnetChainsArray:()=>Qn,useAccount:()=>W,useActiveChain:()=>Xn,useActiveChainCurrency:()=>Jn,useActiveChainValidators:()=>eo,useBalance:()=>Hn,useBalanceStaked:()=>Yn,useBalances:()=>tn,useCheckWallet:()=>se,useClients:()=>ro,useConnect:()=>Vn,useDisconnect:()=>$n,useExecuteContract:()=>lo,useGrazEvents:()=>sn,useInstantiateContract:()=>uo,useOfflineSigners:()=>nn,useQueryClient:()=>io,useQueryRaw:()=>mo,useQuerySmart:()=>po,useRecentChain:()=>to,useSendIbcTokens:()=>ao,useSendTokens:()=>co,useSigners:()=>Zn,useSigningClients:()=>so,useSuggestChain:()=>no,useSuggestChainAndConnect:()=>oo});module.exports=hn(ho);var Ft=require("@cosmjs/stargate");var M="graz-reconnect-session";var Ae=require("zustand"),at=require("zustand/middleware"),H=require("zustand/middleware");var Se=(a=>(a.KEPLR="keplr",a.LEAP="leap",a.COSMOSTATION="cosmostation",a.WALLETCONNECT="walletconnect",a.WC_KEPLR_MOBILE="wc_keplr_mobile",a.WC_LEAP_MOBILE="wc_leap_mobile",a.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",a))(Se||{}),xe=["keplr","leap","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile"];var yn={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},ne={account:null,activeChain:null,balances:null,clients:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,signingClients:null,status:"disconnected",wcSignClient:null},Cn={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:(0,at.createJSONStorage)(()=>sessionStorage)},wn={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},m=(0,Ae.create)((0,H.subscribeWithSelector)((0,H.persist)(()=>ne,Cn))),y=(0,Ae.create)((0,H.subscribeWithSelector)((0,H.persist)(()=>yn,wn)));var be=require("@cosmjs/cosmwasm-stargate"),Ie=require("@cosmjs/stargate"),lt=require("@cosmjs/tendermint-rpc");var ut=require("@cosmjs/stargate"),V=require("@cosmjs/utils");var Ee=(...t)=>{let{tendermint:e}=m.getState().clients,n=new ut.QueryClient(e),r=t.map(o=>o(n));for(let o of r){(0,V.assert)((0,V.isNonNullObject)(o),"Extension must be a non-null object");for(let[s,i]of Object.entries(o)){(0,V.assert)((0,V.isNonNullObject)(i),`Module must be a non-null object. Found type ${typeof i} for module "${s}".`);let a=n[s]||{};n[s]={...a,...i}}}return n};var oe=async({rpc:t,rpcHeaders:e})=>{let n={url:t,headers:{...e||{}}},[r,o,s]=await Promise.all([be.SigningCosmWasmClient.connect(n),Ie.SigningStargateClient.connect(n),lt.Tendermint34Client.connect(t)]);return{cosmWasm:r,stargate:o,tendermint:s}},re=async t=>{let{rpc:e,rpcHeaders:n,offlineSignerAuto:r,cosmWasmSignerOptions:o={},stargateSignerOptions:s={}}=t,i={url:e,headers:{...n||{}}},[a,u]=await Promise.all([be.SigningCosmWasmClient.connectWithSigner(i,r,o),Ie.SigningStargateClient.connectWithSigner(i,r,s)]);return{cosmWasm:a,stargate:u}};var bt=require("@cosmjs/encoding"),It=require("@walletconnect/sign-client"),Tt=require("@walletconnect/utils"),Dt=ct(xt());var G=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,At=()=>G()&&navigator.userAgent.toLowerCase().includes("android"),Et=()=>G()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var je=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((o,s)=>{setTimeout(()=>{s(n)},e)});return Promise.race([t,r])};var z=(t=y.getState().walletType)=>{try{return Y(t),!0}catch{return!1}},L=()=>{window.sessionStorage.removeItem(M),m.setState(ne)},le=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{L(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{L(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.keplr is not defined")},pe=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{L(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{L(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.leap is not defined")},me=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{L(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{L(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")},K=t=>{var nt,ot,rt;if(!((rt=(ot=(nt=y.getState().walletConnect)==null?void 0:nt.options)==null?void 0:ot.projectId)!=null&&rt.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=p=>{if(!t)return;let{appUrl:l,formatNativeUrl:g}=t;if(G()){if(At())if(!p)window.open(l.mobile.android,"_self","noreferrer noopener");else{let h=g(l.mobile.android,p,"android");window.open(h,"_self","noreferrer noopener")}if(Et())if(!p)window.open(l.mobile.ios,"_self","noreferrer noopener");else{let h=g(l.mobile.ios,p,"ios");window.open(h,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:p}=m.getState();if(!p)throw new Error("walletConnect.signClient is not defined");L(),y.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},o=async p=>{let{wcSignClient:l}=m.getState();if(!l)throw new Error("walletConnect.signClient is not defined");if(!p)throw new Error("No wallet connect session");await l.disconnect({topic:p,reason:(0,Tt.getSdkError)("USER_DISCONNECTED")}),await a(l),r()},s=p=>{var l,g;try{let{wcSignClient:h}=m.getState();if(!h)throw new Error("walletConnect.signClient is not defined");let x=h.session.getAll().at(-1);if(!x)return;let b=(g=(l=h.session.getAll().at(-1))==null?void 0:l.namespaces.cosmos)==null?void 0:g.accounts.find(I=>I.startsWith(`cosmos:${p}`));if(!(x.expiry*1e3>Date.now()+1e3))throw o(x.topic),new Error("invalid session");if(!b)try{let I=h.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!I.length)throw new Error("no session");return I.at(-1)}catch(I){if(!I.message.toLowerCase().includes("no matching key"))throw I}return x}catch(h){if(!h.message.toLowerCase().includes("no matching key"))throw h}},i=p=>{try{return s(p)}catch{return}},a=async p=>{try{let l=p.core.pairing.pairings.getAll({active:!1});if(!l.length)return;await Promise.all(l.map(async g=>{await p.core.pairing.pairings.delete(g.topic,{code:7001,message:"clear pairing"})}))}catch(l){if(!l.message.toLowerCase().includes("no matching key"))throw l}},u=async()=>{let{walletConnect:p}=y.getState();if(!(p!=null&&p.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:l}=m.getState();if(l)return m.setState({wcSignClient:l}),l;let g=await It.SignClient.init(p.options);return m.setState({wcSignClient:g}),g},f=p=>{let{wcSignClient:l}=m.getState();if(l)return l.events.on("session_delete",g=>{r()}),l.events.on("session_expire",g=>{r()}),l.events.on("session_event",g=>{var h,x;if(g.params.event.name==="accountsChanged"&&((h=g.params.event.data)==null?void 0:h[0])!==((x=m.getState().account)==null?void 0:x.bech32Address)){let b=g.params.chainId.split(":")[1];b&&d(b)}else p()}),()=>{l.events.off("session_delete",g=>{r()}),l.events.off("session_expire",g=>{r()}),l.events.off("session_event",g=>{var h,x;if(g.params.event.name==="accountsChanged"&&((h=g.params.event.data)==null?void 0:h[0])!==((x=m.getState().account)==null?void 0:x.bech32Address)){let b=g.params.chainId.split(":")[1];b&&d(b)}else p()})}},d=async p=>{var ie;let{wcSignClient:l}=m.getState();if(!l)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:g}=y.getState();if(!((ie=g==null?void 0:g.options)!=null&&ie.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:h}=await import("@web3modal/standalone"),x=new h({projectId:g.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...g.web3Modal}),{account:b,activeChain:N}=m.getState(),I=i(p);if((N==null?void 0:N.chainId)!==p&&!I||!b){let{uri:T,approval:ce}=await l.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!T)throw new Error("No wallet connect uri");t?n(T):await x.openModal({uri:T});try{await je((async()=>{await ce()})(),4e4,new Error("Modal approval timeout"))}catch(st){if(x.closeModal(),!st.message.toLowerCase().includes("no matching key"))return Promise.reject(st)}return t||x.closeModal(),Promise.resolve()}try{await je((async()=>{let T=await C(p);m.setState({account:T})})(),1e4,new Error("Connection timeout"))}catch(T){if(o(I==null?void 0:I.topic),!T.message.toLowerCase().includes("no matching key"))throw T}},A=async p=>{var x;let{wcSignClient:l}=m.getState();if(!l)throw new Error("walletConnect.signClient is not defined");let g=(x=s(p))==null?void 0:x.topic;if(!g)throw new Error("No wallet connect session");n();let h=await l.request({topic:g,chainId:`cosmos:${p}`,request:{method:"cosmos_getAccounts",params:{}}});if(!h[0])throw new Error("No wallet connect account");return{address:h[0].address,algo:h[0].algo,pubkey:new Uint8Array(Buffer.from(h[0].pubkey,e))}},C=async p=>{let{address:l,algo:g,pubkey:h}=await A(p);return{address:(0,bt.fromBech32)(l).data,algo:g,bech32Address:l,name:"",pubKey:h,isKeystone:!1,isNanoLedger:!1}},E=async(...p)=>{var T,ce;let[l,g,h]=p,{account:x,wcSignClient:b}=m.getState();if(!b)throw new Error("walletConnect.signClient is not defined");if(!x)throw new Error("account is not defined");let N=(T=s(l))==null?void 0:T.topic;if(!N)throw new Error("No wallet connect session");if(!h.bodyBytes)throw new Error("No bodyBytes");if(!h.authInfoBytes)throw new Error("No authInfoBytes");let I={topic:N,chainId:`cosmos:${l}`,request:{method:"cosmos_signDirect",params:{signerAddress:g,signDoc:{...h,bodyBytes:Buffer.from(h.bodyBytes).toString(e),authInfoBytes:Buffer.from(h.authInfoBytes).toString(e),accountNumber:(ce=h.accountNumber)==null?void 0:ce.toString()}}}};return n(),await b.request(I)},k=async(...p)=>{let[l,g,h]=p,{signature:x,signed:b}=await E(l,g,h);return{signed:{chainId:b.chainId,accountNumber:Dt.default.fromString(b.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(b.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(b.bodyBytes,e))},signature:x}},Ce=async(...p)=>{var T;let[l,g,h,x]=p,{wcSignClient:b}=m.getState(),{account:N}=m.getState();if(!b)throw new Error("walletConnect.signClient is not defined");if(!N)throw new Error("account is not defined");let I=(T=s(l))==null?void 0:T.topic;if(!I)throw new Error("No wallet connect session");return n(),await b.request({topic:I,chainId:`cosmos:${l}`,request:{method:"cosmos_signDirect",params:{signerAddress:g,signDoc:h}}})},te=async(...p)=>{let[l,g,h,x]=p;return await Ce(l,g,h)},we=p=>({getAccounts:async()=>[await A(p)],signDirect:(l,g)=>k(p,l,g)}),U=p=>({getAccounts:async()=>[await A(p)],signAmino:(l,g)=>te(p,l,g)});return{enable:d,experimentalSuggestChain:async(...p)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:p=>({getAccounts:async()=>[await A(p)],signDirect:(l,g)=>k(p,l,g),signAmino:(l,g)=>te(p,l,g)}),getOfflineSignerAuto:async p=>(await C(p)).isNanoLedger?U(p):we(p),getOfflineSignerOnlyAmino:U,signAmino:te,signDirect:k,subscription:f,init:u}},jt=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!G())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(o,s,i)=>{let a=o.replaceAll("/","").replaceAll(":",""),u=encodeURIComponent(s);switch(i){case"ios":return`${a}://wcV2?${u}`;case"android":return`${a}://wcV2?${u}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${a}://wc?uri=${u}`}}};return K(t)},vt=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!G())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,s,i)=>{let a=o.replaceAll("/","").replaceAll(":",""),u=encodeURIComponent(s);switch(i){case"ios":return`${a}://wcV2?${u}`;case"android":return`${a}://wcV2?${u}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${a}://wc?uri=${u}`}}};return K(t)},_t=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!G())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,s,i)=>`${o.replaceAll("/","").replaceAll(":","")}://wc?${s}`};return K(t)},Y=(t=y.getState().walletType)=>{switch(t){case"keplr":return le();case"leap":return pe();case"cosmostation":return me();case"walletconnect":return K();case"wc_keplr_mobile":return jt();case"wc_leap_mobile":return vt();case"wc_cosmostation_mobile":return _t();default:throw new Error("Unknown wallet type")}},xn=()=>Object.fromEntries(xe.map(t=>[t,z(t)]));var X=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:o}=y.getState(),s=(t==null?void 0:t.walletType)||o;if(!z(s))throw new Error(`${s} is not available`);let a=Y(s),u=(t==null?void 0:t.chain)||r||n;if(!u)throw new Error("No last known connected chain, connect action requires chain info");m.setState(U=>{let tt=y.getState()._reconnect||!!y.getState()._reconnectConnector||!!u;return U.activeChain&&U.activeChain.chainId!==u.chainId?{status:"connecting"}:tt?{status:"reconnecting"}:{status:"connecting"}});let{account:f,activeChain:d}=m.getState();if(await((e=a.init)==null?void 0:e.call(a)),!f||(d==null?void 0:d.chainId)!==u.chainId){await a.enable(u.chainId);let U=await a.getKey(u.chainId);m.setState({account:U})}let A=a.getOfflineSigner(u.chainId),C=a.getOfflineSignerOnlyAmino(u.chainId),E=await a.getOfflineSignerAuto(u.chainId),k=u.gas?Ft.GasPrice.fromString(`${u.gas.price}${u.gas.denom}`):void 0,[Ce,te]=await Promise.all([oe(u),re({...u,offlineSignerAuto:E,cosmWasmSignerOptions:{gasPrice:k,...(t==null?void 0:t.signerOpts)||{}}})]);y.setState({recentChain:u,walletType:s,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:s}),m.setState({activeChain:u,clients:Ce,offlineSigner:A,offlineSignerAmino:C,offlineSignerAuto:E,signingClients:te,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem(M,"Active");let{account:we}=m.getState();return{account:we,walletType:s,chain:u}}catch(n){throw console.error("connect ",n),m.getState().account===null&&m.setState({status:"disconnected"}),m.getState().account&&m.getState().activeChain&&m.setState({status:"connected"}),n}},ge=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(M),m.setState(ne),y.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),B=async t=>{var o;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=y.getState();try{let s=z(n||void 0);if(e&&s&&n)return await X({chain:e,walletType:n,autoReconnect:r})}catch(s){(o=t==null?void 0:t.onError)==null||o.call(t,s),ge()}};var ve=()=>{y.setState({recentChain:null})},_e=t=>{let{activeChain:e}=m.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},An=()=>y.getState().recentChain,fe=async t=>(await Y().experimentalSuggestChain(t),t),Fe=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...o})=>{let s=await fe(t);return{...await X({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...o}),chain:s}};var Oe=(t={})=>(y.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var ke=async t=>{let{activeChain:e,signingClients:n}=m.getState();if(!e||!n)throw new Error("No connected account detected");let{defaultSigningClient:r}=y.getState();return await Promise.all(e.currencies.map(async s=>{let i=s.coinMinimalDenom.startsWith("cw20:");return n[r].getBalance(t,i?s.coinMinimalDenom.replace("cw20:",""):s.coinMinimalDenom)}))},Be=async t=>{let{clients:e}=m.getState();if(!(e!=null&&e.stargate))throw new Error("Stargate client is not ready");return e.stargate.getBalanceStaked(t)},Ne=async({senderAddress:t,recipientAddress:e,amount:n,fee:r,memo:o})=>{let{defaultSigningClient:s}=y.getState(),{signingClients:i}=m.getState();if(!i)throw new Error("No connected account detected");if(!t)throw new Error("senderAddress is not defined");return i[s].sendTokens(t,e,n,r,o)},We=async({senderAddress:t,recipientAddress:e,transferAmount:n,sourcePort:r,sourceChannel:o,timeoutHeight:s,timeoutTimestamp:i,fee:a,memo:u})=>{let{signingClients:f}=m.getState();if(!(f!=null&&f.stargate))throw new Error("Stargate signing client is not ready");if(!t)throw new Error("senderAddress is not defined");return f.stargate.sendIbcTokens(t,e,n,r,o,s,i,a,u)},Re=async({senderAddress:t,msg:e,fee:n,options:r,label:o,codeId:s})=>{let{signingClients:i}=m.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.instantiate(t,s,e,o,n,r)},Ue=async({senderAddress:t,msg:e,fee:n,contractAddress:r,funds:o,memo:s})=>{let{signingClients:i}=m.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.execute(t,r,e,n,s,o)},Me=async(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");return await n.cosmWasm.queryContractSmart(t,e)},qe=(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.cosmWasm.queryContractRaw(t,r)};var kt=require("@keplr-wallet/cosmos"),Bt={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},En={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},bn={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},In={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},Tn={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},Dn={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},Ot=[Bt,En,bn,In,Tn,Dn],Pe={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:Bt,bip44:{coinType:118},bech32Config:kt.Bech32Address.defaultBech32Config("axelar"),currencies:Ot,feeCurrencies:Ot};var Wt=require("@keplr-wallet/cosmos"),Rt={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Nt=[Rt],Ge={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:Rt,bip44:{coinType:118},bech32Config:Wt.Bech32Address.defaultBech32Config("cosmos"),currencies:Nt,feeCurrencies:Nt};var Mt=require("@keplr-wallet/cosmos"),qt={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},jn={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},vn={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},_n={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},Fn={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},On={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},kn={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},Bn={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},Nn={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},Wn={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},Rn={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},Ut=[qt,jn,vn,_n,Fn,On,kn,Bn,Nn,Wn,Rn],Le={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:qt,bip44:{coinType:118},bech32Config:Mt.Bech32Address.defaultBech32Config("juno"),currencies:Ut,feeCurrencies:Ut};var Gt=require("@keplr-wallet/cosmos"),Lt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Un={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Pt=[Lt,Un],ze={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:Lt,bip44:{coinType:118},bech32Config:Gt.Bech32Address.defaultBech32Config("osmo"),currencies:Pt,feeCurrencies:Pt};var Kt=require("@keplr-wallet/cosmos"),Qt={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},zt=[Qt],Ke={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:Qt,bip44:{coinType:118},bech32Config:Kt.Bech32Address.defaultBech32Config("somm"),currencies:zt,feeCurrencies:zt};var Vt=require("@keplr-wallet/cosmos"),$t={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},Ht=[$t],Qe={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:Vt.Bech32Address.defaultBech32Config("CRE"),currencies:Ht,feeCurrencies:Ht,stakeCurrency:$t,coinType:118};var Zt=require("@keplr-wallet/cosmos"),He={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},Mn=[He],Ve={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:He,bip44:{coinType:118},bech32Config:Zt.Bech32Address.defaultBech32Config("juno"),currencies:Mn,feeCurrencies:[He],coinType:118};var Yt=require("@keplr-wallet/cosmos"),$e={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},qn=[$e],Ze={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:$e,bip44:{coinType:118},bech32Config:Yt.Bech32Address.defaultBech32Config("osmo"),currencies:qn,feeCurrencies:[$e],coinType:118};var Ye=t=>t,Pn=t=>t,Gn=t=>t,Ln=Ye({axelar:Pe,cosmoshub:Ge,juno:Le,osmosis:ze,sommelier:Ke}),zn=[Pe,Ge,Le,ze,Ke],Kn=Ye({crescent:Qe,juno:Ve,osmosis:Ze}),Qn=[Qe,Ve,Ze];var Q=require("@tanstack/react-query"),Jt=require("react"),en=require("zustand/shallow");var Xt=require("@tanstack/react-query");var se=t=>{let n=["USE_CHECK_WALLET",y(o=>t||o.walletType)];return(0,Xt.useQuery)(n,({queryKey:[,o]})=>z(o))};var W=({onConnect:t,onDisconnect:e}={})=>{let n=m(o=>o.account),r=m(o=>o.status);return(0,Jt.useEffect)(()=>m.subscribe(o=>o.status,(o,s)=>{if(o==="connected"){let{account:i,activeChain:a}=m.getState(),{walletType:u}=y.getState();t==null||t({account:i,chain:a,walletType:u,isReconnect:s==="reconnecting"})}o==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:B,status:r}},tn=t=>{let{data:e}=W(),n=t||(e==null?void 0:e.bech32Address);return(0,Q.useQuery)(["USE_BALANCES",n],({queryKey:[,s]})=>ke(s),{enabled:!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},Hn=(t,e)=>{let{data:n}=tn(e);return(0,Q.useQuery)(["USE_BALANCE",n,t,e],({queryKey:[,s]})=>s==null?void 0:s.find(i=>i.denom===t),{enabled:!!n})},Vn=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,Q.useMutation)(["USE_CONNECT",t,e,n],X,{onError:(i,a)=>Promise.resolve(t==null?void 0:t(i,a)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:s}=se();return{connect:i=>o.mutate(i),connectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!s,status:o.status}},$n=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,Q.useMutation)(["USE_DISCONNECT",t,e,n],ge,{onError:s=>Promise.resolve(t==null?void 0:t(s,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:s=>o.mutate(s),disconnectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}},nn=()=>m(t=>({signer:t.offlineSigner,signerAmino:t.offlineSignerAmino,signerAuto:t.offlineSignerAuto}),en.shallow),Zn=()=>nn(),Yn=t=>{let{data:e}=W(),n=t||(e==null?void 0:e.bech32Address);return(0,Q.useQuery)(["USE_BALANCE_STAKED",n],({queryKey:[,s]})=>Be(n),{enabled:!!n})};var J=require("@tanstack/react-query");var Xn=()=>m(t=>t.activeChain),Jn=t=>(0,J.useQuery)(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>_e(r)),eo=(t,e="BOND_STATUS_BONDED")=>(0,J.useQuery)(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],({queryKey:[,o,s]})=>o.staking.validators(s),{enabled:typeof t<"u"}),to=()=>({data:y(e=>e.recentChain),clear:ve}),no=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,J.useMutation)(["USE_SUGGEST_CHAIN",t,e,n],fe,{onError:(s,i)=>Promise.resolve(t==null?void 0:t(s,i)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}},oo=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=(0,J.useMutation)(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],Fe,{onError:(i,a)=>Promise.resolve(t==null?void 0:t(i,a)),onMutate:i=>e==null?void 0:e(i),onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:s}=se();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!s,status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}};var Xe=require("@tanstack/react-query");var ro=t=>{let e=m(o=>o.clients);return(0,Xe.useQuery)(["USE_CLIENTS",t,e],({queryKey:[,o,s]})=>o!=null&&o.rpc?oe(o):s,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:o=>{m.setState({clients:o})},initialData:e})},so=t=>{let e=m(o=>o.signingClients);return(0,Xe.useQuery)(["USE_SIGNING_CLIENTS",t,e],({queryKey:[,o,s]})=>o!=null&&o.rpc?re(o):s,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:o=>{m.setState({signingClients:o})},initialData:e})};var on=require("@tanstack/react-query");var io=(...t)=>{let e=["USE_QUERY_CLIENT",...t];return(0,on.useQuery)(e,({queryKey:[,...r]})=>Ee(...t),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var R=require("@tanstack/react-query");var co=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=W(),o=r==null?void 0:r.bech32Address,i=(0,R.useMutation)(["USE_SEND_TOKENS",t,e,n,o],a=>Ne({senderAddress:o,...a}),{onError:(a,u)=>Promise.resolve(t==null?void 0:t(a,u)),onMutate:e,onSuccess:a=>Promise.resolve(n==null?void 0:n(a))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},ao=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=W(),o=r==null?void 0:r.bech32Address,i=(0,R.useMutation)(["USE_SEND_IBC_TOKENS",t,e,n,o],a=>We({senderAddress:o,...a}),{onError:(a,u)=>Promise.resolve(t==null?void 0:t(a,u)),onMutate:e,onSuccess:a=>Promise.resolve(n==null?void 0:n(a))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},uo=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=W(),s=o==null?void 0:o.bech32Address,u=(0,R.useMutation)(["USE_INSTANTIATE_CONTRACT",e,n,r,t,s],f=>{if(!s)throw new Error("senderAddress is undefined");let d={...f,fee:f.fee??"auto",senderAddress:s,codeId:t};return Re(d)},{onError:(f,d)=>Promise.resolve(e==null?void 0:e(f,d)),onMutate:n,onSuccess:f=>Promise.resolve(r==null?void 0:r(f))});return{error:u.error,isLoading:u.isLoading,isSuccess:u.isSuccess,instantiateContract:u.mutate,instantiateContractAsync:u.mutateAsync,status:u.status}},lo=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=W(),s=o==null?void 0:o.bech32Address,u=(0,R.useMutation)(["USE_EXECUTE_CONTRACT",e,n,r,t,s],f=>{if(!s)throw new Error("senderAddress is undefined");let d={...f,fee:f.fee??"auto",senderAddress:s,contractAddress:t,memo:f.memo??"",funds:f.funds??[]};return Ue(d)},{onError:(f,d)=>Promise.resolve(e==null?void 0:e(f,d)),onMutate:n,onSuccess:f=>Promise.resolve(r==null?void 0:r(f))});return{error:u.error,isLoading:u.isLoading,isSuccess:u.isSuccess,executeContract:u.mutate,executeContractAsync:u.mutateAsync,status:u.status}},po=(t,e)=>(0,R.useQuery)(["USE_QUERY_SMART",t,e],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return Me(t,e)},{enabled:!!t&&!!e}),mo=(t,e)=>(0,R.useQuery)(["USE_QUERY_RAW",e,t],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or key undefined");return qe(t,e)},{enabled:!!t&&!!e});var ye=require("@tanstack/react-query"),cn=require("@tanstack/react-query-devtools");var de=require("react"),he=require("react/jsx-runtime"),rn=({children:t})=>{let[e,n]=(0,de.useState)(!1);return(0,de.useEffect)(()=>{n(!0)},[]),(0,he.jsx)(he.Fragment,{children:e?t:null})};var Je=require("react");var sn=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(M)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=y(),{activeChain:o,wcSignClient:s}=m();return(0,Je.useEffect)(()=>{r&&(t&&o?B({onError:n}):!t&&e&&B({onError:n}))},[]),(0,Je.useEffect)(()=>{var i,a,u,f,d,A,C,E;r&&(r==="cosmostation"&&((a=(i=me()).subscription)==null||a.call(i,()=>{B({onError:n})})),r==="keplr"&&((f=(u=le()).subscription)==null||f.call(u,()=>{B({onError:n})})),r==="leap"&&((A=(d=pe()).subscription)==null||A.call(d,()=>{B({onError:n})})),r==="walletconnect"&&s&&((E=(C=K()).subscription)==null||E.call(C,()=>{B({onError:n})})))},[r,s]),null},et=()=>(sn(),null);var ee=require("react/jsx-runtime"),go=new ye.QueryClient({}),fo=({children:t,grazOptions:e,debug:n,...r})=>(e&&Oe(e),(0,ee.jsxs)(ye.QueryClientProvider,{client:go,...r,children:[(0,ee.jsxs)(rn,{children:[(0,ee.jsx)(et,{}),t]}),n?(0,ee.jsx)(cn.ReactQueryDevtools,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));0&&(module.exports={GrazEvents,GrazProvider,WALLET_TYPES,WalletType,checkWallet,clearRecentChain,configureGraz,connect,createClients,createQueryClient,createSigningClients,defineChain,defineChainInfo,defineChains,disconnect,executeContract,getActiveChainCurrency,getAvailableWallets,getBalanceStaked,getBalances,getCosmostation,getKeplr,getLeap,getQueryRaw,getQuerySmart,getRecentChain,getWCCosmostation,getWCKeplr,getWCLeap,getWallet,getWalletConnect,instantiateContract,mainnetChains,mainnetChainsArray,reconnect,sendIbcTokens,sendTokens,suggestChain,suggestChainAndConnect,testnetChains,testnetChainsArray,useAccount,useActiveChain,useActiveChainCurrency,useActiveChainValidators,useBalance,useBalanceStaked,useBalances,useCheckWallet,useClients,useConnect,useDisconnect,useExecuteContract,useGrazEvents,useInstantiateContract,useOfflineSigners,useQueryClient,useQueryRaw,useQuerySmart,useRecentChain,useSendIbcTokens,useSendTokens,useSigners,useSigningClients,useSuggestChain,useSuggestChainAndConnect});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as g,b as st,c as H}from"./chunk-HBC2VYPF.mjs";var J=g((Vc,Nt)=>{var Jr="2.0.0",es=Number.MAX_SAFE_INTEGER||9007199254740991,ts=16,ns=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Nt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:ts,MAX_SAFE_INTEGER:es,RELEASE_TYPES:ns,SEMVER_SPEC_VERSION:Jr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ee=g((Hc,qt)=>{var rs=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};qt.exports=rs});var W=g((j,_t)=>{var{MAX_SAFE_COMPONENT_LENGTH:Oe}=J(),ss=ee();j=_t.exports={};var is=j.re=[],l=j.src=[],p=j.t={},os=0,y=(t,e,n)=>{let r=os++;ss(t,r,e),p[t]=r,l[r]=e,is[r]=new RegExp(e,n?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*");y("NUMERICIDENTIFIERLOOSE","[0-9]+");y("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");y("MAINVERSION",`(${l[p.NUMERICIDENTIFIER]})\\.(${l[p.NUMERICIDENTIFIER]})\\.(${l[p.NUMERICIDENTIFIER]})`);y("MAINVERSIONLOOSE",`(${l[p.NUMERICIDENTIFIERLOOSE]})\\.(${l[p.NUMERICIDENTIFIERLOOSE]})\\.(${l[p.NUMERICIDENTIFIERLOOSE]})`);y("PRERELEASEIDENTIFIER",`(?:${l[p.NUMERICIDENTIFIER]}|${l[p.NONNUMERICIDENTIFIER]})`);y("PRERELEASEIDENTIFIERLOOSE",`(?:${l[p.NUMERICIDENTIFIERLOOSE]}|${l[p.NONNUMERICIDENTIFIER]})`);y("PRERELEASE",`(?:-(${l[p.PRERELEASEIDENTIFIER]}(?:\\.${l[p.PRERELEASEIDENTIFIER]})*))`);y("PRERELEASELOOSE",`(?:-?(${l[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[p.PRERELEASEIDENTIFIERLOOSE]})*))`);y("BUILDIDENTIFIER","[0-9A-Za-z-]+");y("BUILD",`(?:\\+(${l[p.BUILDIDENTIFIER]}(?:\\.${l[p.BUILDIDENTIFIER]})*))`);y("FULLPLAIN",`v?${l[p.MAINVERSION]}${l[p.PRERELEASE]}?${l[p.BUILD]}?`);y("FULL",`^${l[p.FULLPLAIN]}$`);y("LOOSEPLAIN",`[v=\\s]*${l[p.MAINVERSIONLOOSE]}${l[p.PRERELEASELOOSE]}?${l[p.BUILD]}?`);y("LOOSE",`^${l[p.LOOSEPLAIN]}$`);y("GTLT","((?:<|>)?=?)");y("XRANGEIDENTIFIERLOOSE",`${l[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);y("XRANGEIDENTIFIER",`${l[p.NUMERICIDENTIFIER]}|x|X|\\*`);y("XRANGEPLAIN",`[v=\\s]*(${l[p.XRANGEIDENTIFIER]})(?:\\.(${l[p.XRANGEIDENTIFIER]})(?:\\.(${l[p.XRANGEIDENTIFIER]})(?:${l[p.PRERELEASE]})?${l[p.BUILD]}?)?)?`);y("XRANGEPLAINLOOSE",`[v=\\s]*(${l[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[p.XRANGEIDENTIFIERLOOSE]})(?:${l[p.PRERELEASELOOSE]})?${l[p.BUILD]}?)?)?`);y("XRANGE",`^${l[p.GTLT]}\\s*${l[p.XRANGEPLAIN]}$`);y("XRANGELOOSE",`^${l[p.GTLT]}\\s*${l[p.XRANGEPLAINLOOSE]}$`);y("COERCE",`(^|[^\\d])(\\d{1,${Oe}})(?:\\.(\\d{1,${Oe}}))?(?:\\.(\\d{1,${Oe}}))?(?:$|[^\\d])`);y("COERCERTL",l[p.COERCE],!0);y("LONETILDE","(?:~>?)");y("TILDETRIM",`(\\s*)${l[p.LONETILDE]}\\s+`,!0);j.tildeTrimReplace="$1~";y("TILDE",`^${l[p.LONETILDE]}${l[p.XRANGEPLAIN]}$`);y("TILDELOOSE",`^${l[p.LONETILDE]}${l[p.XRANGEPLAINLOOSE]}$`);y("LONECARET","(?:\\^)");y("CARETTRIM",`(\\s*)${l[p.LONECARET]}\\s+`,!0);j.caretTrimReplace="$1^";y("CARET",`^${l[p.LONECARET]}${l[p.XRANGEPLAIN]}$`);y("CARETLOOSE",`^${l[p.LONECARET]}${l[p.XRANGEPLAINLOOSE]}$`);y("COMPARATORLOOSE",`^${l[p.GTLT]}\\s*(${l[p.LOOSEPLAIN]})$|^$`);y("COMPARATOR",`^${l[p.GTLT]}\\s*(${l[p.FULLPLAIN]})$|^$`);y("COMPARATORTRIM",`(\\s*)${l[p.GTLT]}\\s*(${l[p.LOOSEPLAIN]}|${l[p.XRANGEPLAIN]})`,!0);j.comparatorTrimReplace="$1$2$3";y("HYPHENRANGE",`^\\s*(${l[p.XRANGEPLAIN]})\\s+-\\s+(${l[p.XRANGEPLAIN]})\\s*$`);y("HYPHENRANGELOOSE",`^\\s*(${l[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[p.XRANGEPLAINLOOSE]})\\s*$`);y("STAR","(<|>)?=?\\s*\\*");y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var fe=g((Xc,Lt)=>{var as=Object.freeze({loose:!0}),cs=Object.freeze({}),us=t=>t?typeof t!="object"?as:t:cs;Lt.exports=us});var $e=g((Yc,jt)=>{var Dt=/^[0-9]+$/,Pt=(t,e)=>{let n=Dt.test(t),r=Dt.test(e);return n&&r&&(t=+t,e=+e),t===e?0:n&&!r?-1:r&&!n?1:t<e?-1:1},ls=(t,e)=>Pt(e,t);jt.exports={compareIdentifiers:Pt,rcompareIdentifiers:ls}});var v=g((Zc,Bt)=>{var me=ee(),{MAX_LENGTH:Gt,MAX_SAFE_INTEGER:de}=J(),{re:Ft,t:Ut}=W(),ps=fe(),{compareIdentifiers:Q}=$e(),T=class{constructor(e,n){if(n=ps(n),e instanceof T){if(e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Gt)throw new TypeError(`version is longer than ${Gt} characters`);me("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=e.trim().match(n.loose?Ft[Ut.LOOSE]:Ft[Ut.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>de||this.major<0)throw new TypeError("Invalid major version");if(this.minor>de||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>de||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<de)return i}return s}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(me("SemVer.compare",this.version,this.options,e),!(e instanceof T)){if(typeof e=="string"&&e===this.version)return 0;e=new T(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof T||(e=new T(e,this.options)),Q(this.major,e.major)||Q(this.minor,e.minor)||Q(this.patch,e.patch)}comparePre(e){if(e instanceof T||(e=new T(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let n=0;do{let r=this.prerelease[n],s=e.prerelease[n];if(me("prerelease compare",n,r,s),r===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(r===void 0)return-1;if(r===s)continue;return Q(r,s)}while(++n)}compareBuild(e){e instanceof T||(e=new T(e,this.options));let n=0;do{let r=this.build[n],s=e.build[n];if(me("prerelease compare",n,r,s),r===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(r===void 0)return-1;if(r===s)continue;return Q(r,s)}while(++n)}inc(e,n,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(r)?1:0;if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(n){let i=[n,s];r===!1&&(i=[n]),Q(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};Bt.exports=T});var F=g((Jc,Mt)=>{var kt=v(),hs=(t,e,n=!1)=>{if(t instanceof kt)return t;try{return new kt(t,e)}catch(r){if(!n)return null;throw r}};Mt.exports=hs});var Qt=g((eu,Wt)=>{var fs=F(),ms=(t,e)=>{let n=fs(t,e);return n?n.version:null};Wt.exports=ms});var zt=g((tu,Kt)=>{var ds=F(),gs=(t,e)=>{let n=ds(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null};Kt.exports=gs});var Xt=g((nu,Ht)=>{var Vt=v(),Es=(t,e,n,r,s)=>{typeof n=="string"&&(s=r,r=n,n=void 0);try{return new Vt(t instanceof Vt?t.version:t,n).inc(e,r,s).version}catch{return null}};Ht.exports=Es});var Jt=g((ru,Zt)=>{var Yt=F(),ys=(t,e)=>{let n=Yt(t,null,!0),r=Yt(e,null,!0),s=n.compare(r);if(s===0)return null;let i=s>0,o=i?n:r,c=i?r:n,a=!!o.prerelease.length,u=a?"pre":"";return n.major!==r.major?u+"major":n.minor!==r.minor?u+"minor":n.patch!==r.patch?u+"patch":a?"prerelease":c.patch?"patch":c.minor?"minor":"major"};Zt.exports=ys});var tn=g((su,en)=>{var Cs=v(),xs=(t,e)=>new Cs(t,e).major;en.exports=xs});var rn=g((iu,nn)=>{var Ss=v(),As=(t,e)=>new Ss(t,e).minor;nn.exports=As});var on=g((ou,sn)=>{var vs=v(),Rs=(t,e)=>new vs(t,e).patch;sn.exports=Rs});var cn=g((au,an)=>{var Is=F(),ws=(t,e)=>{let n=Is(t,e);return n&&n.prerelease.length?n.prerelease:null};an.exports=ws});var b=g((cu,ln)=>{var un=v(),Ts=(t,e,n)=>new un(t,n).compare(new un(e,n));ln.exports=Ts});var hn=g((uu,pn)=>{var bs=b(),Os=(t,e,n)=>bs(e,t,n);pn.exports=Os});var mn=g((lu,fn)=>{var $s=b(),Ns=(t,e)=>$s(t,e,!0);fn.exports=Ns});var ge=g((pu,gn)=>{var dn=v(),qs=(t,e,n)=>{let r=new dn(t,n),s=new dn(e,n);return r.compare(s)||r.compareBuild(s)};gn.exports=qs});var yn=g((hu,En)=>{var _s=ge(),Ls=(t,e)=>t.sort((n,r)=>_s(n,r,e));En.exports=Ls});var xn=g((fu,Cn)=>{var Ds=ge(),Ps=(t,e)=>t.sort((n,r)=>Ds(r,n,e));Cn.exports=Ps});var te=g((mu,Sn)=>{var js=b(),Gs=(t,e,n)=>js(t,e,n)>0;Sn.exports=Gs});var Ee=g((du,An)=>{var Fs=b(),Us=(t,e,n)=>Fs(t,e,n)<0;An.exports=Us});var Ne=g((gu,vn)=>{var Bs=b(),ks=(t,e,n)=>Bs(t,e,n)===0;vn.exports=ks});var qe=g((Eu,Rn)=>{var Ms=b(),Ws=(t,e,n)=>Ms(t,e,n)!==0;Rn.exports=Ws});var ye=g((yu,In)=>{var Qs=b(),Ks=(t,e,n)=>Qs(t,e,n)>=0;In.exports=Ks});var Ce=g((Cu,wn)=>{var zs=b(),Vs=(t,e,n)=>zs(t,e,n)<=0;wn.exports=Vs});var _e=g((xu,Tn)=>{var Hs=Ne(),Xs=qe(),Ys=te(),Zs=ye(),Js=Ee(),ei=Ce(),ti=(t,e,n,r)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t===n;case"!==":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t!==n;case"":case"=":case"==":return Hs(t,n,r);case"!=":return Xs(t,n,r);case">":return Ys(t,n,r);case">=":return Zs(t,n,r);case"<":return Js(t,n,r);case"<=":return ei(t,n,r);default:throw new TypeError(`Invalid operator: ${e}`)}};Tn.exports=ti});var On=g((Su,bn)=>{var ni=v(),ri=F(),{re:xe,t:Se}=W(),si=(t,e)=>{if(t instanceof ni)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let n=null;if(!e.rtl)n=t.match(xe[Se.COERCE]);else{let r;for(;(r=xe[Se.COERCERTL].exec(t))&&(!n||n.index+n[0].length!==t.length);)(!n||r.index+r[0].length!==n.index+n[0].length)&&(n=r),xe[Se.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;xe[Se.COERCERTL].lastIndex=-1}return n===null?null:ri(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,e)};bn.exports=si});var Nn=g((Au,$n)=>{"use strict";$n.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var _n=g((vu,qn)=>{"use strict";qn.exports=C;C.Node=U;C.create=C;function C(t){var e=this;if(e instanceof C||(e=new C),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var n=0,r=arguments.length;n<r;n++)e.push(arguments[n]);return e}C.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,n=t.prev;return e&&(e.prev=n),n&&(n.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=n),t.list.length--,t.next=null,t.prev=null,t.list=null,e};C.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}};C.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}};C.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)oi(this,arguments[t]);return this.length};C.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)ai(this,arguments[t]);return this.length};C.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}};C.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}};C.prototype.forEach=function(t,e){e=e||this;for(var n=this.head,r=0;n!==null;r++)t.call(e,n.value,r,this),n=n.next};C.prototype.forEachReverse=function(t,e){e=e||this;for(var n=this.tail,r=this.length-1;n!==null;r--)t.call(e,n.value,r,this),n=n.prev};C.prototype.get=function(t){for(var e=0,n=this.head;n!==null&&e<t;e++)n=n.next;if(e===t&&n!==null)return n.value};C.prototype.getReverse=function(t){for(var e=0,n=this.tail;n!==null&&e<t;e++)n=n.prev;if(e===t&&n!==null)return n.value};C.prototype.map=function(t,e){e=e||this;for(var n=new C,r=this.head;r!==null;)n.push(t.call(e,r.value,this)),r=r.next;return n};C.prototype.mapReverse=function(t,e){e=e||this;for(var n=new C,r=this.tail;r!==null;)n.push(t.call(e,r.value,this)),r=r.prev;return n};C.prototype.reduce=function(t,e){var n,r=this.head;if(arguments.length>1)n=e;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;r!==null;s++)n=t(n,r.value,s),r=r.next;return n};C.prototype.reduceReverse=function(t,e){var n,r=this.tail;if(arguments.length>1)n=e;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;r!==null;s--)n=t(n,r.value,s),r=r.prev;return n};C.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;n!==null;e++)t[e]=n.value,n=n.next;return t};C.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;n!==null;e++)t[e]=n.value,n=n.prev;return t};C.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var n=new C;if(e<t||e<0)return n;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(;s!==null&&r<e;r++,s=s.next)n.push(s.value);return n};C.prototype.sliceReverse=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var n=new C;if(e<t||e<0)return n;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=this.length,s=this.tail;s!==null&&r>e;r--)s=s.prev;for(;s!==null&&r>t;r--,s=s.prev)n.push(s.value);return n};C.prototype.splice=function(t,e,...n){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var r=0,s=this.head;s!==null&&r<t;r++)s=s.next;for(var i=[],r=0;s&&r<e;r++)i.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var r=0;r<n.length;r++)s=ii(this,s,n[r]);return i};C.prototype.reverse=function(){for(var t=this.head,e=this.tail,n=t;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=e,this.tail=t,this};function ii(t,e,n){var r=e===t.head?new U(n,null,e,t):new U(n,e,e.next,t);return r.next===null&&(t.tail=r),r.prev===null&&(t.head=r),t.length++,r}function oi(t,e){t.tail=new U(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function ai(t,e){t.head=new U(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function U(t,e,n,r){if(!(this instanceof U))return new U(t,e,n,r);this.list=r,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Nn()(C)}catch{}});var Gn=g((Ru,jn)=>{"use strict";var ci=_n(),B=Symbol("max"),_=Symbol("length"),K=Symbol("lengthCalculator"),re=Symbol("allowStale"),k=Symbol("maxAge"),q=Symbol("dispose"),Ln=Symbol("noDisposeOnSet"),A=Symbol("lruList"),N=Symbol("cache"),Pn=Symbol("updateAgeOnGet"),Le=()=>1,Pe=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let n=this[B]=e.max||1/0,r=e.length||Le;if(this[K]=typeof r!="function"?Le:r,this[re]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[k]=e.maxAge||0,this[q]=e.dispose,this[Ln]=e.noDisposeOnSet||!1,this[Pn]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[B]=e||1/0,ne(this)}get max(){return this[B]}set allowStale(e){this[re]=!!e}get allowStale(){return this[re]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[k]=e,ne(this)}get maxAge(){return this[k]}set lengthCalculator(e){typeof e!="function"&&(e=Le),e!==this[K]&&(this[K]=e,this[_]=0,this[A].forEach(n=>{n.length=this[K](n.value,n.key),this[_]+=n.length})),ne(this)}get lengthCalculator(){return this[K]}get length(){return this[_]}get itemCount(){return this[A].length}rforEach(e,n){n=n||this;for(let r=this[A].tail;r!==null;){let s=r.prev;Dn(this,e,r,n),r=s}}forEach(e,n){n=n||this;for(let r=this[A].head;r!==null;){let s=r.next;Dn(this,e,r,n),r=s}}keys(){return this[A].toArray().map(e=>e.key)}values(){return this[A].toArray().map(e=>e.value)}reset(){this[q]&&this[A]&&this[A].length&&this[A].forEach(e=>this[q](e.key,e.value)),this[N]=new Map,this[A]=new ci,this[_]=0}dump(){return this[A].map(e=>Ae(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[A]}set(e,n,r){if(r=r||this[k],r&&typeof r!="number")throw new TypeError("maxAge must be a number");let s=r?Date.now():0,i=this[K](n,e);if(this[N].has(e)){if(i>this[B])return z(this,this[N].get(e)),!1;let a=this[N].get(e).value;return this[q]&&(this[Ln]||this[q](e,a.value)),a.now=s,a.maxAge=r,a.value=n,this[_]+=i-a.length,a.length=i,this.get(e),ne(this),!0}let o=new je(e,n,i,s,r);return o.length>this[B]?(this[q]&&this[q](e,n),!1):(this[_]+=o.length,this[A].unshift(o),this[N].set(e,this[A].head),ne(this),!0)}has(e){if(!this[N].has(e))return!1;let n=this[N].get(e).value;return!Ae(this,n)}get(e){return De(this,e,!0)}peek(e){return De(this,e,!1)}pop(){let e=this[A].tail;return e?(z(this,e),e.value):null}del(e){z(this,this[N].get(e))}load(e){this.reset();let n=Date.now();for(let r=e.length-1;r>=0;r--){let s=e[r],i=s.e||0;if(i===0)this.set(s.k,s.v);else{let o=i-n;o>0&&this.set(s.k,s.v,o)}}}prune(){this[N].forEach((e,n)=>De(this,n,!1))}},De=(t,e,n)=>{let r=t[N].get(e);if(r){let s=r.value;if(Ae(t,s)){if(z(t,r),!t[re])return}else n&&(t[Pn]&&(r.value.now=Date.now()),t[A].unshiftNode(r));return s.value}},Ae=(t,e)=>{if(!e||!e.maxAge&&!t[k])return!1;let n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[k]&&n>t[k]},ne=t=>{if(t[_]>t[B])for(let e=t[A].tail;t[_]>t[B]&&e!==null;){let n=e.prev;z(t,e),e=n}},z=(t,e)=>{if(e){let n=e.value;t[q]&&t[q](n.key,n.value),t[_]-=n.length,t[N].delete(n.key),t[A].removeNode(e)}},je=class{constructor(e,n,r,s,i){this.key=e,this.value=n,this.length=r,this.now=s,this.maxAge=i||0}},Dn=(t,e,n,r)=>{let s=n.value;Ae(t,s)&&(z(t,n),t[re]||(s=void 0)),s&&e.call(r,s.value,s.key,t)};jn.exports=Pe});var O=g((Iu,kn)=>{var M=class{constructor(e,n){if(n=li(n),e instanceof M)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new M(e.raw,n);if(e instanceof Ge)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e,this.set=e.split("||").map(r=>this.parseRange(r.trim())).filter(r=>r.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter(s=>!Un(s[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&Ei(s[0])){this.set=[s];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let r=((this.options.includePrerelease&&di)|(this.options.loose&&gi))+":"+e,s=Fn.get(r);if(s)return s;let i=this.options.loose,o=i?w[R.HYPHENRANGELOOSE]:w[R.HYPHENRANGE];e=e.replace(o,Ti(this.options.includePrerelease)),S("hyphen replace",e),e=e.replace(w[R.COMPARATORTRIM],hi),S("comparator trim",e),e=e.replace(w[R.TILDETRIM],fi),e=e.replace(w[R.CARETTRIM],mi),e=e.split(/\s+/).join(" ");let c=e.split(" ").map(h=>yi(h,this.options)).join(" ").split(/\s+/).map(h=>wi(h,this.options));i&&(c=c.filter(h=>(S("loose invalid filter",h,this.options),!!h.match(w[R.COMPARATORLOOSE])))),S("range list",c);let a=new Map,u=c.map(h=>new Ge(h,this.options));for(let h of u){if(Un(h))return[h];a.set(h.value,h)}a.size>1&&a.has("")&&a.delete("");let d=[...a.values()];return Fn.set(r,d),d}intersects(e,n){if(!(e instanceof M))throw new TypeError("a Range is required");return this.set.some(r=>Bn(r,n)&&e.set.some(s=>Bn(s,n)&&r.every(i=>s.every(o=>i.intersects(o,n)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new pi(e,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(bi(this.set[n],e,this.options))return!0;return!1}};kn.exports=M;var ui=Gn(),Fn=new ui({max:1e3}),li=fe(),Ge=se(),S=ee(),pi=v(),{re:w,t:R,comparatorTrimReplace:hi,tildeTrimReplace:fi,caretTrimReplace:mi}=W(),{FLAG_INCLUDE_PRERELEASE:di,FLAG_LOOSE:gi}=J(),Un=t=>t.value==="<0.0.0-0",Ei=t=>t.value==="",Bn=(t,e)=>{let n=!0,r=t.slice(),s=r.pop();for(;n&&r.length;)n=r.every(i=>s.intersects(i,e)),s=r.pop();return n},yi=(t,e)=>(S("comp",t,e),t=Si(t,e),S("caret",t),t=Ci(t,e),S("tildes",t),t=vi(t,e),S("xrange",t),t=Ii(t,e),S("stars",t),t),I=t=>!t||t.toLowerCase()==="x"||t==="*",Ci=(t,e)=>t.trim().split(/\s+/).map(n=>xi(n,e)).join(" "),xi=(t,e)=>{let n=e.loose?w[R.TILDELOOSE]:w[R.TILDE];return t.replace(n,(r,s,i,o,c)=>{S("tilde",t,r,s,i,o,c);let a;return I(s)?a="":I(i)?a=`>=${s}.0.0 <${+s+1}.0.0-0`:I(o)?a=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:c?(S("replaceTilde pr",c),a=`>=${s}.${i}.${o}-${c} <${s}.${+i+1}.0-0`):a=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,S("tilde return",a),a})},Si=(t,e)=>t.trim().split(/\s+/).map(n=>Ai(n,e)).join(" "),Ai=(t,e)=>{S("caret",t,e);let n=e.loose?w[R.CARETLOOSE]:w[R.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(s,i,o,c,a)=>{S("caret",t,s,i,o,c,a);let u;return I(i)?u="":I(o)?u=`>=${i}.0.0${r} <${+i+1}.0.0-0`:I(c)?i==="0"?u=`>=${i}.${o}.0${r} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${r} <${+i+1}.0.0-0`:a?(S("replaceCaret pr",a),i==="0"?o==="0"?u=`>=${i}.${o}.${c}-${a} <${i}.${o}.${+c+1}-0`:u=`>=${i}.${o}.${c}-${a} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${c}-${a} <${+i+1}.0.0-0`):(S("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${c}${r} <${i}.${o}.${+c+1}-0`:u=`>=${i}.${o}.${c}${r} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${c} <${+i+1}.0.0-0`),S("caret return",u),u})},vi=(t,e)=>(S("replaceXRanges",t,e),t.split(/\s+/).map(n=>Ri(n,e)).join(" ")),Ri=(t,e)=>{t=t.trim();let n=e.loose?w[R.XRANGELOOSE]:w[R.XRANGE];return t.replace(n,(r,s,i,o,c,a)=>{S("xRange",t,r,s,i,o,c,a);let u=I(i),d=u||I(o),h=d||I(c),x=h;return s==="="&&x&&(s=""),a=e.includePrerelease?"-0":"",u?s===">"||s==="<"?r="<0.0.0-0":r="*":s&&x?(d&&(o=0),c=0,s===">"?(s=">=",d?(i=+i+1,o=0,c=0):(o=+o+1,c=0)):s==="<="&&(s="<",d?i=+i+1:o=+o+1),s==="<"&&(a="-0"),r=`${s+i}.${o}.${c}${a}`):d?r=`>=${i}.0.0${a} <${+i+1}.0.0-0`:h&&(r=`>=${i}.${o}.0${a} <${i}.${+o+1}.0-0`),S("xRange return",r),r})},Ii=(t,e)=>(S("replaceStars",t,e),t.trim().replace(w[R.STAR],"")),wi=(t,e)=>(S("replaceGTE0",t,e),t.trim().replace(w[e.includePrerelease?R.GTE0PRE:R.GTE0],"")),Ti=t=>(e,n,r,s,i,o,c,a,u,d,h,x,f)=>(I(r)?n="":I(s)?n=`>=${r}.0.0${t?"-0":""}`:I(i)?n=`>=${r}.${s}.0${t?"-0":""}`:o?n=`>=${n}`:n=`>=${n}${t?"-0":""}`,I(u)?a="":I(d)?a=`<${+u+1}.0.0-0`:I(h)?a=`<${u}.${+d+1}.0-0`:x?a=`<=${u}.${d}.${h}-${x}`:t?a=`<${u}.${d}.${+h+1}-0`:a=`<=${a}`,`${n} ${a}`.trim()),bi=(t,e,n)=>{for(let r=0;r<t.length;r++)if(!t[r].test(e))return!1;if(e.prerelease.length&&!n.includePrerelease){for(let r=0;r<t.length;r++)if(S(t[r].semver),t[r].semver!==Ge.ANY&&t[r].semver.prerelease.length>0){let s=t[r].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var se=g((wu,Vn)=>{var ie=Symbol("SemVer ANY"),V=class{static get ANY(){return ie}constructor(e,n){if(n=Mn(n),e instanceof V){if(e.loose===!!n.loose)return e;e=e.value}Ue("comparator",e,n),this.options=n,this.loose=!!n.loose,this.parse(e),this.semver===ie?this.value="":this.value=this.operator+this.semver.version,Ue("comp",this)}parse(e){let n=this.options.loose?Wn[Qn.COMPARATORLOOSE]:Wn[Qn.COMPARATOR],r=e.match(n);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new Kn(r[2],this.options.loose):this.semver=ie}toString(){return this.value}test(e){if(Ue("Comparator.test",e,this.options.loose),this.semver===ie||e===ie)return!0;if(typeof e=="string")try{e=new Kn(e,this.options)}catch{return!1}return Fe(e,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof V))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new zn(e.value,n).test(this.value):e.operator===""?e.value===""?!0:new zn(this.value,n).test(e.semver):(n=Mn(n),n.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Fe(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Fe(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Vn.exports=V;var Mn=fe(),{re:Wn,t:Qn}=W(),Fe=_e(),Ue=ee(),Kn=v(),zn=O()});var oe=g((Tu,Hn)=>{var Oi=O(),$i=(t,e,n)=>{try{e=new Oi(e,n)}catch{return!1}return e.test(t)};Hn.exports=$i});var Yn=g((bu,Xn)=>{var Ni=O(),qi=(t,e)=>new Ni(t,e).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));Xn.exports=qi});var Jn=g((Ou,Zn)=>{var _i=v(),Li=O(),Di=(t,e,n)=>{let r=null,s=null,i=null;try{i=new Li(e,n)}catch{return null}return t.forEach(o=>{i.test(o)&&(!r||s.compare(o)===-1)&&(r=o,s=new _i(r,n))}),r};Zn.exports=Di});var tr=g(($u,er)=>{var Pi=v(),ji=O(),Gi=(t,e,n)=>{let r=null,s=null,i=null;try{i=new ji(e,n)}catch{return null}return t.forEach(o=>{i.test(o)&&(!r||s.compare(o)===1)&&(r=o,s=new Pi(r,n))}),r};er.exports=Gi});var sr=g((Nu,rr)=>{var Be=v(),Fi=O(),nr=te(),Ui=(t,e)=>{t=new Fi(t,e);let n=new Be("0.0.0");if(t.test(n)||(n=new Be("0.0.0-0"),t.test(n)))return n;n=null;for(let r=0;r<t.set.length;++r){let s=t.set[r],i=null;s.forEach(o=>{let c=new Be(o.semver.version);switch(o.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!i||nr(c,i))&&(i=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!n||nr(n,i))&&(n=i)}return n&&t.test(n)?n:null};rr.exports=Ui});var or=g((qu,ir)=>{var Bi=O(),ki=(t,e)=>{try{return new Bi(t,e).range||"*"}catch{return null}};ir.exports=ki});var ve=g((_u,lr)=>{var Mi=v(),ur=se(),{ANY:Wi}=ur,Qi=O(),Ki=oe(),ar=te(),cr=Ee(),zi=Ce(),Vi=ye(),Hi=(t,e,n,r)=>{t=new Mi(t,r),e=new Qi(e,r);let s,i,o,c,a;switch(n){case">":s=ar,i=zi,o=cr,c=">",a=">=";break;case"<":s=cr,i=Vi,o=ar,c="<",a="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Ki(t,e,r))return!1;for(let u=0;u<e.set.length;++u){let d=e.set[u],h=null,x=null;if(d.forEach(f=>{f.semver===Wi&&(f=new ur(">=0.0.0")),h=h||f,x=x||f,s(f.semver,h.semver,r)?h=f:o(f.semver,x.semver,r)&&(x=f)}),h.operator===c||h.operator===a||(!x.operator||x.operator===c)&&i(t,x.semver))return!1;if(x.operator===a&&o(t,x.semver))return!1}return!0};lr.exports=Hi});var hr=g((Lu,pr)=>{var Xi=ve(),Yi=(t,e,n)=>Xi(t,e,">",n);pr.exports=Yi});var mr=g((Du,fr)=>{var Zi=ve(),Ji=(t,e,n)=>Zi(t,e,"<",n);fr.exports=Ji});var Er=g((Pu,gr)=>{var dr=O(),eo=(t,e,n)=>(t=new dr(t,n),e=new dr(e,n),t.intersects(e,n));gr.exports=eo});var Cr=g((ju,yr)=>{var to=oe(),no=b();yr.exports=(t,e,n)=>{let r=[],s=null,i=null,o=t.sort((d,h)=>no(d,h,n));for(let d of o)to(d,e,n)?(i=d,s||(s=d)):(i&&r.push([s,i]),i=null,s=null);s&&r.push([s,null]);let c=[];for(let[d,h]of r)d===h?c.push(d):!h&&d===o[0]?c.push("*"):h?d===o[0]?c.push(`<=${h}`):c.push(`${d} - ${h}`):c.push(`>=${d}`);let a=c.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return a.length<u.length?a:e}});var Ir=g((Gu,Rr)=>{var xr=O(),Me=se(),{ANY:ke}=Me,ae=oe(),We=b(),ro=(t,e,n={})=>{if(t===e)return!0;t=new xr(t,n),e=new xr(e,n);let r=!1;e:for(let s of t.set){for(let i of e.set){let o=io(s,i,n);if(r=r||o!==null,o)continue e}if(r)return!1}return!0},so=[new Me(">=0.0.0-0")],Sr=[new Me(">=0.0.0")],io=(t,e,n)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===ke){if(e.length===1&&e[0].semver===ke)return!0;n.includePrerelease?t=so:t=Sr}if(e.length===1&&e[0].semver===ke){if(n.includePrerelease)return!0;e=Sr}let r=new Set,s,i;for(let f of t)f.operator===">"||f.operator===">="?s=Ar(s,f,n):f.operator==="<"||f.operator==="<="?i=vr(i,f,n):r.add(f.semver);if(r.size>1)return null;let o;if(s&&i){if(o=We(s.semver,i.semver,n),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let f of r){if(s&&!ae(f,String(s),n)||i&&!ae(f,String(i),n))return null;for(let L of e)if(!ae(f,String(L),n))return!1;return!0}let c,a,u,d,h=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,x=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;h&&h.prerelease.length===1&&i.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(d=d||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",s){if(x&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===x.major&&f.semver.minor===x.minor&&f.semver.patch===x.patch&&(x=!1),f.operator===">"||f.operator===">="){if(c=Ar(s,f,n),c===f&&c!==s)return!1}else if(s.operator===">="&&!ae(s.semver,String(f),n))return!1}if(i){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(a=vr(i,f,n),a===f&&a!==i)return!1}else if(i.operator==="<="&&!ae(i.semver,String(f),n))return!1}if(!f.operator&&(i||s)&&o!==0)return!1}return!(s&&u&&!i&&o!==0||i&&d&&!s&&o!==0||x||h)},Ar=(t,e,n)=>{if(!t)return e;let r=We(t.semver,e.semver,n);return r>0?t:r<0||e.operator===">"&&t.operator===">="?e:t},vr=(t,e,n)=>{if(!t)return e;let r=We(t.semver,e.semver,n);return r<0?t:r>0||e.operator==="<"&&t.operator==="<="?e:t};Rr.exports=ro});var Ke=g((Fu,br)=>{var Qe=W(),wr=J(),oo=v(),Tr=$e(),ao=F(),co=Qt(),uo=zt(),lo=Xt(),po=Jt(),ho=tn(),fo=rn(),mo=on(),go=cn(),Eo=b(),yo=hn(),Co=mn(),xo=ge(),So=yn(),Ao=xn(),vo=te(),Ro=Ee(),Io=Ne(),wo=qe(),To=ye(),bo=Ce(),Oo=_e(),$o=On(),No=se(),qo=O(),_o=oe(),Lo=Yn(),Do=Jn(),Po=tr(),jo=sr(),Go=or(),Fo=ve(),Uo=hr(),Bo=mr(),ko=Er(),Mo=Cr(),Wo=Ir();br.exports={parse:ao,valid:co,clean:uo,inc:lo,diff:po,major:ho,minor:fo,patch:mo,prerelease:go,compare:Eo,rcompare:yo,compareLoose:Co,compareBuild:xo,sort:So,rsort:Ao,gt:vo,lt:Ro,eq:Io,neq:wo,gte:To,lte:bo,cmp:Oo,coerce:$o,Comparator:No,Range:qo,satisfies:_o,toComparators:Lo,maxSatisfying:Do,minSatisfying:Po,minVersion:jo,validRange:Go,outside:Fo,gtr:Uo,ltr:Bo,intersects:ko,simplifyRange:Mo,subset:Wo,SemVer:oo,re:Qe.re,src:Qe.src,tokens:Qe.t,SEMVER_SPEC_VERSION:wr.SEMVER_SPEC_VERSION,RELEASE_TYPES:wr.RELEASE_TYPES,compareIdentifiers:Tr.compareIdentifiers,rcompareIdentifiers:Tr.rcompareIdentifiers}});import{GasPrice as Ur}from"@cosmjs/stargate";import{create as Nr}from"zustand";import{persist as qr,subscribeWithSelector as _r}from"zustand/middleware";var it=(r=>(r.KEPLR="keplr",r.LEAP="leap",r.COSMOSTATION="cosmostation",r))(it||{}),ot=["keplr","leap","cosmostation"];var Ie={account:null,activeChain:null,balances:null,clients:null,defaultChain:null,defaultSigningClient:"stargate",offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,recentChain:null,signingClients:null,status:"disconnected",walletType:"keplr",_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},Lr={name:"graz",partialize:t=>({activeChain:t.activeChain,recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:2},m=Nr(_r(qr(()=>Ie,Lr)));import{SigningCosmWasmClient as lt}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as pt}from"@cosmjs/stargate";import{Tendermint34Client as Pr}from"@cosmjs/tendermint-rpc";import{QueryClient as Dr}from"@cosmjs/stargate";import{assert as at,isNonNullObject as ct}from"@cosmjs/utils";var ut=(...t)=>{let{tendermint:e}=m.getState().clients,n=new Dr(e),r=t.map(s=>s(n));for(let s of r){at(ct(s),"Extension must be a non-null object");for(let[i,o]of Object.entries(s)){at(ct(o),`Module must be a non-null object. Found type ${typeof o} for module "${i}".`);let c=n[i]||{};n[i]={...c,...o}}}return n};var ue=async({rpc:t,rpcHeaders:e})=>{let n={url:t,headers:{...e||{}}},[r,s,i]=await Promise.all([lt.connect(n),pt.connect(n),Pr.connect(t)]);return{cosmWasm:r,stargate:s,tendermint:i}},le=async t=>{let{rpc:e,rpcHeaders:n,offlineSignerAuto:r,cosmWasmSignerOptions:s={},stargateSignerOptions:i={}}=t,o={url:e,headers:{...n||{}}},[c,a]=await Promise.all([lt.connectWithSigner(o,r,s),pt.connectWithSigner(o,r,i)]);return{cosmWasm:c,stargate:a}};var X=(t=m.getState().walletType)=>{try{return Y(t),!0}catch(e){return console.error(e),!1}},jr=()=>{if(typeof window.keplr<"u")return window.keplr;throw m.getState()._notFoundFn(),new Error("window.keplr is not defined")},Gr=()=>{if(typeof window.leap<"u")return window.leap;throw m.getState()._notFoundFn(),new Error("window.leap is not defined")},Fr=()=>{if(typeof window.cosmostation.providers.keplr<"u")return window.cosmostation.providers.keplr;throw m.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")},Y=(t=m.getState().walletType)=>{switch(t){case"keplr":return jr();case"leap":return Gr();case"cosmostation":return Fr();default:throw new Error("Unknown wallet type")}},ga=()=>Object.fromEntries(ot.map(t=>[t,X(t)]));var Z=async t=>{try{let{defaultChain:e,recentChain:n,walletType:r}=m.getState(),s=(t==null?void 0:t.walletType)||r,i=Y(s),o=(t==null?void 0:t.chain)||n||e;if(!o)throw new Error("No last known connected chain, connect action requires chain info");m.setState(L=>{let He=L._reconnect||!!L._reconnectConnector||!!o;return L.activeChain&&L.activeChain.chainId!==o.chainId?{status:"connecting"}:He?{status:"reconnecting"}:{status:"connecting"}}),await i.enable(o.chainId);let c=i.getOfflineSigner(o.chainId),a=i.getOfflineSignerOnlyAmino(o.chainId),u=await i.getOfflineSignerAuto(o.chainId),d=o.gas?Ur.fromString(`${o.gas.price}${o.gas.denom}`):void 0,[h,x,f]=await Promise.all([i.getKey(o.chainId),ue(o),le({...o,offlineSignerAuto:u,cosmWasmSignerOptions:{gasPrice:d,...(t==null?void 0:t.signerOpts)||{}}})]);return m.setState({account:h,activeChain:o,clients:x,offlineSigner:c,offlineSignerAmino:a,offlineSignerAuto:u,recentChain:o,signingClients:f,status:"connected",walletType:s,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:s}),typeof window<"u"&&window.sessionStorage.setItem(H,"Active"),{account:h,walletType:s,chain:o}}catch(e){throw m.getState().account===null&&m.setState({status:"disconnected"}),e}},we=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(H),m.setState(e=>({...Ie,recentChain:t?null:e.recentChain})),Promise.resolve()),P=async t=>{var i;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=m.getState(),s=X(n||void 0);try{if(e&&s&&n)return await Z({chain:e,walletType:n,autoReconnect:r})}catch(o){(i=t==null?void 0:t.onError)==null||i.call(t,o),we()}};var ht=()=>{m.setState({recentChain:null})},ft=t=>{let{activeChain:e}=m.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},Ta=()=>m.getState().recentChain,Te=async t=>(await Y().experimentalSuggestChain(t),t),mt=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...s})=>{let i=await Te(t);return{...await Z({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...s}),chain:i}};var dt=(t={})=>(m.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var gt=async t=>{let{activeChain:e,signingClients:n}=m.getState();if(!e||!n)throw new Error("No connected account detected");let{defaultSigningClient:r}=m.getState();return await Promise.all(e.currencies.map(async i=>{let o=i.coinMinimalDenom.startsWith("cw20:");return n[r].getBalance(t,o?i.coinMinimalDenom.replace("cw20:",""):i.coinMinimalDenom)}))},Et=async t=>{let{clients:e}=m.getState();if(!(e!=null&&e.stargate))throw new Error("Stargate client is not ready");return e.stargate.getBalanceStaked(t)},yt=async({senderAddress:t,recipientAddress:e,amount:n,fee:r,memo:s})=>{let{signingClients:i,defaultSigningClient:o}=m.getState();if(!i)throw new Error("No connected account detected");if(!t)throw new Error("senderAddress is not defined");return i[o].sendTokens(t,e,n,r,s)},Ct=async({senderAddress:t,recipientAddress:e,transferAmount:n,sourcePort:r,sourceChannel:s,timeoutHeight:i,timeoutTimestamp:o,fee:c,memo:a})=>{let{signingClients:u}=m.getState();if(!(u!=null&&u.stargate))throw new Error("Stargate signing client is not ready");if(!t)throw new Error("senderAddress is not defined");return u.stargate.sendIbcTokens(t,e,n,r,s,i,o,c,a)},xt=async({senderAddress:t,msg:e,fee:n,options:r,label:s,codeId:i})=>{let{signingClients:o}=m.getState();if(!(o!=null&&o.cosmWasm))throw new Error("CosmWasm signing client is not ready");return o.cosmWasm.instantiate(t,i,e,s,n,r)},St=async({senderAddress:t,msg:e,fee:n,contractAddress:r,funds:s,memo:i})=>{let{signingClients:o}=m.getState();if(!(o!=null&&o.cosmWasm))throw new Error("CosmWasm signing client is not ready");return o.cosmWasm.execute(t,r,e,n,i,s)},At=async(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");return await n.cosmWasm.queryContractSmart(t,e)},vt=(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.cosmWasm.queryContractRaw(t,r)};var La=t=>t,Da=t=>t,Pa=t=>t;import{useMutation as Rt,useQuery as be}from"@tanstack/react-query";import{useEffect as kr}from"react";import Mr from"zustand/shallow";import{useQuery as Br}from"@tanstack/react-query";var pe=t=>{let n=["USE_CHECK_WALLET",m(s=>t||s.walletType)];return Br(n,({queryKey:[,s]})=>X(s))};var G=({onConnect:t,onDisconnect:e}={})=>{let n=m(s=>s.account),r=m(s=>s.status);return kr(()=>m.subscribe(s=>s.status,(s,i)=>{if(s==="connected"){let o=m.getState();t==null||t({account:o.account,chain:o.activeChain,walletType:o.walletType,isReconnect:i==="reconnecting"})}s==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:P,status:r}},Wr=t=>{let{data:e}=G(),n=t||(e==null?void 0:e.bech32Address);return be(["USE_BALANCES",n],({queryKey:[,i]})=>gt(i),{enabled:!!n})},Ha=(t,e)=>{let{data:n}=Wr(e);return be(["USE_BALANCE",n,t,e],({queryKey:[,i]})=>i==null?void 0:i.find(o=>o.denom===t),{enabled:!!n})},Xa=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=Rt(["USE_CONNECT",t,e,n],Z,{onError:(o,c)=>Promise.resolve(t==null?void 0:t(o,c)),onMutate:e,onSuccess:o=>Promise.resolve(n==null?void 0:n(o))}),{data:i}=pe();return{connect:o=>s.mutate(o),connectAsync:o=>s.mutateAsync(o),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:!!i,status:s.status}},Ya=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=Rt(["USE_DISCONNECT",t,e,n],we,{onError:i=>Promise.resolve(t==null?void 0:t(i,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:i=>s.mutate(i),disconnectAsync:i=>s.mutateAsync(i),error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,status:s.status}},Qr=()=>m(t=>({signer:t.offlineSigner,signerAmino:t.offlineSignerAmino,signerAuto:t.offlineSignerAuto}),Mr),Za=()=>Qr(),Ja=t=>{let{data:e}=G(),n=t||(e==null?void 0:e.bech32Address);return be(["USE_BALANCE_STAKED",n],({queryKey:[,i]})=>Et(n),{enabled:!!n})};import{useMutation as It,useQuery as wt}from"@tanstack/react-query";var ic=()=>m(t=>t.activeChain),oc=t=>wt(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>ft(r)),ac=(t,e="BOND_STATUS_BONDED")=>wt(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],({queryKey:[,s,i]})=>s.staking.validators(i),{enabled:typeof t<"u"}),cc=()=>({data:m(e=>e.recentChain),clear:ht}),uc=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=It(["USE_SUGGEST_CHAIN",t,e,n],Te,{onError:(i,o)=>Promise.resolve(t==null?void 0:t(i,o)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))});return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,suggest:s.mutate,suggestAsync:s.mutateAsync,status:s.status}},lc=({onError:t,onLoading:e,onSuccess:n}={})=>{let s=It(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],mt,{onError:(o,c)=>Promise.resolve(t==null?void 0:t(o,c)),onMutate:o=>e==null?void 0:e(o),onSuccess:o=>Promise.resolve(n==null?void 0:n(o))}),{data:i}=pe();return{error:s.error,isLoading:s.isLoading,isSuccess:s.isSuccess,isSupported:!!i,status:s.status,suggestAndConnect:s.mutate,suggestAndConnectAsync:s.mutateAsync}};import{useQuery as Tt}from"@tanstack/react-query";import{useQuery as Kr}from"@tanstack/react-query";var mc=(...t)=>{let e=["USE_QUERY_CLIENT",...t];return Kr(e,({queryKey:[,...r]})=>ut(...t),{refetchOnMount:!1,refetchOnWindowFocus:!1})};var Cc=t=>{let e=m(s=>s.clients);return Tt(["USE_CLIENTS",t,e],({queryKey:[,s,i]})=>s!=null&&s.rpc?ue(s):i,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:s=>{m.setState({clients:s})}})},xc=t=>{let e=m(s=>s.signingClients);return Tt(["USE_SIGNING_CLIENTS",t,e],({queryKey:[,s,i]})=>s!=null&&s.rpc?le(s):i,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:s=>{m.setState({signingClients:s})}})};import{useMutation as he,useQuery as bt}from"@tanstack/react-query";var wc=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=G(),s=r==null?void 0:r.bech32Address,o=he(["USE_SEND_TOKENS",t,e,n,s],c=>yt({senderAddress:s,...c}),{onError:(c,a)=>Promise.resolve(t==null?void 0:t(c,a)),onMutate:e,onSuccess:c=>Promise.resolve(n==null?void 0:n(c))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendTokens:o.mutate,sendTokensAsync:o.mutateAsync,status:o.status}},Tc=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=G(),s=r==null?void 0:r.bech32Address,o=he(["USE_SEND_IBC_TOKENS",t,e,n,s],c=>Ct({senderAddress:s,...c}),{onError:(c,a)=>Promise.resolve(t==null?void 0:t(c,a)),onMutate:e,onSuccess:c=>Promise.resolve(n==null?void 0:n(c))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,sendIbcTokens:o.mutate,sendIbcTokensAsync:o.mutateAsync,status:o.status}},bc=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:s}=G(),i=s==null?void 0:s.bech32Address,a=he(["USE_INSTANTIATE_CONTRACT",e,n,r,t,i],u=>{if(!i)throw new Error("senderAddress is undefined");let d={...u,fee:u.fee??"auto",senderAddress:i,codeId:t};return xt(d)},{onError:(u,d)=>Promise.resolve(e==null?void 0:e(u,d)),onMutate:n,onSuccess:u=>Promise.resolve(r==null?void 0:r(u))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,instantiateContract:a.mutate,instantiateContractAsync:a.mutateAsync,status:a.status}},Oc=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:s}=G(),i=s==null?void 0:s.bech32Address,a=he(["USE_EXECUTE_CONTRACT",e,n,r,t,i],u=>{if(!i)throw new Error("senderAddress is undefined");let d={...u,fee:u.fee??"auto",senderAddress:i,contractAddress:t,memo:u.memo??"",funds:u.funds??[]};return St(d)},{onError:(u,d)=>Promise.resolve(e==null?void 0:e(u,d)),onMutate:n,onSuccess:u=>Promise.resolve(r==null?void 0:r(u))});return{error:a.error,isLoading:a.isLoading,isSuccess:a.isSuccess,executeContract:a.mutate,executeContractAsync:a.mutateAsync,status:a.status}},$c=(t,e)=>bt(["USE_QUERY_SMART",t,e],({queryKey:[,s]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return At(t,e)},{enabled:!!t&&!!e}),Nc=(t,e)=>bt(["USE_QUERY_RAW",e,t],({queryKey:[,s]})=>{if(!t||!e)throw new Error("address or key undefined");return vt(t,e)},{enabled:!!t&&!!e});import{QueryClient as Vr,QueryClientProvider as Hr}from"@tanstack/react-query";import{useEffect as Ot}from"react";var zr=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(H)==="Active",{activeChain:e,_reconnect:n,_onReconnectFailed:r,_reconnectConnector:s}=m();return Ot(()=>{t&&e?P({onError:r}):!t&&n&&P({onError:r})},[]),Ot(()=>{if(s&&(s==="cosmostation"&&window.cosmostation.cosmos.on("accountChanged",()=>void P({onError:r})),s==="keplr"||s==="leap"))return window.addEventListener(s==="keplr"?"keplr_keystorechange":"leap_keystorechange",()=>void P({onError:r})),()=>{window.removeEventListener(s==="keplr"?"keplr_keystorechange":"leap_keystorechange",()=>void P({onError:r}))}},[s]),null},$t=()=>(zr(),null);import{jsx as Yr,jsxs as Zr}from"react/jsx-runtime";var Xr=new Vr({}),Bc=({children:t,grazOptions:e,...n})=>(e&&dt(e),Zr(Hr,{client:Xr,...n,children:[Yr($t,{}),t]}));var Wc=t=>t,Qc=t=>t,Kc=t=>t;var ce=st(Ke());import{Bech32Address as Qo}from"@keplr-wallet/cosmos";function Or(t,e){if(t)return;if(process.env.NODE_ENV==="production")throw new Error(ze);let n=typeof e=="function"?e():e,r=n?`${ze}: ${n}`:ze;throw new Error(r)}var ze="Invariant failed";var $r=st(Ke()),Ve=t=>{if(!(0,$r.valid)(t))switch(t.split(".").length){case 1:return`${t}.0.0`;case 2:return`${t}.0`;case 3:default:throw new Error("invalid semver")}return t};var Qu=t=>{var Re,Xe,Ye,Ze,Je,et;let{chain:e,getRestEndpoint:n=({apis:E})=>{var $,D;return((D=($=E==null?void 0:E.rest)==null?void 0:$[0])==null?void 0:D.address)??""},getRpcEndpoint:r=({apis:E})=>{var $,D;return((D=($=E==null?void 0:E.rpc)==null?void 0:$[0])==null?void 0:D.address)??""}}=t,s=[],i=Ve(((Re=e.codebase)==null?void 0:Re.cosmos_sdk_version)??"0.4");if((0,ce.satisfies)(i,">=0.4")&&s.push("stargate"),(0,ce.satisfies)(i,">=0.43")&&s.push("no-legacy-stdTx"),s.push("ibc-transfer"),(0,ce.satisfies)(i,">=0.45")&&s.push("ibc-go"),(Xe=e.codebase)!=null&&Xe.cosmwasm_enabled){s.push("cosmwasm");let E=Ve(e.codebase.cosmwasm_version??"0.24");(0,ce.satisfies)(E,">=0.24")&&s.push("wasmd_0.24+")}let o=[];"assetlists"in t&&Array.isArray(t.assetlists)&&(o=((Ye=t.assetlists.find(E=>E.chain_name===e.chain_name))==null?void 0:Ye.assets)||[]),"assetlist"in t&&Array.isArray(t.assetlist.assets)&&(o=t.assetlist.assets),"assets"in t&&Array.isArray(t.assets)&&(o=t.assets);let c=((Ze=e.fees)==null?void 0:Ze.fee_tokens.map(E=>E.denom))||[],a={};for(let E of((Je=e.fees)==null?void 0:Je.fee_tokens)||[])a[E.denom]={low:E.low_gas_price??.01,average:E.average_gas_price??.025,high:E.high_gas_price??.04};let u=((et=e.staking)==null?void 0:et.staking_tokens.map(E=>E.denom))||[],d=o.map(E=>{var D,tt;let $=E.denom_units.reduce((nt,rt)=>rt.exponent>nt.exponent?rt:nt);return{coinDenom:E.symbol,coinMinimalDenom:E.base,coinDecimals:$.exponent,coinGeckoId:E.coingecko_id,coinImageUrl:((D=E.logo_URIs)==null?void 0:D.svg)??((tt=E.logo_URIs)==null?void 0:tt.png)}}),h=d[0];Or(h,`chain '${e.chain_name}' has no assets`);let x=d.find(E=>u.includes(E.coinDenom))??h,f=d.filter(E=>c.includes(E.coinMinimalDenom)).map(E=>{if(!a.hasOwnProperty(E.coinMinimalDenom))return E;let $=a[E.coinMinimalDenom];return{...E,gasPriceStep:$}}),L=d.filter(E=>x.coinDenom===E.coinDenom).map(E=>{if(!a.hasOwnProperty(E.coinMinimalDenom))return E;let $=a[E.coinMinimalDenom];return{...E,gasPriceStep:$}});return{rpc:r(e),rest:n(e),chainId:e.chain_id,chainName:e.pretty_name||"",bip44:{coinType:e.slip44||118},bech32Config:Qo.defaultBech32Config(e.bech32_prefix),currencies:d,stakeCurrency:x,feeCurrencies:f.length!==0?f:L,features:s}};var Ko=(o=>(o.Bridge="bridge",o.Ibc="ibc",o.IbcCw20="ibc-cw20",o.LiquidStake="liquid-stake",o.Synthetic="synthetic",o.Wrapped="wrapped",o))(Ko||{}),zo=(o=>(o.Cw20="cw20",o.Erc20="erc20",o.Ics20="ics20",o.SDKCoin="sdk.coin",o.Snip20="snip20",o.Snip25="snip25",o))(zo||{}),Vo=(n=>(n.Cometbft="cometbft",n.Tendermint="tendermint",n))(Vo||{}),Ho=(r=>(r.Ics201="ics20-1",r.Ics271="ics27-1",r.Mauth="mauth",r))(Ho||{}),Xo=(n=>(n.Ethermint="ethermint",n.Injective="injective",n))(Xo||{}),Yo=(s=>(s.Ed25519="ed25519",s.Ethsecp256K1="ethsecp256k1",s.Secp256K1="secp256k1",s.Sr25519="sr25519",s))(Yo||{}),Zo=(r=>(r.Devnet="devnet",r.Mainnet="mainnet",r.Testnet="testnet",r))(Zo||{}),Jo=(r=>(r.Killed="killed",r.Live="live",r.Upcoming="upcoming",r))(Jo||{}),ea=(n=>(n.Ordered="ordered",n.Unordered="unordered",n))(ea||{});export{Vo as ConsensusType,Xo as ExtraCodec,$t as GrazEvents,Bc as GrazProvider,Ho as ICSEnabled,Yo as KeyAlgo,Zo as NetworkType,ea as Ordering,Jo as Status,Ko as TraceType,zo as TypeAsset,ot as WALLET_TYPES,it as WalletType,X as checkWallet,ht as clearRecentChain,dt as configureGraz,Z as connect,ue as createClients,ut as createQueryClient,le as createSigningClients,Wc as defineAsset,Qc as defineAssetList,Da as defineChain,Pa as defineChainInfo,La as defineChains,Kc as defineRegistryChain,we as disconnect,St as executeContract,ft as getActiveChainCurrency,ga as getAvailableWallets,Et as getBalanceStaked,gt as getBalances,Fr as getCosmostation,jr as getKeplr,Gr as getLeap,vt as getQueryRaw,At as getQuerySmart,Ta as getRecentChain,Y as getWallet,xt as instantiateContract,P as reconnect,Qu as registryToChainInfo,Ct as sendIbcTokens,yt as sendTokens,Te as suggestChain,mt as suggestChainAndConnect,G as useAccount,ic as useActiveChain,oc as useActiveChainCurrency,ac as useActiveChainValidators,Ha as useBalance,Ja as useBalanceStaked,Wr as useBalances,pe as useCheckWallet,Cc as useClients,Xa as useConnect,Ya as useDisconnect,Oc as useExecuteContract,zr as useGrazEvents,bc as useInstantiateContract,Qr as useOfflineSigners,mc as useQueryClient,Nc as useQueryRaw,$c as useQuerySmart,cc as useRecentChain,Tc as useSendIbcTokens,wc as useSendTokens,Za as useSigners,xc as useSigningClients,uc as useSuggestChain,lc as useSuggestChainAndConnect};
1
+ import{a as Nt,b as Rt,c as R}from"./chunk-HBC2VYPF.mjs";var Ze=Nt((to,$e)=>{$e.exports=w;var v=null;try{v=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function w(t,e,n){this.low=t|0,this.high=e|0,this.unsigned=!!n}w.prototype.__isLong__;Object.defineProperty(w.prototype,"__isLong__",{value:!0});function j(t){return(t&&t.__isLong__)===!0}w.isLong=j;var qe={},Pe={};function M(t,e){var n,r,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(r=Pe[t],r)?r:(n=S(t,(t|0)<0?-1:0,!0),o&&(Pe[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(r=qe[t],r)?r:(n=S(t,t<0?-1:0,!1),o&&(qe[t]=n),n))}w.fromInt=M;function _(t,e){if(isNaN(t))return e?U:F;if(e){if(t<0)return U;if(t>=Ke)return Ve}else{if(t<=-Le)return D;if(t+1>=Le)return He}return t<0?_(-t,e).neg():S(t%z|0,t/z|0,e)}w.fromNumber=_;function S(t,e,n){return new w(t,e,n)}w.fromBits=S;var te=Math.pow;function ce(t,e,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return F;if(typeof e=="number"?(n=e,e=!1):e=!!e,n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return ce(t.substring(1),e,n).neg();for(var o=_(te(n,8)),s=F,i=0;i<t.length;i+=8){var a=Math.min(8,t.length-i),u=parseInt(t.substring(i,i+a),n);if(a<8){var f=_(te(n,a));s=s.mul(f).add(_(u))}else s=s.mul(o),s=s.add(_(u))}return s.unsigned=e,s}w.fromString=ce;function k(t,e){return typeof t=="number"?_(t,e):typeof t=="string"?ce(t,e):S(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}w.fromValue=k;var Ge=65536,zt=1<<24,z=Ge*Ge,Ke=z*z,Le=Ke/2,ze=M(zt),F=M(0);w.ZERO=F;var U=M(0,!0);w.UZERO=U;var L=M(1);w.ONE=L;var Qe=M(1,!0);w.UONE=Qe;var ie=M(-1);w.NEG_ONE=ie;var He=S(-1,2147483647,!1);w.MAX_VALUE=He;var Ve=S(-1,-1,!0);w.MAX_UNSIGNED_VALUE=Ve;var D=S(0,-2147483648,!1);w.MIN_VALUE=D;var c=w.prototype;c.toInt=function(){return this.unsigned?this.low>>>0:this.low};c.toNumber=function(){return this.unsigned?(this.high>>>0)*z+(this.low>>>0):this.high*z+(this.low>>>0)};c.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(D)){var n=_(e),r=this.div(n),o=r.mul(n).sub(this);return r.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=_(te(e,6),this.unsigned),i=this,a="";;){var u=i.div(s),f=i.sub(u.mul(s)).toInt()>>>0,d=f.toString(e);if(i=u,i.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}};c.getHighBits=function(){return this.high};c.getHighBitsUnsigned=function(){return this.high>>>0};c.getLowBits=function(){return this.low};c.getLowBitsUnsigned=function(){return this.low>>>0};c.getNumBitsAbs=function(){if(this.isNegative())return this.eq(D)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,n=31;n>0&&!(e&1<<n);n--);return this.high!=0?n+33:n+1};c.isZero=function(){return this.high===0&&this.low===0};c.eqz=c.isZero;c.isNegative=function(){return!this.unsigned&&this.high<0};c.isPositive=function(){return this.unsigned||this.high>=0};c.isOdd=function(){return(this.low&1)===1};c.isEven=function(){return(this.low&1)===0};c.equals=function(e){return j(e)||(e=k(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};c.eq=c.equals;c.notEquals=function(e){return!this.eq(e)};c.neq=c.notEquals;c.ne=c.notEquals;c.lessThan=function(e){return this.comp(e)<0};c.lt=c.lessThan;c.lessThanOrEqual=function(e){return this.comp(e)<=0};c.lte=c.lessThanOrEqual;c.le=c.lessThanOrEqual;c.greaterThan=function(e){return this.comp(e)>0};c.gt=c.greaterThan;c.greaterThanOrEqual=function(e){return this.comp(e)>=0};c.gte=c.greaterThanOrEqual;c.ge=c.greaterThanOrEqual;c.compare=function(e){if(j(e)||(e=k(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};c.comp=c.compare;c.negate=function(){return!this.unsigned&&this.eq(D)?D:this.not().add(L)};c.neg=c.negate;c.add=function(e){j(e)||(e=k(e));var n=this.high>>>16,r=this.high&65535,o=this.low>>>16,s=this.low&65535,i=e.high>>>16,a=e.high&65535,u=e.low>>>16,f=e.low&65535,d=0,A=0,C=0,E=0;return E+=s+f,C+=E>>>16,E&=65535,C+=o+u,A+=C>>>16,C&=65535,A+=r+a,d+=A>>>16,A&=65535,d+=n+i,d&=65535,S(C<<16|E,d<<16|A,this.unsigned)};c.subtract=function(e){return j(e)||(e=k(e)),this.add(e.neg())};c.sub=c.subtract;c.multiply=function(e){if(this.isZero())return F;if(j(e)||(e=k(e)),v){var n=v.mul(this.low,this.high,e.low,e.high);return S(n,v.get_high(),this.unsigned)}if(e.isZero())return F;if(this.eq(D))return e.isOdd()?D:F;if(e.eq(D))return this.isOdd()?D:F;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(ze)&&e.lt(ze))return _(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,o=this.high&65535,s=this.low>>>16,i=this.low&65535,a=e.high>>>16,u=e.high&65535,f=e.low>>>16,d=e.low&65535,A=0,C=0,E=0,O=0;return O+=i*d,E+=O>>>16,O&=65535,E+=s*d,C+=E>>>16,E&=65535,E+=i*f,C+=E>>>16,E&=65535,C+=o*d,A+=C>>>16,C&=65535,C+=s*f,A+=C>>>16,C&=65535,C+=i*u,A+=C>>>16,C&=65535,A+=r*d+o*f+s*u+i*a,A&=65535,S(E<<16|O,A<<16|C,this.unsigned)};c.mul=c.multiply;c.divide=function(e){if(j(e)||(e=k(e)),e.isZero())throw Error("division by zero");if(v){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var n=(this.unsigned?v.div_u:v.div_s)(this.low,this.high,e.low,e.high);return S(n,v.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?U:F;var r,o,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return U;if(e.gt(this.shru(1)))return Qe;s=U}else{if(this.eq(D)){if(e.eq(L)||e.eq(ie))return D;if(e.eq(D))return L;var i=this.shr(1);return r=i.div(e).shl(1),r.eq(F)?e.isNegative()?L:ie:(o=this.sub(e.mul(r)),s=r.add(o.div(e)),s)}else if(e.eq(D))return this.unsigned?U:F;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=F}for(o=this;o.gte(e);){r=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),u=a<=48?1:te(2,a-48),f=_(r),d=f.mul(e);d.isNegative()||d.gt(o);)r-=u,f=_(r,this.unsigned),d=f.mul(e);f.isZero()&&(f=L),s=s.add(f),o=o.sub(d)}return s};c.div=c.divide;c.modulo=function(e){if(j(e)||(e=k(e)),v){var n=(this.unsigned?v.rem_u:v.rem_s)(this.low,this.high,e.low,e.high);return S(n,v.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};c.mod=c.modulo;c.rem=c.modulo;c.not=function(){return S(~this.low,~this.high,this.unsigned)};c.and=function(e){return j(e)||(e=k(e)),S(this.low&e.low,this.high&e.high,this.unsigned)};c.or=function(e){return j(e)||(e=k(e)),S(this.low|e.low,this.high|e.high,this.unsigned)};c.xor=function(e){return j(e)||(e=k(e)),S(this.low^e.low,this.high^e.high,this.unsigned)};c.shiftLeft=function(e){return j(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?S(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):S(0,this.low<<e-32,this.unsigned)};c.shl=c.shiftLeft;c.shiftRight=function(e){return j(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?S(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):S(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};c.shr=c.shiftRight;c.shiftRightUnsigned=function(e){if(j(e)&&(e=e.toInt()),e&=63,e===0)return this;var n=this.high;if(e<32){var r=this.low;return S(r>>>e|n<<32-e,n>>>e,this.unsigned)}else return e===32?S(n,0,this.unsigned):S(n>>>e-32,0,this.unsigned)};c.shru=c.shiftRightUnsigned;c.shr_u=c.shiftRightUnsigned;c.toSigned=function(){return this.unsigned?S(this.low,this.high,!1):this};c.toUnsigned=function(){return this.unsigned?this:S(this.low,this.high,!0)};c.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};c.toBytesLE=function(){var e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};c.toBytesBE=function(){var e=this.high,n=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};w.fromBytes=function(e,n,r){return r?w.fromBytesLE(e,n):w.fromBytesBE(e,n)};w.fromBytesLE=function(e,n){return new w(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)};w.fromBytesBE=function(e,n){return new w(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)}});import{GasPrice as Yt}from"@cosmjs/stargate";import{create as ke}from"zustand";import{createJSONStorage as Ut}from"zustand/middleware";import{persist as Oe,subscribeWithSelector as Be}from"zustand/middleware";var _e=(a=>(a.KEPLR="keplr",a.LEAP="leap",a.COSMOSTATION="cosmostation",a.WALLETCONNECT="walletconnect",a.WC_KEPLR_MOBILE="wc_keplr_mobile",a.WC_LEAP_MOBILE="wc_leap_mobile",a.WC_COSMOSTATION_MOBILE="wc_cosmostation_mobile",a))(_e||{}),Fe=["keplr","leap","cosmostation","walletconnect","wc_keplr_mobile","wc_leap_mobile","wc_cosmostation_mobile"];var Mt={recentChain:null,defaultChain:null,defaultSigningClient:"stargate",walletType:"keplr",walletConnect:{options:null,web3Modal:null},_notFoundFn:()=>null,_onReconnectFailed:()=>null,_reconnect:!1,_reconnectConnector:null},V={account:null,activeChain:null,balances:null,clients:null,offlineSigner:null,offlineSignerAmino:null,offlineSignerAuto:null,signingClients:null,status:"disconnected",wcSignClient:null},qt={name:"graz-session",version:1,partialize:t=>({account:t.account,activeChain:t.activeChain}),storage:Ut(()=>sessionStorage)},Pt={name:"graz-internal",partialize:t=>({recentChain:t.recentChain,_reconnect:t._reconnect,_reconnectConnector:t._reconnectConnector}),version:1},m=ke(Be(Oe(()=>V,qt))),y=ke(Be(Oe(()=>Mt,Pt)));import{SigningCosmWasmClient as Ue}from"@cosmjs/cosmwasm-stargate";import{SigningStargateClient as Me}from"@cosmjs/stargate";import{Tendermint34Client as Lt}from"@cosmjs/tendermint-rpc";import{QueryClient as Gt}from"@cosmjs/stargate";import{assert as We,isNonNullObject as Ne}from"@cosmjs/utils";var Re=(...t)=>{let{tendermint:e}=m.getState().clients,n=new Gt(e),r=t.map(o=>o(n));for(let o of r){We(Ne(o),"Extension must be a non-null object");for(let[s,i]of Object.entries(o)){We(Ne(i),`Module must be a non-null object. Found type ${typeof i} for module "${s}".`);let a=n[s]||{};n[s]={...a,...i}}}return n};var J=async({rpc:t,rpcHeaders:e})=>{let n={url:t,headers:{...e||{}}},[r,o,s]=await Promise.all([Ue.connect(n),Me.connect(n),Lt.connect(t)]);return{cosmWasm:r,stargate:o,tendermint:s}},ee=async t=>{let{rpc:e,rpcHeaders:n,offlineSignerAuto:r,cosmWasmSignerOptions:o={},stargateSignerOptions:s={}}=t,i={url:e,headers:{...n||{}}},[a,u]=await Promise.all([Ue.connectWithSigner(i,r,o),Me.connectWithSigner(i,r,s)]);return{cosmWasm:a,stargate:u}};var Je=Rt(Ze());import{fromBech32 as Kt}from"@cosmjs/encoding";import{SignClient as Qt}from"@walletconnect/sign-client";import{getSdkError as Ht}from"@walletconnect/utils";var q=()=>typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1,Ye=()=>q()&&navigator.userAgent.toLowerCase().includes("android"),Xe=()=>q()&&(navigator.userAgent.toLowerCase().includes("iphone")||navigator.userAgent.toLowerCase().includes("ipad"));var ae=(t,e,n=new Error("Promise timed out"))=>{let r=new Promise((o,s)=>{setTimeout(()=>{s(n)},e)});return Promise.race([t,r])};var K=(t=y.getState().walletType)=>{try{return $(t),!0}catch{return!1}},P=()=>{window.sessionStorage.removeItem(R),m.setState(V)},ue=()=>{if(typeof window.keplr<"u"){let t=window.keplr;return Object.assign(t,{subscription:r=>(window.addEventListener("keplr_keystorechange",()=>{P(),r()}),()=>{window.removeEventListener("keplr_keystorechange",()=>{P(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.keplr is not defined")},le=()=>{if(typeof window.leap<"u"){let t=window.leap;return Object.assign(t,{subscription:r=>(window.addEventListener("leap_keystorechange",()=>{P(),r()}),()=>{window.removeEventListener("leap_keystorechange",()=>{P(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.leap is not defined")},pe=()=>{if(typeof window.cosmostation.providers.keplr<"u"){let t=window.cosmostation.providers.keplr;return Object.assign(t,{subscription:r=>(window.cosmostation.cosmos.on("accountChanged",()=>{P(),r()}),()=>{window.cosmostation.cosmos.off("accountChanged",()=>{P(),r()})})})}throw y.getState()._notFoundFn(),new Error("window.cosmostation.providers.keplr is not defined")},Q=t=>{var Te,De,je;if(!((je=(De=(Te=y.getState().walletConnect)==null?void 0:Te.options)==null?void 0:De.projectId)!=null&&je.trim()))throw new Error("walletConnect.options.projectId is not defined");let e=(t==null?void 0:t.encoding)||"base64",n=p=>{if(!t)return;let{appUrl:l,formatNativeUrl:g}=t;if(q()){if(Ye())if(!p)window.open(l.mobile.android,"_self","noreferrer noopener");else{let h=g(l.mobile.android,p,"android");window.open(h,"_self","noreferrer noopener")}if(Xe())if(!p)window.open(l.mobile.ios,"_self","noreferrer noopener");else{let h=g(l.mobile.ios,p,"ios");window.open(h,"_self","noreferrer noopener")}}},r=()=>{let{wcSignClient:p}=m.getState();if(!p)throw new Error("walletConnect.signClient is not defined");P(),y.setState({_reconnect:!1,_reconnectConnector:null,recentChain:null})},o=async p=>{let{wcSignClient:l}=m.getState();if(!l)throw new Error("walletConnect.signClient is not defined");if(!p)throw new Error("No wallet connect session");await l.disconnect({topic:p,reason:Ht("USER_DISCONNECTED")}),await a(l),r()},s=p=>{var l,g;try{let{wcSignClient:h}=m.getState();if(!h)throw new Error("walletConnect.signClient is not defined");let x=h.session.getAll().at(-1);if(!x)return;let b=(g=(l=h.session.getAll().at(-1))==null?void 0:l.namespaces.cosmos)==null?void 0:g.accounts.find(I=>I.startsWith(`cosmos:${p}`));if(!(x.expiry*1e3>Date.now()+1e3))throw o(x.topic),new Error("invalid session");if(!b)try{let I=h.find({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!I.length)throw new Error("no session");return I.at(-1)}catch(I){if(!I.message.toLowerCase().includes("no matching key"))throw I}return x}catch(h){if(!h.message.toLowerCase().includes("no matching key"))throw h}},i=p=>{try{return s(p)}catch{return}},a=async p=>{try{let l=p.core.pairing.pairings.getAll({active:!1});if(!l.length)return;await Promise.all(l.map(async g=>{await p.core.pairing.pairings.delete(g.topic,{code:7001,message:"clear pairing"})}))}catch(l){if(!l.message.toLowerCase().includes("no matching key"))throw l}},u=async()=>{let{walletConnect:p}=y.getState();if(!(p!=null&&p.options))throw new Error("walletConnect.options is not defined");let{wcSignClient:l}=m.getState();if(l)return m.setState({wcSignClient:l}),l;let g=await Qt.init(p.options);return m.setState({wcSignClient:g}),g},f=p=>{let{wcSignClient:l}=m.getState();if(l)return l.events.on("session_delete",g=>{r()}),l.events.on("session_expire",g=>{r()}),l.events.on("session_event",g=>{var h,x;if(g.params.event.name==="accountsChanged"&&((h=g.params.event.data)==null?void 0:h[0])!==((x=m.getState().account)==null?void 0:x.bech32Address)){let b=g.params.chainId.split(":")[1];b&&d(b)}else p()}),()=>{l.events.off("session_delete",g=>{r()}),l.events.off("session_expire",g=>{r()}),l.events.off("session_event",g=>{var h,x;if(g.params.event.name==="accountsChanged"&&((h=g.params.event.data)==null?void 0:h[0])!==((x=m.getState().account)==null?void 0:x.bech32Address)){let b=g.params.chainId.split(":")[1];b&&d(b)}else p()})}},d=async p=>{var Y;let{wcSignClient:l}=m.getState();if(!l)throw new Error("enable walletConnect.signClient is not defined");let{walletConnect:g}=y.getState();if(!((Y=g==null?void 0:g.options)!=null&&Y.projectId))throw new Error("walletConnect.options.projectId is not defined");let{Web3Modal:h}=await import("@web3modal/standalone"),x=new h({projectId:g.options.projectId,walletConnectVersion:2,enableExplorer:!1,explorerRecommendedWalletIds:"NONE",...g.web3Modal}),{account:b,activeChain:B}=m.getState(),I=i(p);if((B==null?void 0:B.chainId)!==p&&!I||!b){let{uri:T,approval:X}=await l.connect({requiredNamespaces:{cosmos:{methods:["cosmos_getAccounts","cosmos_signAmino","cosmos_signDirect"],chains:[`cosmos:${p}`],events:["chainChanged","accountsChanged"]}}});if(!T)throw new Error("No wallet connect uri");t?n(T):await x.openModal({uri:T});try{await ae((async()=>{await X()})(),4e4,new Error("Modal approval timeout"))}catch(ve){if(x.closeModal(),!ve.message.toLowerCase().includes("no matching key"))return Promise.reject(ve)}return t||x.closeModal(),Promise.resolve()}try{await ae((async()=>{let T=await C(p);m.setState({account:T})})(),1e4,new Error("Connection timeout"))}catch(T){if(o(I==null?void 0:I.topic),!T.message.toLowerCase().includes("no matching key"))throw T}},A=async p=>{var x;let{wcSignClient:l}=m.getState();if(!l)throw new Error("walletConnect.signClient is not defined");let g=(x=s(p))==null?void 0:x.topic;if(!g)throw new Error("No wallet connect session");n();let h=await l.request({topic:g,chainId:`cosmos:${p}`,request:{method:"cosmos_getAccounts",params:{}}});if(!h[0])throw new Error("No wallet connect account");return{address:h[0].address,algo:h[0].algo,pubkey:new Uint8Array(Buffer.from(h[0].pubkey,e))}},C=async p=>{let{address:l,algo:g,pubkey:h}=await A(p);return{address:Kt(l).data,algo:g,bech32Address:l,name:"",pubKey:h,isKeystone:!1,isNanoLedger:!1}},E=async(...p)=>{var T,X;let[l,g,h]=p,{account:x,wcSignClient:b}=m.getState();if(!b)throw new Error("walletConnect.signClient is not defined");if(!x)throw new Error("account is not defined");let B=(T=s(l))==null?void 0:T.topic;if(!B)throw new Error("No wallet connect session");if(!h.bodyBytes)throw new Error("No bodyBytes");if(!h.authInfoBytes)throw new Error("No authInfoBytes");let I={topic:B,chainId:`cosmos:${l}`,request:{method:"cosmos_signDirect",params:{signerAddress:g,signDoc:{...h,bodyBytes:Buffer.from(h.bodyBytes).toString(e),authInfoBytes:Buffer.from(h.authInfoBytes).toString(e),accountNumber:(X=h.accountNumber)==null?void 0:X.toString()}}}};return n(),await b.request(I)},O=async(...p)=>{let[l,g,h]=p,{signature:x,signed:b}=await E(l,g,h);return{signed:{chainId:b.chainId,accountNumber:Je.default.fromString(b.accountNumber,!1),authInfoBytes:new Uint8Array(Buffer.from(b.authInfoBytes,e)),bodyBytes:new Uint8Array(Buffer.from(b.bodyBytes,e))},signature:x}},re=async(...p)=>{var T;let[l,g,h,x]=p,{wcSignClient:b}=m.getState(),{account:B}=m.getState();if(!b)throw new Error("walletConnect.signClient is not defined");if(!B)throw new Error("account is not defined");let I=(T=s(l))==null?void 0:T.topic;if(!I)throw new Error("No wallet connect session");return n(),await b.request({topic:I,chainId:`cosmos:${l}`,request:{method:"cosmos_signDirect",params:{signerAddress:g,signDoc:h}}})},H=async(...p)=>{let[l,g,h,x]=p;return await re(l,g,h)},se=p=>({getAccounts:async()=>[await A(p)],signDirect:(l,g)=>O(p,l,g)}),N=p=>({getAccounts:async()=>[await A(p)],signAmino:(l,g)=>H(p,l,g)});return{enable:d,experimentalSuggestChain:async(...p)=>{await Promise.reject(new Error("WalletConnect does not support experimentalSuggestChain"))},getKey:C,getOfflineSigner:p=>({getAccounts:async()=>[await A(p)],signDirect:(l,g)=>O(p,l,g),signAmino:(l,g)=>H(p,l,g)}),getOfflineSignerAuto:async p=>(await C(p)).isNanoLedger?N(p):se(p),getOfflineSignerOnlyAmino:N,signAmino:H,signDirect:O,subscription:f,init:u}},Vt=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!q())throw new Error("WalletConnect Keplr mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"keplrwallet://",android:"intent://"}},walletType:"wc_keplr_mobile",formatNativeUrl:(o,s,i)=>{let a=o.replaceAll("/","").replaceAll(":",""),u=encodeURIComponent(s);switch(i){case"ios":return`${a}://wcV2?${u}`;case"android":return`${a}://wcV2?${u}#Intent;package=com.chainapsis.keplr;scheme=keplrwallet;end;`;default:return`${a}://wc?uri=${u}`}}};return Q(t)},$t=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!q())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"base64",appUrl:{mobile:{ios:"leapcosmos://",android:"intent://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,s,i)=>{let a=o.replaceAll("/","").replaceAll(":",""),u=encodeURIComponent(s);switch(i){case"ios":return`${a}://wcV2?${u}`;case"android":return`${a}://wcV2?${u}#Intent;package=io.leapwallet.cosmos;scheme=leapwallet;end;`;default:return`${a}://wc?uri=${u}`}}};return Q(t)},Zt=()=>{var e,n,r;if(!((r=(n=(e=y.getState().walletConnect)==null?void 0:e.options)==null?void 0:n.projectId)!=null&&r.trim()))throw new Error("walletConnect.options.projectId is not defined");if(!q())throw new Error("WalletConnect Leap mobile is only supported in mobile");let t={encoding:"hex",appUrl:{mobile:{ios:"cosmostation://",android:"cosmostation://"}},walletType:"wc_leap_mobile",formatNativeUrl:(o,s,i)=>`${o.replaceAll("/","").replaceAll(":","")}://wc?${s}`};return Q(t)},$=(t=y.getState().walletType)=>{switch(t){case"keplr":return ue();case"leap":return le();case"cosmostation":return pe();case"walletconnect":return Q();case"wc_keplr_mobile":return Vt();case"wc_leap_mobile":return $t();case"wc_cosmostation_mobile":return Zt();default:throw new Error("Unknown wallet type")}},mo=()=>Object.fromEntries(Fe.map(t=>[t,K(t)]));var Z=async t=>{var e;try{let{defaultChain:n,recentChain:r,walletType:o}=y.getState(),s=(t==null?void 0:t.walletType)||o;if(!K(s))throw new Error(`${s} is not available`);let a=$(s),u=(t==null?void 0:t.chain)||r||n;if(!u)throw new Error("No last known connected chain, connect action requires chain info");m.setState(N=>{let Ie=y.getState()._reconnect||!!y.getState()._reconnectConnector||!!u;return N.activeChain&&N.activeChain.chainId!==u.chainId?{status:"connecting"}:Ie?{status:"reconnecting"}:{status:"connecting"}});let{account:f,activeChain:d}=m.getState();if(await((e=a.init)==null?void 0:e.call(a)),!f||(d==null?void 0:d.chainId)!==u.chainId){await a.enable(u.chainId);let N=await a.getKey(u.chainId);m.setState({account:N})}let A=a.getOfflineSigner(u.chainId),C=a.getOfflineSignerOnlyAmino(u.chainId),E=await a.getOfflineSignerAuto(u.chainId),O=u.gas?Yt.fromString(`${u.gas.price}${u.gas.denom}`):void 0,[re,H]=await Promise.all([J(u),ee({...u,offlineSignerAuto:E,cosmWasmSignerOptions:{gasPrice:O,...(t==null?void 0:t.signerOpts)||{}}})]);y.setState({recentChain:u,walletType:s,_reconnect:!!(t!=null&&t.autoReconnect),_reconnectConnector:s}),m.setState({activeChain:u,clients:re,offlineSigner:A,offlineSignerAmino:C,offlineSignerAuto:E,signingClients:H,status:"connected"}),typeof window<"u"&&window.sessionStorage.setItem(R,"Active");let{account:se}=m.getState();return{account:se,walletType:s,chain:u}}catch(n){throw console.error("connect ",n),m.getState().account===null&&m.setState({status:"disconnected"}),m.getState().account&&m.getState().activeChain&&m.setState({status:"connected"}),n}},me=async(t=!1)=>(typeof window<"u"&&window.sessionStorage.removeItem(R),m.setState(V),y.setState(e=>({_reconnect:!1,_reconnectConnector:null,recentChain:t?null:e.recentChain})),Promise.resolve()),W=async t=>{var o;let{recentChain:e,_reconnectConnector:n,_reconnect:r}=y.getState();try{let s=K(n||void 0);if(e&&s&&n)return await Z({chain:e,walletType:n,autoReconnect:r})}catch(s){(o=t==null?void 0:t.onError)==null||o.call(t,s),me()}};var et=()=>{y.setState({recentChain:null})},tt=t=>{let{activeChain:e}=m.getState();return e==null?void 0:e.currencies.find(n=>n.coinMinimalDenom===t)},bo=()=>y.getState().recentChain,ge=async t=>(await $().experimentalSuggestChain(t),t),nt=async({chainInfo:t,rpcHeaders:e,gas:n,path:r,...o})=>{let s=await ge(t);return{...await Z({chain:{chainId:t.chainId,currencies:t.currencies,rest:t.rest,rpc:t.rpc,rpcHeaders:e,gas:n,path:r},...o}),chain:s}};var ot=(t={})=>(y.setState(e=>({defaultChain:t.defaultChain||e.defaultChain,defaultSigningClient:t.defaultSigningClient||e.defaultSigningClient,walletConnect:t.walletConnect||e.walletConnect,walletType:t.defaultWallet||e.walletType,_notFoundFn:t.onNotFound||e._notFoundFn,_onReconnectFailed:t.onReconnectFailed||e._onReconnectFailed,_reconnect:t.autoReconnect===void 0?!0:t.autoReconnect||e._reconnect})),t);var rt=async t=>{let{activeChain:e,signingClients:n}=m.getState();if(!e||!n)throw new Error("No connected account detected");let{defaultSigningClient:r}=y.getState();return await Promise.all(e.currencies.map(async s=>{let i=s.coinMinimalDenom.startsWith("cw20:");return n[r].getBalance(t,i?s.coinMinimalDenom.replace("cw20:",""):s.coinMinimalDenom)}))},st=async t=>{let{clients:e}=m.getState();if(!(e!=null&&e.stargate))throw new Error("Stargate client is not ready");return e.stargate.getBalanceStaked(t)},it=async({senderAddress:t,recipientAddress:e,amount:n,fee:r,memo:o})=>{let{defaultSigningClient:s}=y.getState(),{signingClients:i}=m.getState();if(!i)throw new Error("No connected account detected");if(!t)throw new Error("senderAddress is not defined");return i[s].sendTokens(t,e,n,r,o)},ct=async({senderAddress:t,recipientAddress:e,transferAmount:n,sourcePort:r,sourceChannel:o,timeoutHeight:s,timeoutTimestamp:i,fee:a,memo:u})=>{let{signingClients:f}=m.getState();if(!(f!=null&&f.stargate))throw new Error("Stargate signing client is not ready");if(!t)throw new Error("senderAddress is not defined");return f.stargate.sendIbcTokens(t,e,n,r,o,s,i,a,u)},at=async({senderAddress:t,msg:e,fee:n,options:r,label:o,codeId:s})=>{let{signingClients:i}=m.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.instantiate(t,s,e,o,n,r)},ut=async({senderAddress:t,msg:e,fee:n,contractAddress:r,funds:o,memo:s})=>{let{signingClients:i}=m.getState();if(!(i!=null&&i.cosmWasm))throw new Error("CosmWasm signing client is not ready");return i.cosmWasm.execute(t,r,e,n,s,o)},lt=async(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");return await n.cosmWasm.queryContractSmart(t,e)},pt=(t,e)=>{let{clients:n}=m.getState();if(!(n!=null&&n.cosmWasm))throw new Error("CosmWasm client is not ready");let r=new TextEncoder().encode(e);return n.cosmWasm.queryContractRaw(t,r)};import{Bech32Address as Xt}from"@keplr-wallet/cosmos";var gt={coinDenom:"axl",coinMinimalDenom:"uaxl",coinDecimals:6,coinGeckoId:"axelar-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"},Jt={coinDenom:"usdc",coinMinimalDenom:"uusdc",coinDecimals:6,coinGeckoId:"usd-coin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png"},en={coinDenom:"dai",coinMinimalDenom:"dai-wei",coinDecimals:18,coinGeckoId:"dai",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png"},tn={coinDenom:"usdt",coinMinimalDenom:"uusdt",coinDecimals:6,coinGeckoId:"tether",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png"},nn={coinDenom:"weth-wei",coinMinimalDenom:"weth",coinDecimals:18,coinGeckoId:"weth",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"},on={coinDenom:"wbtc-satoshi",coinMinimalDenom:"wbtc",coinDecimals:8,coinGeckoId:"wrapped-bitcoin",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png"},mt=[gt,Jt,en,tn,nn,on],fe={rpc:"https://rpc.axelar.strange.love",rest:"https://api.axelar.strange.love",chainId:"axelar-dojo-1",chainName:"Axelar",stakeCurrency:gt,bip44:{coinType:118},bech32Config:Xt.defaultBech32Config("axelar"),currencies:mt,feeCurrencies:mt};import{Bech32Address as rn}from"@keplr-wallet/cosmos";var dt={coinDenom:"atom",coinMinimalDenom:"uatom",coinDecimals:6,coinGeckoId:"cosmos",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},ft=[dt],de={rpc:"https://rpc.cosmoshub.strange.love",rest:"https://api.cosmoshub.strange.love",chainId:"cosmoshub-4",chainName:"Cosmos Hub",stakeCurrency:dt,bip44:{coinType:118},bech32Config:rn.defaultBech32Config("cosmos"),currencies:ft,feeCurrencies:ft};import{Bech32Address as sn}from"@keplr-wallet/cosmos";var yt={coinDenom:"juno",coinMinimalDenom:"ujuno",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},cn={coinDenom:"neta",coinMinimalDenom:"cw20:juno168ctmpyppk90d34p3jjy658zf5a5l3w8wk35wht6ccqj4mr0yv8s4j5awr",coinDecimals:6,coinGeckoId:"neta",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/neta.png"},an={coinDenom:"marble",coinMinimalDenom:"cw20:juno1g2g7ucurum66d42g8k5twk34yegdq8c82858gz0tq2fc75zy7khssgnhjl",coinDecimals:3,coinGeckoId:"marble",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/marble.png"},un={coinDenom:"hope",coinMinimalDenom:"cw20:juno1re3x67ppxap48ygndmrc7har2cnc7tcxtm9nplcas4v0gc3wnmvs3s807z",coinDecimals:6,coinGeckoId:"hope-galaxy",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hope.png"},ln={coinDenom:"rac",coinMinimalDenom:"cw20:juno1r4pzw8f9z0sypct5l9j906d47z998ulwvhvqe5xdwgy8wf84583sxwh0pa",coinDecimals:6,coinGeckoId:"racoon",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/rac.png"},pn={coinDenom:"block",coinMinimalDenom:"cw20:juno1y9rf7ql6ffwkv02hsgd4yruz23pn4w97p75e2slsnkm0mnamhzysvqnxaq",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/block.png"},mn={coinDenom:"dhk",coinMinimalDenom:"cw20:juno1tdjwrqmnztn2j3sj2ln9xnyps5hs48q3ddwjrz7jpv6mskappjys5czd49",coinDecimals:0,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/dhk.png"},gn={coinDenom:"raw",coinMinimalDenom:"cw20:juno15u3dt79t6sxxa3x3kpkhzsy56edaa5a66wvt3kxmukqjz2sx0hes5sn38g",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/raw.png",coinGeckoId:"junoswap-raw-dao"},fn={coinDenom:"asvt",coinMinimalDenom:"cw20:juno17wzaxtfdw5em7lc94yed4ylgjme63eh73lm3lutp2rhcxttyvpwsypjm4w",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/asvt.png"},dn={coinDenom:"hns",coinMinimalDenom:"cw20:juno1ur4jx0sxchdevahep7fwq28yk4tqsrhshdtylz46yka3uf6kky5qllqp4k",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/hns.svg"},hn={coinDenom:"joe",coinMinimalDenom:"cw20:juno1n7n7d5088qlzlj37e9mgmkhx6dfgtvt02hqxq66lcap4dxnzdhwqfmgng3",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/joe.png"},ht=[yt,cn,an,un,ln,pn,mn,gn,fn,dn,hn],he={rpc:"https://rpc.juno.strange.love",rest:"https://api.juno.strange.love",chainId:"juno-1",chainName:"Juno",stakeCurrency:yt,bip44:{coinType:118},bech32Config:sn.defaultBech32Config("juno"),currencies:ht,feeCurrencies:ht};import{Bech32Address as yn}from"@keplr-wallet/cosmos";var wt={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png"},Cn={coinDenom:"ion",coinMinimalDenom:"uion",coinDecimals:6,coinGeckoId:"ion",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png"},Ct=[wt,Cn],ye={rpc:"https://rpc.osmosis.strange.love",rest:"https://api.osmosis.strange.love",chainId:"osmosis-1",chainName:"Osmosis",stakeCurrency:wt,bip44:{coinType:118},bech32Config:yn.defaultBech32Config("osmo"),currencies:Ct,feeCurrencies:Ct};import{Bech32Address as wn}from"@keplr-wallet/cosmos";var xt={coinDenom:"somm",coinMinimalDenom:"usomm",coinDecimals:6,coinGeckoId:"sommelier",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png"},St=[xt],Ce={rpc:"https://rpc.sommelier.strange.love",rest:"https://api.sommelier.strange.love",chainId:"sommelier-3",chainName:"Sommelier",stakeCurrency:xt,bip44:{coinType:118},bech32Config:wn.defaultBech32Config("somm"),currencies:St,feeCurrencies:St};import{Bech32Address as Sn}from"@keplr-wallet/cosmos";var Et={coinDenom:"CRE",coinMinimalDenom:"ucre",coinDecimals:6,coinGeckoId:"crescent",coinImageUrl:"https://raw.githubusercontent.com/crescent-network/asset/main/images/coin/CRE.png"},At=[Et],we={rpc:"https://testnet-endpoint.crescent.network/rpc/crescent",rest:"https://testnet-endpoint.crescent.network/api/crescent",chainId:"mooncat-1-1",chainName:"Crescent Testnet",bip44:{coinType:118},bech32Config:Sn.defaultBech32Config("CRE"),currencies:At,feeCurrencies:At,stakeCurrency:Et,coinType:118};import{Bech32Address as xn}from"@keplr-wallet/cosmos";var Se={coinDenom:"junox",coinMinimalDenom:"ujunox",coinDecimals:6,coinGeckoId:"juno-network",coinImageUrl:"https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/images/juno.png"},An=[Se],xe={rpc:"https://rpc.uni.junonetwork.io",rest:"https://api.uni.junonetwork.io",chainId:"uni-5",chainName:"Juno Testnet",stakeCurrency:Se,bip44:{coinType:118},bech32Config:xn.defaultBech32Config("juno"),currencies:An,feeCurrencies:[Se],coinType:118};import{Bech32Address as En}from"@keplr-wallet/cosmos";var Ae={coinDenom:"osmo",coinMinimalDenom:"uosmo",coinDecimals:6,coinGeckoId:"osmosis",coinImageUrl:"https://dhj8dql1kzq2v.cloudfront.net/white/osmo.png"},bn=[Ae],Ee={rpc:"https://testnet-rpc.osmosis.zone",rest:"https://testnet-rest.osmosis.zone",chainId:"osmo-test-4",chainName:"Osmosis Testnet",stakeCurrency:Ae,bip44:{coinType:118},bech32Config:En.defaultBech32Config("osmo"),currencies:bn,feeCurrencies:[Ae],coinType:118};var bt=t=>t,tr=t=>t,nr=t=>t,or=bt({axelar:fe,cosmoshub:de,juno:he,osmosis:ye,sommelier:Ce}),rr=[fe,de,he,ye,Ce],sr=bt({crescent:we,juno:xe,osmosis:Ee}),ir=[we,xe,Ee];import{useMutation as It,useQuery as be}from"@tanstack/react-query";import{useEffect as Tn}from"react";import{shallow as Dn}from"zustand/shallow";import{useQuery as In}from"@tanstack/react-query";var ne=t=>{let n=["USE_CHECK_WALLET",y(o=>t||o.walletType)];return In(n,({queryKey:[,o]})=>K(o))};var G=({onConnect:t,onDisconnect:e}={})=>{let n=m(o=>o.account),r=m(o=>o.status);return Tn(()=>m.subscribe(o=>o.status,(o,s)=>{if(o==="connected"){let{account:i,activeChain:a}=m.getState(),{walletType:u}=y.getState();t==null||t({account:i,chain:a,walletType:u,isReconnect:s==="reconnecting"})}o==="disconnected"&&(e==null||e())}),[t,e]),{data:n,isConnected:!!n,isConnecting:r==="connecting",isDisconnected:r==="disconnected",isReconnecting:r==="reconnecting",isLoading:r==="connecting"||r==="reconnecting",reconnect:W,status:r}},jn=t=>{let{data:e}=G(),n=t||(e==null?void 0:e.bech32Address);return be(["USE_BALANCES",n],({queryKey:[,s]})=>rt(s),{enabled:!!n,refetchOnMount:!1,refetchOnReconnect:!0,refetchOnWindowFocus:!1})},wr=(t,e)=>{let{data:n}=jn(e);return be(["USE_BALANCE",n,t,e],({queryKey:[,s]})=>s==null?void 0:s.find(i=>i.denom===t),{enabled:!!n})},Sr=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=It(["USE_CONNECT",t,e,n],Z,{onError:(i,a)=>Promise.resolve(t==null?void 0:t(i,a)),onMutate:e,onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:s}=ne();return{connect:i=>o.mutate(i),connectAsync:i=>o.mutateAsync(i),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!s,status:o.status}},xr=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=It(["USE_DISCONNECT",t,e,n],me,{onError:s=>Promise.resolve(t==null?void 0:t(s,void 0)),onMutate:e,onSuccess:()=>Promise.resolve(n==null?void 0:n(void 0))});return{disconnect:s=>o.mutate(s),disconnectAsync:s=>o.mutateAsync(s),error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,status:o.status}},vn=()=>m(t=>({signer:t.offlineSigner,signerAmino:t.offlineSignerAmino,signerAuto:t.offlineSignerAuto}),Dn),Ar=()=>vn(),Er=t=>{let{data:e}=G(),n=t||(e==null?void 0:e.bech32Address);return be(["USE_BALANCE_STAKED",n],({queryKey:[,s]})=>st(n),{enabled:!!n})};import{useMutation as Tt,useQuery as Dt}from"@tanstack/react-query";var vr=()=>m(t=>t.activeChain),_r=t=>Dt(["USE_ACTIVE_CHAIN_CURRENCY",t],({queryKey:[,r]})=>tt(r)),Fr=(t,e="BOND_STATUS_BONDED")=>Dt(["USE_ACTIVE_CHAIN_VALIDATORS",t,e],({queryKey:[,o,s]})=>o.staking.validators(s),{enabled:typeof t<"u"}),kr=()=>({data:y(e=>e.recentChain),clear:et}),Or=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=Tt(["USE_SUGGEST_CHAIN",t,e,n],ge,{onError:(s,i)=>Promise.resolve(t==null?void 0:t(s,i)),onMutate:e,onSuccess:s=>Promise.resolve(n==null?void 0:n(s))});return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,suggest:o.mutate,suggestAsync:o.mutateAsync,status:o.status}},Br=({onError:t,onLoading:e,onSuccess:n}={})=>{let o=Tt(["USE_SUGGEST_CHAIN_AND_CONNECT",t,e,n],nt,{onError:(i,a)=>Promise.resolve(t==null?void 0:t(i,a)),onMutate:i=>e==null?void 0:e(i),onSuccess:i=>Promise.resolve(n==null?void 0:n(i))}),{data:s}=ne();return{error:o.error,isLoading:o.isLoading,isSuccess:o.isSuccess,isSupported:!!s,status:o.status,suggestAndConnect:o.mutate,suggestAndConnectAsync:o.mutateAsync}};import{useQuery as jt}from"@tanstack/react-query";var qr=t=>{let e=m(o=>o.clients);return jt(["USE_CLIENTS",t,e],({queryKey:[,o,s]})=>o!=null&&o.rpc?J(o):s,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:o=>{m.setState({clients:o})},initialData:e})},Pr=t=>{let e=m(o=>o.signingClients);return jt(["USE_SIGNING_CLIENTS",t,e],({queryKey:[,o,s]})=>o!=null&&o.rpc?ee(o):s,{refetchOnMount:!1,refetchOnWindowFocus:!1,onSuccess:o=>{m.setState({signingClients:o})},initialData:e})};import{useQuery as _n}from"@tanstack/react-query";var Kr=(...t)=>{let e=["USE_QUERY_CLIENT",...t];return _n(e,({queryKey:[,...r]})=>Re(...t),{refetchOnMount:!1,refetchOnWindowFocus:!1})};import{useMutation as oe,useQuery as vt}from"@tanstack/react-query";var Zr=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=G(),o=r==null?void 0:r.bech32Address,i=oe(["USE_SEND_TOKENS",t,e,n,o],a=>it({senderAddress:o,...a}),{onError:(a,u)=>Promise.resolve(t==null?void 0:t(a,u)),onMutate:e,onSuccess:a=>Promise.resolve(n==null?void 0:n(a))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendTokens:i.mutate,sendTokensAsync:i.mutateAsync,status:i.status}},Yr=({onError:t,onLoading:e,onSuccess:n}={})=>{let{data:r}=G(),o=r==null?void 0:r.bech32Address,i=oe(["USE_SEND_IBC_TOKENS",t,e,n,o],a=>ct({senderAddress:o,...a}),{onError:(a,u)=>Promise.resolve(t==null?void 0:t(a,u)),onMutate:e,onSuccess:a=>Promise.resolve(n==null?void 0:n(a))});return{error:i.error,isLoading:i.isLoading,isSuccess:i.isSuccess,sendIbcTokens:i.mutate,sendIbcTokensAsync:i.mutateAsync,status:i.status}},Xr=({codeId:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=G(),s=o==null?void 0:o.bech32Address,u=oe(["USE_INSTANTIATE_CONTRACT",e,n,r,t,s],f=>{if(!s)throw new Error("senderAddress is undefined");let d={...f,fee:f.fee??"auto",senderAddress:s,codeId:t};return at(d)},{onError:(f,d)=>Promise.resolve(e==null?void 0:e(f,d)),onMutate:n,onSuccess:f=>Promise.resolve(r==null?void 0:r(f))});return{error:u.error,isLoading:u.isLoading,isSuccess:u.isSuccess,instantiateContract:u.mutate,instantiateContractAsync:u.mutateAsync,status:u.status}},Jr=({contractAddress:t,onError:e,onLoading:n,onSuccess:r})=>{let{data:o}=G(),s=o==null?void 0:o.bech32Address,u=oe(["USE_EXECUTE_CONTRACT",e,n,r,t,s],f=>{if(!s)throw new Error("senderAddress is undefined");let d={...f,fee:f.fee??"auto",senderAddress:s,contractAddress:t,memo:f.memo??"",funds:f.funds??[]};return ut(d)},{onError:(f,d)=>Promise.resolve(e==null?void 0:e(f,d)),onMutate:n,onSuccess:f=>Promise.resolve(r==null?void 0:r(f))});return{error:u.error,isLoading:u.isLoading,isSuccess:u.isSuccess,executeContract:u.mutate,executeContractAsync:u.mutateAsync,status:u.status}},es=(t,e)=>vt(["USE_QUERY_SMART",t,e],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or queryMsg undefined");return lt(t,e)},{enabled:!!t&&!!e}),ts=(t,e)=>vt(["USE_QUERY_RAW",e,t],({queryKey:[,o]})=>{if(!t||!e)throw new Error("address or key undefined");return pt(t,e)},{enabled:!!t&&!!e});import{QueryClient as Nn,QueryClientProvider as Rn}from"@tanstack/react-query";import{ReactQueryDevtools as Un}from"@tanstack/react-query-devtools";import{useEffect as Fn,useState as kn}from"react";import{Fragment as On,jsx as Bn}from"react/jsx-runtime";var _t=({children:t})=>{let[e,n]=kn(!1);return Fn(()=>{n(!0)},[]),Bn(On,{children:e?t:null})};import{useEffect as Ft}from"react";var Wn=()=>{let t=typeof window<"u"&&window.sessionStorage.getItem(R)==="Active",{_reconnect:e,_onReconnectFailed:n,_reconnectConnector:r}=y(),{activeChain:o,wcSignClient:s}=m();return Ft(()=>{r&&(t&&o?W({onError:n}):!t&&e&&W({onError:n}))},[]),Ft(()=>{var i,a,u,f,d,A,C,E;r&&(r==="cosmostation"&&((a=(i=pe()).subscription)==null||a.call(i,()=>{W({onError:n})})),r==="keplr"&&((f=(u=ue()).subscription)==null||f.call(u,()=>{W({onError:n})})),r==="leap"&&((A=(d=le()).subscription)==null||A.call(d,()=>{W({onError:n})})),r==="walletconnect"&&s&&((E=(C=Q()).subscription)==null||E.call(C,()=>{W({onError:n})})))},[r,s]),null},kt=()=>(Wn(),null);import{jsx as Ot,jsxs as Bt}from"react/jsx-runtime";var Mn=new Nn({}),ys=({children:t,grazOptions:e,debug:n,...r})=>(e&&ot(e),Bt(Rn,{client:Mn,...r,children:[Bt(_t,{children:[Ot(kt,{}),t]}),n?Ot(Un,{initialIsOpen:!1,position:"bottom-right"}):null]},"graz-provider"));export{kt as GrazEvents,ys as GrazProvider,Fe as WALLET_TYPES,_e as WalletType,K as checkWallet,et as clearRecentChain,ot as configureGraz,Z as connect,J as createClients,Re as createQueryClient,ee as createSigningClients,tr as defineChain,nr as defineChainInfo,bt as defineChains,me as disconnect,ut as executeContract,tt as getActiveChainCurrency,mo as getAvailableWallets,st as getBalanceStaked,rt as getBalances,pe as getCosmostation,ue as getKeplr,le as getLeap,pt as getQueryRaw,lt as getQuerySmart,bo as getRecentChain,Zt as getWCCosmostation,Vt as getWCKeplr,$t as getWCLeap,$ as getWallet,Q as getWalletConnect,at as instantiateContract,or as mainnetChains,rr as mainnetChainsArray,W as reconnect,ct as sendIbcTokens,it as sendTokens,ge as suggestChain,nt as suggestChainAndConnect,sr as testnetChains,ir as testnetChainsArray,G as useAccount,vr as useActiveChain,_r as useActiveChainCurrency,Fr as useActiveChainValidators,wr as useBalance,Er as useBalanceStaked,jn as useBalances,ne as useCheckWallet,qr as useClients,Sr as useConnect,xr as useDisconnect,Jr as useExecuteContract,Wn as useGrazEvents,Xr as useInstantiateContract,vn as useOfflineSigners,Kr as useQueryClient,ts as useQueryRaw,es as useQuerySmart,kr as useRecentChain,Yr as useSendIbcTokens,Zr as useSendTokens,Ar as useSigners,Pr as useSigningClients,Or as useSuggestChain,Br as useSuggestChainAndConnect};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "graz",
3
3
  "description": "React hooks for Cosmos",
4
- "version": "0.0.42-alpha.2",
4
+ "version": "0.0.42",
5
5
  "author": "Griko Nibras <griko@strange.love>",
6
6
  "repository": "https://github.com/strangelove-ventures/graz.git",
7
7
  "homepage": "https://github.com/strangelove-ventures/graz",
@@ -10,17 +10,18 @@
10
10
  "module": "./dist/index.mjs",
11
11
  "types": "./dist/index.d.ts",
12
12
  "bin": {
13
- "graz": "./dist/cli/index.mjs"
13
+ "graz": "./cli.mjs"
14
14
  },
15
15
  "files": [
16
- "**/*.stub",
17
- "dist/**/*.d.ts",
18
- "dist/**/*.js",
19
- "dist/**/*.mjs"
16
+ "chains/*.stub",
17
+ "cli.js",
18
+ "compiled/**",
19
+ "dist/*.d.ts",
20
+ "dist/*.js",
21
+ "dist/*.mjs"
20
22
  ],
21
23
  "sideEffects": false,
22
24
  "dependencies": {
23
- "@clack/prompts": "^0.6.3",
24
25
  "@cosmjs/cosmwasm-stargate": "^0.30.1",
25
26
  "@cosmjs/launchpad": "^0.27.1",
26
27
  "@cosmjs/proto-signing": "^0.30.1",
@@ -28,8 +29,14 @@
28
29
  "@cosmjs/tendermint-rpc": "^0.30.1",
29
30
  "@keplr-wallet/cosmos": "^0.11.64",
30
31
  "@keplr-wallet/types": "^0.11.64",
31
- "@tanstack/react-query": "^4.29.11",
32
- "commander": "10.0.1",
32
+ "@tanstack/react-query": "^4.29.12",
33
+ "@tanstack/react-query-devtools": "^4.29.12",
34
+ "@walletconnect/sign-client": "^2.7.7",
35
+ "@walletconnect/types": "^2.7.7",
36
+ "@walletconnect/utils": "^2.7.7",
37
+ "@web3modal/standalone": "^2.4.1",
38
+ "arg": "^5.0.2",
39
+ "cosmos-directory-client": "0.0.6",
33
40
  "zustand": "^4.3.8"
34
41
  },
35
42
  "devDependencies": {