graz 0.0.44-alpha.2 → 0.0.44

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