PageSourceSearch

https://orbiter.finance/_next/static/chunks/vendors-907dbd09-c59312f6b7e3e4da.js

js orbiter.finance collected 2026-09-24 11:14:31 UTC 291,024 bytes, 7 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9356],{64744:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(68955);function i(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}function a(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}function s(t,e){return void 0===e&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function o(t,e){return void 0===e&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function c(t,e){return void 0===e&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function l(t,e){return void 0===e&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}function u(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}function d(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}function h(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),u(t/4294967296>>>0,e,r),u(t>>>0,e,r+4),e}function f(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),d(t>>>0,e,r),d(t/4294967296>>>0,e,r+4),e}e.readInt16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16},e.readUint16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])>>>0},e.readInt16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])<<16>>16},e.readUint16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])>>>0},e.writeUint16BE=i,e.writeInt16BE=i,e.writeUint16LE=a,e.writeInt16LE=a,e.readInt32BE=s,e.readUint32BE=o,e.readInt32LE=c,e.readUint32LE=l,e.writeUint32BE=u,e.writeInt32BE=u,e.writeUint32LE=d,e.writeInt32LE=d,e.readInt64BE=function(t,e){void 0===e&&(e=0);var r=s(t,e),n=s(t,e+4);return 4294967296*r+n-(n>>31)*4294967296},e.readUint64BE=function(t,e){return void 0===e&&(e=0),4294967296*o(t,e)+o(t,e+4)},e.readInt64LE=function(t,e){void 0===e&&(e=0);var r=c(t,e);return 4294967296*c(t,e+4)+r-(r>>31)*4294967296},e.readUint64LE=function(t,e){void 0===e&&(e=0);var r=l(t,e);return 4294967296*l(t,e+4)+r},e.writeUint64BE=h,e.writeInt64BE=h,e.writeUint64LE=f,e.writeInt64LE=f,e.readUintBE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw Error("readUintBE: array is too short for the given b
1itLength");for(var n=0,i=1,a=t/8+r-1;a>=r;a--)n+=e[a]*i,i*=256;return n},e.readUintLE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,a=r;a<r+t/8;a++)n+=e[a]*i,i*=256;return n},e.writeUintBE=function(t,e,r,i){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===i&&(i=0),t%8!=0)throw Error("writeUintBE supports only bitLengths divisible by 8");if(!n.isSafeInteger(e))throw Error("writeUintBE value must be an integer");for(var a=1,s=t/8+i-1;s>=i;s--)r[s]=e/a&255,a*=256;return r},e.writeUintLE=function(t,e,r,i){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===i&&(i=0),t%8!=0)throw Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(e))throw Error("writeUintLE value must be an integer");for(var a=1,s=i;s<i+t/8;s++)r[s]=e/a&255,a*=256;return r},e.readFloat32BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e)},e.readFloat32LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e,!0)},e.readFloat64BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e)},e.readFloat64LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e,!0)},e.writeFloat32BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t),e},e.writeFloat32LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t,!0),e},e.writeFloat64BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t),e},e.writeFloat64LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t,!0),e}},8123:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(64744),i=r(49876);function a(t,e,r,a,s){if(void 0===s&&(s=0),32!==t.length)throw Error("ChaCha: key size must be 32 bytes");if(a.length<r.length)throw Error("ChaCha: destination is shorter than source");if(0===s){if(8!==e.length&&12!==e.length)throw Error("ChaCha nonce must be 8 or 12 bytes");c=(o=new Uint8Array(16)).length-e.length,o.set(e,c)}else{if(16!==e.length)throw Error("ChaCha nonce with counter must be 16 bytes");o=e,c=s}for(var o,c,l=new Uint8Array(64),u=0;u<r.length;u+=64){!function(t,e,r){for(var i=r[3]<<24|r[2]<<16|r[1]<<8|r[0],a=r[7]<<24|r[6]<<16|r[5]<<8|r[4],s=r[11]<<24|r[10]<<16|r[9]<<8|r[8],o=r[15]<<24|r[14]<<16|r[13]<<8|r[12],c=r[19]<<24|r[18]<<16|r[17]<<8|r[16],l=r[23]<<24|r[22]<<16|r[21]<<8|r[20],u=r[27]<<24|r[26]<<16|r[25]<<8|r[24],d=r[31]<<24|r[30]<<16|r[29]<<8|r[28],h=e[3]<<24|e[2]<<16|e[1]<<8|e[0],f=e[7]<<24|e[6]<<16|e[5]<<8|e[4],p=e[11]<<24|e[10]<<16|e[9]<<8|e[8],g=e[15]<<24|e[14]<<16|e[13]<<8|e[12],y=1634760805,m=857760878,_=2036477234,E=1797285236,b=i,I=a,w=s,A=o,v=c,T=l,S=u,N=d,M=h,D=f,C=p,k=g,O=0;O<20;O+=2)M^=y=y+b|0,b^=v=v+(M=M>>>16|M<<16)|0,b=b>>>20|b<<12,D^=m=m+I|0,I^=T=T+(D=D>>>16|D<<16)|0,I=I>>>20|I<<12,C^=_=_+w|0,w^=S=S+(C=C>>>16|C<<16)|0,w=w>>>20|w<<12,k^=E=E+A|0,A^=N=N+(k=k>>>16|k<<16)|0,A=A>>>20|A<<12,C^=_=_+w|0,w^=S=S+(C=C>>>24|C<<8)|0,w=w>>>25|w<<7,k^=E=E+A|0,A^=N=N+(k=k>>>24|k<<8)|0,A=A>>>25|A<<7,D^=m=m+I|0,I^=T=T+(D=D>>>24|D<<8)|0,I=I>>>25|I<<7,M^=y=y+b|0,b^=v=v+(M=M>>>24|M<<8)|0,b=b>>>25|b<<7,k^=y=y+I|0,I^=S=S+(k=k>>>16|k<<16)|0,I=I>>>20|I<<12,M^=m=m+w|0,w^=N=N+(M=M>>>16|M<<16)|0,w=w>>>20|w<<12,D^=_=_+A|0,A^=v=v+(D=D>>>16|D<<16)|0,A=A>>>20|A<<12,C^=E=E+b|0,b^=T=T+(C=C>>>16|C<<16)|0,b=b>>>20|b<<12,D^=_=_+A|0,A^=v=v+(D=D>>>24|D<<8)|0,A=A>>>25|A<<7,C^=E=E+b|0,b^=T=T+(C=C>>>24|C<<8)|0,b=b>>>25|b<<7,M^=m=m+w|0,w^=N=N+(M=M>>>24|M<<8)|0,w=w>>>25|w<<7,k^=y=y+I|0,I^=S=S+(k=k>>>24|k<<8)|0,I=I>>>25|I<<7;n.writeUint32LE(y+1634760805|0,t,0),n.writeUint32LE(m+857760878|0,t,4),n.writeUint32LE(_+2036477234|0,t,8),n.writeUint32LE(E+1797285236|0,t,12),n.writeUint32LE(b+i|0,t,16),n.writeUint32LE(I+a|0,t,20),n.writeUint32LE(w+s|0,t,24),n.writeUint32LE(A+o|0,t,28),n.writeUint32LE(v+c|0,t,32),n.writeUint32LE(T+l|0,t,36),n.writeUint32LE(S+u|0,t,40),n.writeUint32LE(N+d|0,t,44),n.writeUint32LE(M+h|0,t,48),n.writeUint32LE(D+f|0,t,52),n.writeUint32LE(C+p|0,t,56),n.writeUint32LE(k+g|0,t,60)}(l,o,t);for(var d=u;d<u+64&&d<r.length;d++)a[d]=r[d]^l[d-u];!function(t,e,r){for(var n=1;r--;)n=n+(255&t[e])|0,t[e]=255&n,n>>>=8,e++;
1if(n>0)throw Error("ChaCha: counter overflow")}(o,0,c)}return i.wipe(l),0===s&&i.wipe(o),a}e.streamXOR=a,e.stream=function(t,e,r,n){return void 0===n&&(n=0),i.wipe(r),a(t,e,r,r,n)}},72352:function(t,e,r){"use strict";var n=r(8123),i=r(30023),a=r(49876),s=r(64744),o=r(89508);e.Cv=32,e.WH=12,e.pg=16;var c=new Uint8Array(16),l=function(){function t(t){if(this.nonceLength=e.WH,this.tagLength=e.pg,t.length!==e.Cv)throw Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return t.prototype.seal=function(t,e,r,i){if(t.length>16)throw Error("ChaCha20Poly1305: incorrect nonce length");var s,o=new Uint8Array(16);o.set(t,o.length-t.length);var c=new Uint8Array(32);n.stream(this._key,o,c,4);var l=e.length+this.tagLength;if(i){if(i.length!==l)throw Error("ChaCha20Poly1305: incorrect destination length");s=i}else s=new Uint8Array(l);return n.streamXOR(this._key,o,e,s,4),this._authenticate(s.subarray(s.length-this.tagLength,s.length),c,s.subarray(0,s.length-this.tagLength),r),a.wipe(o),s},t.prototype.open=function(t,e,r,i){if(t.length>16)throw Error("ChaCha20Poly1305: incorrect nonce length");if(e.length<this.tagLength)return null;var s,c=new Uint8Array(16);c.set(t,c.length-t.length);var l=new Uint8Array(32);n.stream(this._key,c,l,4);var u=new Uint8Array(this.tagLength);if(this._authenticate(u,l,e.subarray(0,e.length-this.tagLength),r),!o.equal(u,e.subarray(e.length-this.tagLength,e.length)))return null;var d=e.length-this.tagLength;if(i){if(i.length!==d)throw Error("ChaCha20Poly1305: incorrect destination length");s=i}else s=new Uint8Array(d);return n.streamXOR(this._key,c,e.subarray(0,e.length-this.tagLength),s,4),a.wipe(c),s},t.prototype.clean=function(){return a.wipe(this._key),this},t.prototype._authenticate=function(t,e,r,n){var o=new i.Poly1305(e);n&&(o.update(n),n.length%16>0&&o.update(c.subarray(n.length%16))),o.update(r),r.length%16>0&&o.update(c.subarray(r.length%16));var l=new Uint8Array(8);n&&s.writeUint64LE(n.length,l),o.update(l),s.writeUint64LE(r.length,l),o.update(l);for(var u=o.digest(),d=0;d<u.length;d++)t[d]=u[d];o.clean(),a.wipe(u),a.wipe(l)},t}();e.OK=l},89508:function(t,e){"use strict";function r(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 1&r-1>>>8}Object.defineProperty(e,"__esModule",{value:!0}),e.select=function(t,e,r){return~(t-1)&e|t-1&r},e.lessOrEqual=function(t,e){return(0|t)-(0|e)-1>>>31&1},e.compare=r,e.equal=function(t,e){return 0!==t.length&&0!==e.length&&0!==r(t,e)}},36483:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isSerializableHash=function(t){return void 0!==t.saveState&&void 0!==t.restoreState&&void 0!==t.cleanSavedState}},11336:function(t,e,r){"use strict";var n=r(15017),i=r(49876),a=function(){function t(t,e,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=i;var a=n.hmac(this._hash,r,e);this._hmac=new n.HMAC(t,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(0===t)throw Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(t){for(var e=new Uint8Array(t),r=0;r<e.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),e[r]=this._buffer[this._bufpos++];return e},t.prototype.clean=function(){this._hmac.clean(),i.wipe(this._buffer),i.wipe(this._counter),this._bufpos=0},t}();e.t=a},15017:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(36483),i=r(89508),a=r(49876),s=function(){function t(t,e){this._finished=!1,this._inner=new t,this._outer=new t,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);e.length>this.blockSize?this._inner.update(e).finish(r).clean():r.set(e);for(var i=0;i<r.length;i++)r[i]^=54;this._inner.update(r);for(var i=0;i<r.length;i++)r[i]^=106;this._outer.update(r),n.isSerializableHash(this._inner)&&n.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),a.wipe(r)}return t.prototype.reset=function(){if(!n.isSerializableHash(this._inner)||!n.isSerializableHash(this._outer))throw Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){n.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),n.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(t){return this._inner.update(t),this},t.prototype.finish=function(t){return this._finished?this._outer.finish(t):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t.prototype.saveState=function(){if(!n.isSerializableHash(this._inner))throw Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(t){if(!n.isSerializableHash(this._inner)||!n.isSerializableHash(this._outer))throw Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(t){if(!n.isSerializableHash(this._inner))throw Error("hmac: can't 
1cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},t}();e.HMAC=s,e.hmac=function(t,e,r){var n=new s(t,e);n.update(r);var i=n.digest();return n.clean(),i},e.equal=i.equal},68955:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(t,e){var r=65535&t,n=65535&e;return r*n+((t>>>16&65535)*n+r*(e>>>16&65535)<<16>>>0)|0},e.add=function(t,e){return t+e|0},e.sub=function(t,e){return t-e|0},e.rotl=function(t,e){return t<<e|t>>>32-e},e.rotr=function(t,e){return t<<32-e|t>>>e},e.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}},30023:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(89508),i=r(49876);e.DIGEST_LENGTH=16;var a=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=t[0]|t[1]<<8;this._r[0]=8191&r;var n=t[2]|t[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=t[4]|t[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var a=t[6]|t[7]<<8;this._r[3]=(i>>>7|a<<9)&8191;var s=t[8]|t[9]<<8;this._r[4]=(a>>>4|s<<12)&255,this._r[5]=s>>>1&8190;var o=t[10]|t[11]<<8;this._r[6]=(s>>>14|o<<2)&8191;var c=t[12]|t[13]<<8;this._r[7]=(o>>>11|c<<5)&8065;var l=t[14]|t[15]<<8;this._r[8]=(c>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(t,e,r){for(var n=this._fin?0:2048,i=this._h[0],a=this._h[1],s=this._h[2],o=this._h[3],c=this._h[4],l=this._h[5],u=this._h[6],d=this._h[7],h=this._h[8],f=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],m=this._r[3],_=this._r[4],E=this._r[5],b=this._r[6],I=this._r[7],w=this._r[8],A=this._r[9];r>=16;){var v,T=t[e+0]|t[e+1]<<8;i+=8191&T;var S=t[e+2]|t[e+3]<<8;a+=(T>>>13|S<<3)&8191;var N=t[e+4]|t[e+5]<<8;s+=(S>>>10|N<<6)&8191;var M=t[e+6]|t[e+7]<<8;o+=(N>>>7|M<<9)&8191;var D=t[e+8]|t[e+9]<<8;c+=(M>>>4|D<<12)&8191,l+=D>>>1&8191;var C=t[e+10]|t[e+11]<<8;u+=(D>>>14|C<<2)&8191;var k=t[e+12]|t[e+13]<<8;d+=(C>>>11|k<<5)&8191;var O=t[e+14]|t[e+15]<<8;h+=(k>>>8|O<<8)&8191,f+=O>>>5|n;var L=0;L=(v=0+i*p+5*A*a+5*w*s+5*I*o+5*b*c)>>>13,v&=8191,v+=5*E*l+5*_*u+5*m*d+5*y*h+5*g*f,L+=v>>>13,v&=8191;var x=L;x+=i*g+a*p+5*A*s+5*w*o+5*I*c,L=x>>>13,x&=8191,x+=5*b*l+5*E*u+5*_*d+5*m*h+5*y*f,L+=x>>>13,x&=8191;var R=L;R+=i*y+a*g+s*p+5*A*o+5*w*c,L=R>>>13,R&=8191,R+=5*I*l+5*b*u+5*E*d+5*_*h+5*m*f,L+=R>>>13,R&=8191;var B=L;B+=i*m+a*y+s*g+o*p+5*A*c,L=B>>>13,B&=8191,B+=5*w*l+5*I*u+5*b*d+5*E*h+5*_*f,L+=B>>>13,B&=8191;var j=L;j+=i*_+a*m+s*y+o*g+c*p,L=j>>>13,j&=8191,j+=5*A*l+5*w*u+5*I*d+5*b*h+5*E*f,L+=j>>>13,j&=8191;var P=L;P+=i*E+a*_+s*m+o*y+c*g,L=P>>>13,P&=8191,P+=l*p+5*A*u+5*w*d+5*I*h+5*b*f,L+=P>>>13,P&=8191;var U=L;U+=i*b+a*E+s*_+o*m+c*y,L=U>>>13,U&=8191,U+=l*g+u*p+5*A*d+5*w*h+5*I*f,L+=U>>>13,U&=8191;var z=L;z+=i*I+a*b+s*E+o*_+c*m,L=z>>>13,z&=8191,z+=l*y+u*g+d*p+5*A*h+5*w*f,L+=z>>>13,z&=8191;var V=L;V+=i*w+a*I+s*b+o*E+c*_,L=V>>>13,V&=8191,V+=l*m+u*y+d*g+h*p+5*A*f,L+=V>>>13,V&=8191;var F=L;F+=i*A+a*w+s*I+o*b+c*E,L=F>>>13,F&=8191,F+=l*_+u*m+d*y+h*g+f*p,L+=F>>>13,F&=8191,v=8191&(L=(L=(L<<2)+L|0)+v|0),L>>>=13,x+=L,i=v,a=x,s=R,o=B,c=j,l=P,u=U,d=z,h=V,f=F,e+=16,r-=16}this._h[0]=i,this._h[1]=a,this._h[2]=s,this._h[3]=o,this._h[4]=c,this._h[5]=l,this._h[6]=u,this._h[7]=d,this._h[8]=h,this._h[9]=f},t.prototype.finish=function(t,e){void 0===e&&(e=0);var r,n,i,a,s=new Uint16Array(10);if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=r,r=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,s[0]=this._h[0]+5,r=s[0]>>>13,s[0]&=8191,a=1;a<10;a++)s[a]=this._h[a]+r,r=s[a]>>>13,s[a]&=8191;for(s[9]-=8192,n=(1^r)-1,a=0;a<10;a++)s[a]&=n;for(a=0,n=~n;a<10;a++)this._h[a]=this._h[a]&n|s[a];for(a=1,this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,i=this._h[0]+this._pad[0],this._h[0]=65535&i;a<8;a++)i=(this._h[a]+this._pad[a]|0)+(i>>>16)|0,this._h[a]=65535&i;return t[e+0]=this._h[0]>>>0,t[e+1]=this._h[0]>>>8,t[e+2]=this._h[1]>>>0,t[e+3]=this._h[1]>>>8,t[e+4]=this._h[2]>>>0,t[e+5]=this._h[2]>>>8,t[e+6]=this._h[3]>>>0,t[e+7]=this._h[3]>>>8,t[e+8]=this._h[4]>>>0,t[e+9]=this._h[4]>>>8,t[e+10]=this._h[5]>>>0,t[e+11]=this._h[5]>>>8,t[e+12]=this._h[6]>>>0,t[e+13]=this._h[6]>>>8,t[e+14]=this._h[7]>>>0,t[e+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(t){var e,r=0,n=t.length;if(this._leftover){(e=16-this._leftover)>n&&(e=n);for(var i=0;i<e;i++)this._buffer[this._leftover+i]=t[r+i];if(n-=e,r+=e,this._leftover+=e,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(e=n-n%16,this._blocks(t,r,e),r+=e,n-=e),n){for(var i=0;i<n;i++)this._buffer[this._leftover+i]=t[r+i];this._leftover+=n}return this},t.prototype.digest=function(){if(this._finished)throw Error("Poly1305 was finished");var t=new Uint8Array(16);return this.finish(t),t},t.prototype.clean=function(){return i.wipe(this._buffer),i.wipe(this._r),i.wipe(this._h),i.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();e.Poly1305=a,e.oneTimeAuth=function(t,e){var r=new a(t);r.update(e);var n=r.digest();return r.clean(),n},e.equal=function(t,r){return t.length===e.DIGEST_LENGTH&&r.length===e.DIGEST_LENGTH&&n.equal(t,r)}},1430:function(t,e,r){"use strict";
1Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;let n=r(75615),i=r(64744),a=r(49876);function s(t,r=e.defaultRandomSource){return r.randomBytes(t)}e.defaultRandomSource=new n.SystemRandomSource,e.randomBytes=s,e.randomUint32=function(t=e.defaultRandomSource){let r=s(4,t),n=(0,i.readUint32LE)(r);return(0,a.wipe)(r),n};let o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(t,r=o,n=e.defaultRandomSource){if(r.length<2)throw Error("randomString charset is too short");if(r.length>256)throw Error("randomString charset is too long");let i="",c=r.length,l=256-256%c;for(;t>0;){let e=s(Math.ceil(256*t/l),n);for(let n=0;n<e.length&&t>0;n++){let a=e[n];a<l&&(i+=r.charAt(a%c),t--)}(0,a.wipe)(e)}return i}e.randomString=c,e.randomStringForEntropy=function(t,r=o,n=e.defaultRandomSource){return c(Math.ceil(t/(Math.log(r.length)/Math.LN2)),r,n)}},51369:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserRandomSource=void 0;class r{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw Error("Browser random byte generator is not available.");let e=new Uint8Array(t);for(let t=0;t<e.length;t+=65536)this._crypto.getRandomValues(e.subarray(t,t+Math.min(e.length-t,65536)));return e}}e.BrowserRandomSource=r},12882:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeRandomSource=void 0;let n=r(49876);class i{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{let t=r(75477);t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw Error("NodeRandomSource: got fewer bytes than requested");let r=new Uint8Array(t);for(let t=0;t<r.length;t++)r[t]=e[t];return(0,n.wipe)(e),r}}e.NodeRandomSource=i},75615:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SystemRandomSource=void 0;let n=r(51369),i=r(12882);class a{constructor(){if(this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new i.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw Error("System random byte generator is not available.");return this._source.randomBytes(t)}}e.SystemRandomSource=a},94386:function(t,e,r){"use strict";var n=r(64744),i=r(49876);e.k=32,e.cn=64;var a=function(){function t(){this.digestLength=e.k,this.blockSize=e.cn,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},t.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this._finished)throw Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=e,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&e>0;)this._buffer[this._bufferLength++]=t[r++],e--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(e>=this.blockSize&&(r=o(this._temp,this._state,t,r,e),e%=this.blockSize);e>0;)this._buffer[this._bufferLength++]=t[r++],e--;return this},t.prototype.finish=function(t){if(!this._finished){var e=this._bytesHashed,r=this._bufferLength,i=e%64<56?64:128;this._buffer[r]=128;for(var a=r+1;a<i-8;a++)this._buffer[a]=0;n.writeUint32BE(e/536870912|0,this._buffer,i-8),n.writeUint32BE(e<<3,this._buffer,i-4),o(this._temp,this._state,this._buffer,0,i),this._finished=!0}for(var a=0;a<this.digestLength/4;a++)n.writeUint32BE(this._state[a],t,4*a);return this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t.prototype.saveState=function(){if(this._finished)throw Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(t){return this._state.set(t.state),this._bufferLength=t.bufferLength,t.buffer&&this._buffer.set(t.buffer),this._bytesHashed=t.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(t){i.wipe(t.state),t.buffer&&i.wipe(t.buffer),t.bufferLength=0,t.bytesHashed=0},t}();e.mE=a;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
1734187,3204031479,3329325298]);function o(t,e,r,i,a){for(;a>=64;){for(var o=e[0],c=e[1],l=e[2],u=e[3],d=e[4],h=e[5],f=e[6],p=e[7],g=0;g<16;g++){var y=i+4*g;t[g]=n.readUint32BE(r,y)}for(var g=16;g<64;g++){var m=t[g-2],_=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,E=((m=t[g-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;t[g]=(_+t[g-7]|0)+(E+t[g-16]|0)}for(var g=0;g<64;g++){var _=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&h^~d&f)|0)+(p+(s[g]+t[g]|0)|0)|0,E=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&c^o&l^c&l)|0;p=f,f=h,h=d,d=u+_|0,u=l,l=c,c=o,o=_+E|0}e[0]+=o,e[1]+=c,e[2]+=l,e[3]+=u,e[4]+=d,e[5]+=h,e[6]+=f,e[7]+=p,i+=64,a-=64}return i}e.vp=function(t){var e=new a;e.update(t);var r=e.digest();return e.clean(),r}},49876:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.wipe=function(t){for(var e=0;e<t.length;e++)t[e]=0;return t}},34989:function(t,e,r){"use strict";e.gi=e.Au=e.KS=e.kz=void 0;let n=r(1430),i=r(49876);function a(t){let e=new Float64Array(16);if(t)for(let r=0;r<t.length;r++)e[r]=t[r];return e}e.kz=32,e.KS=32;let s=new Uint8Array(32);s[0]=9;let o=a([56129,1]);function c(t){let e=1;for(let r=0;r<16;r++){let n=t[r]+e+65535;e=Math.floor(n/65536),t[r]=n-65536*e}t[0]+=e-1+37*(e-1)}function l(t,e,r){let n=~(r-1);for(let r=0;r<16;r++){let i=n&(t[r]^e[r]);t[r]^=i,e[r]^=i}}function u(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function d(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function h(t,e,r){let n,i,a=0,s=0,o=0,c=0,l=0,u=0,d=0,h=0,f=0,p=0,g=0,y=0,m=0,_=0,E=0,b=0,I=0,w=0,A=0,v=0,T=0,S=0,N=0,M=0,D=0,C=0,k=0,O=0,L=0,x=0,R=0,B=r[0],j=r[1],P=r[2],U=r[3],z=r[4],V=r[5],F=r[6],H=r[7],Y=r[8],$=r[9],W=r[10],q=r[11],Z=r[12],G=r[13],Q=r[14],K=r[15];a+=(n=e[0])*B,s+=n*j,o+=n*P,c+=n*U,l+=n*z,u+=n*V,d+=n*F,h+=n*H,f+=n*Y,p+=n*$,g+=n*W,y+=n*q,m+=n*Z,_+=n*G,E+=n*Q,b+=n*K,s+=(n=e[1])*B,o+=n*j,c+=n*P,l+=n*U,u+=n*z,d+=n*V,h+=n*F,f+=n*H,p+=n*Y,g+=n*$,y+=n*W,m+=n*q,_+=n*Z,E+=n*G,b+=n*Q,I+=n*K,o+=(n=e[2])*B,c+=n*j,l+=n*P,u+=n*U,d+=n*z,h+=n*V,f+=n*F,p+=n*H,g+=n*Y,y+=n*$,m+=n*W,_+=n*q,E+=n*Z,b+=n*G,I+=n*Q,w+=n*K,c+=(n=e[3])*B,l+=n*j,u+=n*P,d+=n*U,h+=n*z,f+=n*V,p+=n*F,g+=n*H,y+=n*Y,m+=n*$,_+=n*W,E+=n*q,b+=n*Z,I+=n*G,w+=n*Q,A+=n*K,l+=(n=e[4])*B,u+=n*j,d+=n*P,h+=n*U,f+=n*z,p+=n*V,g+=n*F,y+=n*H,m+=n*Y,_+=n*$,E+=n*W,b+=n*q,I+=n*Z,w+=n*G,A+=n*Q,v+=n*K,u+=(n=e[5])*B,d+=n*j,h+=n*P,f+=n*U,p+=n*z,g+=n*V,y+=n*F,m+=n*H,_+=n*Y,E+=n*$,b+=n*W,I+=n*q,w+=n*Z,A+=n*G,v+=n*Q,T+=n*K,d+=(n=e[6])*B,h+=n*j,f+=n*P,p+=n*U,g+=n*z,y+=n*V,m+=n*F,_+=n*H,E+=n*Y,b+=n*$,I+=n*W,w+=n*q,A+=n*Z,v+=n*G,T+=n*Q,S+=n*K,h+=(n=e[7])*B,f+=n*j,p+=n*P,g+=n*U,y+=n*z,m+=n*V,_+=n*F,E+=n*H,b+=n*Y,I+=n*$,w+=n*W,A+=n*q,v+=n*Z,T+=n*G,S+=n*Q,N+=n*K,f+=(n=e[8])*B,p+=n*j,g+=n*P,y+=n*U,m+=n*z,_+=n*V,E+=n*F,b+=n*H,I+=n*Y,w+=n*$,A+=n*W,v+=n*q,T+=n*Z,S+=n*G,N+=n*Q,M+=n*K,p+=(n=e[9])*B,g+=n*j,y+=n*P,m+=n*U,_+=n*z,E+=n*V,b+=n*F,I+=n*H,w+=n*Y,A+=n*$,v+=n*W,T+=n*q,S+=n*Z,N+=n*G,M+=n*Q,D+=n*K,g+=(n=e[10])*B,y+=n*j,m+=n*P,_+=n*U,E+=n*z,b+=n*V,I+=n*F,w+=n*H,A+=n*Y,v+=n*$,T+=n*W,S+=n*q,N+=n*Z,M+=n*G,D+=n*Q,C+=n*K,y+=(n=e[11])*B,m+=n*j,_+=n*P,E+=n*U,b+=n*z,I+=n*V,w+=n*F,A+=n*H,v+=n*Y,T+=n*$,S+=n*W,N+=n*q,M+=n*Z,D+=n*G,C+=n*Q,k+=n*K,m+=(n=e[12])*B,_+=n*j,E+=n*P,b+=n*U,I+=n*z,w+=n*V,A+=n*F,v+=n*H,T+=n*Y,S+=n*$,N+=n*W,M+=n*q,D+=n*Z,C+=n*G,k+=n*Q,O+=n*K,_+=(n=e[13])*B,E+=n*j,b+=n*P,I+=n*U,w+=n*z,A+=n*V,v+=n*F,T+=n*H,S+=n*Y,N+=n*$,M+=n*W,D+=n*q,C+=n*Z,k+=n*G,O+=n*Q,L+=n*K,E+=(n=e[14])*B,b+=n*j,I+=n*P,w+=n*U,A+=n*z,v+=n*V,T+=n*F,S+=n*H,N+=n*Y,M+=n*$,D+=n*W,C+=n*q,k+=n*Z,O+=n*G,L+=n*Q,x+=n*K,b+=(n=e[15])*B,I+=n*j,w+=n*P,A+=n*U,v+=n*z,T+=n*V,S+=n*F,N+=n*H,M+=n*Y,D+=n*$,C+=n*W,k+=n*q,O+=n*Z,L+=n*G,x+=n*Q,R+=n*K,a+=38*I,s+=38*w,o+=38*A,c+=38*v,l+=38*T,u+=38*S,d+=38*N,h+=38*M,f+=38*D,p+=38*C,g+=38*k,y+=38*O,m+=38*L,_+=38*x,E+=38*R,i=Math.floor((n=a+(i=1)+65535)/65536),a=n-65536*i,i=Math.floor((n=s+i+65535)/65536),s=n-65536*i,i=Math.floor((n=o+i+65535)/65536),o=n-65536*i,i=Math.floor((n=c+i+65535)/65536),c=n-65536*i,i=Math.floor((n=l+i+65535)/65536),l=n-65536*i,i=Math.floor((n=u+i+65535)/65536),u=n-65536*i,i=Math.floor((n=d+i+65535)/65536),d=n-65536*i,i=Math.floor((n=h+i+65535)/65536),h=n-65536*i,i=Math.floor((n=f+i+65535)/65536),f=n-65536*i,i=Math.floor((n=p+i+65535)/65536),p=n-65536*i,i=Math.floor((n=g+i+65535)/65536),g=n-65536*i,i=Math.floor((n=y+i+65535)/65536),y=n-65536*i,i=Math.floor((n=m+i+65535)/65536),m=n-65536*i,i=Math.floor((n=_+i+65535)/65536),_=n-6
15536*i,i=Math.floor((n=E+i+65535)/65536),E=n-65536*i,i=Math.floor((n=b+i+65535)/65536),b=n-65536*i,a+=i-1+37*(i-1),i=Math.floor((n=a+(i=1)+65535)/65536),a=n-65536*i,i=Math.floor((n=s+i+65535)/65536),s=n-65536*i,i=Math.floor((n=o+i+65535)/65536),o=n-65536*i,i=Math.floor((n=c+i+65535)/65536),c=n-65536*i,i=Math.floor((n=l+i+65535)/65536),l=n-65536*i,i=Math.floor((n=u+i+65535)/65536),u=n-65536*i,i=Math.floor((n=d+i+65535)/65536),d=n-65536*i,i=Math.floor((n=h+i+65535)/65536),h=n-65536*i,i=Math.floor((n=f+i+65535)/65536),f=n-65536*i,i=Math.floor((n=p+i+65535)/65536),p=n-65536*i,i=Math.floor((n=g+i+65535)/65536),g=n-65536*i,i=Math.floor((n=y+i+65535)/65536),y=n-65536*i,i=Math.floor((n=m+i+65535)/65536),m=n-65536*i,i=Math.floor((n=_+i+65535)/65536),_=n-65536*i,i=Math.floor((n=E+i+65535)/65536),E=n-65536*i,i=Math.floor((n=b+i+65535)/65536),b=n-65536*i,a+=i-1+37*(i-1),t[0]=a,t[1]=s,t[2]=o,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=h,t[8]=f,t[9]=p,t[10]=g,t[11]=y,t[12]=m,t[13]=_,t[14]=E,t[15]=b}function f(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=a(),s=a(),f=a(),p=a(),g=a(),y=a();for(let e=0;e<31;e++)r[e]=t[e];r[31]=127&t[31]|64,r[0]&=248,function(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(n,e);for(let t=0;t<16;t++)s[t]=n[t];i[0]=p[0]=1;for(let t=254;t>=0;--t){let e=r[t>>>3]>>>(7&t)&1;l(i,s,e),l(f,p,e),u(g,i,f),d(i,i,f),u(f,s,p),d(s,s,p),h(p,g,g),h(y,i,i),h(i,f,i),h(f,s,g),u(g,i,f),d(i,i,f),h(s,i,i),d(f,p,y),h(i,f,o),u(i,i,p),h(f,f,i),h(i,p,y),h(p,s,n),h(s,g,g),l(i,s,e),l(f,p,e)}for(let t=0;t<16;t++)n[t+16]=i[t],n[t+32]=f[t],n[t+48]=s[t],n[t+64]=p[t];let m=n.subarray(32),_=n.subarray(16);!function(t,e){let r=a();for(let t=0;t<16;t++)r[t]=e[t];for(let t=253;t>=0;t--)h(r,r,r),2!==t&&4!==t&&h(r,r,e);for(let e=0;e<16;e++)t[e]=r[e]}(m,m),h(_,_,m);let E=new Uint8Array(32);return!function(t,e){let r=a(),n=a();for(let t=0;t<16;t++)n[t]=e[t];c(n),c(n),c(n);for(let t=0;t<2;t++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let t=r[15]>>16&1;r[14]&=65535,l(n,r,1-t)}for(let e=0;e<16;
1e++)t[2*e]=255&n[e],t[2*e+1]=n[e]>>8}(E,_),E}e.Au=function(t){let r=(0,n.randomBytes)(32,t),a=function(t){if(t.length!==e.KS)throw Error(`x25519: seed must be ${e.KS} bytes`);let r=new Uint8Array(t);return{publicKey:f(r,s),secretKey:r}}(r);return(0,i.wipe)(r),a},e.gi=function(t,r,n=!1){if(t.length!==e.kz)throw Error("X25519: incorrect secret key length");if(r.length!==e.kz)throw Error("X25519: incorrect public key length");let i=f(t,r);if(n){let t=0;for(let e=0;e<i.length;e++)t|=i[e];if(0===t)throw Error("X25519: invalid shared key")}return i}},15203:function(t){"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)},88832:function(t,e,r){"use strict";var n=r(61090).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(t){var e;switch(this.encoding=function(t){var e=function(t){var e;if(!t)return"utf8";for(;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=l,e=4;break;case"utf8":this.fillLast=o,e=4;break;case"base64":this.text=u,this.end=d,e=3;break;default:this.write=h,this.end=f;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function o(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if((192&e[0])!=128)return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if((192&e[1])!=128)return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&(192&e[2])!=128)return t.lastNeed=2,"�"}}(this,t,0);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length)}function c(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function u(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function d(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=a,a.prototype.write=function(t){var e,r;if(0===t.length)return"";if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},a.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},a.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=s(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(e[n]))>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(e[n]))>=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},63921:function(t,e,r){var n=r(38396);t.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},37224:function(t,e,r){"use strict";var n=r(68571);r(42356);var i=r(7653),a=i&&"object"==typeof i&&"default"in i?i:{default:i},s=void 0!==n&&n.env&&!0,o=function(t){return"[object String]"===Object.prototype.toString.call(t)},c=function(){function t(t){var e=void 0===t?{}:t,r=e.name,n=void 0===r?"stylesheet":r,i=e.optimizeForSpeed,a=void 0===i?s:i;l(o(n),"`name` must be a string"),this._name=n,this._deletedRulePlaceholder="#"+n+"-deleted-rule____{}",l("boolean"==typeof a,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=a,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var c="undefined"!=typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=c?c.getAttribute("content"):null}var e=t.prototype;return e.setOptimizeForSpeed=function(t){l("boolean"==typeof t,"`setOptimizeForSpeed` accepts a boolean"),l(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=t,this.inject()},e.isOptimizeForSpeed=function(){return this._optimizeForSpeed},e.inject=function(){var t=this;if(l(!this._injected,"sheet already injected"),this._injected=!0,"undefined"!=typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.get
1Sheet(),this._optimizeForSpeed||(this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(e,r){return"number"==typeof r?t._serverSheet.cssRules[r]={cssText:e}:t._serverSheet.cssRules.push({cssText:e}),r},deleteRule:function(e){t._serverSheet.cssRules[e]=null}}},e.getSheetForTag=function(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]},e.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},e.insertRule=function(t,e){if(l(o(t),"`insertRule` accepts only strings"),"undefined"==typeof window)return"number"!=typeof e&&(e=this._serverSheet.cssRules.length),this._serverSheet.insertRule(t,e),this._rulesCount++;if(this._optimizeForSpeed){var r=this.getSheet();"number"!=typeof e&&(e=r.cssRules.length);try{r.insertRule(t,e)}catch(t){return -1}}else{var n=this._tags[e];this._tags.push(this.makeStyleTag(this._name,t,n))}return this._rulesCount++},e.replaceRule=function(t,e){if(this._optimizeForSpeed||"undefined"==typeof window){var r="undefined"!=typeof window?this.getSheet():this._serverSheet;if(e.trim()||(e=this._deletedRulePlaceholder),!r.cssRules[t])return t;r.deleteRule(t);try{r.insertRule(e,t)}catch(e){r.insertRule(this._deletedRulePlaceholder,t)}}else{var n=this._tags[t];l(n,"old rule at index `"+t+"` not found"),n.textContent=e}return t},e.deleteRule=function(t){if("undefined"==typeof window){this._serverSheet.deleteRule(t);return}if(this._optimizeForSpeed)this.replaceRule(t,"");else{var e=this._tags[t];l(e,"rule at index `"+t+"` not found"),e.parentNode.removeChild(e),this._tags[t]=null}},e.flush=function(){this._injected=!1,this._rulesCount=0,"undefined"!=typeof window?(this._tags.forEac
1h(function(t){return t&&t.parentNode.removeChild(t)}),this._tags=[]):this._serverSheet.cssRules=[]},e.cssRules=function(){var t=this;return"undefined"==typeof window?this._serverSheet.cssRules:this._tags.reduce(function(e,r){return r?e=e.concat(Array.prototype.map.call(t.getSheetForTag(r).cssRules,function(e){return e.cssText===t._deletedRulePlaceholder?null:e})):e.push(null),e},[])},e.makeStyleTag=function(t,e,r){e&&l(o(e),"makeStyleTag accepts only strings as second parameter");var n=document.createElement("style");this._nonce&&n.setAttribute("nonce",this._nonce),n.type="text/css",n.setAttribute("data-"+t,""),e&&n.appendChild(document.createTextNode(e));var i=document.head||document.getElementsByTagName("head")[0];return r?i.insertBefore(n,r):i.appendChild(n),n},function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,[{key:"length",get:function(){return this._rulesCount}}]),t}();function l(t,e){if(!t)throw Error("StyleSheet: "+e+".")}var u=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0},d={};function h(t,e){if(!e)return"jsx-"+t;var r=String(e),n=t+r;return d[n]||(d[n]="jsx-"+u(t+"-"+r)),d[n]}function f(t,e){"undefined"==typeof window&&(e=e.replace(/\/style/gi,"\\/style"));var r=t+e;return d[r]||(d[r]=e.replace(/__jsx-style-dynamic-selector/g,t)),d[r]}var p=function(){function t(t){var e=void 0===t?{}:t,r=e.styleSheet,n=void 0===r?null:r,i=e.optimizeForSpeed,a=void 0!==i&&i;this._sheet=n||new c({name:"styled-jsx",optimizeForSpeed:a}),this._sheet.inject(),n&&"boolean"==typeof a&&(this._sheet.setOptimizeForSpeed(a),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var e=t.prototype;return e.add=function(t){var e=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(t.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"undefined"==typeof window||this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(t,e){return t[e]=0,t},{}));var r=this.getIdAndRules(t),n=r.styleId,i=r.rules;if(n in this._instancesCounts){this._instancesCounts[n]+=1;return}var a=i.map(function(t){return e._sheet.insertRule(t)}).filter(function(t){return -1!==t});this._indices[n]=a,this._instancesCounts[n]=1},e.remove=function(t){var e=this,r=this.getIdAndRules(t).styleId;if(function(t,e){if(!t)throw Error("StyleSheetRegistry: "+e+".")}(r in this._instancesCounts,"styleId: `"+r+"` not found"),this._instancesCounts[r]-=1,this._instancesCounts[r]<1){var n=this._fromServer&&this._fromServer[r];n?(n.parentNode.removeChild(n),delete this._fromServer[r]):(this._indices[r].forEach(function(t){return e._sheet.deleteRule(t)}),delete this._indices[r]),delete this._instancesCounts[r]}},e.update=function(t,e){this.add(e),this.remove(t)},e.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},e.cssRules=function(){var t=this,e=this._fromServer?Object.keys(this._fromServer).map(function(e){return[e,t._fromServer[e]]}):[],r=this._sheet.cssRules();return e.concat(Object.keys(this._indices).map(function(e){return[e,t._indices[e].map(function(t){return r[t].cssText}).join(t._optimizeForSpeed?"":"\n")]}).filter(function(t){return!!t[1]}))},e.styles=function(t){var e,r;return e=this.cssRules(),void 0===(r=t)&&(r={}),e.map(function(t){var e=t[0],n=t[1];return a.default.createElement("style",{id:"__"+e,key:"__"+e,nonce:r.nonce?r.nonce:void 0,dangerouslySetInnerHTML:{__html:n}})})},e.getIdAndRules=function(t){var e=t.children,r=t.dynamic,n=t.id;if(r){var i=h(n,r);return{styleId:i,rules:Array.isArray(e)?e.map(function(t){return f(i,t)}):[f(i,e)]}}return{styleId:h(n),rules:Array.isArray(e)?e:[e]}},e.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(t,e){return t[e.id.slice(2)]=e,t},{})},t}(),g=i.createContext(null);g.displayName="StyleSheetContext";var y=a.default.useInsertionEffect||a.default.useLayoutEffect,m="undefined"!=typeof window?new p:void 0;function _(t){var e=m||i.useContext(g);return e&&("undefined"==typeof window?e.add(t):y(function(){return e.add(t),function(){e.remove(t)}},[t.id,String(t.dynamic)])),null}_.dynamic=function(t){return t.map(function(t){return h(t[0],t[1])}).join(" ")},e.style=_},53146:function(t,e,r){"use strict";
1t.exports=r(37224).style},19650:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},64672:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},8709:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},73323:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.SPEC=e.Errors=void 0,i(r(64672),e),e.Errors=r(8709),e.SPEC=r(19650),i(r(61684),e)},61684:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ETransactionVersion3=e.ETransactionVersion2=e.ETransactionVersion=e.EDAMode=e.EDataAvailabilityMode=e.EBlockTag=e.ETransactionExecutionStatus=e.ETransactionFinalityStatus=e.ETransactionStatus=e.ESimulationFlag=e.ETransactionType=void 0,e.ETransactionType={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE",L1_HANDLER:"L1_HANDLER"},e.ESimulationFlag={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},e.ETransactionStatus={RECEIVED:"RECEIVED",REJECTED:"REJECTED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},e.ETransactionFinalityStatus={ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},e.ETransactionExecutionStatus={SUCCEEDED:"SUCCEEDED",REVERTED:"REVERTED"},e.EBlockTag={LATEST:"latest",PENDING:"pending"},e.EDataAvailabilityMode={L1:"L1",L2:"L2"},e.EDAMode={L1:0,L2:1},e.ETransactionVersion={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},e.ETransactionVersion2={V0:"0x0",V1:"0x1",V2:"0x2",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002"},e.ETransactionVersion3={V3:"0x3",F3:"0x100000000000000000000000000000003"}},9609:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.WALLET_API=e.API=void 0,i(r(73323),e),e.API=r(73323),i(r(12278),e),e.WALLET_API=r(12278)},44652:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},38677:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},70526:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Permission=void 0,e.Permission={ACCOUNTS:"accounts"}},47786:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},75181:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},12278:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),i(r(70526),e),i(r(16428),e),i(r(44652),e),i(r(38677),e),i(r(76e3),e),i(r(75181),e),i(r(47786),e)},76e3:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},16428:function(t,e){"use strict";
1Object.defineProperty(e,"__esModule",{value:!0}),e.TypedDataRevision=void 0,e.TypedDataRevision={ACTIVE:"1",LEGACY:"0"}},39799:function(t,e,r){"use strict";r.d(e,{$9:function(){return n},Fo:function(){return a},RJ:function(){return i}});var n={id:BigInt("0x534e5f5345504f4c4941"),network:"devnet",name:"Starknet Devnet",nativeCurrency:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",name:"Ether",symbol:"ETH",decimals:18},testnet:!0,rpcUrls:{default:{http:[]},public:{http:["http://localhost:5050/rpc"]}},paymasterRpcUrls:{avnu:{http:["http://localhost:5050"]}}},i={id:BigInt("0x534e5f4d41494e"),network:"mainnet",name:"Starknet",nativeCurrency:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://starknet-mainnet.g.alchemy.com/v2"]},blast:{http:["https://starknet-mainnet.blastapi.io"]},infura:{http:["https://starknet-mainnet.infura.io/v3"]},lava:{http:["https://g.w.lavanet.xyz:443/gateway/strk/rpc-http"]},cartridge:{http:["https://api.cartridge.gg/x/starknet/mainnet"]},default:{http:[]},public:{http:["https://starknet-mainnet.public.blastapi.io/rpc/v0_8","https://rpc.starknet.lava.build"]}},paymasterRpcUrls:{avnu:{http:["https://starknet.paymaster.avnu.fi/"]}},explorers:{starkCompass:["https://www.starkcompass.com"],cartridge:["https://explorer.cartridge.gg"],starkscan:["https://starkscan.co"],viewblock:["https://viewblock.io/starknet"],voyager:["https://voyager.online"]}},a={id:BigInt("0x534e5f5345504f4c4941"),network:"sepolia",name:"Starknet Sepolia Testnet",nativeCurrency:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",name:"Ether",symbol:"ETH",decimals:18},testnet:!0,rpcUrls:{blast:{http:["https://starknet-sepolia.blastapi.io"]},infura:{http:["https://starknet-sepolia.infura.io/v3"]},cartridge:{http:["https://api.cartridge.gg/x/starknet/sepolia"]},default:{http:[]},public:{http:["https://starknet-sepolia.public.blastapi.io"]}},paymasterRpcUrls:{avnu:{http:["https://sepolia.paymaster.avnu.fi/"]}},explorers:{cartridge:["https://starknet-sepolia.explorer.cartridge.gg"],starkscan:["https://sepolia.starkscan.co"],voyager:["https://sepolia.voyager.online"]}}},43438:function(t,e,r){"use strict";r.d(e,{dY:function(){return R},yl:function(){return T},I8:function(){return z},Cd:function(){return v},mA:function(){return B},$4:function(){return P},qL:function(){return U},pp:function(){return S}});var n=r(48191),i=r(7653);let a={ACCOUNTS:"accounts"};var s=r(89441),o=r(39799),c=r(71628),l=r(77930),u=r(27573),d=r(15969),h=Object.defineProperty,f=(t,e,r)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p=(t,e,r)=>f(t,"symbol"!=typeof e?e+"":e,r),g=class extends n.Z{},y=class extends Error{constructor(){super(...arguments),p(this,"name","ConnectorNotConnectedError"),p(this,"message","Connector not connected")}},m=class extends Error{constructor(){super(...arguments),p(this,"name","ConnectorNotFoundError"),p(this,"message","Connector not found")}},_=class extends Error{constructor(){super(...arguments),p(this,"name","UserRejectedRequestError"),p(this,"message","User rejected request")}},E=class extends Error{constructor(){super(...arguments),p(this,"name","UserNotConnectedError"),p(this,"message","User not connected")}},b={argentX:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA2NS4xOTUwOCA1Ny43MzU2MiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNjUuMTk1MDggNTcuNzM1NjI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkY4NzVCO30KPC9zdHlsZT4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQwLjk4NTkyLDBIMjQuMjA4ODhjLTAuNTYsMC0xLjAxMDAxLDAuNDUxMDItMS4wMjE5NywxLjAxMjAyCgljLTAuMzM4OTksMTUuNzU1LTguNTgyMDMsMzAuNzA4OTgtMjIuNzcwMDIsNDEuMzAwOTljLTAuN
1DUwMDEsMC4zMzcwMS0wLjU1Mjk4LDAuOTY3OTktMC4yMjQsMS40MjNsOS44MTU5OCwxMy41NzMKCWMwLjMzNDA1LDAuNDYyMDEsMC45ODUwNSwwLjU2NTk4LDEuNDQyOTksMC4yMjY5OWM4Ljg3MTAzLTYuNTc5MDEsMTYuMDA3MDItMTQuNTE3LDIxLjE0NjA2LTIzLjMxNQoJYzUuMTM4LDguNzk4LDEyLjI3Mzk5LDE2LjczNTk5LDIxLjE0NiwyMy4zMTVjMC40NTY5NywwLjMzODk5LDEuMTA3OTcsMC4yMzUwMiwxLjQ0MTk2LTAuMjI2OTlsOS44MTYwNC0xMy41NzMKCWMwLjMyODk4LTAuNDU1MDIsMC4yMjY5OS0xLjA4Ni0wLjIyNC0xLjQyM0M1MC41ODk4NiwzMS43MjEwMSw0Mi4zNDY4OCwxNi43NjcwMyw0Mi4wMDc4OSwxLjAxMjAyCglDNDEuOTk1ODcsMC40NTEwMiw0MS41NDY4OSwwLDQwLjk4NTkyLDAiLz4KPC9zdmc+Cg==",braavos:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjUwMCIgdmlld0JveD0iMCAwIDUwMCA1MDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zMjMuNDQgNDEuMzg4NkMzMjQuMTk4IDQyLjY3MjggMzIzLjE5NSA0NC4yNjAzIDMyMS43MDQgNDQuMjYwM0MyOTEuNTEgNDQuMjYwMyAyNjYuOTY1IDY4LjE2NTYgMjY2LjM4OSA5Ny44NzFDMjU2LjA1IDk1Ljk0MDcgMjQ1LjMzNyA5NS43OTU2IDIzNC43NTQgOTcuNTc4N0MyMzQuMDIzIDY4LjAwOSAyMDkuNTQgNDQuMjYwMyAxNzkuNDQ1IDQ0LjI2MDNDMTc3Ljk1MyA0NC4yNjAzIDE3Ni45NDkgNDIuNjcxNiAxNzcuNzA3IDQxLjM4NjVDMTkyLjMyMyAxNi42MzMgMjE5LjQ4MyAwIDI1MC41NzMgMEMyODEuNjY0IDAgMzA4LjgyNCAxNi42MzM5IDMyMy40NCA0MS4zODg2WiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzIzMjRfNjE4NjkpIi8+CjxwYXRoIGQ9Ik00MTguNzU2IDIyNi44OTRDNDI2LjM3IDIyOS4yIDQzMy41ODEgMjIyLjUxNyA0MzEuMDM2IDIxNC45NzlDNDA0LjUwNyAxMzYuNDAxIDMxNi41MzUgMTA0LjM1OCAyNTAuMTU5IDEwNC4zNThDMTgzLjY3NCAxMDQuMzU4IDkzLjczOTEgMTM3LjQxOCA2OS4zMDUxIDIxNS4zMzFDNjYuOTU3NCAyMjIuODE4IDc0LjE0NjUgMjI5LjI3NSA4MS42NDc5IDIyNi45NzdMMjQ0LjI1IDE3Ny4xNTFDMjQ3LjU2OSAxNzYuMTM0IDI1MS4xMTYgMTc2LjEyOCAyNTQuNDM5IDE3Ny4xMzVMNDE4Ljc1NiAyMjYuODk0WiIgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzIzMjRfNjE4NjkpIi8+CjxwYXRoIGQ9Ik02OS43MTY1IDIzOS40MjZMMjQ0LjM3IDE4Ni40NTZDMjQ3LjY2OSAxODUuNDU2IDI1MS4xOTEgMTg1LjQ1MyAyNTQuNDkyIDE4Ni40NDhMNDMwLjIzMiAyMzkuNDUyQzQ0NC43NiAyNDMuODMzIDQ1NC43MDEgMjU3LjIxNiA0NTQuNzAxIDI3Mi4zOVY0MzAuNDgxQzQ1NC4wMjggNDY5LjA3IDQxOS4zNjIgNTAwIDM4MC43ODYgNTAwSDMxNi43MTJDMzEwLjM3OSA1MDAgMzA1LjI1IDQ5NC44NzcgMzA1LjI1I
1DQ4OC41NDNWNDMzLjExNUMzMDUuMjUgNDExLjI4OSAzMTguMTY3IDM5MS41MzUgMzM4LjE1NSAzODIuNzkyQzM2NC45NDkgMzcxLjA3MSAzOTYuNjQ2IDM1NS4yMTggNDAyLjYwOCAzMjMuNDA2QzQwNC41MzIgMzEzLjEzOCAzOTcuODM3IDMwMy4yMzQgMzg3LjU5NSAzMDEuMTk4QzM2MS42OTkgMjk2LjA1MSAzMzIuOTg5IDI5OC4wMzkgMzA4LjcxMSAzMDguODk4QzI4MS4xNSAzMjEuMjI1IDI3My45NCAzNDEuNzMxIDI3MS4yNzEgMzY5LjI3TDI2OC4wMzYgMzk4LjkzOEMyNjcuMDQ3IDQwOC4wMDUgMjU4LjU0NiA0MTQuOTUyIDI0OS40MjkgNDE0Ljk1MkMyMzkuOTk4IDQxNC45NTIgMjMyLjkyNiA0MDcuNzY5IDIzMS45MDMgMzk4LjM4OEwyMjguNzI4IDM2OS4yN0MyMjYuNDQyIDM0NS42ODEgMjIyLjI5OCAzMjIuNzY3IDE5Ny45MTIgMzExLjg2QzE3MC4wOTUgMjk5LjQxOSAxNDIuMTQxIDI5NS4yODcgMTEyLjQwNCAzMDEuMTk4QzEwMi4xNjIgMzAzLjIzNCA5NS40NjcgMzEzLjEzOCA5Ny4zOTEzIDMyMy40MDZDMTAzLjQwNSAzNTUuNDk1IDEzNC44NTQgMzcwLjk4NSAxNjEuODQ0IDM4Mi43OTJDMTgxLjgzMyAzOTEuNTM1IDE5NC43NSA0MTEuMjg5IDE5NC43NSA0MzMuMTE1VjQ4OC41MzNDMTk0Ljc1IDQ5NC44NjcgMTg5LjYyMiA1MDAgMTgzLjI4OSA1MDBIMTE5LjIxNEM4MC42Mzc0IDUwMCA0NS45NzE2IDQ2OS4wNyA0NS4yOTc5IDQzMC40ODFWMjcyLjM0OUM0NS4yOTc5IDI1Ny4xOTQgNTUuMjE0MiAyNDMuODI0IDY5LjcxNjUgMjM5LjQyNloiIGZpbGw9InVybCgjcGFpbnQyX2xpbmVhcl8yMzI0XzYxODY5KSIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzIzMjRfNjE4NjkiIHgxPSIyNDUuOTg2IiB5MT0iLTI3IiB4Mj0iNDI1LjQ5NiIgeTI9IjUwMi4zNzYiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiLz4KPC9saW5lYXJHcmFkaWVudD4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzIzMjRfNjE4NjkiIHgxPSIyNDUuOTg2IiB5MT0iLTI3IiB4Mj0iNDI1LjQ5NiIgeTI9IjUwMi4zNzYiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiLz4KPC9saW5lYXJHcmFkaWVudD4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDJfbGluZWFyXzIzMjRfNjE4NjkiIHgxPSIyNDUuOTg2IiB5MT0iLTI3IiB4Mj0iNDI1LjQ5NiIgeTI9IjUwMi4zNzYiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4="},I=class extends g{constructor({options:t}){super(),p(this,"_wallet"),p(this,"_options"),this._options=t}get id(){return this._options.id}get name(){return this.ensureWallet(),this._options.name??this._wallet?.name??this._options.id}get icon(){this.ensureWallet();let t={dark:b[this.id]||"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0id2hpdGUiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+Cg==",light:b[this.id]||"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iYmxhY2siPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+"};return this._options.icon||this._wallet?.icon||t}available(){return this.ensureWallet(),void 0!==this._wallet}async chainId(){this.ensureWallet();let t=await this.isLocked();if(!this._wallet||t)throw new y;return await this.requestChainId()}async ready(){if(this.ensureWallet(),!this._wallet)return!1;let t=await this.request({type:"wallet_getPermissions"});return!!t&&t.includes(a.ACCOUNTS)}async account(t,e){if(this.ensureWallet(),await this.isLocked()||!this._wallet)throw new y;return await s.R1.connect(t,this._wallet,void 0,e,!0)}async connect(t={}){if(this.ensureWallet(),!this._wallet)throw new m;this._wallet.on("accountsChanged",async t=>{await this.onAccountsChanged(t)}),this._wallet.on("networkChanged",(t,e)=>{this.onNetworkChanged(t,e)});let e=await this.request({type:"wallet_requestAccounts"});if(!e)throw new _;t.chainIdHint&&await this.requestChainId()!==t.chainIdHint&&await this.switchChain(t.chainIdHint);let[r]=e,n=await this.requestChainId();
1return this.emit("connect",{account:r,chainId:n}),{account:r,chainId:n}}async disconnect(){if(this.ensureWallet(),!this._wallet)throw new m;this.emit("disconnect")}async request(t){if(this.ensureWallet(),!this._wallet)throw new y;return await this._wallet.request(t)}async isLocked(){return 0===(await this.request({type:"wallet_requestAccounts",params:{silent_mode:!0}})).length}async requestChainId(){return BigInt(await this.request({type:"wallet_requestChainId"}))}ensureWallet(){let t=globalThis,e=t?.[`starknet_${this._options.id}`];e&&(this._wallet=e)}async onAccountsChanged(t){if(t){let[e]=t;if(e){let t=await this.requestChainId();this.emit("change",{account:e,chainId:t})}else this.emit("disconnect")}else this.emit("disconnect")}onNetworkChanged(t,e){if(t){let r=BigInt(t),[n]=e||[];this.emit("change",{chainId:r,account:n})}else this.emit("change",{})}async switchChain(t){await this.request({type:"wallet_switchStarknetChain",params:{chainId:s.OK.toHex(t)}})}},w={argentX:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA2NS4xOTUwOCA1Ny43MzU2MiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNjUuMTk1MDggNTcuNzM1NjI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkY4NzVCO30KPC9zdHlsZT4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQwLjk4NTkyLDBIMjQuMjA4ODhjLTAuNTYsMC0xLjAxMDAxLDAuNDUxMDItMS4wMjE5NywxLjAxMjAyCgljLTAuMzM4OTksMTUuNzU1LTguNTgyMDMsMzAuNzA4OTgtMjIuNzcwMDIsNDEuMzAwOTljLTAuNDUwMDEsMC4zMzcwMS0wLjU1Mjk4LDAuOTY3OTktMC4yMjQsMS40MjNsOS44MTU5OCwxMy41NzMKCWMwLjMzNDA1LDAuNDYyMDEsMC45ODUwNSwwLjU2NTk4LDEuNDQyOTksMC4yMjY5OWM4Ljg3MTAzLTYuNTc5MDEsMTYuMDA3MDItMTQuNTE3LDIxLjE0NjA2LTIzLjMxNQoJYzUuMTM4LDguNzk4LDEyLjI3Mzk5LDE2LjczNTk5LDIxLjE0NiwyMy4zMTVjMC40NTY5NywwLjMzODk5LDEuMTA3OTcsMC4yMzUwMiwxLjQ0MTk2LTAuMjI2OTlsOS44MTYwNC0xMy41NzMKCWMwLjMyODk4LTAuNDU1MDIsMC4yMjY5OS0xLjA4Ni0wLjIyNC0xLjQyM0M1MC41ODk4NiwzMS43MjEwMSw0Mi4zNDY4OCwxNi43NjcwMyw0Mi4wMDc4OSwxLjAxMjAyCglDNDEuOTk1ODcsMC40NTEwMiw0MS41NDY4OSwwLDQwLjk4NTkyLDAiLz4KPC9zdmc+Cg==",braavos:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjUwMCIgdmlld0JveD0iMCAwIDUwMCA1MDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0zMjMuNDQgNDEuMzg4NkMzMjQuMTk4IDQyLjY3MjggMzIzLjE5NSA0NC4yNjAzIDMyMS43MDQgNDQuMjYwM0MyOTEuNTEgNDQuMjYwMyAyNjYuOTY1IDY4LjE2NTYgMjY2LjM4OSA5Ny44NzFDMjU2LjA1IDk1Ljk0MDcgMjQ1LjMzNyA5NS43OTU2IDIzNC43NTQgOTcuNTc4N0MyMzQuMDIzIDY4LjAwOSAyMDkuNTQgNDQuMjYwMyAxNzkuNDQ1IDQ0LjI2MDNDMTc3Ljk1MyA0NC4yNjAzIDE3Ni45NDkgNDIuNjcxNiAxNzcuNzA3IDQxLjM4NjVDMTkyLjMyMyAxNi42MzMgMjE5LjQ4MyAwIDI1MC41NzMgMEMyODEuNjY0IDAgMzA4LjgyNCAxNi42MzM5IDMyMy40NCA0MS4zODg2WiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzIzMjRfNjE4NjkpIi8+CjxwYXRoIGQ9Ik00MTguNzU2IDIyNi44OTRDNDI2LjM3IDIyOS4yIDQzMy41ODEgMjIyLjUxNyA0MzEuMDM2IDIxNC45NzlDNDA0LjUwNyAxMzYuNDAxIDMxNi41MzUgMTA0LjM1OCAyNTAuMTU5IDEwNC4zNThDMTgzLjY3NCAxMDQuMzU4IDkzLjczOTEgMTM3LjQxOCA2OS4zMDUxIDIxNS4zMzFDNjYuOTU3NCAyMjIuODE4IDc0LjE0NjUgMjI5LjI3NSA4MS42NDc5IDIyNi45NzdMMjQ0LjI1IDE3Ny4xNTFDMjQ3LjU2OSAxNzYuMTM0IDI1MS4xMTYgMTc2LjEyOCAyNTQuNDM5IDE3Ny4xMzVMNDE4Ljc1NiAyMjYuODk0WiIgZmlsbD0idXJsKCNwYWludDFfbGluZWFyXzIzMjRfNjE4NjkpIi8+CjxwYXRoIGQ9Ik02OS43MTY1IDIzOS40MjZMMjQ0LjM3IDE4Ni40NTZDMjQ3LjY2OSAxODUuNDU2IDI1MS4xOTEgMTg1LjQ1MyAyNTQuNDkyIDE4Ni40NDhMNDMwLjIzMiAyMzkuNDUyQzQ0NC43NiAyNDMuODMzIDQ1NC43MDEgMjU3LjIxNiA0NTQuNzAxIDI3Mi4zOVY0MzAuNDgxQzQ1NC4wMjggNDY5LjA3IDQxOS4zNjIgNTAwIDM4MC43ODYgNTAwSDMxNi43MTJDMzEwLjM3OSA1MDAgMzA1LjI1IDQ5NC44NzcgMzA1LjI1I
1DQ4OC41NDNWNDMzLjExNUMzMDUuMjUgNDExLjI4OSAzMTguMTY3IDM5MS41MzUgMzM4LjE1NSAzODIuNzkyQzM2NC45NDkgMzcxLjA3MSAzOTYuNjQ2IDM1NS4yMTggNDAyLjYwOCAzMjMuNDA2QzQwNC41MzIgMzEzLjEzOCAzOTcuODM3IDMwMy4yMzQgMzg3LjU5NSAzMDEuMTk4QzM2MS42OTkgMjk2LjA1MSAzMzIuOTg5IDI5OC4wMzkgMzA4LjcxMSAzMDguODk4QzI4MS4xNSAzMjEuMjI1IDI3My45NCAzNDEuNzMxIDI3MS4yNzEgMzY5LjI3TDI2OC4wMzYgMzk4LjkzOEMyNjcuMDQ3IDQwOC4wMDUgMjU4LjU0NiA0MTQuOTUyIDI0OS40MjkgNDE0Ljk1MkMyMzkuOTk4IDQxNC45NTIgMjMyLjkyNiA0MDcuNzY5IDIzMS45MDMgMzk4LjM4OEwyMjguNzI4IDM2OS4yN0MyMjYuNDQyIDM0NS42ODEgMjIyLjI5OCAzMjIuNzY3IDE5Ny45MTIgMzExLjg2QzE3MC4wOTUgMjk5LjQxOSAxNDIuMTQxIDI5NS4yODcgMTEyLjQwNCAzMDEuMTk4QzEwMi4xNjIgMzAzLjIzNCA5NS40NjcgMzEzLjEzOCA5Ny4zOTEzIDMyMy40MDZDMTAzLjQwNSAzNTUuNDk1IDEzNC44NTQgMzcwLjk4NSAxNjEuODQ0IDM4Mi43OTJDMTgxLjgzMyAzOTEuNTM1IDE5NC43NSA0MTEuMjg5IDE5NC43NSA0MzMuMTE1VjQ4OC41MzNDMTk0Ljc1IDQ5NC44NjcgMTg5LjYyMiA1MDAgMTgzLjI4OSA1MDBIMTE5LjIxNEM4MC42Mzc0IDUwMCA0NS45NzE2IDQ2OS4wNyA0NS4yOTc5IDQzMC40ODFWMjcyLjM0OUM0NS4yOTc5IDI1Ny4xOTQgNTUuMjE0MiAyNDMuODI0IDY5LjcxNjUgMjM5LjQyNloiIGZpbGw9InVybCgjcGFpbnQyX2xpbmVhcl8yMzI0XzYxODY5KSIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzIzMjRfNjE4NjkiIHgxPSIyNDUuOTg2IiB5MT0iLTI3IiB4Mj0iNDI1LjQ5NiIgeTI9IjUwMi4zNzYiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiLz4KPC9saW5lYXJHcmFkaWVudD4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDFfbGluZWFyXzIzMjRfNjE4NjkiIHgxPSIyNDUuOTg2IiB5MT0iLTI3IiB4Mj0iNDI1LjQ5NiIgeTI9IjUwMi4zNzYiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiLz4KPC9saW5lYXJHcmFkaWVudD4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDJfbGluZWFyXzIzMjRfNjE4NjkiIHgxPSIyNDUuOTg2IiB5MT0iLTI3IiB4Mj0iNDI1LjQ5NiIgeTI9IjUwMi4zNzYiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y1RDQ1RSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGRjk2MDAiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4="},A=class extends g{constructor({options:t}){super(),p(this,"_wallet"),p(this,"_options"),this._options=t}get id(){return this._options.id}get name(){return this._options.name??this._wallet?.name??this._options.id}get icon(){let t={dark:w[this.id]||"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0id2hpdGUiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+Cg==",light:w[this.id]||"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iYmxhY2siPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTkuODc5IDcuNTE5YzEuMTcxLTEuMDI1IDMuMDcxLTEuMDI1IDQuMjQyIDAgMS4xNzIgMS4wMjUgMS4xNzIgMi42ODcgMCAzLjcxMi0uMjAzLjE3OS0uNDMuMzI2LS42Ny40NDItLjc0NS4zNjEtMS40NS45OTktMS40NSAxLjgyN3YuNzVNMjEgMTJhOSA5IDAgMTEtMTggMCA5IDkgMCAwMTE4IDB6bS05IDUuMjVoLjAwOHYuMDA4SDEydi0uMDA4eiIgLz4KPC9zdmc+"};return this._options.icon||this._wallet?.icon||t}available(){return this.ensureWallet(),void 0!==this._wallet}async chainId(){if(this.ensureWallet(),!this._wallet||!this._wallet.provider)throw new y;return BigInt(await this._wallet.provider.getChainId())}async ready(){return this.ensureWallet(),!!this._wallet&&await this._wallet.isPreauthorized()}async connect(t={}){let e;if(this.ensureWallet(),!this._wallet)throw new m;try{e=await this._wallet.enable({starknetVersion:"v5"})}catch{throw new _}if(!this._wallet.isConnected||!this._wallet.account||!e)throw new _;this._wallet.on("accountsChanged",async t=>{t&&await this.onAccountsChanged(t)}),this._wallet.on("networkChanged",t=>{this.onNetworkChanged(t)}),await this.onAccountsChanged(e);let r=this._wallet.account.address,n=await this.chainId();
1return this.emit("connect",{account:r,chainId:n}),{account:r,chainId:n}}async disconnect(){if(this.ensureWallet(),!this.available())throw new m;if(!this._wallet?.isConnected)throw new E;this.emit("disconnect")}async account(){if(this.ensureWallet(),!this._wallet||!this._wallet.account)throw new y;return this._wallet.account}async request(t){if(this.ensureWallet(),!this._wallet)throw new y;try{switch(t.type){case"wallet_getPermissions":if(this._wallet)return[a.ACCOUNTS];return[];case"wallet_requestAccounts":if(this._wallet.account)return[this._wallet.account.address];return[];case"wallet_requestChainId":if(this._wallet.chainId)return this._wallet.chainId;return null;case"wallet_addInvokeTransaction":{if(!this._wallet)throw Error("Send transaction failed");let e=(t.params.calls??[]).map(({calldata:t,contract_address:e,entry_point:r})=>({calldata:t,contractAddress:e,entrypoint:r}));return await this._wallet.account?.execute(e)}default:throw Error(`Wallet API method ${t.type} is not supported.`)}}catch{throw new _}}ensureWallet(){var t;let e=Object.values(Object.getOwnPropertyNames(t=globalThis).reduce((e,r)=>{if(r.startsWith("starknet")){let n=t[r];(function(t){try{return t&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(e=>e in t)}catch(t){}return!1})(n)&&!e[n.id]&&(e[n.id]=n)}return e},{})).filter(t=>t.id===this._options.id)[0];e&&(this._wallet=e)}async onAccountsChanged(t){let e;if(e="string"==typeof t?t:t[0]){let t=await this.chainId();this.emit("change",{account:e,chainId:t})}else this.emit("disconnect")}onNetworkChanged(t){switch(t){case"SN_MAIN":case"mainnet-alpha":this.emit("change",{chainId:o.RJ.id});break;case"SN_SEPOLIA":case"sepolia-alpha":this.emit("change",{chainId:o.Fo.id});break;
1default:this.emit("change",{})}}};function v(){return new I({options:{id:"argentX",name:"Ready Wallet (formerly Argent)"}})}function T(){return new I({options:{id:"braavos",name:"Braavos"}})}function S({recommended:t,includeRecommended:e="always",order:r="alphabetical",shimLegacyConnectors:n=[]}){let[a,s]=(0,i.useState)([]),o=(0,i.useCallback)(()=>{var t;s(Object.values(Object.getOwnPropertyNames(t=window).reduce((e,r)=>{if(r.startsWith("starknet")){let n=t[r];(function(t){try{return t&&["request","isConnected","provider","enable","isPreauthorized","on","off","version","id","name","icon"].every(e=>e in t)}catch(t){}return!1})(n)&&!e[n.id]&&(e[n.id]=n)}return e},{})).map(t=>n.includes(t.id)?function({id:t}){return new A({options:{id:t}})}({id:t.id}):function({id:t}){return new I({options:{id:t}})}({id:t.id})))},[n.includes]);return(0,i.useEffect)(()=>{o()},[o]),{connectors:(0,i.useMemo)(()=>(function(t,e,{includeRecommended:r,order:n}){let i=new Set(e.map(t=>t.id)),a="always"===r||"onlyIfNoConnectors"===r&&0===t.length,s=[];return(a&&s.push(...e),s.push(...t.filter(t=>!i.has(t.id))),"random"===n)?function(t){for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}return t}(s):s.sort((t,e)=>t.id.localeCompare(e.id))})(a,t??[],{includeRecommended:e,order:r}),[a,t,e,r])}}var N=i.createContext({account:void 0,address:void 0});function M({address:t,account:e,children:r}){return(0,u.jsx)(N.Provider,{value:{account:e,address:t},children:r})}var D=new c.S,C=(0,i.createContext)(void 0);function k(){let t=(0,i.useContext)(C);if(!t)throw Error("useStarknet must be used within a StarknetProvider or StarknetConfig");return t}function O({chains:t,provider:e,paymasterProvider:r,connectors:n,explorer:a,autoConnect:o,queryClient:c,defaultChainId:d,children:h}){let{account:f,address:p,...g}=function({chains:t,provider:e,paymasterProvider:r,explorer:n,connectors:a=[],autoConnect:s=!1,defaultChainId:o}){let c=o?t.find(t=>t.id===o)??t[0]:t[0];if(void 0===c)throw Error("Must provide at least one chain.");let l=new Set;for(let e of t){if(l.has(e.id))throw Error(`Duplicated chain id found: ${e.id}`);l.add(e.id)}let{chain:u,provider:d}=L(c,e),{paymasterProvider:h}=x(c,r),f=(0,i.useRef)(),[p,g]=(0,i.useState)({currentChain:c,currentProvider:d,currentPaymasterProvider:h,connectors:a}),y=(0,i.useCallback)(({chainId:n})=>{if(n){for(let i of t)if(i.id===n){let{chain:t,provider:n}=L(i,e),{paymasterProvider:a}=x(i,r);g(e=>({...e,currentChain:t,currentProvider:n,currentPaymasterProvider:a}));return}}},[t,e,r]),_=(0,i.useCallback)(async({chainId:t,account:e})=>{t&&y({chainId:t}),e&&f.current&&g(t=>({...t,currentAddress:e}))},[y]);(0,i.useEffect)(()=>{f.current||g(t=>({...t,currentChain:c,currentProvider:L(c,e).provider,currentPaymasterProvider:x(c,r).paymasterProvider}))},[c]);let E=(0,i.useCallback)(async()=>{if(g(t=>({...t,currentAddress:void 0,currentProvider:d,currentPaymasterProvider:h,currentChain:c})),s&&localStorage.removeItem("lastUsedConnector"),f.current){f.current.off("change",_),f.current.off("disconnect",E);try{await f.current.disconnect()}catch{}f.current=void 0}},[s,_,d,h,c]),b=(0,i.useCallback)(async({connector:t})=>{if(!t)throw Error("Must provide a connector.");let e=f.current?.id!==t.id;e&&(f.current?.off("change",_),f.current?.off("disconnect",E));try{let{chainId:r,account:n}=await t.connect({chainIdHint:c.id});n!==p.currentAddress&&(f.current=t,g(t=>({...t,currentAddress:n}))),s&&localStorage.setItem("lastUsedConnector",t.id),e&&(t.on("change",_),t.on("disconnect",E)),y({chainId:r})}catch(t){throw g(t=>({...t,error:new m})),t}},[s,p.currentAddress,c.id,_,y,E]);return(0,i.useEffect)(()=>{async function t(t){let e=localStorage.getItem("lastUsedConnector");if(null===e)return;let r=t.find(t=>t.id===e);if(void 0!==r)try{if(!await r.ready())return;b({connector:r})}catch{}}s&&!f.current&&t(a)},[]),{address:p.currentAddress,provider:p.currentProvider,paymasterProvider:p.currentPaymasterProvider,chain:p.currentChain,connector:f.current,explorer:n,connect:b,disconnect:E,connectors:a,chains:t}}({chains:t,provider:e,paymasterProvider:r??function({apiKey:t}){return function({rpc:t}){return e=>{let r=t(e);return r?new s.Tw(r):null}}({rpc:e=>{let r=e.paymasterRpcUrls.avnu.http[0];return r?{nodeUrl:r,headers:{"x-paymaster-api-key":t??""}}:null}})}({}),explorer:a,connectors:n,autoConnect:o,defaultChainId:d});
1return(0,u.jsx)(l.aH,{client:c??D,children:(0,u.jsx)(C.Provider,{value:g,children:(0,u.jsx)(M,{address:p,account:f,children:h})})})}function L(t,e){let r=e(t);if(r)return{chain:t,provider:r};throw Error(`No provider found for chain ${t.name}`)}function x(t,e){let r=e(t);if(r)return{chain:t,paymasterProvider:r};throw Error(`No paymaster provider found for chain ${t.name}`)}function R({children:t,...e}){return(0,u.jsx)(O,{...e,children:t})}function B(){let{connector:t,chain:e}=k(),{provider:r,paymasterProvider:n}=function(){let{provider:t,paymasterProvider:e}=k();return{provider:t,paymasterProvider:e}}(),{address:a}=function(){let{account:t,address:e}=(0,i.useContext)(N);return{account:t,address:e}}(),[o,c]=(0,i.useState)(void 0===a?{status:"disconnected"}:{status:"connected",connector:t,chainId:e.id,account:void 0,address:(0,s.qn)(a),isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1}),l=(0,i.useCallback)(async()=>{if(!t||!r||!a)return c({status:"disconnected",connector:void 0,chainId:void 0,account:void 0,address:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1});c({status:"connected",connector:t,chainId:e.id,account:void 0,address:(0,s.qn)(a),isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1}),t.account(r,n).then(t=>c(e=>({...e,account:t})))},[r,n,t,e.id,a]);return(0,i.useEffect)(()=>
1{l()},[l]),o}function j(t){let e=(0,d.D)(t);return{data:e.data,error:e.error,reset:e.reset,isError:e.isError,isIdle:e.isIdle,isPending:e.isPending,isSuccess:e.isSuccess,isPaused:e.isPaused,mutate:e.mutate,mutateAsync:e.mutateAsync,status:e.status,variables:e.variables}}function P(t={}){let{connector:e,connectors:r,connect:n,chain:a}=k(),{mutate:s,mutateAsync:o,variables:c,...l}=j({mutationKey:[{entity:"connect",chainId:a.name}],mutationFn:n,...t}),u=(0,i.useCallback)(t=>s(t??{connector:e}),[s,e]),d=(0,i.useCallback)(t=>o(t??{connector:e}),[o,e]);return{connector:e,connectors:r,pendingConnector:c?.connector,connect:u,connectAsync:d,variables:c,...l}}function U(t={}){let{disconnect:e,chain:r}=k(),{mutate:n,mutateAsync:i,...a}=j({mutationKey:[{entity:"disconnect",chainId:r.name}],mutationFn:e,...t});return{disconnect:n,disconnectAsync:i,...a}}function z(){return function({rpc:t}){return e=>{let r=t(e);if(!r)return null;let n=function(t){switch(t){case o.RJ.id:return s._G.StarknetChainId.SN_MAIN;case o.Fo.id:return s._G.StarknetChainId.SN_SEPOLIA;default:return}}(e.id);return new s.Gf({...r,chainId:n})}}({rpc:t=>{let e=t.rpcUrls.public.http,r=e[Math.floor(Math.random()*e.length)];return r?{nodeUrl:r,specVersion:"0.8.1"}:null}})}},89441:function(t,e,r){"use strict";r.d(e,{mR:function(){return lO},i9:function(){return il},lx:function(){return sC},CH:function(){return lX},Tw:function(){return lM},Gf:function(){return le},R1:function(){return lW},wV:function(){return al},_G:function(){return r4},vp:function(){return sk},OK:function(){return iT},lC:function(){return i7},E_:function(){return oE},qn:function(){return lo}});var n={};r.r(n);var i={};r.r(i),r.d(i,{ABI_TYPE_CONSTRUCTOR:function(){return k},ABI_TYPE_ENUM:function(){return L},ABI_TYPE_FUNCTION:function(){return C},ABI_TYPE_L1_HANDLER:function(){return O},CALL_TYPE:function(){return U},CONTRACT:function(){return n},EBlockTag:function(){return $},EDAMode:function(){return q},EDataAvailabilityMode:function(){return W},ESimulationFlag:function(){return V},ETransactionExecutionStatus:function(){return Y},ETransactionFinalityStatus:function(){return H},ETransactionStatus:function(){return F},ETransactionType:function(){return z},ETransactionVersion:function(){return Z},ETransactionVersion2:function(){return G},ETransactionVersion3:function(){return Q},EVENT_ABI_TYPE:function(){return D},L1_DA_MODE:function(){return P},PRICE_UNIT_FRI:function(){return j},PRICE_UNIT_WEI:function(){return B},STATE_MUTABILITY_EXTERNAL:function(){return R},STATE_MUTABILITY_VIEW:function(){return x},STATUS_ACCEPTED_ON_L1:function(){return m},STATUS_ACCEPTED_ON_L2:function(){return y},STATUS_PENDING:function(){return b},STATUS_RECEIVED:function(){return w},STATUS_REJECTED:function(){return I},STATUS_REVERTED:function(){return E},STATUS_SUCCEEDED:function(){return _},STRUCT_ABI_TYPE:function(){return M},TXN_TYPE_DECLARE:function(){return A},TXN_TYPE_DEPLOY:function(){return v},TXN_TYPE_DEPLOY_ACCOUNT:function(){return T},TXN_TYPE_INVOKE:function(){return S},TXN_TYPE_L1_HANDLER:function(){return N}});var a={};r.r(a),r.d(a,{Permission:function(){return K},TypedDataRevision:function(){return X}});var s={};r.r(s);var o={};r.r(o),r.d(o,{ABI_TYPE_CONSTRUCTOR:function(){return k},ABI_TYPE_ENUM:function(){return L},ABI_TYPE_FUNCTION:function(){return C},ABI_TYPE_L1_HANDLER:function(){return O},API:function(){return i},CALL_TYPE:function(){return U},CONTRACT:function(){return n},EBlockTag:function(){return $},EDAMode:function(){return q},EDataAvailabilityMode:function(){return W},ESimulationFlag:function(){return V},ETransactionExecutionStatus:function(){return Y},ETransactionFinalityStatus:function(){return H},ETransactionStatus:function(){return F},ETransactionType:function(){return z},ETransactionVersion:function(){return Z},ETransactionVersion2:function(){return G},ETransactionVersion3:function(){return Q},EVENT_ABI_TYPE:function(){return D},L1_DA_MODE:function(){return P},PAYMASTER_API:function(){return s},PRICE_UNIT_FRI:function(){return j},PRICE_UNIT_WEI:function(){return B},Permission:function(){return K},STATE_MUTABILITY_EXTERNAL:function(){return R},STATE_MUTABILITY_VIEW:function(){return x},STATUS_ACCEPTED_ON_L1:function(){return m},STATUS_ACCEPTED_ON_L2:function(){return y},STATUS_PENDING:function(){return b},STATUS_RECEIVED:function(){return w},STATUS_REJECTED:function(){return I},STATUS_REVERTED:function(){return E},STATUS_SUCCEEDED:function(){return _},STRUCT_ABI_TYPE:function(){return M},TXN_TYPE_DECLARE:function(){return A},TXN_TYPE_DEPLOY:function(){return v},TXN_TYPE_DEPLOY_ACCOUNT:function(){return T},TXN_TYPE_INVOKE:function(){return S},TXN_TYPE_L1_HANDLER:function(){return N},TypedDataRevision:function(){return X},WALLET_API:function(){return a}});var c={};r.r(c);var l={};r.r(l),r.d(l,{ABI_TYPE_CONSTRUCTOR:function(){return tg},ABI_TYPE_ENUM:function(){return tm},ABI_TYPE_FUNCTION:function(){return tp}
1,ABI_TYPE_L1_HANDLER:function(){return ty},CALL_TYPE:function(){return tA},CONTRACT:function(){return c},EBlockStatus:function(){return tC},EBlockTag:function(){return tD},EDAMode:function(){return tO},EDataAvailabilityMode:function(){return tk},ESimulationFlag:function(){return tT},ETransactionExecutionStatus:function(){return tM},ETransactionFinalityStatus:function(){return tN},ETransactionStatus:function(){return tS},ETransactionType:function(){return tv},ETransactionVersion:function(){return tL},ETransactionVersion2:function(){return tx},ETransactionVersion3:function(){return tR},EVENT_ABI_TYPE:function(){return tf},L1_DA_MODE:function(){return tw},PRICE_UNIT_FRI:function(){return tI},PRICE_UNIT_WEI:function(){return tb},STATE_MUTABILITY_EXTERNAL:function(){return tE},STATE_MUTABILITY_VIEW:function(){return t_},STATUS_ACCEPTED_ON_L1:function(){return tt},STATUS_ACCEPTED_ON_L2:function(){return J},STATUS_CANDIDATE:function(){return ti},STATUS_PRE_CONFIRMED:function(){return ta},STATUS_PRE_CONFIRMED_LOWERCASE:function(){return ts},STATUS_RECEIVED:function(){return tn},STATUS_REVERTED:function(){return tr},STATUS_SUCCEEDED:function(){return te},STRUCT_ABI_TYPE:function(){return th},TXN_TYPE_DECLARE:function(){return to},TXN_TYPE_DEPLOY:function(){return tc},TXN_TYPE_DEPLOY_ACCOUNT:function(){return tl},TXN_TYPE_INVOKE:function(){return tu},TXN_TYPE_L1_HANDLER:function(){return td}});var u={};r.r(u),r.d(u,{Permission:function(){return tB},TypedDataRevision:function(){return tj}});var d={};r.r(d);var h={};r.r(h),r.d(h,{ABI_TYPE_CONSTRUCTOR:function(){return tg},ABI_TYPE_ENUM:function(){return tm},ABI_TYPE_FUNCTION:function(){return tp},ABI_TYPE_L1_HANDLER:function(){return ty},API:function(){return l},CALL_TYPE:function(){return tA},CONTRACT:function(){return c},EBlockStatus:function(){return tC},EBlockTag:function(){return tD},EDAMode:function(){return tO},EDataAvailabilityMode:function(){return tk},ESimulationFlag:function(){return tT},ETransactionExecutionStatus:function(){return tM},ETransactionFinalityStatus:function(){return tN},ETransactionStatus:function(){return tS},ETransactionType:function(){return tv},ETransactionVersion:function(){return tL},ETransactionVersion2:function(){return tx},ETransactionVersion3:function(){return tR},EVENT_ABI_TYPE:function(){return tf},L1_DA_MODE:function(){return tw},PAYMASTER_API:function(){return d},PRICE_UNIT_FRI:function(){return tI},PRICE_UNIT_WEI:function(){return tb},Permission:function(){return tB},STATE_MUTABILITY_EXTERNAL:function(){return tE},STATE_MUTABILITY_VIEW:function(){return t_},STATUS_ACCEPTED_ON_L1:function(){return tt},STATUS_ACCEPTED_ON_L2:function(){return J},STATUS_CANDIDATE:function(){return ti},STATUS_PRE_CONFIRMED:function(){return ta},STATUS_PRE_CONFIRMED_LOWERCASE:function(){return ts},STATUS_RECEIVED:function(){return tn},STATUS_REVERTED:function(){return tr},STATUS_SUCCEEDED:function(){return te},STRUCT_ABI_TYPE:function(){return th},TXN_TYPE_DECLARE:function(){return to},TXN_TYPE_DEPLOY:function(){return tc},TXN_TYPE_DEPLOY_ACCOUNT:function(){return tl},TXN_TYPE_INVOKE:function(){return tu},TXN_TYPE_L1_HANDLER:function(){return td},TypedDataRevision:function(){return tj},WALLET_API:function(){return u}});var f={};r.r(f),r.d(f,{Fy:function(){return t8},uw:function(){return t$},gk:function(){return tY},Dd:function(){return t9},dQ:function(){return t7},ci:function(){return tq},bytesToNumberBE:function(){return tJ},ty:function(){return t0},eV:function(){return t5},n$:function(){return er},ql:function(){return t4},hexToBytes:function(){return tX},Z2:function(){return t6},_t:function(){return tH},H9:function(){return ea},tL:function(){return t1},S5:function(){return t2},uz:function(){return tZ},FF:function(){return ei}});var p={};r.r(p),r.d(p,{poseidon:function(){return rc},splitConstants:function(){return ro},validateOpts:function(){return rs}});var g={};r.r(g),r.d(g,{DER:function(){return rI},SWUFpSqrtRatio:function(){return rD},mapToCurveSimpleSWU:function(){return rC},weierstrass:function(){return rM},weierstrassPoints:function(){return rN}});let y="ACCEPTED_ON_L2",m="ACCEPTED_ON_L1",_="SUCCEEDED",E="REVERTED",b="PENDING",I="REJECTED",w="RECEIVED",A="DECLARE",v="DEPLOY",T="DEPLOY_ACCOUNT",S="INVOKE",N="L1_HANDLER",M="struct",D="event",C="function",k="constructor",O="l1_handler",L="enum",x="view",R="external",B="WEI",j="FRI",P={BLOB:"BLOB",CALLDATA:"CALLDATA"},U={DELEGATE:"DELEGATE",LIBRARY_CALL:"LIBRARY_CALL",CALL:"CALL"},z={DECLARE:A,DEPLOY:v,DEPLOY_ACCOUNT:T,INVOKE:S,L1_HANDLER:N},V={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},F={RECEIVED:w,REJECTED:I,ACCEPTED_ON_L2:y,ACCEPTED_ON_L1:m},H={ACCEPTED_ON_L2:y,ACCEPTED_ON_L1:m},Y={SUCCEEDED:_,REVERTED:E},$={LATEST:"latest",PENDING:"pending"},W={L1:"L1",L2:"L2"},q={L1:0,L2:1},Z={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},G={V0:Z.V0,V1:Z.V1,V2:Z.V2,F0:Z.F0,F1:Z.F1,F2:Z.F2},Q={V3:Z.V3,F3:Z.F3},K={ACCOUNTS:"accounts"},X={ACTIVE:"1",LEGACY:"0"},J="ACCEPTED_ON_L2",tt="ACCEPTED_ON_L1",te="SUCCEEDED",tr="REVERTED",tn="RECEIVED",ti="CANDIDATE",ta="PRE_CONFIRMED",ts=ta.toLowerCase(),to="DECLARE",tc="DEPLOY",tl="DEPLOY_ACCOUNT",tu="INVOKE",td="L1_HANDLER",th="struct",tf="event",tp="function",tg="constructor",ty="l1_handler",tm="enum",t_="view",tE="external",tb="WEI",tI="FRI",tw={BLOB:"BLOB",CALLDATA:"CALLDATA"},tA={DELEGATE:"DELEGATE",LIBRARY_CALL:"LIBRARY_CALL",CALL:"CALL"},tv={DECLARE:to,DEPLOY:tc,DEPLOY_ACCOUNT:tl,INVOKE:tu,L1_HANDLER:td},tT={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},tS={RECEIVED:tn,CANDIDATE:ti,PRE_CONFIRMED:ta,ACCEPTED_ON_L2:J,ACCEPTED_ON_L1:tt},tN={PRE_CONFIRMED:ta,ACCEPTED_ON_L2:J,ACCEPTED_ON_L1:tt}
1,tM={SUCCEEDED:te,REVERTED:tr},tD={LATEST:"latest",PRE_CONFIRMED:ts,L1_ACCEPTED:"l1_accepted"},tC={PRE_CONFIRMED:ta,ACCEPTED_ON_L2:J,ACCEPTED_ON_L1:tt},tk={L1:"L1",L2:"L2"},tO={L1:0,L2:1},tL={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},tx={V0:tL.V0,V1:tL.V1,V2:tL.V2,F0:tL.F0,F1:tL.F1,F2:tL.F2},tR={V3:tL.V3,F3:tL.F3},tB={ACCOUNTS:"accounts"},tj={ACTIVE:"1",LEGACY:"0"};var tP=r(99907),tU=r(57505);let tz=BigInt(0),tV=BigInt(1),tF=BigInt(2);function tH(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function tY(t){if(!tH(t))throw Error("Uint8Array expected")}function t$(t,e){if("boolean"!=typeof e)throw Error(t+" boolean expected, got "+e)}let tW=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function tq(t){tY(t);let e="";for(let r=0;r<t.length;r++)e+=tW[t[r]];return e}function tZ(t){let e=t.toString(16);return 1&e.length?"0"+e:e}function tG(t){if("string"!=typeof t)throw Error("hex string expected, got "+typeof t);return""===t?tz:BigInt("0x"+t)}let tQ={_0:48,_9:57,A:65,F:70,a:97,f:102};function tK(t){return t>=tQ._0&&t<=tQ._9?t-tQ._0:t>=tQ.A&&t<=tQ.F?t-(tQ.A-10):t>=tQ.a&&t<=tQ.f?t-(tQ.a-10):void 0}function tX(t){if("string"!=typeof t)throw Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let e=0,i=0;e<r;e++,i+=2){let r=tK(t.charCodeAt(i)),a=tK(t.charCodeAt(i+1));if(void 0===r||void 0===a)throw Error('hex string expected, got non-hex character "'+(t[i]+t[i+1])+'" at index '+i);n[e]=16*r+a}return n}
vendor: 6,377 bytes, line 1
1function tJ(t){return tG(tq(t))}function t0(t){return tY(t),tG(tq(Uint8Array.from(t).reverse()))}function t1(t,e){return tX(t.toString(16).padStart(2*e,"0"))}function t2(t,e){return t1(t,e).reverse()}function t4(t,e,r){let n;if("string"==typeof e)try{n=tX(e)}catch(e){throw Error(t+" must be hex string or Uint8Array, cause: "+e)}else if(tH(e))n=Uint8Array.from(e);else throw Error(t+" must be hex string or Uint8Array");let i=n.length;if("number"==typeof r&&i!==r)throw Error(t+" of length "+r+" expected, got "+i);return n}function t5(...t){let e=0;for(let r=0;r<t.length;r++){let n=t[r];tY(n),e+=n.length}let r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){let i=t[e];r.set(i,n),n+=i.length}return r}let t3=t=>"bigint"==typeof t&&tz<=t;function t6(t,e,r){return t3(t)&&t3(e)&&t3(r)&&e<=t&&t<r}function t8(t,e,r,n){if(!t6(e,r,n))throw Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function t9(t){let e;for(e=0;t>tz;t>>=tV,e+=1);return e}let t7=t=>(tF<<BigInt(t-1))-tV,et=t=>new Uint8Array(t),ee=t=>Uint8Array.from(t);function er(t,e,r){if("number"!=typeof t||t<2)throw Error("hashLen must be a number");if("number"!=typeof e||e<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=et(t),i=et(t),a=0,s=()=>{n.fill(1),i.fill(0),a=0},o=(...t)=>r(i,n,...t),c=(t=et())=>{i=o(ee([0]),t),n=o(),0!==t.length&&(i=o(ee([1]),t),n=o())},l=()=>{if(a++>=1e3)throw Error("drbg: tried 1000 values");let t=0,r=[];for(;t<e;){let e=(n=o()).slice();r.push(e),t+=n.length}return t5(...r)};return(t,e)=>{let r;for(s(),c(t);!(r=e(l()));)c();return s(),r}}let en={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||tH(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function ei(t,e,r={}){let n=(e,r,n)=>{let i=en[r];if("function"!=typeof i)throw Error("invalid validator function");let a=t[e];if((!n||void 0!==a)&&!i(a,t))throw Error("param "+String(e)+" is invalid. Expected "+r+", got "+a)};for(let[t,r]of Object.entries(e))n(t,r,!1);for(let[t,e]of Object.entries(r))n(t,e,!0);return t}function ea(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(void 0!==i)return i;let a=t(r,...n);return e.set(r,a),a}}function es(t){if(!Number.isSafeInteger(t)||t<0)throw Error("positive integer expected, got "+t)}function eo(t,...e){if(!(t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name))throw Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw Error("Uint8Array expected of length "+e+", got length="+t.length)}function ec(t,e=!0){if(t.destroyed)throw Error("Hash instance has been destroyed");if(e&&t.finished)throw Error("Hash#digest() has already been called")}function el(t,e){eo(t);let r=e.outputLen;if(t.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}let eu="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,ed=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),eh=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ef=(t,e)=>t<<32-e|t>>>e,ep=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],eg=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,ey=ep?t=>t:t=>eg(t);function em(t){for(let e=0;e<t.length;e++)t[e]=eg(t[e])}function e_(t){return"string"==typeof t&&(t=function(t){if("string"!=typeof t)throw Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}(t)),eo(t),t}class eE{clone(){return this._cloneInto()}}function eb(t){let e=e=>t().update(e_(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function eI(t=32){if(eu&&"function"==typeof eu.getRandomValues)return eu.getRandomValues(new Uint8Array(t));if(eu&&"function"==typeof eu.randomBytes)return eu.randomBytes(t);throw Error("crypto.getRandomValues must be defined")}let ew=(t,e,r)=>t&e^~t&r,eA=(t,e,r)=>t&e^t&r^e&r;class ev extends eE{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=eh(this.buffer)}update(t){ec(this);let{view:e,buffer:r,blockLen:n}=this,i=(t=e_(t)).length;for(let a=0;a<i;){let s=Math.min(n-this.pos,i-a);if(s===n){let e=eh(t);for(;n<=i-a;a+=n)this.process(e,a);continue}r.set(t.subarray(a,a+s),this.pos),this.pos+=s,a+=s,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ec(this),el(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>n-a&&(this.process(r,0),a=0);for(let t=a;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);let i=BigInt(32),a=BigInt(4294967295),s=Number(r>>i&a),o=Number(r&a),c=n?4:0,l=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+l,o,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);let s=eh(t),o=this.outputLen;if(o%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=o/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)s.setUint32(4*t,l[t],i)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:n,finished:i,destroyed:a,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=a,n%e&&t.buffer.set(r),t}}let eT=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
1734187,3204031479,3329325298]),eS=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),eN=new Uint32Array(64);class eM extends ev{constructor(){super(64,32,8,!1),this.A=0|eS[0],this.B=0|eS[1],this.C=0|eS[2],this.D=0|eS[3],this.E=0|eS[4],this.F=0|eS[5],this.G=0|eS[6],this.H=0|eS[7]}get(){let{A:t,B:e,C:r,D:n,E:i,F:a,G:s,H:o}=this;return[t,e,r,n,i,a,s,o]}set(t,e,r,n,i,a,s,o){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|a,this.G=0|s,this.H=0|o}process(t,e){for(let r=0;r<16;r++,e+=4)eN[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){let e=eN[t-15],r=eN[t-2],n=ef(e,7)^ef(e,18)^e>>>3,i=ef(r,17)^ef(r,19)^r>>>10;eN[t]=i+eN[t-7]+n+eN[t-16]|0}let{A:r,B:n,C:i,D:a,E:s,F:o,G:c,H:l}=this;for(let t=0;t<64;t++){let e=l+(ef(s,6)^ef(s,11)^ef(s,25))+ew(s,o,c)+eT[t]+eN[t]|0,u=(ef(r,2)^ef(r,13)^ef(r,22))+eA(r,n,i)|0;l=c,c=o,o=s,s=a+e|0,a=i,i=n,n=r,r=e+u|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,a=a+this.D|0,s=s+this.E|0,o=o+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,a,s,o,c,l)}roundClean(){eN.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let eD=eb(()=>new eM);var eC=r(91606);let ek=BigInt(4294967296-1),eO=BigInt(32);function eL(t,e=!1){return e?{h:Number(t&ek),l:Number(t>>eO&ek)}:{h:0|Number(t>>eO&ek),l:0|Number(t&ek)}}let ex=(t,e,r)=>t<<r|e>>>32-r,eR=(t,e,r)=>e<<r|t>>>32-r,eB=(t,e,r)=>e<<r-32|t>>>64-r,ej=(t,e,r)=>t<<r-32|e>>>64-r,eP=[],eU=[],ez=[],eV=BigInt(0),eF=BigInt(1),eH=BigInt(2),eY=BigInt(7),e$=BigInt(256),eW=BigInt(113);for(let t=0,e=eF,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],eP.push(2*(5*n+r)),eU.push((t+1)*(t+2)/2%64);let i=eV;for(let t=0;t<7;t++)(e=(e<<eF^(e>>eY)*eW)%e$)&eH&&(i^=eF<<(eF<<BigInt(t))-eF);ez.push(i)}let[eq,eZ]=function(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:a,l:s}=eL(t[i],e);[r[i],n[i]]=[a,s]}return[r,n]}(ez,!0),eG=(t,e,r)=>r>32?eB(t,e,r):ex(t,e,r),eQ=(t,e,r)=>r>32?ej(t,e,r):eR(t,e,r);class eK extends eE{constructor(t,e,r,n=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,es(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ed(this.state)}keccak(){ep||em(this.state32),function(t,e=24){let r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let e=0;e<10;e++)r[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){let n=(e+8)%10,i=(e+2)%10,a=r[i],s=r[i+1],o=eG(a,s,1)^r[n],c=eQ(a,s,1)^r[n+1];for(let r=0;r<50;r+=10)t[e+r]^=o,t[e+r+1]^=c}let e=t[2],i=t[3];for(let r=0;r<24;r++){let n=eU[r],a=eG(e,i,n),s=eQ(e,i,n),o=eP[r];e=t[o],i=t[o+1],t[o]=a,t[o+1]=s}for(let e=0;e<50;e+=10){for(let n=0;n<10;n++)r[n]=t[e+n];for(let n=0;n<10;n++)t[e+n]^=~r[(n+2)%10]&r[(n+4)%10]}t[0]^=eq[n],t[1]^=eZ[n]}r.fill(0)}(this.state32,this.rounds),ep||em(this.state32),this.posOut=0,this.pos=0}update(t){ec(this);let{blockLen:e,state:r}=this,n=(t=e_(t)).length;for(let i=0;i<n;){let a=Math.min(e-this.pos,n-i);for(let e=0;e<a;e++)r[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:n}=this;t[r]^=e,(128&e)!=0&&r===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){ec(this,!1),eo(t),this.finish();let e=this.state,{blockLen:r}=this;for(let n=0,i=t.length;n<i;){this.posOut>=r&&this.keccak();let a=Math.min(r-this.posOut,i-n);t.set(e.subarray(this.posOut,this.posOut+a),n),this.posOut+=a,n+=a}return t}xofInto(t){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return es(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(el(t,this),this.finished)throw Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:n,rounds:i,enableXOF:a}=this;return t||(t=new eK(e,r,n,a,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=n,t.enableXOF=a,t.destroyed=this.destroyed,t}}let eX=eb(()=>new eK(136,1,32)),eJ=BigInt(0),e0=BigInt(1),e1=BigInt(2),e2=BigInt(3),e4=BigInt(4),e5=BigInt(5),e3=BigInt(8);function e6(t,e){let r=t%e;return r>=eJ?r:e+r}function e8(t,e,r){let n=t;for(;e-- >eJ;)n*=n,n%=r;return n}function e9(t,e){if(t===eJ)throw Error("invert: expected non-zero number");if(e<=eJ)throw Error("invert: expected positive modulus, got "+e);let r=e6(t,e),n=e,i=eJ,a=e0,s=e0,o=eJ;for(;r!==eJ;){let t=n/r,e=n%r,c=i-s*t,l=a-o*t;n=r,r=e,i=s,a=o,s=c,o=l}if(n!==e0)throw Error("invert: does not exist");return e6(i,e)}let e7=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function rt(t){return ei(t,e7.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}function re(t,e,r){if(r<eJ)throw Error("invalid exponent, negatives unsupported");if(r===eJ)return t.ONE;if(r===e0)return e;let n=t.ONE,i=e;for(;r>eJ;)r&e0&&(n=t.mul(n,i)),i=t.sqr(i),r>>=e0;return n}function rr(t,e){let r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function rn(t,e,r=!1,n={}){let i;if(t<=eJ)throw Error("invalid field: expected ORDER > 0, got "+t);let{nBitLength:a,nByteLength:s}=rr(t,e);if(s>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let o=Object.freeze({ORDER:t,BITS:a,BYTES:s,MASK:t7(a),ZERO:eJ,ONE:e0,create:e=>e6(e,t),isValid:e=>{if("bigint"!=typeof e)throw Error("invalid field element: expected bigint, got "+typeof e);return eJ<=e&&e<t},is0:t=>t===eJ,isOdd:t=>(t&e0)===e0,neg:e=>e6(-e,t),eql:(t,e)=>t===e,sqr:e=>e6(e*e,t),add:(e,r)=>e6(e+r,t),sub:(e,r)=>e6(e-r,t),mul:(e,r)=>e6(e*r,t),pow:(t,e)=>re(o,t,e),div:(e,r)=>e6(e*e9(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>e9(e,t),sqrt:n.sqrt||(e=>(i||(i=function(t){if(t%e4===e2){let e=(t+e0)/e4;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}if(t%e3===e5){let e=(t-e5)/e3;return function(t,r){let n=t.mul(r,e1),i=t.pow(n,e),a=t.mul(r,i),s=t.mul(t.mul(a,e1),i),o=t.mul(a,t.sub(s,t.ONE));if(!t.eql(t.sqr(o),r))throw Error("Cannot find square root");return o}}return function(t){let e,r,n;let i=(t-e0)/e1;for(e=t-e0,r=0;e%e1===eJ;e/=e1,r++);for(n=e1;n<t&&function(t,e,r){if(e<eJ)throw Error("invalid exponent, negatives unsupported");if(r<=eJ)throw Error("invalid modulus");if(r===e0)return eJ;let n=e0;for(;e>eJ;)e&e0&&(n=n*t%r),t=t*t%r,e>>=e0;return n}(n,i,t)!==t-e0;n++)if(n>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let e=(t+e0)/e4;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}let a=(e+e0)/e1;return function(t,s){if(t.pow(s,i)===t.neg(t.ONE))throw Error("Cannot find square root");let o=r,c=t.pow(t.mul(t.ONE,n),e),l=t.pow(s,a),u=t.pow(s,e);for(;!t.eql(u,t.ONE);){if(t.eql(u,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(u);e<o&&!t.eql(r,t.ONE);e++)r=t.sqr(r);let r=t.pow(c,e0<<BigInt(o-e-1));c=t.sqr(r),l=t.mul(l,r),u=t.mul(u,c),o=e}return l}}(t)}(t)),i(o,e))),invertBatch:t=>(function(t,e){let r=Array(e.length),n=e.reduce((e,n,i)=>t.is0(n)?e:(r[i]=e,t.mul(e,n)),t.ONE),i=t.inv(n);return e.reduceRight((e,n,i)=>t.is0(n)?e:(r[i]=t.mul(e,r[i]),t.mul(e,n)),i),r})(o,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?t2(t,s):t1(t,s),fromBytes:t=>{if(t.length!==s)throw Error("Field.fromBytes: expected "+s+" bytes, got "+t.length);return r?t0(t):tJ(t)}});return Object.freeze(o)}function ri(t){if("bigint"!=typeof t)throw Error("field order must be bigint");return Math.ceil(t.toString(2).length/8)}function ra(t){let e=ri(t);return e+Math.ceil(e/2)}function rs(t){let{Fp:e,mds:r,reversePartialPowIdx:n,roundConstants:i}
1=t,{roundsFull:a,roundsPartial:s,sboxPower:o,t:c}=t;for(let r of(rt(e),["t","roundsFull","roundsPartial"]))if("number"!=typeof t[r]||!Number.isSafeInteger(t[r]))throw Error("invalid number "+r);if(!Array.isArray(r)||r.length!==c)throw Error("Poseidon: invalid MDS matrix");let l=r.map(t=>{if(!Array.isArray(t)||t.length!==c)throw Error("invalid MDS matrix row: "+t);return t.map(t=>{if("bigint"!=typeof t)throw Error("invalid MDS matrix bigint: "+t);return e.create(t)})});if(void 0!==n&&"boolean"!=typeof n)throw Error("invalid param reversePartialPowIdx="+n);if(1&a)throw Error("roundsFull is not even"+a);let u=a+s;if(!Array.isArray(i)||i.length!==u)throw Error("Poseidon: invalid round constants");let d=i.map(t=>{if(!Array.isArray(t)||t.length!==c)throw Error("invalid round constants");return t.map(t=>{if("bigint"!=typeof t||!e.isValid(t))throw Error("invalid round constant");return e.create(t)})});if(!o||![3,5,7].includes(o))throw Error("invalid sboxPower");let h=BigInt(o),f=t=>re(e,t,h);return 3===o?f=t=>e.mul(e.sqrN(t),t):5===o&&(f=t=>e.mul(e.sqrN(e.sqrN(t)),t)),Object.freeze({...t,rounds:u,sboxFn:f,roundConstants:d,mds:l})}function ro(t,e){if("number"!=typeof e)throw Error("poseidonSplitConstants: invalid t");if(!Array.isArray(t)||t.length%e)throw Error("poseidonSplitConstants: invalid rc");let r=[],n=[];for(let i=0;i<t.length;i++)n.push(t[i]),n.length===e&&(r.push(n),n=[]);return r}function rc(t){let e=rs(t),{Fp:r,mds:n,roundConstants:i,rounds:a,roundsPartial:s,sboxFn:o,t:c}=e,l=e.roundsFull/2,u=e.reversePartialPowIdx?c-1:0,d=(t,e,a)=>(t=t.map((t,e)=>r.add(t,i[a][e])),e?t=t.map(t=>o(t)):t[u]=o(t[u]),t=n.map(e=>e.reduce((e,n,i)=>r.add(e,r.mulN(n,t[i])),r.ZERO))),h=function(t){if(!Array.isArray(t)||t.length!==c)throw Error("invalid values, expected array of bigints with length "+c);t=t.map(t=>{if("bigint"!=typeof t)throw Error("invalid bigint="+t);return r.create(t)});let e=0;for(let r=0;r<l;r++)t=d(t,!0,e++);for(let r=0;r<s;r++)t=d(t,!1,e++);for(let r=0;r<l;r++)t=d(t,!0,e++);if(e!==a)throw Error("invalid number of rounds");return t};return h.roundConstants=i,h}let rl=BigInt(0),ru=BigInt(1);function rd(t,e){let r=e.negate();return t?r:e}function rh(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw Error("invalid window size, expected [1.."+e+"], got W="+t)}function rf(t,e){return rh(t,e),{windows:Math.ceil(e/t)+1,windowSize:2**(t-1)}}let rp=new WeakMap,rg=new WeakMap;function ry(t){return rg.get(t)||1}function rm(t){return rt(t.Fp),ei(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...rr(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function r_(t){void 0!==t.lowS&&t$("lowS",t.lowS),void 0!==t.prehash&&t$("prehash",t.prehash)}let{bytesToNumberBE:rE,hexToBytes:rb}=f,rI={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(t,e)=>{let{Err:r}=rI;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(1&e.length)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=tZ(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let a=n>127?tZ(i.length/2|128):"";return tZ(t)+a+i+e},decode(t,e){let{Err:r}=rI,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let i=e[n++],a=0;if(128&i){let t=127&i;if(!t)throw new r("tlv.decode(long): indefinite length not supported");if(t>4)throw new r("tlv.decode(long): byte length is too big");let s=e.subarray(n,n+t);if(s.length!==t)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(let t of s)a=a<<8|t;if(n+=t,a<128)throw new r("tlv.decode(long): not minimal encoding")}else a=i;let s=e.subarray(n,n+a);if(s.length!==a)throw new r("tlv.decode: wrong value length");return{v:s,l:e.subarray(n+a)}}},_int:{encode(t){let{Err:e}=rI;if(t<rw)throw new e("integer: negative integers are not allowed");let r=tZ(t);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){let{Err:e}=rI;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return rE(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=rI,i="string"==typeof t?rb(t):t;tY(i);let{v:a,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");let{v:o,l:c}=n.decode(2,a),{v:l,l:u}=n.decode(2,c);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(o),s:r.decode(l)}},hexFromSig(t){let{_tlv:e,_int:r}=rI,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s));return e.encode(48,n+i)}},rw=BigInt(0),rA=BigInt(1),rv=BigInt(2),rT=BigInt(3),rS=BigInt(4);function rN(t){var e;let r=function(t){let e=rm(t);ei(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=r,i=rn(r.n,r.nBitLength),a=r.toBytes||((t,e,r)=>{let i=e.toAffine();return t5(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),s=r.fromBytes||(t=>{let e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function o(t){let{a:e,b:i}=r,a=n.sqr(t),s=n.mul(a,t);return n.add(n.add(s,n.mul(t,e)),i)}
vendor: 4,569 bytes, line 1
1if(!n.eql(n.sqr(r.Gy),o(r.Gx)))throw Error("bad generator point: equation left != right");function c(t){let e;let{allowedPrivateKeyLengths:n,nByteLength:i,wrapPrivateKey:a,n:s}=r;if(n&&"bigint"!=typeof t){if(tH(t)&&(t=tq(t)),"string"!=typeof t||!n.includes(t.length))throw Error("invalid private key");t=t.padStart(2*i,"0")}try{e="bigint"==typeof t?t:tJ(t4("private key",t,i))}catch(e){throw Error("invalid private key, expected hex or "+i+" bytes, got "+typeof t)}return a&&(e=e6(e,s)),t8("private key",e,rA,s),e}function l(t){if(!(t instanceof h))throw Error("ProjectivePoint expected")}let u=ea((t,e)=>{let{px:r,py:i,pz:a}=t;if(n.eql(a,n.ONE))return{x:r,y:i};let s=t.is0();null==e&&(e=s?n.ONE:n.inv(a));let o=n.mul(r,e),c=n.mul(i,e),l=n.mul(a,e);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw Error("invZ was invalid");return{x:o,y:c}}),d=ea(t=>{if(t.is0()){if(r.allowInfinityPoint&&!n.is0(t.py))return;throw Error("bad point: ZERO")}let{x:e,y:i}=t.toAffine();if(!n.isValid(e)||!n.isValid(i))throw Error("bad point: x or y not FE");let a=n.sqr(i),s=o(e);if(!n.eql(a,s))throw Error("bad point: equation left != right");if(!t.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class h{constructor(t,e,r){if(this.px=t,this.py=e,this.pz=r,null==t||!n.isValid(t))throw Error("x required");if(null==e||!n.isValid(e))throw Error("y required");if(null==r||!n.isValid(r))throw Error("z required");Object.freeze(this)}static fromAffine(t){let{x:e,y:r}=t||{};if(!t||!n.isValid(e)||!n.isValid(r))throw Error("invalid affine point");if(t instanceof h)throw Error("projective point not allowed");let i=t=>n.eql(t,n.ZERO);return i(e)&&i(r)?h.ZERO:new h(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){let e=n.invertBatch(t.map(t=>t.pz));return t.map((t,r)=>t.toAffine(e[r])).map(h.fromAffine)}static fromHex(t){let e=h.fromAffine(s(t4("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return h.BASE.multiply(c(t))}static msm(t,e){return function(t,e,r,n){if(!function(t,e){if(!Array.isArray(t))throw Error("array expected");t.forEach((t,r)=>{if(!(t instanceof e))throw Error("invalid point at index "+r)})}(r,t),!function(t,e){if(!Array.isArray(t))throw Error("array of scalars expected");t.forEach((t,r)=>{if(!e.isValid(t))throw Error("invalid scalar at index "+r)})}(n,e),r.length!==n.length)throw Error("arrays of points and scalars must have equal length");let i=t.ZERO,a=t9(BigInt(r.length)),s=a>12?a-3:a>4?a-2:a?2:1,o=(1<<s)-1,c=Array(o+1).fill(i),l=Math.floor((e.BITS-1)/s)*s,u=i;for(let t=l;t>=0;t-=s){c.fill(i);for(let e=0;e<n.length;e++){let i=Number(n[e]>>BigInt(t)&BigInt(o));c[i]=c[i].add(r[e])}let e=i;for(let t=c.length-1,r=i;t>0;t--)r=r.add(c[t]),e=e.add(r);if(u=u.add(e),0!==t)for(let t=0;t<s;t++)u=u.double()}return u}(h,i,t,e)}_setWindowSize(t){p.setWindowSize(this,t)}assertValidity(){d(this)}hasEvenY(){let{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw Error("Field doesn't support isOdd")}equals(t){l(t);let{px:e,py:r,pz:i}=this,{px:a,py:s,pz:o}=t,c=n.eql(n.mul(e,o),n.mul(a,i)),u=n.eql(n.mul(r,o),n.mul(s,i));return c&&u}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){let{a:t,b:e}=r,i=n.mul(e,rT),{px:a,py:s,pz:o}=this,c=n.ZERO,l=n.ZERO,u=n.ZERO,d=n.mul(a,a),f=n.mul(s,s),p=n.mul(o,o),g=n.mul(a,s);return g=n.add(g,g),u=n.mul(a,o),u=n.add(u,u),c=n.mul(t,u),l=n.mul(i,p),l=n.add(c,l),c=n.sub(f,l),l=n.add(f,l),l=n.mul(c,l),c=n.mul(g,c),u=n.mul(i,u),p=n.mul(t,p),g=n.sub(d,p),g=n.mul(t,g),g=n.add(g,u),u=n.add(d,d),d=n.add(u,d),d=n.add(d,p),d=n.mul(d,g),l=n.add(l,d),p=n.mul(s,o),p=n.add(p,p),d=n.mul(p,g),c=n.sub(c,d),u=n.mul(p,f),u=n.add(u,u),new h(c,l,u=n.add(u,u))}add(t){l(t);let{px:e,py:i,pz:a}=this,{px:s,py:o,pz:c}=t,u=n.ZERO,d=n.ZERO,f=n.ZERO,p=r.a,g=n.mul(r.b,rT),y=n.mul(e,s),m=n.mul(i,o),_=n.mul(a,c),E=n.add(e,i),b=n.add(s,o);E=n.mul(E,b),b=n.add(y,m),E=n.sub(E,b),b=n.add(e,a);let I=n.add(s,c);return b=n.mul(b,I),I=n.add(y,_),b=n.sub(b,I),I=n.add(i,a),u=n.add(o,c),I=n.mul(I,u),u=n.add(m,_),I=n.sub(I,u),f=n.mul(p,b),u=n.mul(g,_),f=n.add(u,f),u=n.sub(m,f),f=n.add(m,f),d=n.mul(u,f),m=n.add(y,y),m=n.add(m,y),_=n.mul(p,_),b=n.mul(g,b),m=n.add(m,_),_=n.sub(y,_),_=n.mul(p,_),b=n.add(b,_),y=n.mul(m,b),d=n.add(d,y),y=n.mul(I,b),u=n.mul(E,u),u=n.sub(u,y),y=n.mul(E,m),f=n.mul(I,f),new h(u,d,f=n.add(f,y))}subtract(t){return this.add(t.negate())}is0(){return this.equals(h.ZERO)}wNAF(t){return p.wNAFCached(this,t,h.normalizeZ)}multiplyUnsafe(t){let{endo:e,n:i}=r;t8("scalar",t,rw,i);let a=h.ZERO;if(t===rw)return a;
vendor: 4,221 bytes, line 1
1if(this.is0()||t===rA)return this;if(!e||p.hasPrecomputes(this))return p.wNAFCachedUnsafe(this,t,h.normalizeZ);let{k1neg:s,k1:o,k2neg:c,k2:l}=e.splitScalar(t),u=a,d=a,f=this;for(;o>rw||l>rw;)o&rA&&(u=u.add(f)),l&rA&&(d=d.add(f)),f=f.double(),o>>=rA,l>>=rA;return s&&(u=u.negate()),c&&(d=d.negate()),d=new h(n.mul(d.px,e.beta),d.py,d.pz),u.add(d)}multiply(t){let e,i;let{endo:a,n:s}=r;if(t8("scalar",t,rA,s),a){let{k1neg:r,k1:s,k2neg:o,k2:c}=a.splitScalar(t),{p:l,f:u}=this.wNAF(s),{p:d,f:f}=this.wNAF(c);l=p.constTimeNegate(r,l),d=p.constTimeNegate(o,d),d=new h(n.mul(d.px,a.beta),d.py,d.pz),e=l.add(d),i=u.add(f)}else{let{p:r,f:n}=this.wNAF(t);e=r,i=n}return h.normalizeZ([e,i])[0]}multiplyAndAddUnsafe(t,e,r){let n=h.BASE,i=(t,e)=>e!==rw&&e!==rA&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),a=i(this,e).add(i(t,r));return a.is0()?void 0:a}toAffine(t){return u(this,t)}isTorsionFree(){let{h:t,isTorsionFree:e}=r;if(t===rA)return!0;if(e)return e(h,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:t,clearCofactor:e}=r;return t===rA?this:e?e(h,this):this.multiplyUnsafe(r.h)}toRawBytes(t=!0){return t$("isCompressed",t),this.assertValidity(),a(h,this,t)}toHex(t=!0){return t$("isCompressed",t),tq(this.toRawBytes(t))}}h.BASE=new h(r.Gx,r.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);let f=r.nBitLength,p=(e=r.endo?Math.ceil(f/2):f,{constTimeNegate:rd,hasPrecomputes:t=>1!==ry(t),unsafeLadder(t,e,r=h.ZERO){let n=t;for(;e>rl;)e&ru&&(r=r.add(n)),n=n.double(),e>>=ru;return r},precomputeWindow(t,r){let{windows:n,windowSize:i}=rf(r,e),a=[],s=t,o=s;for(let t=0;t<n;t++){o=s,a.push(o);for(let t=1;t<i;t++)o=o.add(s),a.push(o);s=o.double()}return a},wNAF(t,r,n){let{windows:i,windowSize:a}=rf(t,e),s=h.ZERO,o=h.BASE,c=BigInt(2**t-1),l=2**t,u=BigInt(t);for(let t=0;t<i;t++){let e=t*a,i=Number(n&c);n>>=u,i>a&&(i-=l,n+=ru);let d=e+Math.abs(i)-1,h=t%2!=0,f=i<0;0===i?o=o.add(rd(h,r[e])):s=s.add(rd(f,r[d]))}return{p:s,f:o}},wNAFUnsafe(t,r,n,i=h.ZERO){let{windows:a,windowSize:s}=rf(t,e),o=BigInt(2**t-1),c=2**t,l=BigInt(t);for(let t=0;t<a;t++){let e=t*s;if(n===rl)break;let a=Number(n&o);if(n>>=l,a>s&&(a-=c,n+=ru),0===a)continue;let u=r[e+Math.abs(a)-1];a<0&&(u=u.negate()),i=i.add(u)}return i},getPrecomputes(t,e,r){let n=rp.get(e);return n||(n=this.precomputeWindow(e,t),1!==t&&rp.set(e,r(n))),n},wNAFCached(t,e,r){let n=ry(t);return this.wNAF(n,this.getPrecomputes(n,t,r),e)},wNAFCachedUnsafe(t,e,r,n){let i=ry(t);return 1===i?this.unsafeLadder(t,e,n):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),e,n)},setWindowSize(t,r){rh(r,e),rg.set(t,r),rp.delete(t)}});return{CURVE:r,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:function(t){return t6(t,rA,r.n)}}}function rM(t){let e=function(t){let e=rm(t);return ei(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n}=e,i=r.BYTES+1,a=2*r.BYTES+1;function s(t){return e6(t,n)}let{ProjectivePoint:o,normPrivateKeyToScalar:c,weierstrassEquation:l,isWithinCurveOrder:u}=rN({...e,toBytes(t,e,n){let i=e.toAffine(),a=r.toBytes(i.x),s=t5;return(t$("isCompressed",n),n)?s(Uint8Array.from([e.hasEvenY()?2:3]),a):s(Uint8Array.from([4]),a,r.toBytes(i.y))},fromBytes(t){let e=t.length,n=t[0],s=t.subarray(1);if(e===i&&(2===n||3===n)){let t;let e=tJ(s);if(!t6(e,rA,r.ORDER))throw Error("Point is not on curve");let i=l(e);try{t=r.sqrt(i)}catch(t){throw Error("Point is not on curve"+(t instanceof Error?": "+t.message:""))}return(1&n)==1!=((t&rA)===rA)&&(t=r.neg(t)),{x:e,y:t}}if(e===a&&4===n)return{x:r.fromBytes(s.subarray(0,r.BYTES)),y:r.fromBytes(s.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+i+", or uncompressed "+a+", got "+e)}}),d=t=>tq(t1(t,e.nByteLength)),h=(t,e,r)=>tJ(t.slice(e,r));class f{constructor(t,e,r){this.r=t,this.s=e,this.recovery=r,this.assertValidity()}static fromCompact(t){let r=e.nByteLength;return new f(h(t=t4("compactSignature",t,2*r),0,r),h(t,r,2*r))}static fromDER(t){let{r:e,s:r}=rI.toSig(t4("DER",t));return new f(e,r)}assertValidity(){t8("r",this.r,rA,n),t8("s",this.s,rA,n)}addRecoveryBit(t){return new f(this.r,this.s,t)}
1recoverPublicKey(t){let{r:i,s:a,recovery:c}=this,l=y(t4("msgHash",t));if(null==c||![0,1,2,3].includes(c))throw Error("recovery id invalid");let u=2===c||3===c?i+e.n:i;if(u>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let h=(1&c)==0?"02":"03",f=o.fromHex(h+d(u)),p=e9(u,n),g=s(-l*p),m=s(a*p),_=o.BASE.multiplyAndAddUnsafe(f,g,m);if(!_)throw Error("point at infinify");return _.assertValidity(),_}hasHighS(){return this.s>n>>rA}normalizeS(){return this.hasHighS()?new f(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return tX(this.toDERHex())}toDERHex(){return rI.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return tX(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}function p(t){let e=tH(t),r="string"==typeof t,n=(e||r)&&t.length;return e?n===i||n===a:r?n===2*i||n===2*a:t instanceof o}let g=e.bits2int||function(t){if(t.length>8192)throw Error("input is too large");let r=tJ(t),n=8*t.length-e.nBitLength;return n>0?r>>BigInt(n):r},y=e.bits2int_modN||function(t){return s(g(t))},m=t7(e.nBitLength);function _(t){return t8("num < 2^"+e.nBitLength,t,rw,m),t1(t,e.nByteLength)}let E={lowS:e.lowS,prehash:!1},b={lowS:e.lowS,prehash:!1};return o.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return o.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,r=!0){if(p(t))throw Error("first arg must be private key");if(!p(e))throw Error("second arg must be public key");return o.fromHex(e).multiply(c(t)).toRawBytes(r)},sign:function(t,i,a=E){let{seed:l,k2sig:d}=function(t,i,a=E){if(["recovered","canonical"].some(t=>t in a))throw Error("sign() legacy options not supported");let{hash:l,randomBytes:d}=e,{lowS:h,prehash:p,extraEntropy:m}=a;null==h&&(h=!0),t=t4("msgHash",t),r_(a),p&&(t=t4("prehashed msgHash",l(t)));let b=y(t),I=c(i),w=[_(I),_(b)];if(null!=m&&!1!==m){let t=!0===m?d(r.BYTES):m;w.push(t4("extraEntropy",t))}return{seed:t5(...w),k2sig:function(t){let e=g(t);if(!u(e))return;let r=e9(e,n),i=o.BASE.multiply(e).toAffine(),a=s(i.x);if(a===rw)return;let c=s(r*s(b+a*I));if(c===rw)return;let l=(i.x===a?0:2)|Number(i.y&rA),d=c;if(h&&c>n>>rA)d=c>n>>rA?s(-c):c,l^=1;return new f(a,d,l)}}}(t,i,a);return er(e.hash.outputLen,e.nByteLength,e.hmac)(l,d)},verify:function(t,r,i,a=b){let c,l;r=t4("msgHash",r),i=t4("publicKey",i);let{lowS:u,prehash:d,format:h}=a;if(r_(a),"strict"in a)throw Error("options.strict was renamed to lowS");if(void 0!==h&&"compact"!==h&&"der"!==h)throw Error("format must be compact or der");let p="string"==typeof t||tH(t),g=!p&&!h&&"object"==typeof t&&null!==t&&"bigint"==typeof t.r&&"bigint"==typeof t.s;if(!p&&!g)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");try{if(g&&(l=new f(t.r,t.s)),p){try{"compact"!==h&&(l=f.fromDER(t))}catch(t){if(!(t instanceof rI.Err))throw t}l||"der"===h||(l=f.fromCompact(t))}c=o.fromHex(i)}catch(t){return!1}if(!l||u&&l.hasHighS())return!1;d&&(r=e.hash(r));let{r:m,s:_}=l,E=y(r),I=e9(_,n),w=s(E*I),A=s(m*I),v=o.BASE.multiplyAndAddUnsafe(c,w,A)?.toAffine();return!!v&&s(v.x)===m},ProjectivePoint:o,Signature:f,utils:{isValidPrivateKey(t){try{return c(t),!0}catch(t){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{let t=ra(e.n);return function(t,e,r=!1){let n=t.length,i=ri(e),a=ra(e);if(n<16||n<a||n>1024)throw Error("expected "+a+"-1024 bytes of input, got "+n);let s=e6(r?tJ(t):t0(t),e-e0)+e0;return r?t2(s,i):t1(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=o.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}}function rD(t,e){let r=t.ORDER,n=rw;for(let t=r-rA;t%rv===rw;t/=rv)n+=rA;let i=n,a=rv<<i-rA-rA,s=a*rv,o=(r-rA)/s,c=(o-rA)/rv,l=s-rA,u=t.pow(e,o),d=t.pow(e,(o+rA)/rv),h=(e,r)=>{let n=u,s=t.pow(r,l),o=t.sqr(s);o=t.mul(o,r);let h=t.mul(e,o);h=t.pow(h,c),h=t.mul(h,s),s=t.mul(h,r),o=t.mul(h,e);let f=t.mul(o,s);h=t.pow(f,a);let p=t.eql(h,t.ONE);s=t.mul(o,d),h=t.mul(f,n),o=t.cmov(s,o,p),f=t.cmov(h,f,p);for(let e=i;e>rA;e--){let r=e-rv;r=rv<<r-rA;let i=t.pow(f,r),a=t.eql(i,t.ONE);s=t.mul(o,n),n=t.mul(n,n),i=t.mul(f,n),o=t.cmov(s,o,a),f=t.cmov(i,f,a)}return{isValid:p,value:o}};if(t.ORDER%rS===rT){let r=(t.ORDER-rT)/rS,n=t.sqrt(t.neg(e));h=(e,i)=>{let a=t.sqr(i),s=t.mul(e,i);a=t.mul(a,s);let o=t.pow(a,r);o=t.mul(o,s);let c=t.mul(o,n),l=t.mul(t.sqr(o),i),u=t.eql(l,e),d=t.cmov(c,o,u);return{isValid:u,value:d}}}return h}function rC(t,e){if(rt(t),!t.isValid(e.A)||!t.isValid(e.B)||!t.isValid(e.Z))throw Error("mapToCurveSimpleSWU: invali
1d opts");let r=rD(t,e.Z);if(!t.isOdd)throw Error("Fp.isOdd is not implemented!");return n=>{let i,a,s,o,c,l,u,d;i=t.sqr(n),i=t.mul(i,e.Z),a=t.sqr(i),a=t.add(a,i),s=t.add(a,t.ONE),s=t.mul(s,e.B),o=t.cmov(e.Z,t.neg(a),!t.eql(a,t.ZERO)),o=t.mul(o,e.A),a=t.sqr(s),l=t.sqr(o),c=t.mul(l,e.A),a=t.add(a,c),a=t.mul(a,s),l=t.mul(l,o),c=t.mul(l,e.B),a=t.add(a,c),u=t.mul(i,s);let{isValid:h,value:f}=r(a,l);d=t.mul(i,n),d=t.mul(d,f),u=t.cmov(u,s,h),d=t.cmov(d,f,h);let p=t.isOdd(n)===t.isOdd(d);return d=t.cmov(t.neg(d),d,p),{x:u=t.div(u,o),y:d}}}let rk=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class rO extends eE{constructor(t,e,r={},n,i,a){if(super(),this.blockLen=t,this.outputLen=e,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,es(t),es(e),es(n),e<0||e>n)throw Error("outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>n))throw Error("key length must be undefined or 1.."+n);if(void 0!==r.salt&&r.salt.length!==i)throw Error("salt must be undefined or "+i);if(void 0!==r.personalization&&r.personalization.length!==a)throw Error("personalization must be undefined or "+a);this.buffer=new Uint8Array(t),this.buffer32=ed(this.buffer)}update(t){ec(this);let{blockLen:e,buffer:r,buffer32:n}=this,i=(t=e_(t)).length,a=t.byteOffset,s=t.buffer;for(let o=0;o<i;){this.pos===e&&(ep||em(n),this.compress(n,0,!1),ep||em(n),this.pos=0);let c=Math.min(e-this.pos,i-o),l=a+o;if(c===e&&!(l%4)&&o+c<i){let t=new Uint32Array(s,l,Math.floor((i-o)/4));ep||em(t);for(let r=0;o+e<i;r+=n.length,o+=e)this.length+=e,this.compress(t,r,!1);ep||em(t);continue}r.set(t.subarray(o,o+c),this.pos),this.pos+=c,this.length+=c,o+=c}return this}digestInto(t){ec(this),el(t,this);let{pos:e,buffer32:r}=this;this.finished=!0,this.buffer.subarray(e).fill(0),ep||em(r),this.compress(r,0,!0),ep||em(r);let n=ed(t);this.get().forEach((t,e)=>n[e]=ey(t))}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){let{buffer:e,length:r,finished:n,destroyed:i,outputLen:a,pos:s}=this;return t||(t=new this.constructor({dkLen:a})),t.set(...this.get()),t.length=r,t.finished=n,t.destroyed=i,t.outputLen=a,t.buffer.set(e),t.pos=s,t}}let rL=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function rx(t,e,r,n,i){return r=r+(n=ef(n^(t=t+e+i|0),16))|0,{a:t,b:e=ef(e^r,12),c:r,d:n}}function rR(t,e,r,n,i){return r=r+(n=ef(n^(t=t+e+i|0),8))|0,{a:t,b:e=ef(e^r,7),c:r,d:n}}class rB extends rO{constructor(t={}){super(64,void 0===t.dkLen?32:t.dkLen,t,32,8,8),this.v0=0|rL[0],this.v1=0|rL[1],this.v2=0|rL[2],this.v3=0|rL[3],this.v4=0|rL[4],this.v5=0|rL[5],this.v6=0|rL[6],this.v7=0|rL[7];let e=t.key?t.key.length:0;if(this.v0^=this.outputLen|e<<8|16842752,t.salt){let e=ed(e_(t.salt));this.v4^=ey(e[0]),this.v5^=ey(e[1])}if(t.personalization){let e=ed(e_(t.personalization));this.v6^=ey(e[0]),this.v7^=ey(e[1])}if(t.key){let e=new Uint8Array(this.blockLen);e.set(e_(t.key)),this.update(e)}}get(){let{v0:t,v1:e,v2:r,v3:n,v4:i,v5:a,v6:s,v7:o}=this;return[t,e,r,n,i,a,s,o]}set(t,e,r,n,i,a,s,o){this.v0=0|t,this.v1=0|e,this.v2=0|r,this.v3=0|n,this.v4=0|i,this.v5=0|a,this.v6=0|s,this.v7=0|o}compress(t,e,r){let{h:n,l:i}=eL(BigInt(this.length)),{v0:a,v1:s,v2:o,v3:c,v4:l,v5:u,v6:d,v7:h,v8:f,v9:p,v10:g,v11:y,v12:m,v13:_,v14:E,v15:b}=function(t,e,r,n,i,a,s,o,c,l,u,d,h,f,p,g,y,m,_,E){let b=0;for(let n=0;n<10;n++)({a:i,b:c,c:h,d:y}=rx(i,c,h,y,r[e+t[b++]])),({a:i,b:c,c:h,d:y}=rR(i,c,h,y,r[e+t[b++]])),({a:a,b:l,c:f,d:m}=rx(a,l,f,m,r[e+t[b++]])),({a:a,b:l,c:f,d:m}=rR(a,l,f,m,r[e+t[b++]])),({a:s,b:u,c:p,d:_}=rx(s,u,p,_,r[e+t[b++]])),({a:s,b:u,c:p,d:_}=rR(s,u,p,_,r[e+t[b++]])),({a:o,b:d,c:g,d:E}=rx(o,d,g,E,r[e+t[b++]])),({a:o,b:d,c:g,d:E}=rR(o,d,g,E,r[e+t[b++]])),({a:i,b:l,c:p,d:E}=rx(i,l,p,E,r[e+t[b++]])),({a:i,b:l,c:p,d:E}=rR(i,l,p,E,r[e+t[b++]])),({a:a,b:u,c:g,d:y}=rx(a,u,g,y,r[e+t[b++]])),({a:a,b:u,c:g,d:y}=rR(a,u,g,y,r[e+t[b++]])),({a:s,b:d,c:h,d:m}=rx(s,d,h,m,r[e+t[b++]])),({a:s,b:d,c:h,d:m}=rR(s,d,h,m,r[e+t[b++]])),({a:o,b:c,c:f,d:_}=rx(o,c,f,_,r[e+t[b++]])),{a:o,b:c,c:f,d:_}=rR(o,c,f,_,r[e+t[b++]]);return{v0:i,v1:a,v2:s,v3:o,v4:c,v5:l,v6:u,v7:d,v8:h,v9:f,v10:p,v11:g,v12:y,v13:m,v14:_,v15:E}}(rk,e,t,0,this.v0,this.v1,this.v2,this.v3,this.v4,this.v5,this.v6,this.v7,rL[0],rL[1],rL[2],rL[3],i^rL[4],n^rL[5],r?~rL[6]:rL[6],rL[7]);this.v0^=a^f,this.v1^=s^p,this.v2^=o^g,this.v3^=c^y,this.v4^=l^m,this.v5^=u^_,this.v6^=d^E,this.v7^=h^b}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0)}}let rj=function(t){let e=(e,r)=>t(r).update(e_(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e}(t=>new rB(t));var rP=r(2592);class rU extends eE{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(t){if("function"!=typeof t||"function"!=typeof t.create)throw Error("Hash should be wrapped by utils.wrapConstructor");es(t.outputLen),es(t.blockLen)}(t);let r=e_(e);
1if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?t.create().update(r).digest():r);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),i.fill(0)}update(t){return ec(this),this.iHash.update(t),this}digestInto(t){ec(this),eo(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:a,outputLen:s}=this;return t.finished=n,t.destroyed=i,t.blockLen=a,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let rz=(t,e,r)=>new rU(t,e).update(r).digest();rz.create=(t,e)=>new rU(t,e);let rV=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),rF=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),rH=BigInt(1),rY=BigInt(2),r$=(t,e)=>(t+e/rY)/e,rW=rn(rV,void 0,void 0,{sqrt:function(t){let e=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),a=BigInt(23),s=BigInt(44),o=BigInt(88),c=t*t*t%rV,l=c*c*t%rV,u=e8(l,e,rV)*l%rV,d=e8(u,e,rV)*l%rV,h=e8(d,rY,rV)*c%rV,f=e8(h,n,rV)*h%rV,p=e8(f,i,rV)*f%rV,g=e8(p,s,rV)*p%rV,y=e8(g,o,rV)*g%rV,m=e8(y,s,rV)*p%rV,_=e8(m,e,rV)*l%rV,E=e8(_,a,rV)*f%rV,b=e8(E,r,rV)*c%rV,I=e8(b,rY,rV);if(!rW.eql(rW.sqr(I),t))throw Error("Cannot find square root");return I}}),rq=function(t,e){let r=e=>rM({...t,hash:e,hmac:(t,...r)=>rz(e,t,function(...t){let e=0;for(let r=0;r<t.length;r++){let n=t[r];eo(n),e+=n.length}let r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){let i=t[e];r.set(i,n),n+=i.length}return r}(...r)),randomBytes:eI});return Object.freeze({...r(e),create:r})}({a:BigInt(0),b:BigInt(7),Fp:rW,n:rF,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rH*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=BigInt("0x100000000000000000000000000000000"),a=r$(e*t,rF),s=r$(-r*t,rF),o=e6(t-a*e-s*n,rF),c=e6(-a*r-s*e,rF),l=o>i,u=c>i;if(l&&(o=rF-o),u&&(c=rF-c),o>i||c>i)throw Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:o,k2neg:u,k2:c}}}},eD);BigInt(0),rq.ProjectivePoint;var rZ=r(47789),rG=r(87376).Buffer,rQ=Object.defineProperty,rK=Object.getOwnPropertyDescriptor,rX=Object.getOwnPropertyNames,rJ=Object.prototype.hasOwnProperty,r0=(t,e)=>{for(var r in e)rQ(t,r,{get:e[r],enumerable:!0})},r1=(t,e,r,n)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of rX(e))rJ.call(t,i)||i===r||rQ(t,i,{get:()=>e[i],enumerable:!(n=rK(e,i))||n.enumerable});return t},r2=(t,e,r)=>(r1(t,e,"default"),r&&r1(r,e,"default")),r4={};r0(r4,{ADDR_BOUND:()=>nT,API_VERSION:()=>nw,BaseUrl:()=>nW,DEFAULT_GLOBAL_CONFIG:()=>nK,HARDENING_4BYTES:()=>n$,HARDENING_BYTE:()=>nY,IS_BROWSER:()=>r8,LegacyUDC:()=>nU,MASK_250:()=>nb,MASK_31:()=>nI,MAX_STORAGE_ITEM_SIZE:()=>nv,NetworkName:()=>nq,OutsideExecutionCallerAny:()=>nV,PAYMASTER_RPC_NODES:()=>nJ,PRIME:()=>nA,RANGE_FELT:()=>nN,RANGE_I128:()=>nP,RANGE_I16:()=>nR,RANGE_I32:()=>nB,RANGE_I64:()=>nj,RANGE_I8:()=>nx,RANGE_U128:()=>nL,RANGE_U16:()=>nD,RANGE_U32:()=>nC,RANGE_U64:()=>nk,RANGE_U8:()=>nM,RANGE_U96:()=>nO,RPC_DEFAULT_NODES:()=>nX,SNIP9_V1_INTERFACE_ID:()=>nF,SNIP9_V2_INTERFACE_ID:()=>nH,SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS:()=>n1,SYSTEM_MESSAGES:()=>n0,StarknetChainId:()=>nZ,SupportedRpcVersion:()=>nQ,TEXT_TO_FELT_MAX_LEN:()=>n_,TransactionHashPrefix:()=>nG,UDC:()=>nz,ZERO:()=>nE});var r5={};r0(r5,{JRPC:()=>r3,PAYMASTER_API:()=>s,RPCSPEC08:()=>o,RPCSPEC09:()=>h});var r3={},r6={};r2(r6,h),r2(r5,r6),r0({}
1,{IS_BROWSER:()=>r8,addHexPrefix:()=>ns,arrayBufferToString:()=>r9,atobUniversal:()=>nr,bigIntToUint8Array:()=>ny,btoaUniversal:()=>nn,buf2hex:()=>ni,calcByteLength:()=>nc,concatenateArrayBuffer:()=>nh,hexStringToUint8Array:()=>nf,padLeft:()=>no,pascalToSnake:()=>nd,removeHexPrefix:()=>na,sanitizeBytes:()=>nl,sanitizeHex:()=>nu,stringToUint8Array:()=>ng,uint8ArrayToBigInt:()=>nm,utf8ToArray:()=>nt,utf8ToBigInt:()=>ne,utf8ToUint8Array:()=>r7});var r8="undefined"!=typeof window;function r9(t){return new Uint8Array(t).reduce((t,e)=>t+String.fromCharCode(e),"")}function r7(t){return new TextEncoder().encode(t)}var nt=r7;function ne(t){return nm(r7(t))}function nr(t){return tP.US.decode(t)}function nn(t){return tP.US.encode(new Uint8Array(t))}function ni(t){return t.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"")}function na(t){return t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t}function ns(t){return`0x${na(t)}`}function no(t,e,r="0"){return function(t,e,r,n="0"){let i=e-t.length,a=t;if(i>0){let e=n.repeat(i);a=r?e+t:t+e}return a}(t,e,!0,r)}function nc(t,e=8){let{length:r}=t,n=r%e;return n?(r-n)/e*e+e:r}function nl(t,e=8,r="0"){return no(t,nc(t,e),r)}function nu(t){let e=nl(na(t),2);return e?ns(e):e}var nd=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t;function nh(t){let e=new Uint8Array(t.reduce((t,e)=>t+e.byteLength,0)),r=0;return t.forEach(t=>{e.set(t,r),r+=t.byteLength}),e}function nf(t){if(!np(ns(t)))throw Error(`Invalid hex string: "${t}"`);let e=na(nu(t)),r=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)r[t/2]=parseInt(e.substring(t,t+2),16);return r}function np(t){return/^0[xX][0-9a-fA-F]*$/.test(t)}function ng(t){return np(t)?nf(t):/^[0-9]+$/.test(t)?ny(BigInt(t)):r7(t)}function ny(t){if(t<0n)throw Error(`Cannot convert negative bigint ${t} to Uint8Array`);if(0n===t)return new Uint8Array([0]);let e=t.toString(16);e.length%2!=0&&(e=`0${e}`);let r=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)r[t/2]=parseInt(e.substring(t,t+2),16);return r}function nm(t){if(!t||0===t.length)return 0n;let e="0x";for(let r=0;r<t.length;r+=1)e+=t[r].toString(16).padStart(2,"0");return BigInt(e)}var n_=31,nE=0n,nb=2n**250n-1n,nI=2n**31n-1n,nw=nE,nA=2n**251n+17n*2n**192n+1n,nv=256n,nT=2n**251n-nv,nS=(t,e)=>({min:t,max:e}),nN=nS(nE,nA-1n),nM=nS(nE,2n**8n-1n),nD=nS(nE,2n**16n-1n),nC=nS(nE,2n**32n-1n),nk=nS(nE,2n**64n-1n),nO=nS(nE,2n**96n-1n),nL=nS(nE,2n**128n-1n),nx=nS(-(2n**7n),2n**7n-1n),nR=nS(-(2n**15n),2n**15n-1n),nB=nS(-(2n**31n),2n**31n-1n),nj=nS(-(2n**63n),2n**63n-1n),nP=nS(-(2n**127n),2n**127n-1n),nU={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},nz={ADDRESS:"0x02ceed65a4bd731034c01113685c831b01c15d7d432f71afb1cf1634b53a2125",ENTRYPOINT:"deploy_contract"},nV="0x414e595f43414c4c4552",nF="0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181",nH="0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872",nY=128,n$=2147483648n,nW={SN_MAIN:"https://alpha-mainnet.starknet.io",SN_SEPOLIA:"https://alpha-sepolia.starknet.io"},nq={SN_MAIN:"SN_MAIN",SN_SEPOLIA:"SN_SEPOLIA"},nZ={SN_MAIN:"0x534e5f4d41494e",SN_SEPOLIA:"0x534e5f5345504f4c4941"},nG={DECLARE:"0x6465636c617265",DEPLOY:"0x6465706c6f79",DEPLOY_ACCOUNT:"0x6465706c6f795f6163636f756e74",INVOKE:"0x696e766f6b65",L1_HANDLER:"0x6c315f68616e646c6572"},nQ={"0.8.1":"0.8.1","0.9.0":"0.9.0",v0_8_1:"0.8.1",v0_9_0:"0.9.0"},nK={rpcVersion:"0.9.0",transactionVersion:r5.ETransactionVersion.V3,logLevel:"INFO",resourceBoundsOverhead:{l1_gas:{max_amount:50,max_price_per_unit:50},l1_data_gas:{max_amount:50,max_price_per_unit:50},l2_gas:{max_amount:50,max_price_per_unit:50}},defaultTipType:"recommendedTip",fetch:void 0,websocket:void 0,buffer:void 0,blake:void 0},nX={SN_MAIN:["https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/"],SN_SEPOLIA:["https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/"]},nJ={SN_MAIN:["https://starknet.paymaster.avnu.fi"],SN_SEPOLIA:["https://sepolia.paymaster.avnu.fi"]},n0={legacyTxWarningMessage:"You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!",legacyTxRPC08Message:"RPC 0.8+ do not support legacy transactions, use RPC 0.8+ v3 transactions!",SWOldV3:"RPC 0.7 V3 tx (improper resource bounds) not supported in RPC 0.8+",channelVersionMismatch:"Channel specification version is not compatible with the connected node Specification Version",unsupportedSpecVersion:"The connected node specification version is not supported by this library",maxFeeInV3:"maxFee is not supported in V3 transactions, use resourceBounds instead",declareNonSierra:"Declaring non Sierra (Cairo0)contract using RPC 0.8+",unsupportedMethodForRpcVersion:"Unsupported method for RPC version",txEvictedFromMempool:"Transaction TTL, evicted from the mempool, try to increase the tip",consensusFailed:"Consensus failed to finalize the block proposal",txFailsBlockBuildingValidation:"Transaction fails block building validation"},n1="0.14.1",n2=(class t{static instance;config;constructor(){this.initialize()}initialize(){this.config={...nK}}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(t,e){return this.config[t]??e}set(t,e){this.config[t]=e}update(t){this.config={...this.config,...t}}getAll(){return{...this.config}}reset(){this.initialize()}delete(t){delete this.config[t]}hasKey(t){return t in this.config}}).getInstance(),n4={DEBUG:5,INFO:4,WARN:3,ERROR:2,FATAL:1,OFF:0},n5=(class t{static instance;config;constructor(){this.config=n2}static getInstance(){return t.instance||(t.instance=new t),t.instance}getTimestamp(){return new Date().toISOString()}
1shouldLog(t){return t<=n4[this.config.get("logLevel","INFO")]}formatMessage(t){let{level:e,message:r,timestamp:n,data:i}=t,a=`[${n}] ${e}: ${r}`;if(i)try{a+=`
2${JSON.stringify(i,null,2)}`}catch(t){a+=`
3[JSON.stringify Error/Circular]: ${t}`}return a}log(t,e,r){if(!this.shouldLog(n4[t]))return;let n={level:t,message:e,timestamp:this.getTimestamp(),data:r},i=this.formatMessage(n);switch(t){case"DEBUG":console.debug(i);break;case"INFO":console.info(i);break;case"WARN":console.warn(i);break;case"ERROR":case"FATAL":console.error(i);break;case"OFF":break;default:console.log(i)}}debug(t,e){this.log("DEBUG",t,e)}info(t,e){this.log("INFO",t,e)}warn(t,e){this.log("WARN",t,e)}error(t,e){this.log("ERROR",t,e)}fatal(t,e){this.log("FATAL",t,e)}setLogLevel(t){this.config.set("logLevel",t)}getLogLevel(){return this.config.get("logLevel","INFO")}getEnabledLogLevels(){return Object.keys(n4).filter(t=>this.shouldLog(n4[t])&&"OFF"!==t)}}).getInstance(),n3={};r0(n3,{RpcChannel:()=>o3});var{ETransactionVersion:n6}=h,{ETransactionVersion2:n8}=h,{ETransactionVersion3:n9}=h,{EDataAvailabilityMode:n7}=o,{EDAMode:it}=o;function ie(t){return"l1_data_gas"in t}var{ETransactionStatus:ir}=o,{ETransactionExecutionStatus:ii}=o,{ETransactionType:ia}=h,{EBlockStatus:is}=h,{ETransactionFinalityStatus:io}=h,{ETransactionExecutionStatus:ic}=h,{EBlockTag:il}=h,iu={DEPLOY:"DEPLOY",CALL:"CALL",INVOKE:"INVOKE"},id={u8:"core::integer::u8",u16:"core::integer::u16",u32:"core::integer::u32",u64:"core::integer::u64",u96:"core::integer::u96",u128:"core::integer::u128",u256:"core::integer::u256",u512:"core::integer::u512"},ih={i8:"core::integer::i8",i16:"core::integer::i16",i32:"core::integer::i32",i64:"core::integer::i64",i128:"core::integer::i128"},ip={ClassHash:"core::starknet::class_hash::ClassHash",ContractAddress:"core::starknet::contract_address::ContractAddress",Secp256k1Point:"core::starknet::secp256k1::Secp256k1Point",U96:"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"};function ig(t){return"execute"in t}var iy={StarkNetDomain:[{name:"name",type:"felt"},{name:"version",type:"felt"},{name:"chainId",type:"felt"}],OutsideExecution:[{name:"caller",type:"felt"},{name:"nonce",type:"felt"},{name:"execute_after",type:"felt"},{name:"execute_before",type:"felt"},{name:"calls_len",type:"felt"},{name:"calls",type:"OutsideCall*"}],OutsideCall:[{name:"to",type:"felt"},{name:"selector",type:"felt"},{name:"calldata_len",type:"felt"},{name:"calldata",type:"felt*"}]},im={StarknetDomain:[{name:"name",type:"shortstring"},{name:"version",type:"shortstring"},{name:"chainId",type:"shortstring"},{name:"revision",type:"shortstring"}],OutsideExecution:[{name:"Caller",type:"ContractAddress"},{name:"Nonce",type:"felt"},{name:"Execute After",type:"u128"},{name:"Execute Before",type:"u128"},{name:"Calls",type:"Call*"}],Call:[{name:"To",type:"ContractAddress"},{name:"Selector",type:"selector"},{name:"Calldata",type:"felt*"}]},i_={UNSUPPORTED:"0",V1:"1",V2:"2"};r0({},{parse:()=>ib,parseAlwaysAsBig:()=>iI,stringify:()=>iw});var iE=t=>{if(!tU.U(t))return parseFloat(t);let e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},ib=t=>tU.Qc(String(t),void 0,iE),iI=t=>tU.Qc(String(t),void 0,tU.A7),iw=(t,e,r,n)=>tU.Pz(t,e,r,n),iA=class{nodeUrl;headers;interval;requestId=0;pendingRequests={};batchPromises={};delayTimer;delayPromise;delayPromiseResolve;baseFetch;rpcMethods;constructor(t){this.nodeUrl=t.nodeUrl,this.headers=t.headers,this.interval=t.interval,this.baseFetch=t.baseFetch,this.rpcMethods=t.rpcMethods}async wait(){return this.delayPromise&&this.delayPromiseResolve||(this.delayPromise=new Promise(t=>{this.delayPromiseResolve=t})),this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=void 0),this.delayTimer=setTimeout(()=>{this.delayPromiseResolve&&(this.delayPromiseResolve(),this.delayPromise=void 0,this.delayPromiseResolve=void 0)},this.interval),this.delayPromise}addPendingRequest(t,e,r){let n={id:r??`batched_${this.requestId+=1}`,jsonrpc:"2.0",method:t.description||String(t),params:e??void 0};return this.pendingRequests[n.id]=n,n.id}async sendBatch(t){return(await this.baseFetch(this.nodeUrl,{method:"POST",body:iw(t),headers:this.headers})).json()}async fetch(t,e,r){let n=this.addPendingRequest(t,e,r);await this.wait();let i=this.pendingRequests;if(this.pendingRequests={},!this.batchPromises[n]){let t=this.sendBatch(Object.values(i));
3Object.keys(i).forEach(e=>{this.batchPromises[e]=t})}let a=await this.batchPromises[n];delete this.batchPromises[n];let s=a.find(t=>t.id===n);if(!s)throw Error(`Couldn't find the result for the request. Method: ${String(t)}`);return s}};function iv(t,e){if(!t)throw Error(e||"Assertion failure")}var iT={};r0(iT,{addPercent:()=>iX,assertInRange:()=>iH,bigNumberishArrayToDecimalStringArray:()=>iY,bigNumberishArrayToHexadecimalStringArray:()=>i$,cleanHex:()=>iU,getDecimalString:()=>iq,getHexString:()=>iZ,getHexStringArray:()=>iG,getNext:()=>i1,hexToBytes:()=>iK,hexToDecimalString:()=>iF,isBigNumberish:()=>i0,isHex:()=>iL,isHexString:()=>ix,isStringWholeNumber:()=>iW,stringToSha256ToArrayBuff4:()=>iJ,toBigInt:()=>iR,toCairoBool:()=>iQ,toHex:()=>ij,toHex64:()=>iV,toHexString:()=>iP,toStorageKey:()=>iz,tryToBigInt:()=>iB});var iS=t=>void 0===t||void 0===t;function iN(t){return"number"==typeof t}function iM(t){return"boolean"==typeof t}function iD(t){return"bigint"==typeof t}function iC(t){return"string"==typeof t}function ik(t){return void 0!==rG&&t instanceof rG}function iO(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function iL(t){return/^0[xX][0-9a-fA-F]*$/.test(t)}var ix=iL;function iR(t){return BigInt(t)}function iB(t){return t?BigInt(t):void 0}function ij(t){return ns(iR(t).toString(16))}var iP=ij;function iU(t){return ij(t)}function iz(t){return ns(iR(t).toString(16).padStart(64,"0"))}function iV(t){let e=ns(iR(t).toString(16).padStart(64,"0"));if(66!==e.length)throw TypeError("number is too big for hex 0x(64) representation");return e}function iF(t){return BigInt(ns(t)).toString(10)}function iH(t,e,r,n=""){let i=""===n?"invalid length":`invalid ${n} length`,a=BigInt(t),s=BigInt(e),o=BigInt(r);iv(a>=s&&a<=o,`Message not signable, ${i}.`)}function iY(t){return t.map(t=>iR(t).toString(10))}function i$(t){return t.map(t=>ij(t))}function iW(t){return/^\d+$/.test(t)}function iq(t){if(iL(t))return iF(t);if(iW(t))return t;throw Error(`${t} needs to be a hex-string or whole-number-string`)}function iZ(t){if(iL(t))return t;if(iW(t))return iP(t);throw Error(`${t} needs to be a hex-string or whole-number-string`)}function iG(t){return t.map(iZ)}function iQ(t){return(+t).toString()}function iK(t){if(!iL(t))throw Error(`${t} needs to be a hex-string`);let e=na(t);return e.length%2!=0&&(e=`0${e}`),tX(e)}function iX(t,e){let r=BigInt(t);return r+r*BigInt(e)/100n}function iJ(t){return iK(ij(Number(BigInt(ns(ni(eD(t))))&nI)))}function i0(t){return iN(t)||iD(t)||iC(t)&&(iL(t)||iW(t))}function i1(t){let e=t.next();if(e.done)throw Error("Unexpected end of response");return e.value}function i2(t){let e=na(ij(BigInt(t))),r=e.length%2==0?e:`0${e}`;return ns((0,eC.keccak)(iK(ns(r))).toString(16))}function i4(t){return BigInt(ns((0,eC.keccak)(nt(t)).toString(16)))&nb}function i5(t){return ij(i4(t))}function i3(t){return iN(t)||iD(t)?ij(t):iL(t)?t:iW(t)?ij(t):i5(t)}function i6(t){let e=ns(t.reduce((t,e)=>t+na(ij(e)).padStart(64,"0"),""));return ns(tq(eX(iK(e))))}function i8(t,e,r,n,i){return i6([t,e,i,r,n.length,...n])}function i9(t,e,r){return i6([t,e,r.length,...r])}r0({},{getL1MessageHash:()=>i9,getL2MessageHash:()=>i8,getSelector:()=>i3,getSelectorFromName:()=>i5,keccakBn:()=>i2,solidityUint256PackedKeccak256:()=>i6,starknetKeccak:()=>i4});var i7={};function at(t){return/^[\x00-\x7F]*$/.test(t)}function ae(t){return t.length<=n_}function ar(t){return/^[0-9]*$/i.test(t)}function an(t){return iC(t)&&!iL(t)&&!iW(t)}r0(i7,{decodeShortString:()=>ac,encodeShortString:()=>ao,isASCII:()=>at,isDecimalString:()=>ar,isLongText:()=>aa,isShortString:()=>ae,isShortText:()=>ai,isText:()=>an,splitLongString:()=>as});var ai=t=>an(t)&&ae(t),aa=t=>an(t)&&!ae(t);function as(t){let e=RegExp(`[^]{1,${n_}}`,"g");return t.match(e)||[]}function ao(t){if(!at(t))throw Error(`${t} is not an ASCII string`);if(!ae(t))throw Error(`${t} is too long`);return ns(t.replace(/./g,t=>t.charCodeAt(0).toString(16)))}function ac(t){if(!at(t))throw Error(`${t} is not an ASCII string`);if(iL(t))return na(t).replace(/.{2}/g,t=>String.fromCharCode(parseInt(t,16)));if(ar(t))return ac("0X".concat(BigInt(t).toString(16)));throw Error(`${t} is not Hex or decimal`)}var al={};
3function au(t){let e=0n===BigInt(t.pending_word)?"":ac(ij(t.pending_word));return t.data.reduce((t,e)=>t+(0n===BigInt(e)?"":ac(ij(e))),"")+e}function ad(t){let e=as(t),r=e[e.length-1],n=e.map(ao),[i,a]=void 0===r||31===r.length?["0x00",0]:[n.pop(),r.length];return{data:0===n.length?[]:n,pending_word:i,pending_word_len:a}}r0(al,{byteArrayFromString:()=>ad,stringFromByteArray:()=>au});var ah={};function af(t){return Object.defineProperty(t,"__compiled__",{enumerable:!1,writable:!1,value:!0}),t}function ap(t){if(iD(t)||Number.isInteger(t))return t.toString();if(iC(t)){if(iL(t))return BigInt(t).toString();if(an(t)){if(!ae(t))throw Error(`${t} is a long string > 31 chars. Please split it into an array of short strings.`);return BigInt(ao(t)).toString()}if(iW(t))return t}if(iM(t))return`${+t}`;throw Error(`${t} can't be computed by felt()`)}r0(ah,{felt:()=>aq,getAbiContractVersion:()=>aH,getArrayType:()=>az,isCairo1Abi:()=>aV,isCairo1Type:()=>aU,isLen:()=>aI,isTypeArray:()=>aA,isTypeBool:()=>ax,isTypeContractAddress:()=>aR,isTypeEnum:()=>aN,isTypeEthAddress:()=>aB,isTypeFelt:()=>aw,isTypeInt:()=>ak,isTypeLiteral:()=>aL,isTypeNamedTuple:()=>aT,isTypeNonZero:()=>aF,isTypeOption:()=>aM,isTypeResult:()=>aD,isTypeSecp256k1Point:()=>aP,isTypeStruct:()=>aS,isTypeTuple:()=>av,isTypeU96:()=>aj,isTypeUint:()=>aC,isTypeUint256:()=>aO,tuple:()=>aW,uint256:()=>aY,uint512:()=>a$});var ag=class t{data;static abiSelector="core::felt252";constructor(e){t.validate(e);let r=t.__processData(e);this.data=r.subarray(r.findIndex(t=>t>0))}static __processData(t){if(iC(t))return ng(t);if(iD(t))return ny(t);if(Number.isInteger(t))return ny(BigInt(t));if(iM(t))return ny(BigInt(t?1:0));throw Error(`${t} can't be computed by felt()`)}toBigInt(){return nm(this.data)}decodeUtf8(){return new TextDecoder().decode(this.data)}toHexString(){return ns(this.toBigInt().toString(16))}toApiRequest(){return af([this.toHexString()])}static validate(e){iv(null!==e,"null value is not allowed for felt252"),iv(void 0!==e,"undefined value is not allowed for felt252"),iv(iC(e)||iN(e)||iD(e)||iM(e),`Unsupported data type '${typeof e}' for felt252. Expected string, number, bigint, or boolean`);let r=t.__processData(e),n=nm(r);iv(n>=0n&&n<nA,`Value ${r} is out of felt252 range [0, ${nA})`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},ay=(1n<<128n)-1n,am=(1n<<256n)-1n,a_=class t{low;high;static abiSelector="core::integer::u256";constructor(...e){if(iO(e[0])&&1===e.length&&"low"in e[0]&&"high"in e[0]){let r=t.validateProps(e[0].low,e[0].high);this.low=r.low,this.high=r.high}else if(1===e.length){let r=t.validate(e[0]);this.low=r&ay,this.high=r>>128n}else if(2===e.length){let r=t.validateProps(e[0],e[1]);this.low=r.low,this.high=r.high}else throw Error("Incorrect constructor parameters")}static validate(t){iv(null!==t,"null value is not allowed for u256"),iv(void 0!==t,"undefined value is not allowed for u256"),iv(i0(t)||iO(t),`Unsupported data type '${typeof t}' for u256. Expected string, number, bigint, or Uint256 object`);let e=BigInt(t);return iv(e>=0n,"bigNumberish is smaller than UINT_256_MIN"),iv(e<=am,"bigNumberish is bigger than UINT_256_MAX"),e}static validateProps(t,e){let r=BigInt(t),n=BigInt(e);return iv(r>=0n&&r<=0xffffffffffffffffffffffffffffffffn,"low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX"),iv(n>=0n&&n<=0xffffffffffffffffffffffffffffffffn,"high is out of range UINT_256_HIGH_MIN - UINT_256_HIGH_MAX"),{low:r,high:n}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e),i1(e))}toBigInt(){return(this.high<<128n)+this.low}toUint256HexString(){return{low:ns(this.low.toString(16)),high:ns(this.high.toString(16))}}toUint256DecimalString(){return{low:this.low.toString(10),high:this.high.toString(10)}}toApiRequest(){return[ap(this.low),ap(this.high)]}},aE=(1n<<512n)-1n,ab=class t{limb0;limb1;limb2;limb3;static abiSelector="core::integer::u512";constructor(...e){if(iO(e[0])&&1===e.length&&"limb0"in e[0]&&"limb1"in e[0]&&"limb2"in e[0]&&"limb3"in e[0]){let r=t.validateProps(e[0].limb0,e[0].limb1,e[0].limb2,e[0].limb3);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}else if(1===e.length){let r=t.validate(e[0]);this.limb0=r&ay,this.limb1=(r&ay<<128n)>>128n,this.limb2=(r&ay<<256n)>>256n,this.limb3=r>>384n}else if(4===e.length){let r=t.validateProps(e[0],e[1],e[2],e[3]);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}else throw Error("Incorrect Uint512 constructor parameters")}static validate(t){iv(null!==t,"null value is not allowed for u512"),iv(void 0!==t,"undefined value is not allowed for u512"),iv(i0(t)||iO(t),`Unsupported data type '${typeof t}' for u512. Expected string, number, bigint, or Uint512 object`);let e=BigInt(t);return iv(e>=0n,"bigNumberish is smaller than UINT_512_MIN."),iv(e<=aE,"bigNumberish is bigger than UINT_512_MAX."),e}static validateProps(t,e,r,n){let i=BigInt(t),a=BigInt(e),s=BigInt(r),o=BigInt(n);
3return[i,a,s,o].forEach((t,e)=>{iv(t>=0n&&t<=ay,`limb${e} is not in the range of a u128 number`)}),{limb0:i,limb1:a,limb2:s,limb3:o}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){let r=i1(e);return new t(r,i1(e),i1(e),i1(e))}toBigInt(){return(this.limb3<<384n)+(this.limb2<<256n)+(this.limb1<<128n)+this.limb0}toUint512HexString(){return{limb0:ns(this.limb0.toString(16)),limb1:ns(this.limb1.toString(16)),limb2:ns(this.limb2.toString(16)),limb3:ns(this.limb3.toString(16))}}toUint512DecimalString(){return{limb0:this.limb0.toString(10),limb1:this.limb1.toString(10),limb2:this.limb2.toString(10),limb3:this.limb3.toString(10)}}toApiRequest(){return[ap(this.limb0),ap(this.limb1),ap(this.limb2),ap(this.limb3)]}},aI=t=>/_len$/.test(t),aw=t=>"felt"===t||"core::felt252"===t,aA=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),av=t=>/^\(.*\)$/i.test(t),aT=t=>/\(.*\)/i.test(t)&&t.includes(":"),aS=(t,e)=>t in e,aN=(t,e)=>t in e,aM=t=>t.startsWith("core::option::Option::"),aD=t=>t.startsWith("core::result::Result::"),aC=t=>Object.values(id).includes(t),ak=t=>Object.values(ih).includes(t),aO=t=>a_.isAbiType(t),aL=t=>Object.values(ip).includes(t),ax=t=>"core::bool"===t,aR=t=>t===ip.ContractAddress,aB=t=>"core::starknet::eth_address::EthAddress"===t,aj=t=>"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"===t,aP=t=>t===ip.Secp256k1Point,aU=t=>t.includes("::"),az=t=>aU(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function aV(t){let{cairo:e}=aH(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function aF(t){return t.startsWith("core::zeroable::NonZero::")}function aH(t){if(t.find(t=>"interface"===t.type))return{cairo:"1",compiler:"2"};let e=t.find(t=>("function"===t.type||"constructor"===t.type)&&(t.inputs.length||t.outputs.length));return e?aU((e.inputs.length?e.inputs:e.outputs)[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}:{cairo:void 0,compiler:void 0}}var aY=t=>new a_(t).toUint256DecimalString(),a$=t=>new ab(t).toUint512DecimalString(),aW=(...t)=>({...t});function aq(t){return ap(t)}var aZ=class{variant;constructor(t){let e=Object.values(t);if(0===e.length)throw Error("This Enum must have at least 1 variant");if(1!==e.filter(t=>!iS(t)).length)throw Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){return Object.values(this.variant).find(t=>!iS(t))}activeVariant(){let t=Object.entries(this.variant).find(t=>!iS(t[1]));return iS(t)?"":t[0]}},aG={Some:0,None:1},aQ=class{Some;None;constructor(t,e){if(!(t in Object.values(aG)))throw Error("Wrong variant! It should be CairoOptionVariant.Some or .None.");if(t===aG.Some){if(iS(e))throw Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=e,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){return this.None?void 0:this.Some}isSome(){return!iS(this.Some)}isNone(){return!0===this.None}},aK={Ok:0,Err:1},aX=class{Ok;Err;constructor(t,e){if(!(t in Object.values(aK)))throw Error("Wrong variant! It should be CairoResultVariant.Ok or .Err.");t===aK.Ok?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(!iS(this.Ok))return this.Ok;if(!iS(this.Err))return this.Err;throw Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!iS(this.Ok)}isErr(){return!iS(this.Err)}},aJ={isBN:(t,e,r)=>{if(!iD(t[r]))throw Error(`Data and formatter mismatch on ${r}:${e[r]}, expected response data ${r}:${t[r]} to be BN instead it is ${typeof t[r]}`)},unknown:(t,e,r)=>{throw Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)}},a0=class t{static MAX_BYTE_SIZE=31;data;static abiSelector="core::bytes_31::bytes31";constructor(e){t.validate(e);let r=t.__processData(e);this.data=new Uint8Array(t.MAX_BYTE_SIZE),this.data.set(r,t.MAX_BYTE_SIZE-r.length)}static __processData(t){if(iC(t))return ng(t);if(ik(t)||t instanceof Uint8Array)return new Uint8Array(t);throw Error("Invalid input type for CairoBytes31. Expected string, Buffer, or Uint8Array")}toApiRequest(){return af([this.toHexString()])}toBigInt(){return nm(this.data)}decodeUtf8(){let t=this.data.findIndex(t=>t>0),e=this.data.subarray(t>=0?t:1/0);return new TextDecoder().decode(e)}toHexString(t){return ns("padded"===t?ni(this.data):this.toBigInt().toString(16))}static validate(e){let r=t.__processData(e).length;iv(r<=this.MAX_BYTE_SIZE,`Data is too long: ${r} bytes (max ${this.MAX_BYTE_SIZE} bytes)`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},a1={FAILED_TO_RECEIVE_TXN:1,NO_TRACE_AVAILABLE:10,CONTRACT_NOT_FOUND:20,ENTRYPOINT_NOT_FOUND:21,BLOCK_NOT_FOUND:24,INVALID_TXN_INDEX:27,CLASS_HASH_NOT_FOUND:28,TXN_HASH_NOT_FOUND:29,PAGE_SIZE_TOO_BIG:31,NO_BLOCKS:32,INVALID_CONTINUATION_TOKEN:33,TOO_MANY_KEYS_IN_FILTER:34,CONTRACT_ERROR:40,TRANSACTION_EXECUTION_ERROR:41,STORAGE_PROOF_NOT_SUPPORTED:42,CLASS_ALREADY_DECLARED:51,INVALID_TRANSACTION_NONCE:52,INSUFFICIENT_RESOURCES_FOR_VALIDATE:53,INSUFFICIENT_ACCOUNT_BA
3LANCE:54,VALIDATION_FAILURE:55,COMPILATION_FAILED:56,CONTRACT_CLASS_SIZE_IS_TOO_LARGE:57,NON_ACCOUNT:58,DUPLICATE_TX:59,COMPILED_CLASS_HASH_MISMATCH:60,UNSUPPORTED_TX_VERSION:61,UNSUPPORTED_CONTRACT_CLASS_VERSION:62,UNEXPECTED_ERROR:63,REPLACEMENT_TRANSACTION_UNDERPRICED:64,FEE_BELOW_MINIMUM:65,INVALID_SUBSCRIPTION_ID:66,TOO_MANY_ADDRESSES_IN_FILTER:67,TOO_MANY_BLOCKS_BACK:68,COMPILATION_ERROR:100,INVALID_ADDRESS:150,TOKEN_NOT_SUPPORTED:151,INVALID_SIGNATURE:153,MAX_AMOUNT_TOO_LOW:154,CLASS_HASH_NOT_SUPPORTED:155,PAYMASTER_TRANSACTION_EXECUTION_ERROR:156,INVALID_TIME_BOUNDS:157,INVALID_DEPLOYMENT_DATA:158,INVALID_CLASS_HASH:159,INVALID_ID:160,UNKNOWN_ERROR:163},a2=class extends Error{name;constructor(t){super(t),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),function(t,e){let{setPrototypeOf:r}=Object;r?r(t,e):t.__proto__=e}(this,new.target.prototype),function(t,e=t.constructor){let{captureStackTrace:r}=Error;r&&r(t,e)}(this)}},a4=class extends a2{},a5=class extends a4{constructor(t,e,r){super(`RPC: ${e} with params ${iw(r,null,2)}
4
5      ${t.code}: ${t.message}: ${iw(t.data)}`),this.baseError=t,this.request={method:e,params:r}}request;get code(){return this.baseError.code}isType(t){return a1[t]===this.code}},a3=n2.get("buffer")||void 0!==rG&&rG||"undefined"!=typeof globalThis&&globalThis.Buffer||"undefined"!=typeof window&&window.Buffer||"undefined"!=typeof global&&global.Buffer||class{constructor(){throw new a4("Buffer not detected, use 'config.set(\"buffer\", YourBufferPolyfill)' or polyfill or Node.js environment for Buffer support")}static from(t){throw new a4("Buffer not detected, use 'config.set(\"buffer\", YourBufferPolyfill)' or polyfill or Node.js environment for Buffer support")}static isBuffer(t){let e=n2.get("buffer")||void 0!==rG&&rG;return e&&e.isBuffer&&e.isBuffer(t)}},a6=class t{data;static abiSelector="core::u32::u32";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data))}toHexString(){return ns(this.toBigInt().toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=0n&&r<=2n**32n-1n,"Value is out of u32 range [0, 2^32)")}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},a8=class t{data=[];pending_word;pending_word_len;static abiSelector="core::byte_array::ByteArray";constructor(...e){if(3===e.length){let[t,r,n]=e;iv(Array.isArray(t)&&r instanceof ag&&n instanceof a6,"Invalid constructor parameters. Expected (CairoBytes31[], CairoFelt252, CairoUint32)"),this.data=t,this.pending_word=r,this.pending_word_len=n;return}let r=e[0];t.validate(r);let{data:n,pending_word:i,pending_word_len:a}=t.__processData(r);this.data=n,this.pending_word=i,this.pending_word_len=a}static __processData(t){let e,r,n;if(t instanceof Uint8Array)e=t;else if(ik(t))e=new Uint8Array(t);else if(iC(t))e=ng(t);else if(iD(t))e=ny(t);else if(Number.isInteger(t))e=ny(BigInt(t));else throw Error("Invalid input type. Expected Uint8Array, Buffer, string, number, or bigint");let i=a0.MAX_BYTE_SIZE,a=Math.floor(e.length/i),s=e.length%i,o=[];for(let t=0;t<a;t+=1){let r=t*i,n=r+i,a=e.slice(r,n);o.push(new a0(a))}if(s>0){let t=e.slice(a*i),o="0x";for(let e=0;e<t.length;e+=1)o+=t[e].toString(16).padStart(2,"0");r=new ag(o),n=new a6(s)}else r=new ag(0),n=new a6(0);return{data:o,pending_word:r,pending_word_len:n}}toApiRequest(){return this.assertInitialized(),af([ns(this.data.length.toString(16)),...this.data.flatMap(t=>t.toApiRequest()),...this.pending_word.toApiRequest(),...this.pending_word_len.toApiRequest()])}decodeUtf8(){let t=nh(this.toElements());return new TextDecoder().decode(t)}toBigInt(){let t=nh(this.toElements());if(0===t.length)return 0n;let e=0n;return t.forEach(t=>{e=256n*e+BigInt(t)}),e}toHexString(){let t=nh(this.toElements());return ns(0===t.length?"0":ni(t))}toBuffer(){let t=nh(this.toElements());return a3.from(t)}toElements(){this.assertInitialized();let t=this.data.flatMap(t=>t.data),e=Number(this.pending_word_len.toBigInt());if(e){let r=new Uint8Array(e),n=e-this.pending_word.data.length;r.set(this.pending_word.data,n),t.push(r)}return t}assertInitialized(){iv(this.data&&void 0!==this.pending_word&&void 0!==this.pending_word_len,"CairoByteArray is not properly initialized")}static validate(t){iv(null!=t,"Invalid input: null or undefined"),iv(!Array.isArray(t)||t instanceof Uint8Array,"Invalid input: arrays are not supported, use Uint8Array"),iv("object"!=typeof t||ik(t)||t instanceof Uint8Array,"Invalid input for CairoByteArray: objects are not supported"),iv(!iN(t)||Number.isInteger(t),"Invalid input for CairoByteArray: decimal numbers are not supported, only integers"),iv(!iN(t)||t>=0,"Invalid input for CairoByteArray: negative numbers are not supported"),iv(!iD(t)||t>=0n,"Invalid input for CairoByteArray: negative bigints are not supported"),iv(t instanceof Uint8Array||ik(t)||iC(t)||iN(t)||iD(t),"Invalid input type. Expected Uint8Array, Buffer, string, number, or bigint")}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(Array.from({length:Number(i1(e))},()=>a0.factoryFromApiResponse(e)),ag.factoryFromApiResponse(e),a6.factoryFromApiResponse(e))}},a9=class t{data;static abiSelector="core::integer::u8";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data))}toHexString(){return ns(this.toBigInt().toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nM.min&&r<=nM.max,`Value is out of u8 range [${nM.min}, ${nM.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},a7=class t{data;static abiSelector="core::integer::u16";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data))}toHexString(){return ns(this.toBigInt().toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nD.min&&r<=nD.max,`Value is out of u16 range [${nD.min}, ${nD.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},st=class t{data;static abiSelector="core::integer::u64";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data))}toHexString(){return ns(this.toBigInt().toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nk.min&&r<=nk.max,`Value is out of u64 range [${nk.min}, ${nk.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},se=class t{data;static abiSelector="core::integer::u96";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data))}toHexString(){return ns(this.toBigInt().toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nO.min&&r<=nO.max,`Value is out of u96 range [${nO.min}, ${nO.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},sr=class t{data;static abiSelector="core::integer::u128";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data))}toHexString(){return ns(this.toBigInt().toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nL.min&&r<=nL.max,`Value is out of u128 range [${nL.min}, ${nL.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){return new t(i1(e))}},sn=class t{data;static abiSelector="core::integer::i8";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data>=0n?this.data:256n+this.data))}toHexString(){let t=this.toBigInt();return t<0n?ns((nA+t).toString(16)):ns(t.toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nx.min&&r<=nx.max,`Value is out of i8 range [${nx.min}, ${nx.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){let r=BigInt(i1(e));return new t(r>nA/2n?r-nA:r)}},si=class t{data;static abiSelector="core::integer::i16";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data>=0n?this.data:65536n+this.data))}toHexString(){let t=this.toBigInt();return t<0n?ns((nA+t).toString(16)):ns(t.toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nR.min&&r<=nR.max,`Value is out of i16 range [${nR.min}, ${nR.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){let r=BigInt(i1(e));return new t(r>nA/2n?r-nA:r)}},sa=class t{data;static abiSelector="core::integer::i32";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data>=0n?this.data:4294967296n+this.data))}toHexString(){let t=this.toBigInt();return t<0n?ns((nA+t).toString(16)):ns(t.toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nB.min&&r<=nB.max,`Value is out of i32 range [${nB.min}, ${nB.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){let r=BigInt(i1(e));return new t(r>nA/2n?r-nA:r)}},ss=class t{data;static abiSelector="core::integer::i64";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data>=0n?this.data:2n**64n+this.data))}toHexString(){let t=this.toBigInt();return t<0n?ns((nA+t).toString(16)):ns(t.toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nj.min&&r<=nj.max,`Value is out of i64 range [${nj.min}, ${nj.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){let r=BigInt(i1(e));return new t(r>nA/2n?r-nA:r)}},so=class t{data;static abiSelector="core::integer::i128";constructor(e){t.validate(e),this.data=t.__processData(e)}static __processData(t){return iC(t)&&an(t)?ne(t):BigInt(t)}toApiRequest(){return af([this.toHexString()])}toBigInt(){return this.data}decodeUtf8(){return new TextDecoder().decode(ny(this.data>=0n?this.data:2n**128n+this.data))}toHexString(){let t=this.toBigInt();return t<0n?ns((nA+t).toString(16)):ns(t.toString(16))}static validate(e){iv(null!=e,"Invalid input: null or undefined"),iv(!iO(e)&&!Array.isArray(e),"Invalid input: objects are not supported"),iv(!iN(e)||Number.isInteger(e),"Invalid input: decimal numbers are not supported, only integers");let r=t.__processData(e);iv(r>=nP.min&&r<=nP.max,`Value is out of i128 range [${nP.min}, ${nP.max}]`)}static is(e){try{return t.validate(e),!0}catch{return!1}}static isAbiType(e){return e===t.abiSelector}static factoryFromApiResponse(e){let r=BigInt(i1(e));return new t(r>nA/2n?r-nA:r)}};a0.abiSelector,a8.abiSelector,ag.abiSelector,a_.abiSelector,ab.abiSelector,a9.abiSelector,a7.abiSelector,st.abiSelector,se.abiSelector,sr.abiSelector,sn.abiSelector,si.abiSelector,sa.abiSelector,ss.abiSelector,so.abiSelector,a0.abiSelector,a8.abiSelector,ag.abiSelector,a_.abiSelector,ab.abiSelector,a9.abiSelector,a7.abiSelector,st.abiSelector,se.abiSelector,sr.abiSelector,sn.abiSelector,si.abiSelector,sa.abiSelector,ss.abiSelector,so.abiSelector,t=>so.factoryFromApiResponse(t).toBigInt();var sc={request:{[a0.abiSelector]:t=>new a0(t).toApiRequest(),[a8.abiSelector]:t=>new a8(t).toApiRequest(),[ag.abiSelector]:t=>ap(t),[a_.abiSelector]:t=>new a_(t).toApiRequest(),[ab.abiSelector]:t=>new ab(t).toApiRequest(),[a9.abiSelector]:t=>ap(t),[a7.abiSelector]:t=>ap(t),[st.abiSelector]:t=>ap(t),[se.abiSelector]:t=>ap(t),[sr.abiSelector]:t=>ap(t),[sn.abiSelector]:t=>new sn(t).toApiRequest(),[si.abiSelector]:t=>new si(t).toApiRequest(),[sa.abiSelector]:t=>new sa(t).toApiRequest(),[ss.abiSelector]:t=>new ss(t).toApiRequest(),[so.abiSelector]:t=>new so(t).toApiRequest()},response:{[a0.abiSelector]:t=>a0.factoryFromApiResponse(t).decodeUtf8(),[a8.abiSelector]:t=>a8.factoryFromApiResponse(t).decodeUtf8(),[ag.abiSelector]:t=>BigInt(i1(t)),[a_.abiSelector]:t=>a_.factoryFromApiResponse(t).toBigInt(),[ab.abiSelector]:t=>ab.factoryFromApiResponse(t).toBigInt(),[a9.abiSelector]:t=>BigInt(i1(t)),[a7.abiSelector]:t=>BigInt(i1(t)),[st.abiSelector]:t=>BigInt(i1(t)),[se.abiSelector]:t=>BigInt(i1(t)),[sr.abiSelector]:t=>BigInt(i1(t)),[sn.abiSelector]:t=>BigInt(i1(t)),[si.abiSelector]:t=>BigInt(i1(t)),[sa.ab
5iSelector]:t=>BigInt(i1(t)),[ss.abiSelector]:t=>BigInt(i1(t)),[so.abiSelector]:t=>BigInt(i1(t))}},sl=class{abi;parsingStrategy;constructor(t,e){this.abi=t,this.parsingStrategy=e||sc}getRequestParser(t){if(this.parsingStrategy.request[t])return this.parsingStrategy.request[t];throw Error(`Parser for ${t} not found`)}getResponseParser(t){if(this.parsingStrategy.response[t])return this.parsingStrategy.response[t];throw Error(`Parser for ${t} not found`)}methodInputsLength(t){return t.inputs.reduce((t,e)=>aI(e.name)?t:t+1,0)}getMethod(t){return this.abi.find(e=>e.name===t)}getLegacyFormat(){return this.abi}},su=class{abi;parsingStrategy;constructor(t,e){this.abi=t,this.parsingStrategy=e||sc}getRequestParser(t){if(this.parsingStrategy.request[t])return this.parsingStrategy.request[t];throw Error(`Parser for ${t} not found`)}getResponseParser(t){if(this.parsingStrategy.response[t])return this.parsingStrategy.response[t];throw Error(`Parser for ${t} not found`)}methodInputsLength(t){return t.inputs.length}getMethod(t){let e=this.abi.find(t=>"interface"===t.type);return e?.items?.find(e=>e.name===t)}getLegacyFormat(){return this.abi.flatMap(t=>"interface"===t.type?t.items:t)}};function sd(t,e){let r=t.find(t=>"interface"===t.type)?2:aV(t)?1:0;if(0===r||1===r)return new sl(t,e);if(2===r)return new su(t,e);throw Error(`Unsupported ABI version ${r}`)}function sh(t,e,r){return"constructor"===t&&!r&&!e.length}function sf(t,e,r){for(let n=0,i=0;n<t.length;n++)if(t[n]===e)i++;else if(t[n]===r&&0==--i)return n;return Number.POSITIVE_INFINITY}function sp(t){return aU(t)?function(t){let e;let r=t.slice(1,-1),n=[],i=0;for(;i<r.length;){switch(!0){case"("===r[i]:e=i+sf(r.slice(i),"(",")")+1;break;case r.startsWith("core::result::Result::<",i)||r.startsWith("core::array::Array::<",i)||r.startsWith("core::option::Option::<",i):e=i+sf(r.slice(i),"<",">")+1;break;default:{let t=r.indexOf(",",i);e=-1!==t?t:Number.POSITIVE_INFINITY}}n.push(r.slice(i,e)),i=e+2}return n}(t):function(t){let{subTuple:e,result:r}=function(t){if(!t.includes("("))return{subTuple:[],result:t};let e=[],r="",n=0;for(;n<t.length;){if("("===t[n]){let i=1,a=n;for(n++;i;)")"===t[n]&&i--,"("===t[n]&&i++,n++;e.push(t.substring(a,n)),r+=" ",n--}else r+=t[n];n++}return{subTuple:e,result:r}}(t.replace(/\s/g,"").slice(1,-1)),n=r.split(",").map(t=>e.length?t.replace(" ",e.shift()):t);return aT(t)&&(n=n.reduce((t,e)=>t.concat(function(t){let e=t.substring(0,t.indexOf(":")),r=t.substring(e.length+1);return{name:e,type:r}}(e)),[])),n}(t)}var sg=class t{content;arrayType;constructor(e,r){let n;iv(t.isTypeFixedArray(r),`The type ${r} is not a Cairo fixed array. Needs [type; length].`);try{t.getFixedArrayType(r)}catch{throw Error(`The type ${r} do not includes any content type. Needs [type; length].`)}try{n=t.getFixedArraySize(r)}catch{throw Error(`The type ${r} type do not includes any length. Needs [type; length].`)}iv(n===e.length,`The ABI type ${r} is expecting ${n} items. ${e.length} items provided.`),this.content=e,this.arrayType=r}static getFixedArraySize(t){let e=t.match(/(?<=; )\d+(?=\])/);if(null===e)throw Error(`ABI type ${t} do not includes a valid number after ';' character.`);return Number(e[0])}getFixedArraySize(){return t.getFixedArraySize(this.arrayType)}static getFixedArrayType=t=>{let e=t.match(/(?<=\[).+(?=;)/);if(null===e)throw Error(`ABI type ${t} do not includes a valid type of data.`);return e[0]};getFixedArrayType(){return t.getFixedArrayType(this.arrayType)}static compile(t){return t.reduce((t,e,r)=>(t[r]=e,t),{})}compile(){return t.compile(this.content)}static isTypeFixedArray(t){return/^\[.*;\s.*\]$/.test(t)&&/(?<=\[).+(?=;)/.test(t)&&/(?<=; )\d+(?=\])/.test(t)}};function sy({type:t,val:e,parser:r}){switch(!0){case a_.isAbiType(t):case ab.isAbiType(t):case a9.isAbiType(t):case a7.isAbiType(t):case st.isAbiType(t):case se.isAbiType(t):case sr.isAbiType(t):case sn.isAbiType(t):case si.isAbiType(t):case sa.isAbiType(t):case ss.isAbiType(t):case so.isAbiType(t):case a0.isAbiType(t):return r.getRequestParser(t)(e);case aP(t):{let t=na(ij(e)).padStart(128,"0"),r=aY(ns(t.slice(-64))),n=aY(ns(t.slice(0,-64)));return[ap(n.low),ap(n.high),ap(r.low),ap(r.high)]}default:return r.getRequestParser(ag.abiSelector)(e)}}function sm({element:t,type:e,structs:r,enums:n,parser:i}){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(sg.isTypeFixedArray(e)){let a=sg.getFixedArrayType(e),s=[];if(Array.isArray(t))s=new sg(t,e).content;else if("object"==typeof t)iv((s=Object.values(t)).length===sg.getFixedArraySize(e),`ABI type ${e}: object provided do not includes  ${sg.getFixedArraySize(e)} items. ${s.length} items provided.`);else throw Error(`ABI type ${e}: not an Array representing a cairo.fixedArray() provided.`);return s.reduce((t,e)=>t.concat(sm({element:e,type:a,structs:r,enums:n,parser:i})),[])}if(Array.isArray(t)){let a=[];a.push(ap(t.length));let s=az(e);return t.reduce((t,e)=>t.concat(sm({element:e,type:s,structs:r,enums:n,parser:i})),a)}if(a_.isAbiType(e)||ab.isAbiType(e))return i.getRequestParser(e)(t);if(r[e]&&r[e].members.length){if(aB(e))return sy({type:e,val:t,parser:i});if(a8.isAbiType(e))return i.getRequestParser(e)(t);let{members:a}=r[e];return a.reduce((e,a)=>e.concat(sm({element:t[a.name],type:a.type,structs:r,enums:n,parser:i})),[])}if(av(e))return(function(t,e){let r=sp(e),n=Object.values(t);if(n.length!==r.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match.
6      provided: ${n}
7      expected: ${r}`);return r.map((t,e)=>({element:n[e],type:t.type??t}))})(t,e).reduce((t,e)=>{let a=sm({element:e.element,type:e.type,structs:r,enums:n,parser:i});return t.concat(a)},[]);if(aN(e,n)){let{variants:a}=n[e];if(aM(e)){if(t.isSome()){let e=a.find(t=>"Some"===t.name);if(iS(e))throw Error("Error in abi : Option has no 'Some' variant.");let s=e.type;if("()"===s)return aG.Some.toString();let o=sm({element:t.unwrap(),type:s,structs:r,enums:n,parser:i});return Array.isArray(o)?[aG.Some.toString(),...o]:[aG.Some.toString(),o]}return aG.None.toString()}if(aD(e)){if(t.isOk()){let e=a.find(t=>"Ok"===t.name);if(iS(e))throw Error("Error in abi : Result has no 'Ok' variant.");let s=e.type;if("()"===s)return aK.Ok.toString();let o=sm({element:t.unwrap(),type:s,structs:r,enums:n,parser:i});return Array.isArray(o)?[aK.Ok.toString(),...o]:[aK.Ok.toString(),o]}let e=a.find(t=>"Err"===t.name);if(iS(e))throw Error("Error in abi : Result has no 'Err' variant.");let s=e.type;if("()"===s)return aK.Err.toString();let o=sm({element:t.unwrap(),type:s,structs:r,enums:n,parser:i});return Array.isArray(o)?[aK.Err.toString(),...o]:[aK.Err.toString(),o]}let s=t.activeVariant(),o=a.find(t=>t.name===s);if(iS(o))throw Error(`Not find in abi : Enum has no '${s}' variant.`);let c=o.type,l=a.findIndex(t=>t.name===s);if("()"===c)return l.toString();let u=sm({element:t.unwrap(),type:c,structs:r,enums:n,parser:i});return Array.isArray(u)?[l.toString(),...u]:[l.toString(),u]}if(aF(e))return sy({type:az(e),val:t,parser:i});if("object"==typeof t)throw Error(`Parameter ${t}
7 do not align with abi parameter ${e}`);return sy({type:e,val:t,parser:i})}function s_(t,e,r){switch(!0){case ax(t):return!!BigInt(e.next().value);case a_.isAbiType(t):case ab.isAbiType(t):case a9.isAbiType(t):case a7.isAbiType(t):case st.isAbiType(t):case se.isAbiType(t):case sr.isAbiType(t):case sn.isAbiType(t):case si.isAbiType(t):case sa.isAbiType(t):case ss.isAbiType(t):case so.isAbiType(t):return r.getResponseParser(t)(e);case aB(t):return BigInt(e.next().value);case a0.isAbiType(t):return r.getResponseParser(t)(e);case aP(t):let n=na(e.next().value).padStart(32,"0"),i=na(e.next().value).padStart(32,"0"),a=na(e.next().value).padStart(32,"0");return BigInt(ns(i+n+na(e.next().value).padStart(32,"0")+a));default:return r.getResponseParser(ag.abiSelector)(e)}}function sE(t,e,r,n,i){if("()"===e.type)return{};if(a_.isAbiType(e.type)||ab.isAbiType(e.type)||a8.isAbiType(e.type))return r.getResponseParser(e.type)(t);if(sg.isTypeFixedArray(e.type)){let a=[],s={name:"",type:sg.getFixedArrayType(e.type)},o=sg.getFixedArraySize(e.type);for(;a.length<o;)a.push(sE(t,s,r,n,i));return a}
7if(aA(e.type)){let a=[],s={name:"",type:az(e.type)},o=BigInt(t.next().value);for(;a.length<o;)a.push(sE(t,s,r,n,i));return a}if(aF(e.type))return sE(t,{name:"",type:az(e.type)},r,n,i);if(n&&e.type in n&&n[e.type])return aB(e.type)?s_(e.type,t,r):n[e.type].members.reduce((e,a)=>(e[a.name]=sE(t,a,r,n,i),e),{});if(i&&e.type in i&&i[e.type]){let a=Number(t.next().value),s=i[e.type].variants.reduce((e,s,o)=>(o===a?e[s.name]=sE(t,{name:"",type:s.type},r,n,i):e[s.name]=void 0,e),{});if(e.type.startsWith("core::option::Option")){let t=a===aG.Some?s.Some:void 0;return new aQ(a,t)}if(e.type.startsWith("core::result::Result")){let t;return t=a===aK.Ok?s.Ok:s.Err,new aX(a,t)}return new aZ(s)}if(av(e.type))return sp(e.type).reduce((e,a,s)=>{let o=a?.name?a.name:s,c=a?.type?a.type:a;return e[o]=sE(t,{name:o,type:c},r,n,i),e},{});if(aA(e.type)){let a=[],s={name:"",type:az(e.type)},o=BigInt(t.next().value);for(;a.length<o;)a.push(sE(t,s,r,n,i));return a}return s_(e.type,t,r)}function sb({responseIterator:t,output:e,structs:r,enums:n,parsedResult:i,parser:a}){let{name:s,type:o}=e;switch(!0){case aI(s):return BigInt(t.next().value);case r&&o in r||av(o):case n&&aN(o,n):case sg.isTypeFixedArray(o):return sE(t,e,a,r,n);case aA(o):if(aU(o))return sE(t,e,a,r,n);let c=[];if(i&&i[`${s}_len`]){let o=i[`${s}_len`];for(;c.length<o;)c.push(sE(t,{name:s,type:e.type.replace("*","")},a,r,n))}return c;case aF(o):return sE(t,e,a,r,n);default:return s_(o,t,a)}}var sI=(t,e)=>{if(iv(iC(t)||iN(t)||iD(t),`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),iC(t)&&!iL(t))return;let r=BigInt(t.toString(10));iv(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},sw=(t,e)=>{let r;switch(iN(t)&&iv(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is too large to be typed as Number use (BigInt or String)"),iv(iC(t)||iN(t)||iD(t)||iO(t)&&"low"in t&&"high"in t||iO(t)&&["limb0","limb1","limb2","limb3"].every(e=>e in t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (String, Number or BigInt), but is ${typeof t} ${t}.`),e.type){case id.u256:r=new a_(t).toBigInt();break;case id.u512:r=new ab(t).toBigInt();break;default:r=iR(t)}switch(e.type){case id.u8:iv(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case id.u16:iv(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case id.u32:iv(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case id.u64:iv(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case id.u128:iv(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case id.u256:iv(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^256-1`);break;case id.u512:iv(ab.is(r),`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^512-1`);break;case ip.ClassHash:case ip.ContractAddress:iv(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`);break;case ip.Secp256k1Point:iv(r>=0n&&r<=2n**512n-1n,`Validate: arg ${e.name} must be ${e.type} : a 512 bits number.`);break;case ip.U96:iv(r>=0n&&r<=2n**96n-1n,`Validate: arg ${e.name} must be ${e.type} : a 96 bits number.`)}},sA=(t,e)=>{iv(iM(t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},sv=(t,e,r)=>{if(e.type===id.u256||e.type===id.u512){sw(t,e);return}if(aB(e.type)){iv(!iO(t),`EthAddress type is waiting a BigNumberish. Got "${t}"`);let r=BigInt(t.toString(10));iv(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`);return}iv(iO(t),`Validate: arg ${e.name} is cairo type struct (${e.type}), and should be defined as a js object (not array)`),r[e.type].members.forEach(({name:r})=>{iv(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)})},sT=(t,e)=>{iv(iO(t),`Validate: arg ${e.name} is cairo type Enum (${e.type}), and should be defined as a js object (not array)`);let r=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),n=[...Object.getOwnPropertyNames(t),...r];if(!(aM(e.type)&&n.includes("isSome")&&n.includes("isNone")||aD(e.type)&&n.includes("isOk")&&n.includes("isErr")||n.includes("variant")&&n.includes("activeVariant")))throw Error(`Validate Enum: argument ${e.name}, type ${e.type}, value received "${t}", is not an Enum.`)},sS=(t,e)=>{iv(iO(t),`Validate: arg ${e.name}
7 should be a tuple (defined as object)`)},sN=(t,e,r,n)=>{let i=aA(e.type),a=i?az(e.type):sg.getFixedArrayType(e.type);if(i&&aw(a)&&aa(t))return;let s=[];if(i)iv(Array.isArray(t),`Validate: arg ${e.name} should be an Array`),s=t;else switch(!0){case Array.isArray(t):s=t;break;case"object"==typeof t:s=Object.values(t);break;default:throw Error(`Validate: arg ${e.name} should be an Array or an object.`)}switch(!0){case aw(a):s.forEach(t=>sI(t,e));break;case av(a):s.forEach(t=>sS(t,{name:e.name,type:a}));break;case aA(a):s.forEach(t=>sN(t,{name:"",type:a},r,n));break;case aS(a,r):s.forEach(t=>sv(t,{name:e.name,type:a},r));break;case aN(a,n):s.forEach(t=>sT(t,{name:e.name,type:a}));break;case aC(a)||aL(a):s.forEach(t=>sw(t,{name:"",type:a}));break;case ax(a):s.forEach(t=>sA(t,e));break;default:throw Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${s}`)}},sM=(t,e)=>{let r=az(e.type);switch(iv(aC(r)&&r!==ab.abiSelector||aw(r),`Validate: ${e.name} type is not authorized for NonZero type.`),!0){case aw(r):sI(t,e),iv(BigInt(t.toString(10))>0,"Validate: value 0 is not authorized in NonZero felt252 type.");break;case aC(r):(sw(t,{name:"",type:r}),r===id.u256)?iv(new a_(t).toBigInt()>0,"Validate: value 0 is not authorized in NonZero uint256 type."):iv(iR(t)>0,"Validate: value 0 is not authorized in NonZero uint type.");break;default:throw Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value "${t}"`)}};function sD(t,e,r,n){t.inputs.reduce((t,i)=>{let a=e[t];switch(!0){case aI(i.name):return t;case aw(i.type):sI(a,i);break;case a0.isAbiType(i.type):a0.validate(a);break;case aC(i.type)||aL(i.type):sw(a,i);break;case ax(i.type):sA(a,i);break;case a8.isAbiType(i.type):a8.validate(a);break;case sn.isAbiType(i.type):sn.validate(a);break;case si.isAbiType(i.type):si.validate(a);break;case sa.isAbiType(i.type):sa.validate(a);break;case ss.isAbiType(i.type):ss.validate(a);break;case so.isAbiType(i.type):so.validate(a);break;case aA(i.type)||sg.isTypeFixedArray(i.type):sN(a,i,r,n);break;case aS(i.type,r):sv(a,i,r);break;case aN(i.type,n):sT(a,i);break;case av(i.type):sS(a,i);break;case aF(i.type):sM(a,i);break;default:throw Error(`Validate Unhandled: argument ${i.name}, type ${i.type}, value ${a}`)}return t+1},0)}var sC=class t{abi;parser;structs;enums;constructor(e,r){this.structs=t.getAbiStruct(e),this.enums=t.getAbiEnum(e),this.parser=sd(e,r),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){t!==iu.DEPLOY&&iv(this.abi.filter(e=>{if("function"!==e.type)return!1;let r="view"===e.stateMutability||"view"===e.state_mutability;return t===iu.INVOKE?!r:r}).map(t=>t.name).includes(e),`${t===iu.INVOKE?"invocable":"viewable"} method not found in abi`);let n=this.abi.find(r=>t===iu.DEPLOY?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type);if(sh(e,r,n))return;let i=this.parser.methodInputsLength(n);if(r.length!==i)throw Error(`Invalid number of arguments, expected ${i} arguments, but got ${r.length}`);sD(n,r,this.structs,this.enums)}compile(t,e){let r;let n=this.abi.find(e=>e.name===t);if(sh(t,e,n))return[];Array.isArray(e)?r=e:(r=Object.values(function(t,e,r,n){let i=(t,e)=>{if(sg.isTypeFixedArray(e))return function(t,e){let r=sg.getFixedArrayType(e),n=sg.getFixedArraySize(e);if(Array.isArray(t)){if(n!==t.length)throw Error(`ABI type ${e}: array provided do not includes  ${n} items. ${t.length} items provided.`);return t.map(t=>i(t,r))}if(n!==Object.keys(t).length)throw Error(`ABI type ${e}: object provided do not includes  ${n} properties. ${Object.keys(t).length} items provided.`);return i(t,r)}(t,e);if(aA(e))return function(t,e){let r=az(e);return iC(t)?t:t.map(t=>i(t,r))}(t,e);if(aN(e,n))return s(t,n[e]);if(av(e))return sp(e).reduce((e,r,n)=>{let a;let s=Object.keys(t),o=r?.type?r.type:r;return a=i(t[s[n]],o),Object.defineProperty(e,n.toString(),{enumerable:!0,value:a??t[s[n]]}),e},{});if(aB(e)||aF(e)||a8.isAbiType(e)||aj(e)||aP(e))return t;if(a_.isAbiType(e)){if("object"!=typeof t)return t;if(!("low"in t&&"high"in t))throw Error(`Your object includes the property : ${e}, containing an Uint256 object without the 'low' and 'high' keys.`);return{low:t.low,high:t.high}}if(ab.isAbiType(e)){if("object"!=typeof t)return t;if(!["limb0","limb1","limb2","limb3"].every(e=>e in t))throw Error(`Your object includes the property : ${e}, containing an Uint512 object without the 'limb0' to 'limb3' keys.`);return{limb0:t.limb0,limb1:t.limb1,limb2:t.limb2,limb3:t.limb3}}return aS(e,r)?a(t,r[e].members):t},a=(t,e)=>e.reduce((e,r)=>{let n;if("undefined"===t[r.name]&&(aU(r.type)||!aI(r.name)))throw Error(`Your object needs a property with key : ${r.name} .`);return n=i(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:n??t[r.name]}),e},{}),s=(t,e)=>{if(aD(e.name)){let r=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(",")),n=e.name.substring(e.name.indexOf(",")+1,e.name.lastIndexOf(">"));return t.isOk()?new aX(aK.Ok,i(t.unwrap(),r)):new aX(aK.Err,i(t.unwrap(),n))}if(aM(e.name)){let r=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return t.isSome()?new aQ(aG.Some,i(t.unwrap(),r)):new aQ(aG.None,{})}return new aZ(Object.fromEntries(Object.entries(t.variant).map(r=>{if(iS(r[1]))return r;let n=e.type.substring(e.type.lastIndexOf("<")+1,e.type.lastIndexOf(">"));return"()"===n?r:[r[0],i(t.unwrap(),n)]})))};return e.reduce((e,r)=>{let n;return aI(r.name)&&!aU(r.type)||(n=i(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:n})),e},{})}(e,n.inputs,this.structs,this.enums)),sD(n,r,this.structs,this.enums));let i=r[Symbol.iterator](),a=n.inputs.reduce((t,e)=>aI(e.name)&&!aU(e.type)?t:t.concat(function({argsIterator:t,input:e,structs:r,enums:n,parser:i}){let{name:a,type:s}=e,{value:o}=t.next();switch(!0){case sg.isTypeFixedArray(s):if(!Array.isArray(o)&&"object"!=typeof o)throw Error(`ABI expected parameter ${a} to be an array or an object, got ${o}`);return sm({element:o,type:e.type,structs:r,enums:n,parser:i});case aA(s):if(!Array.isArray(o)&&!an(o))throw Error(`ABI expected parameter ${a} to be array or long string, got ${o}`);return iC(o)&&(o=as(o)),sm({element:o,type:e.type,structs:r,enums:n,parser:i});case aF(s):return sy({type:az(s),val:o,parser:i});case aB(s):return sy({type:s,val:o,parser:i});case aS(s,r)||av(s)||a_.isAbiType(s):case aN(s,n):return sm({element:o,type:s,structs:r,enums:n,parser:i});default:return sy({type:s,val:o,parser:i})}}({argsIterator:i,input:e,structs:this.structs,enums:this.enums,parser:this.parser})),[]);return Object.defineProperty(a,"__compiled__",{enumerable:!1,writable:!1,value:!0}),a}static compile(t){let e;let r=t=>{let e=(t,r=".")=>{let n=Array.isArray(t)?[t.length.toString(),...t]:t;return Object.entries(n).flatMap(([t,i])=>{let a=i;"entrypoint"===t?a=i5(a):aa(a)&&(a=ad(a));let s=Array.isArray(n)&&"0"===t?"$$len":t;if(iD(a))return[[`${r}${s}`,ap(a)]];if(Object(a)===a){let t=Object.getOwnPropertyNames(Object.getPrototypeOf(a)),n=[...Object.getOwnPropertyNames(a),...t];if(n.includes("isSome")&&n.includes("isNone")){let t=a,n=t.isSome()?aG.Some:aG.None;return t.isSome()?e({0:n,1:t.unwrap()},`${r}${s}.`):[[`${r}${s}`,ap(n)]]}if(n.includes("isOk")&&n.includes("isErr")){let t=a;return e({0:t.isOk()?aK.Ok:aK.Err,1:t.unwrap()},`${r}${s}.`)}if(n.includes("variant")&&n.includes("activeVariant")){let t=a,n=t.activeVariant(),i=Object.keys(t.variant).findIndex(t=>t===n);return"object"==typeof t.unwrap()&&0===Object.keys(t.unwrap()).length?[[`${r}${s}`,ap(i)]]:e({0:i,1:t.unwrap()},`${r}${s}.`)}return e(a,`${r}${s}.`)}return[[`${r}${s}`,ap(a)]]})};return Object.fromEntries(e(t))};return Object.defineProperty(e=Array.isArray(t)?Object.values(r({...t})):Object.values(r(t)),"__compiled__",{enumerable:!1,writable:!1,value:!0}),e}parse(t,e){let{outputs:r}=this.abi.find(e=>e.name===t),n=e.flat()[Symbol.iterator](),i=r.flat().reduce((t,e,r)=>{let i=e.name??r;return t[i]=sb({responseIterator:n,output:e,structs:this.structs,enums:this.enums,parsedResult:t,parser:this.parser}),t[i]&&t[`${i}_len`]&&delete t[`${i}_len`],t},{});return 1===Object.keys(i).length&&0 in i?i[0]:i}format(t,e,r){return function t(e,r,n){return Object.entries(e).reduce((i,[a,s])=>{let o=n??r[a];if(!(a in r)&&!n)return i[a]=s,i;if("string"===o){if(Array.isArray(e[a])){let r=t(e[a],e[a].map(t=>o));return i[a]=Object.values(r).join(""),i}return aJ.isBN(e,r,a),i[a]=ac(s),i}if("number"===o)return aJ.isBN(e,r,a),i[a]=Number(s),i;if("function"==typeof o)return i[a]=o(s),i;if(Array.isArray(o)){let r=t(e[a],o,o[0]);return i[a]=Object.values(r),i}return iO(o)?i[a]=t(e[a],o):aJ.unknown(e,r,a),i},{})}(this.parse(t,e),r)}static getAbiStruct(t){return t.filter(t=>"struct"===t.type).reduce((t,e)=>({...t,[e.name]:e}),{})}static getAbiEnum(t){let e=t.filter(t=>"enum"===t.type).reduce((t,e)=>({...t,[e.name]:e}),{});return delete e["core::bool"],e}static toCalldata(e=[]){return t.compile(e)}static toHex(e=[]){return t.compile(e).map(t=>ij(t))}decodeParameters(t,e){let r=Array.isArray(t)?t:[t],n=e.flat()[Symbol.iterator](),i=r.map(t=>sb({responseIterator:n,output:{name:"",type:t},parser:this.parser,structs:this.structs,enums:this.enums}));return 1===i.length?i[0]:i}},sk={};r0(sk,{COMPILED_CLASS_VERSION:()=>s1,blake2sHashMany:()=>ol,calculateContractAddressFromHash:()=>s7,calculateDeclareTransactionHash:()=>sJ,calculateDeployAccountTransactionHash:()=>s0,calculateInvokeTransactionHash:()=>sX,calculateL2MessageTxHash:()=>sK,computeCompiledClassHash:()=>o_,computeCompiledClassHashBlake:()=>oh,computeCompiledClassHashPoseidon:()=>os,computeContractClassHash:()=>om,computeHashOnElements:()=>s8,computeHintedClassHash:()=>ot,computeLegacyContractClassHash:()=>oe,computePedersenHash:()=>s6,computePedersenHashOnElements:()=>
7s9,computePoseidonHash:()=>or,computePoseidonHashOnElements:()=>on,computeSierraContractClassHash:()=>oc,encodeBuiltins:()=>s5,flattenEntryPointData:()=>s3,formatSpaces:()=>s2,getL1MessageHash:()=>i9,getL2MessageHash:()=>i8,getSelector:()=>i3,getSelectorFromName:()=>i5,hashByteCodeSegments:()=>oa,hashByteCodeSegmentsBlake:()=>od,keccakBn:()=>i2,nullSkipReplacer:()=>s4,poseidon:()=>p,solidityUint256PackedKeccak256:()=>i6,starknetKeccak:()=>i4}),r0({},{calculateDeclareTransactionHash:()=>sY,calculateDeployAccountTransactionHash:()=>sH,calculateInvokeTransactionHash:()=>s$,calculateTransactionHashCommon:()=>sF,encodeDataResourceBoundsL1:()=>sz,encodeResourceBoundsL1:()=>sP,encodeResourceBoundsL2:()=>sU,hashDAMode:()=>sj,hashFeeFieldV3B3:()=>sV});var sO=t=>t.map(t=>BigInt(t)),sL=64n+128n,sx=BigInt(ao("L1_GAS")),sR=BigInt(ao("L2_GAS")),sB=BigInt(ao("L1_DATA"));function sj(t,e){return(BigInt(t)<<32n)+BigInt(e)}function sP(t){return(sx<<sL)+(t.l1_gas.max_amount<<128n)+t.l1_gas.max_price_per_unit}function sU(t){return(sR<<sL)+(t.l2_gas.max_amount<<128n)+t.l2_gas.max_price_per_unit}function sz(t){return(sB<<sL)+(t.l1_data_gas.max_amount<<128n)+t.l1_data_gas.max_price_per_unit}function sV(t,e){let r=sP(e),n=sU(e),i=sz(e);return(0,eC.poseidonHashMany)([BigInt(t),r,n,i])}function sF(t,e,r,n,i,a,s,o,c,l,u=[]){let d=sV(a,l),h=sj(o,c),f=sO([t,e,r,d,(0,eC.poseidonHashMany)(sO(s)),n,i,h,...sO(u)]);return ij((0,eC.poseidonHashMany)(f))}function sH(t,e,r,n,i,a,s,o,c,l,u,d){return sF(nG.DEPLOY_ACCOUNT,i,t,a,s,u,d,o,c,l,[(0,eC.poseidonHashMany)(sO(r)),e,n])}function sY(t,e,r,n,i,a,s,o,c,l,u,d){return sF(nG.DECLARE,n,r,i,a,u,sO(d),o,c,l,[(0,eC.poseidonHashMany)(sO(s)),t,e])}function s$(t,e,r,n,i,a,s,o,c,l,u){return sF(nG.INVOKE,e,t,n,i,l,u,s,o,c,[(0,eC.poseidonHashMany)(sO(a)),(0,eC.poseidonHashMany)(sO(r))])}function sW(t){return[...t,t.length].reduce((t,e)=>eC.pedersen(iR(t),iR(e)),0).toString()}function sq(t,e,r,n,i,a,s,o=[]){let c=[t,e,r,n,sW(i),a,s,...o];return sW(c)}function sZ(t,e,r,n,i,a,s){return sq(nG.DECLARE,r,e,0,[t],n,i,[a,...s?[s]:[]])}function sG(t,e,r,n,i,a,s,o){let c=[e,n,...r];return sq(nG.DEPLOY_ACCOUNT,i,t,0,c,a,s,[o])}function sQ(t,e,r,n,i,a){return sq(nG.INVOKE,e,t,0,r,n,i,[a])}function sK(t,e,r,n,i,a){let s=[t,...n];return sq(nG.L1_HANDLER,0,e,i3(r),s,0,i,[a])}function sX(t){if([r5.ETransactionVersion.V3,r5.ETransactionVersion.F3].includes(t.version))return s$(t.senderAddress,t.version,t.compiledCalldata,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData);throw Error("Invalid Tx version for hash calculation")}function sJ(t){if([r5.ETransactionVersion.V3,r5.ETransactionVersion.F3].includes(t.version))return sY(t.classHash,t.compiledClassHash,t.senderAddress,t.version,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData);throw Error("Invalid Tx version for hash calculation")}function s0(t){if([r5.ETransactionVersion.V3,r5.ETransactionVersion.F3].includes(t.version))return sH(t.contractAddress,t.classHash,t.compiledConstructorCalldata,t.salt,t.version,t.chainId,t.nonce,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData);throw Error("Invalid Tx version for hash calculation")}r0({},{calculateDeclareTransactionHash:()=>sZ,calculateDeployAccountTransactionHash:()=>sG,calculateL2MessageTxHash:()=>sK,calculateTransactionHash:()=>sQ,calculateTransactionHashCommon:()=>sq,computeHashOnElements:()=>sW}),r0({},{starkCurve:()=>eC,weierstrass:()=>g});var s1="COMPILED_CLASS_V1";function s2(t){let e=!1,r=[];for(let n of t)'"'===n&&!1==(r.length>0&&"\\"===r.slice(-1)[0])&&(e=!e),e?r.push(n):r.push(":"===n?": ":","===n?", ":n);return r.join("")}function s4(t,e){return"attributes"===t||"accessible_scopes"===t?Array.isArray(e)&&0===e.length?void 0:e:"debug_info"===t?null:null===e?void 0:e}function s5(t){return t.map(t=>BigInt(ao(t)))}function s3(t,e){return t.flatMap((t,r)=>[BigInt(t.selector),BigInt(t.offset),...e[r]])}function s6(t,e){return eC.pedersen(BigInt(t),BigInt(e))}function s8(t){return[...t,t.length].reduce((t,e)=>eC.pedersen(BigInt(t),BigInt(e)),0).toString()}var s9=s8;function s7(t,e,r,n){let i=s8(sC.compile(r));return ij(BigInt(s8([ap("0x535441524b4e45545f434f4e54524143545f41444452455353"),n,t,e,i]))%nT)}function ot(t){let{abi:e,program:r}=t,n=s2(iw({abi:e,program:r},s4));return ns(eC.keccak(nt(n)).toString(16))}function oe(t){let e=iC(t)?ib(t):t,r=ij(nw),n=s8(e.entry_points_by_type.EXTERNAL.flatMap(t=>[t.selector,t.offset])),i=s8(e.entry_points_by_type.L1_HANDLER.flatMap(t=>[t.selector,t.offset])),a=s8(e.entry_points_by_type.CONSTRUCTOR.flatMap(t=>[t.selector,t.offset])),s=s8(e.program.builtins.map(t=>ao(t))),o=ot(e),c=s8(e.program.data);return s8([r,n,i,a,s,o,c])}function or(t,e){return ij(eC.poseidonHash(BigInt(t),BigInt(e)))}function on(t){return ij((0,eC.poseidonHashMany)(t.map(t=>BigInt(t))))}function oi(t){let e=t.flatMap(t=>{var e;return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,(0,eC.poseidonHashMany)(s5(e)))]});return(0,eC.poseidonHashMany)(e)}function oa(t){let e=t.bytecode.map(t=>BigInt(t)),r=t.bytecode_segment_lengths??[],n=0,i=r.flatMap(t=>{let r=e.slice(n,n+=t);return[BigInt(t),(0,eC.poseidonHashMany)(r)]});return 1n+(0,eC.poseidonHashMany)(i)}
7function os(t){let e=BigInt(ao(s1)),r=oi(t.entry_points_by_type.EXTERNAL),n=oi(t.entry_points_by_type.L1_HANDLER),i=oi(t.entry_points_by_type.CONSTRUCTOR),a=t.bytecode_segment_lengths?oa(t):(0,eC.poseidonHashMany)(t.bytecode.map(t=>BigInt(t)));return ij((0,eC.poseidonHashMany)([e,r,n,i,a]))}function oo(t){let e=t.flatMap(t=>[BigInt(t.selector),BigInt(t.function_idx)]);return(0,eC.poseidonHashMany)(e)}function oc(t){let e=BigInt(ao("CONTRACT_CLASS_V0.1.0")),r=oo(t.entry_points_by_type.EXTERNAL),n=oo(t.entry_points_by_type.L1_HANDLER),i=oo(t.entry_points_by_type.CONSTRUCTOR),a=function(t){let e=s2(iw(t.abi,null));return BigInt(ns(eC.keccak(nt(e)).toString(16)))}(t),s=(0,eC.poseidonHashMany)(t.sierra_program.map(t=>BigInt(t)));return ij((0,eC.poseidonHashMany)([e,r,n,i,a,s]))}function ol(t){var e;let r=[],n=new DataView(new ArrayBuffer(32));for(let e of t){let t=0xffffffffffffffffn&e,i=(0xffffffffffffffff0000000000000000n&e)>>64n,a=(0xffffffffffffffff00000000000000000000000000000000n&e)>>128n,s=(0xffffffffffffffff000000000000000000000000000000000000000000000000n&e)>>192n;if(n.setBigUint64(0,s,!1),n.setBigUint64(8,a,!1),n.setBigUint64(16,i,!1),n.setBigUint64(24,t,!1),e<0x8000000000000000n){let t=n.getUint32(24,!1),e=n.getUint32(28,!1);r.push(t,e)}else{let t=2147483648|n.getUint32(0,!1),e=n.getUint32(4,!1),i=n.getUint32(8,!1),a=n.getUint32(12,!1),s=n.getUint32(16,!1),o=n.getUint32(20,!1),c=n.getUint32(24,!1),l=n.getUint32(28,!1);r.push(t,e,i,a,s,o,c,l)}}let i=new ArrayBuffer(4*r.length),a=new DataView(i);for(let t=0;t<r.length;t++)a.setUint32(4*t,r[t],!0);let s=(e=new Uint8Array(i),n2.get("blake")?.(e)||rj(e,{dkLen:32})),o=0n;for(let t=0;t<32;t++)o|=BigInt(s[t])<<BigInt(8*t);return o%nA}function ou(t){let e=t.flatMap(t=>[BigInt(t.selector),BigInt(t.offset),ol(s5(t.builtins))]);return ol(e)}function od(t){let e=t.bytecode.map(t=>BigInt(t)),r=t.bytecode_segment_lengths;if(!r)return ol(e);let[n,i]=function t(e,r){if("number"==typeof r){let t=[];for(let n=0;n<r;n++){let r=e.next();if(r.done)throw Error("Bytecode length mismatch");t.push(r.value)}return[r,ol(t)]}let n=r.map(r=>t(e,r)),i=ol(n.flatMap(([t,e])=>[BigInt(t),e]))+1n;return[n.reduce((t,[e])=>t+e,0),i]}(e[Symbol.iterator](),r);if(n!==e.length)throw Error(`Bytecode length mismatch: expected ${e.length}, got ${n}`);return i}function oh(t){let e=BigInt(ao(s1)),r=ou(t.entry_points_by_type.EXTERNAL);return ij(ol([e,r,ou(t.entry_points_by_type.L1_HANDLER),ou(t.entry_points_by_type.CONSTRUCTOR),od(t)]))}function of(t){let e=t.version?ij(t.version):n6.V3;return e===n6.V3||e===n6.F3}function op(t,e){let r=t.split("."),n=e.split(".");return r.every((t,e)=>"*"===t||t===n[e])}function og(t,e={allowAnyPatchVersion:!1}){return Object.values(nQ).some(r=>op(e.allowAnyPatchVersion?function(t){let e=t.split(".");return e.length<3?t:`${e[0]}.${e[1]}.*`}(r):r,t))}function oy(t){let[e,r]=t.replace(/^v/,"").split(".");return`v${e}_${r}`}function om(t){let e=iC(t)?ib(t):t;return"sierra_program"in e?oc(e):oe(e)}function o_(t,e=n1){return function(t,e){let r=t.split(".").map(Number),n=e.split(".").map(Number),i=Math.max(r.length,n.length);for(let t=0;t<i;t+=1){let e=r[t]||0,i=n[t]||0;if(e>i)return 1;if(e<i)return -1}return 0}(e,n1)>=0?oh(t):os(t)}var oE={};function ob(t){let e=iC(t)?t:iw(t);return nn((0,rP.iv)(e))}function oI(t){return Array.isArray(t)?t:ib(r9((0,rP.ec)(nr(t))))}function ow(){let t=eC.utils.randomPrivateKey();return(0,eC.getStarkKey)(t)}function oA(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map(t=>ij(t));try{let{r:e,s:r}=t;return[ij(e),ij(r)]}catch(t){throw Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function ov(t){return iY(oA(t))}function oT(t){return i$(oA(t))}function oS(){return oN(oC(),!1)}function oN(t,e=n2.get("resourceBoundsOverhead")){return{l2_gas:{max_amount:iX(t.l2_gas_consumed,!1!==e?e.l2_gas.max_amount:0),max_price_per_unit:iX(t.l2_gas_price,!1!==e?e.l2_gas.max_price_per_unit:0)},l1_gas:{max_amount:iX(t.l1_gas_consumed,!1!==e?e.l1_gas.max_amount:0),max_price_per_unit:iX(t.l1_gas_price,!1!==e?e.l1_gas.max_price_per_unit:0)},l1_data_gas:{max_amount:iX(t.l1_data_gas_consumed,!1!==e?e.l1_data_gas.max_amount:0),max_price_per_unit:iX(t.l1_data_gas_price,!1!==e?e.l1_data_gas.max_price_per_unit:0)}}}function oM(t){return{resourceBounds:t,overall_fee:t.l1_gas.max_amount*t.l1_gas.max_price_per_unit+t.l1_data_gas.max_amount*t.l1_data_gas.max_price_per_unit+t.l2_gas.max_amount*t.l2_gas.max_price_per_unit,unit:"FRI"}}function oD(t,e=n2.get("resourceBoundsOverhead")){return iX(t.l1_gas_consumed,!1!==e?e.l1_gas.max_amount:0)*iX(t.l1_gas_price,!1!==e?e.l1_gas.max_price_per_unit:0)+iX(t.l1_data_gas_consumed,!1!==e?e.l1_data_gas.max_amount:0)*iX(t.l1_data_gas_price,!1!==e?e.l1_data_gas.max_price_per_unit:0)+iX(t.l2_gas_consumed,!1!==e?e.l2_gas.max_amount:0)*iX(t.l2_gas_price,!1!==e?e.l2_gas.max_price_per_unit:0)}function oC(){return{l1_gas_consumed:"0",l1_gas_price:"0",l1_data_gas_consumed:"0",l1_data_gas_price:"0",l2_gas_consumed:"0",l2_gas_price:"0",overall_fee:"0",unit:"FRI"}}function ok(t){if(t===n7.L1)return it.L1;if(t===n7.L2)return it.L2;throw Error("EDAM conversion")}function oO(t,e){let r=e?ij(e):ij(t);if(!Object.values(n9).includes(r))throw Error(`${e?"providedVersion":"defaultVersion"} ${r} is not ETransactionVersion`);return r}function oL(t){if(!t)return;let e=ij(t);if(e===n6.V0)return n6.F0;if(e===n6.V1)return n6.F1;if(e===n6.V2)return n6.F2;if(e===n6.V3)return n6.F3;throw Error(`toFeeVersion: ${e} is not supported`)}
7function ox(t){return{tip:t.tip||0,paymasterData:t.paymasterData||[],accountDeploymentData:t.accountDeploymentData||[],nonceDataAvailabilityMode:t.nonceDataAvailabilityMode||n7.L1,feeDataAvailabilityMode:t.feeDataAvailabilityMode||n7.L1,resourceBounds:t.resourceBounds??oS()}}function oR(t){let e=ij(t);return ns(ni((0,eC.getPublicKey)(e,!1)))}function oB(t){let e=t=>{if(iD(t))return ij(t);if(iO(t)){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}return t};return e(t)}function oj(t){let e=t=>{if(iC(t))return BigInt(t);if(iO(t)){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}return t};return e(t)}function oP(t){return"sierra_program"in(iC(t)?ib(t):t)}function oU(t,e){let r={...t};if(oP(t.contract)&&(!t.compiledClassHash&&t.casm&&(r.compiledClassHash=o_(t.casm,e)),!r.compiledClassHash))throw Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(r.classHash=t.classHash??om(t.contract),!r.classHash)throw Error("Extract classHash failed, provide (CompiledContract).json file or classHash");return r}function oz(){return nu(ni(rq.utils.randomPrivateKey()))}function oV(t){iH(t,nE,2n**160n-1n,"Ethereum Address ");let e=ns(na(ij(t)).padStart(40,"0"));return iv(!!e.match(/^(0x)?[0-9a-f]{40}$/),"Invalid Ethereum Address Format"),e}r0(oE,{ZeroFeeEstimate:()=>oC,compressProgram:()=>ob,decompressProgram:()=>oI,formatSignature:()=>oA,getFullPublicKey:()=>oR,intDAM:()=>ok,randomAddress:()=>ow,resourceBoundsToBigInt:()=>oj,resourceBoundsToEstimateFeeResponse:()=>oM,resourceBoundsToHexString:()=>oB,signatureToDecimalArray:()=>ov,signatureToHexArray:()=>oT,toFeeVersion:()=>oL,toOverheadOverallFee:()=>oD,toOverheadResourceBounds:()=>oN,toTransactionVersion:()=>oO,v3Details:()=>ox,zeroResourceBounds:()=>oS}),r0({},{ethRandomPrivateKey:()=>oz,validateAndParseEthAddress:()=>oV});var oF="undefined"!=typeof globalThis&&globalThis.fetch.bind(globalThis)||"undefined"!=typeof window&&window.fetch.bind(window)||"undefined"!=typeof global&&global.fetch.bind(global)||(()=>{throw new a4("'fetch()' not detected, use the 'baseFetch' constructor parameter to set it")});function oH(t){return new Promise(e=>{setTimeout(e,t)})}function oY(t){let e={...t};return delete e.sierra_program_debug_info,e.abi=s2(iw(t.abi)),e.sierra_program=s2(iw(t.sierra_program)),e.sierra_program=ob(e.sierra_program),e}function o$(t){let e=iC(t)?ib(t):t;return oP(t)?oY(e):{...e,..."program"in e&&{program:ob(e.program)}}}function oW(t){return iC(t.abi)?ib(t.abi):t.abi}r0({},{Block:()=>oK,createSierraContractClass:()=>oY,extractAbi:()=>oW,getDefaultNodeUrl:()=>oq,getDefaultNodes:()=>oZ,getSupportedRpcVersions:()=>oG,parseContract:()=>o$,validBlockTags:()=>oQ,wait:()=>oH});var oq=(t,e=!1,r)=>{e||n5.info("Using default public node url, please provide nodeUrl in provider options!");let n=oZ(r??n2.get("rpcVersion"))[t??nq.SN_SEPOLIA],i=Math.floor(Math.random()*n.length);return n[i]};function oZ(t){let e={...nX};return Object.keys(e).forEach(function(r,n){e[r]=e[r].map(e=>"https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/"===e||"https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/"===e?`${e}${oy(t)}/uYLxCteYbHTFJpKSoKdVm`:`${e}${oy(t)}`)}),e}function oG(){return[...new Set(Object.values(nQ))]}var oQ=Object.values(il),oK=class{hash=null;number=null;tag=null;setIdentifier(t){if(iC(t)){if(ar(t))this.number=parseInt(t,10);else if(iL(t))this.hash=t;else if(oQ.includes(t))this.tag=t;else throw TypeError(`Block identifier unmanaged: ${t}`)}else iD(t)?this.hash=ij(t):iN(t)?this.number=t:this.tag=il.LATEST;if(iN(this.number)&&this.number<0)throw TypeError(`Block number (${this.number}) can't be negative`)}constructor(t){this.setIdentifier(t)}get queryIdentifier(){return null!==this.number?`blockNumber=${this.number}`:null!==this.hash?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return null!==this.number?{block_number:this.number}:null!==this.hash?{block_hash:this.hash}:this.tag}set identifier(t){this.setIdentifier(t)}valueOf=()=>this.number;toString=()=>this.hash};function oX(t,e){return Array.isArray(t)&&"__compiled__"in t?t:Array.isArray(t)&&Array.isArray(t[0])&&"__compiled__"in t[0]?t[0]:e()}r0({},{fromCallsToExecuteCalldata:()=>o0,fromCallsToExecuteCalldata_cairo1:()=>o1,getCompiledCalldata:()=>oX,getExecuteCalldata:()=>o2,getVersionsByType:()=>o4,transformCallsToMulticallArrays:()=>oJ});var oJ=t=>{let e=[],r=[];return t.forEach(t=>{let n=sC.compile(t.calldata||[]);e.push({to:iR(t.contractAddress).toString(10),selector:iR(i5(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:n.length.toString()}),r.push(...n)}),{callArray:e,calldata:sC.compile({calldata:r})}},o0=t=>{let{callArray:e,calldata:r}=oJ(t);return[...sC.compile({callArray:e}),...r]},o1=t=>{let e=t.map(t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:sC.compile(t.calldata)}));return sC.compile({orderCalls:e})},o2=(t,e="0")=>"1"===e?o1(t):o0(t);function o4(t){return"fee"===t?{v3:n6.F3}:{v3:n6.V3}}var o5={headers:{"Content-Type":"application/json"},blockIdentifier:il.LATEST,retries:200},o3=class{id="RPC081";channelSpecVersion=nQ.v0_8_1;nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){let{baseFetch:e,batch:r,blockIdentifier:n,chainId:i,headers:a,nodeUrl:s,retries:o,specVersion:c,transactionRetryIntervalFallback:l,waitMode:u}=t||{};Object.values(nq).includes(s)?this.nodeUrl=oq(s,t?.default,this.channelSpecVersion):s?this.nodeUrl=s:this.nodeUrl=oq(void 0,t?.default,this.channelSpecVersion),this.baseFetch=e||n2.get("fetch")||oF,this.blockIdentifier=n??o5.blockIdentifier,this.chainId=i,this.headers={...o5.headers,...a},this.retries=o??o5.retries,this.specVersion=c,this.transactionRetryIntervalFallback=l,this.waitMode=u??!1,this.requestId=0,iN(r)&&(this.batchClient=new iA({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch,rpcMethods:{}})),n5.debug("Using Channel",this.id)}readSpecVersion(){return this.specVersion}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){let n={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:iw(n),headers:this.headers})}errorHandler(t,e,r,n){if(r)throw new a5(r,t,e);if(n instanceof a4)throw n;if(n)throw Error(n.message)}async fetchEndpoint(t,e){try{if(this.batchClient){let{error:r,result:n}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),n}let r=await this.fetch(t,e,this.requestId+=1),{error:n,result:i}=await r.json();return this.errorHandler(t,e,n),i}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}getSpecVersion(){return this.fetchEndpoint("starknet_specVersion")}async setUpSpecVersion(){if(!this.specVersion){let t=await this.fetchEndpoint("starknet_specVersion");if(op(this.channelSpecVersion,t)||n5.error(n0.channelVersionMismatch,{channelId:this.id,channelSpecVersion:this.channelSpecVersion,nodeSpecVersion:this.specVersion}),!og(t))throw new a4(`${n0.unsupportedSpecVersion}, channelId: ${this.id}`);this.specVersion=t}return this.specVersion}getMessagesStatus(t){let e=ij(t);return this.fetchEndpoint("starknet_getMessagesStatus",{transaction_hash:e})}getStorageProof(t=[],e=[],r=[],n=this.blockIdentifier){let i=new oK(n).identifier,a=i$(t),s=i$(e);return this.fetchEndpoint("starknet_getStorageProof",{block_id:i,class_hashes:a,contract_addresses:s,contracts_storage_keys:r})}getCompiledCasm(t){let e=ij(t);return this.fetchEndpoint("starknet_getCompiledCasm",{class_hash:e})}getNonceForAddress(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:n})}async getStarknetVersion(t=this.blockIdentifier){return(await this.getBlockWithTxHashes(t)).starknet_version}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){let e=ij(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){let r=new oK(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){let e=ij(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){let e=ij(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){let e=ij(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){let{blockIdentifier:r=this.blockIdentifier,skipValidate:n=!0,skipFeeCharge:i=!0}=e,a=new oK(r).identifier,s=[];return n&&s.push(V.SKIP_VALIDATE),i&&s.push(V.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:a,transactions:t.map(t=>this.buildTransaction(t)),simulation_flags:s})}async waitForTransaction(t,e){let r;let n=ij(t),i=e?.retries??this.retries,a=e?.lifeCycleRetries??3,s=!1,o=!1,c=e?.retryInterval??this.transactionRetryIntervalDefault,l=e?.errorStates??[F.REJECTED],u=e?.successStates??[F.ACCEPTED_ON_L2,F.ACCEPTED_ON_L1],d={[tS.RECEIVED]:n0.txEvictedFromMempool,[tS.PRE_CONFIRMED]:n0.consensusFailed,[tS.CANDIDATE]:n0.txFailsBlockBuildingValidation},h=[];for(;!s;){await oH(c);try{r=await this.getTransactionStatus(n),h.push(r.finality_status);let t=r.execution_status,e=r.finality_status;if(!e)throw Error("waiting for transaction status");if(l.includes(t)||l.includes(e)){let n=`${t}: ${e}`,i=Error(n);throw i.response=r,o=!0,i}(u.includes(t)||u.includes(e))&&(s=!0)}catch(t){if(t instanceof Error&&o)throw t;if(t instanceof a5&&t.isType("TXN_HASH_NOT_FOUND")){n5.info("txLife: ",h);let t=d[h.at(-1)];if(t&&a<=0)throw Error(t);a-=1}if(i<=0)throw Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let f=null;for(;null===f;){try{f=await this.getTransactionReceipt(n)}catch(t){if(i<=0)throw Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await oH(c)}return f}getStorageAt(t,e,r=this.blockIdentifier){let n=ij(t),i=iz(e),a=new oK(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:n,key:i,block_id:a})}getClassHashAt(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:n,contract_address:r})}getClass(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:n})}getClassAt(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:n,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}={}){let n=new oK(e).identifier,i={simulation_flags:r?[V.SKIP_VALIDATE]:[]};return this.fetchEndpoint("starknet_estimateFee",{request:t.map(t=>this.buildTransaction(t,"fee")),block_id:n,...i})}async invoke(t,e){let r;
7if(of(e)){if(ie(e.resourceBounds))r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:z.INVOKE,sender_address:t.contractAddress,calldata:sC.toHex(t.calldata),version:Z.V3,signature:oT(t.signature),nonce:ij(e.nonce),resource_bounds:oB(e.resourceBounds),tip:ij(e.tip),paymaster_data:e.paymasterData.map(t=>ij(t)),account_deployment_data:e.accountDeploymentData.map(t=>ij(t)),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}});else throw Error(n0.SWOldV3)}else throw Error(n0.legacyTxRPC08Message);return this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:n},i){let a;if(oP(t)&&of(i)){if(ie(i.resourceBounds))a=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:z.DECLARE,sender_address:r,compiled_class_hash:n||"",version:Z.V3,signature:oT(e),nonce:ij(i.nonce),contract_class:{sierra_program:oI(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:oB(i.resourceBounds),tip:ij(i.tip),paymaster_data:i.paymasterData.map(t=>ij(t)),account_deployment_data:i.accountDeploymentData.map(t=>ij(t)),nonce_data_availability_mode:i.nonceDataAvailabilityMode,fee_data_availability_mode:i.feeDataAvailabilityMode}});else throw Error(n0.SWOldV3)}else throw Error(n0.legacyTxRPC08Message);return this.waitMode?this.waitForTransaction((await a).transaction_hash):a}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:n},i){let a;if(of(i)){if(ie(i.resourceBounds))a=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:z.DEPLOY_ACCOUNT,version:Z.V3,signature:oT(n),nonce:ij(i.nonce),contract_address_salt:ij(r||0),constructor_calldata:sC.toHex(e||[]),class_hash:ij(t),resource_bounds:oB(i.resourceBounds),tip:ij(i.tip),paymaster_data:i.paymasterData.map(t=>ij(t)),nonce_data_availability_mode:i.nonceDataAvailabilityMode,fee_data_availability_mode:i.feeDataAvailabilityMode}});else throw Error(n0.SWOldV3)}else throw Error(n0.legacyTxRPC08Message);return this.waitMode?this.waitForTransaction((await a).transaction_hash):a}callContract(t,e=this.blockIdentifier){let r=new oK(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:i5(t.entrypoint),calldata:sC.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){let{from_address:r,to_address:n,entry_point_selector:i,payload:a}=t,s={from_address:oV(r),to_address:ij(n),entry_point_selector:i3(i),payload:iG(a)},o=new oK(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:s,block_id:o})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){let r;let n=o4(e);if(of(t))r={signature:oT(t.signature),nonce:ij(t.nonce),resource_bounds:oB(t.resourceBounds),tip:ij(t.tip),paymaster_data:t.paymasterData.map(t=>ij(t)),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map(t=>ij(t))};else throw Error("v0,v1,v2 tx are not supported on RPC 0.8");if(t.type===z.INVOKE)return{type:z.INVOKE,sender_address:t.contractAddress,calldata:sC.toHex(t.calldata),version:ij(t.version||n.v3),...r};if(t.type===z.DECLARE){if(!oP(t.contract))throw n5.error("Cairo 0 -  non Sierra v1 tx are not supported"),Error("Declaring non Sierra contract using RPC 0.8");return{type:t.type,contract_class:{...t.contract,sierra_program:oI(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:ij(t.version||n.v3),...r}}if(t.type===z.DEPLOY_ACCOUNT){let{account_deployment_data:e,...i}=r;return{type:t.type,constructor_calldata:sC.toHex(t.constructorCalldata||[]),class_hash:ij(t.classHash),contract_address_salt:ij(t.addressSalt||0),version:ij(t.version||n.v3),...i}}throw Error("RPC buildTransaction received unknown TransactionType")}},o6={};r0(o6,{RpcChannel:()=>o9});var o8={headers:{"Content-Type":"application/json"},blockIdentifier:il.LATEST,retries:200},o9=class{id="RPC090";channelSpecVersion=nQ.v0_9_0;nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){let{baseFetch:e,batch:r,blockIdentifier:n,chainId:i,headers:a,nodeUrl:s,retries:o,specVersion:c,transactionRetryIntervalFallback:l,waitMode:u}=t||{};Object.values(nq).includes(s)?this.nodeUrl=oq(s,t?.default,this.channelSpecVersion):s?this.nodeUrl=s:this.nodeUrl=oq(void 0,t?.default,this.channelSpecVersion),this.baseFetch=e||n2.get("fetch")||oF,this.blockIdentifier=n??o8.blockIdentifier,this.chainId=i,this.headers={...o8.headers,...a},this.retries=o??o8.retries,this.specVersion=c,this.transactionRetryIntervalFallback=l,this.waitMode=u??!1,this.requestId=0,iN(r)&&(this.batchClient=new iA({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch,rpcMethods:{}})),n5.debug("Using Channel",this.id)}readSpecVersion(){return this.specVersion}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){let n={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:iw(n),headers:this.headers})}errorHandler(t,e,r,n){if(r)throw new a5(r,t,e);if(n instanceof a4)throw n;if(n)throw Error(n.message)}async fetchEndpoint(t,e){try{if(this.batchClient){let{error:r,result:n}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),n}let r=await this.fetch(t,e,this.requestId+=1),{error:n,result:i}=await r.json();return this.errorHandler(t,e,n),i}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}getSpecVersion(){return this.fetchEndpoint("starknet_specVersion")}async setUpSpecVersion(){if(!this.specVersion){let t=await this.fetchEndpoint("starknet_specVersion");if(op(this.channelSpecVersion,t)||n5.error(n0.channelVersionMismatch,{channelId:this.id,channelSpecVersion:this.channelSpecVersion,nodeSpecVersion:this.specVersion}),!og(t))throw new a4(`${n0.unsupportedSpecVersion}, channelId: ${this.id}`);this.specVersion=t}return this.specVersion}getMessagesStatus(t){let e=ij(t);return this.fetchEndpoint("starknet_getMessagesStatus",{transaction_hash:e})}getStorageProof(t=[],e=[],r=[],n=this.blockIdentifier){let i=new oK(n).identifier,a=i$(t),s=i$(e);return this.fetchEndpoint("starknet_getStorageProof",{block_id:i,class_hashes:a,contract_addresses:s,contracts_storage_keys:r})}getCompiledCasm(t){let e=ij(t);return this.fetchEndpoint("starknet_getCompiledCasm",{class_hash:e})}getNonceForAddress(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:n})}async getStarknetVersion(t=this.blockIdentifier){return(await this.getBlockWithTxHashes(t)).starknet_version}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){let e=new oK(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){let e=ij(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){let r=new oK(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){let e=ij(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){let e=ij(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){let e=ij(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){let{blockIdentifier:r=this.blockIdentifier,skipValidate:n=!0,skipFeeCharge:i=!0}=e,a=new oK(r).identifier,s=[];return n&&s.push(tT.SKIP_VALIDATE),i&&s.push(tT.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:a,transactions:t.map(t=>this.buildTransaction(t)),simulation_flags:s})}async waitForTransaction(t,e){let r;let n=ij(t),i=e?.retries??this.retries,a=e?.lifeCycleRetries??3,s=!1,o=!1,c=e?.retryInterval??this.transactionRetryIntervalDefault,l=e?.errorStates??[],u=e?.successStates??[tN.ACCEPTED_ON_L2,tN.ACCEPTED_ON_L1],d={[tS.RECEIVED]:n0.txEvictedFromMempool,[tS.PRE_CONFIRMED]:n0.consensusFailed,[tS.CANDIDATE]:n0.txFailsBlockBuildingValidation},h=[];for(;!s;){await oH(c);try{r=await this.getTransactionStatus(n),h.push(r.finality_status);let t=r.execution_status,e=r.finality_status;if(!e)throw Error("waiting for transaction status");if(l.includes(t)||l.includes(e)){let n=`${t}: ${e}`,i=Error(n);throw i.response=r,o=!0,i}(u.includes(t)||u.includes(e))&&(s=!0)}catch(t){if(t instanceof Error&&o)throw t;if(t instanceof a5&&t.isType("TXN_HASH_NOT_FOUND")){n5.info("txLife: ",h);let t=d[h.at(-1)];if(t&&a<=0)throw Error(t);a-=1}if(i<=0)throw Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let f=null;for(;null===f;){try{f=await this.getTransactionReceipt(n)}catch(t){if(i<=0)throw Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await oH(c)}return f}async fastWaitForTransaction(t,e,r,n){let i;let a=BigInt(r),s=n?.retries??50,o=n?.retryInterval??500,c=[tM.REVERTED],l=[tN.ACCEPTED_ON_L2,tN.ACCEPTED_ON_L1,tN.PRE_CONFIRMED],u=new Date().getTime();for(;s>0;){await oH(o),i=await this.getTransactionStatus(t),n5.info(`${s} ${JSON.stringify(i)} ${(new Date().getTime()-u)/1e3}s.`);let r=i.execution_status??"",n=i.finality_status;if(c.includes(r)){let t=Error(`${r}: ${n}`);throw t.response=i,t}if(l.includes(n)){let t=a;for(;t===a&&s>0;
7){if(t=BigInt(await this.getNonceForAddress(e,il.PRE_CONFIRMED)),n5.info(`${s} Checking new nonce ${t} ${(new Date().getTime()-u)/1e3}s.`),t!==a)return!0;await oH(o),s-=1}break}s-=1}return!1}getStorageAt(t,e,r=this.blockIdentifier){let n=ij(t),i=iz(e),a=new oK(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:n,key:i,block_id:a})}getClassHashAt(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:n,contract_address:r})}getClass(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:n})}getClassAt(t,e=this.blockIdentifier){let r=ij(t),n=new oK(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:n,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}={}){let n=new oK(e).identifier,i={simulation_flags:r?[tT.SKIP_VALIDATE]:[]};return this.fetchEndpoint("starknet_estimateFee",{request:t.map(t=>this.buildTransaction(t,"fee")),block_id:n,...i})}async invoke(t,e){let r=this.buildTransaction({type:r5.ETransactionType.INVOKE,...t,...e},"transaction"),n=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:r});return this.waitMode?this.waitForTransaction((await n).transaction_hash):n}async declare(t,e){let r=this.buildTransaction({type:r5.ETransactionType.DECLARE,...t,...e},"transaction"),n=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:r});return this.waitMode?this.waitForTransaction((await n).transaction_hash):n}async deployAccount(t,e){let r=this.buildTransaction({type:r5.ETransactionType.DEPLOY_ACCOUNT,...t,...e},"transaction"),n=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:r});return this.waitMode?this.waitForTransaction((await n).transaction_hash):n}callContract(t,e=this.blockIdentifier){let r=new oK(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:i5(t.entrypoint),calldata:sC.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){let{from_address:r,to_address:n,entry_point_selector:i,payload:a}=t,s={from_address:oV(r),to_address:ij(n),entry_point_selector:i3(i),payload:iG(a)},o=new oK(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:s,block_id:o})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){let r=o4(e);iv(of(t),n0.legacyTxRPC08Message),iv("transaction"!==e||ie(t.resourceBounds),n0.SWOldV3);let n={signature:oT(t.signature),nonce:ij(t.nonce),resource_bounds:oB(t.resourceBounds),tip:ij(t.tip),paymaster_data:t.paymasterData.map(t=>ij(t)),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map(t=>ij(t)),version:oO(r.v3,t.version)};if(t.type===r5.ETransactionType.INVOKE)return{type:tv.INVOKE,sender_address:t.contractAddress,calldata:sC.toHex(t.calldata),...n};if(t.type===r5.ETransactionType.DECLARE)return iv(oP(t.contract),"Declaring non Sierra contract using RPC 0.9"),{type:t.type,contract_class:{...t.contract,sierra_program:oI(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,...n};if(t.type===r5.ETransactionType.DEPLOY_ACCOUNT){let{account_deployment_data:e,...r}=n;return{type:t.type,constructor_calldata:sC.toHex(t.constructorCalldata||[]),class_hash:ij(t.classHash),contract_address_salt:ij(t.addressSalt||0),...r}}throw Error("RPC buildTransaction received unknown TransactionType")}},o7=("undefined"!=typeof WebSocket&&WebSocket||"undefined"!=typeof globalThis&&globalThis.WebSocket||"undefined"!=typeof window&&window.WebSocket&&window.WebSocket.bind(window)||"undefined"!=typeof global&&global.WebSocket,class{resourceBoundsOverhead;constructor(t){this.resourceBoundsOverhead=t}parseGetBlockResponse(t){return t}parseTransactionReceipt(t){return t}parseFeeEstimateBulkResponse(t){return t.map(t=>({resourceBounds:oN(t,this.resourceBoundsOverhead),overall_fee:oD(t,this.resourceBoundsOverhead),unit:t.unit}))}parseSimulateTransactionResponse(t){return t.map(t=>({transaction_trace:t.transaction_trace,resourceBounds:oN(t.fee_estimation,this.resourceBoundsOverhead),overall_fee:oD(t.fee_estimation,this.resourceBoundsOverhead),unit:t.fee_estimation.unit}))}parseContractClassResponse(t){return{...t,abi:iC(t.abi)?JSON.parse(t.abi):t.abi}}parseL1GasPriceResponse(t){return t.l1_gas_price.price_in_wei}});function ct(t){return"0x3"===t.version&&"tip"in t&&iC(t.tip)&&("INVOKE"===t.type||"DECLARE"===t.type||"DEPLOY_ACCOUNT"===t.type)}function ce(t,e=!0){return t.transactions.filter(ct).map(t=>BigInt(t.tip)).filter(t=>e||t>0n)}function cr(t,e){return{minTip:0n,maxTip:0n,averageTip:0n,medianTip:0n,modeTip:0n,recommendedTip:0n,p90Tip:0n,p95Tip:0n,metrics:{blocksAnalyzed:t,transactionsTipsFound:e}}}function cn(t,e){let r=e/100*(t.length-1),n=Math.floor(r),i=Math.ceil(r);if(n===i)return t[n];let a=t[n],s=(t[i]-a)*BigInt(Math.round(1e3*(r-n)))/1000n;return a+s}function ci(t){let e;iv(t.length>0,"Cannot calculate statistics from empty tip array");let r=t.reduce((t,e)=>e<t?e:t,nN.max),n=t.reduce((t,e)=>e>t?e:t,0n),i=t.reduce((t,e)=>t+e,0n)/BigInt(t.length),a=[...t].sort((t,e)=>t<e?-1:t>e?1:0),s=Math.floor(a.length/2);e=a.length%2==0?(a[s-1]+a[s])/2n:a[s];let o=new Map;t.forEach(t=>{o.set(t,(o.get(t)||0)+1)});let{modeTip:c}=Array.from(o.entries()).reduce((t,[e,r])=>r>t.maxCount||r===t.maxCount&&e<t.modeTip?{maxCount:r,modeTip:e}:t,{maxCount:0,modeTip:0n});return{minTip:r,maxTip:n,averageTip:i,medianTip:e,modeTip:c,recommendedTip:e,p90Tip:cn(a,90),p95Tip:cn(a,95)}}async function ca(t,e){try{let r=await t.getBlockWithTxs(e);if(iN(r.block_number))return r.block_number;return(await t.getBlockLatestAccepted()).block_number}catch(t){throw new a4(`Failed to determine starting block number: ${t instanceof Error?t.message:"Unknown error"}`)}}async function cs(t,e){try{return await t.getBlockWithTxs(e)}catch(t){return n5.warn(`Failed to fetch block ${e}:`,t),null}}function co(t,e){return Array.from({length:t-Math.max(0,t-e+1)+1},(e,r)=>t-r)}async function cc(t,e){return Promise.all(e.map(async e=>{try{return await t.getBlockWithTxs(e)}catch(t){return n5.warn(`Failed to fetch block ${e} in parallel:`,t),null}}))}async function cl(t,e,r){let{maxBlocks:n=3,minTxsNecessary:i=10,includeZeroTips:a=!0}=r;try{let r=await ca(t,e),s=co(r,n),o=await cc(t,s),c=o.filter(t=>null!==t).flatMap(t=>ce(t,a)),l=o.filter(t=>null!==t).length;if(c.length<i)return n5.error(`Insufficient transaction data: foun
7d ${c.length} V3 transactions with tips in ${l} blocks (block range: ${Math.max(0,r-n+1)}-${r}). Required: ${i} transactions. Consider reducing minTxsNecessary or increasing maxBlocks.`),cr(l,c);return{...ci(c),metrics:{blocksAnalyzed:l,transactionsTipsFound:c}}}catch(t){throw new a4(`Failed to analyze tip statistics (parallel): ${t instanceof Error?t.message:"Unknown error"}`)}}async function cu(t,e,r){let{maxBlocks:n=3,minTxsNecessary:i=10,includeZeroTips:a=!0}=r;try{let r=await ca(t,e),s=co(r,n),o=[],c=0;for(let e of s){let r=await cs(t,e);if(r){c+=1;let t=ce(r,a);if(o.push(...t),o.length>=i)break}}if(o.length<i)return n5.error(`Insufficient transaction data: found ${o.length} V3 transactions with tips in ${c} blocks (block range: ${Math.max(0,r-n+1)}-${r}). Required: ${i} transactions. Consider reducing minTxsNecessary or increasing maxBlocks.`),cr(c,o);return{...ci(o),metrics:{blocksAnalyzed:c,transactionsTipsFound:o}}}catch(t){throw new a4(`Failed to analyze tip statistics (sequential): ${t instanceof Error?t.message:"Unknown error"}`)}}async function cd(t,e=il.LATEST,r={}){let{maxBlocks:n=3,minTxsNecessary:i=10}=r;return(iv(Number.isInteger(n),"maxBlocks parameter must be an integer"),iv(n>=1,"maxBlocks parameter must be greater than or equal to 1"),iv(n<=100,"maxBlocks parameter must be less than or equal to 100 for performance"),iv(Number.isInteger(i),"minTxsNecessary parameter must be an integer"),iv(i>=1,"minTxsNecessary parameter must be greater than or equal to 1"),t.channel.batchClient)?cl(t,e,r):cu(t,e,r)}var ch=class t{statusReceipt;value;constructor(e){Object.assign(this,e);let[r,n]=t.isSuccess(e)?["SUCCEEDED",e]:t.isReverted(e)?["REVERTED",e]:["ERROR",Error("Unknown response type")];Object.defineProperties(this,{statusReceipt:{value:r,writable:!1,enumerable:!1,configurable:!1},value:{value:n,writable:!1,enumerable:!1,configurable:!1},match:{value:t=>r in t?t[r](n):t._(),writable:!1,enumerable:!1,configurable:!1},isSuccess:{value:()=>"SUCCEEDED"===r,writable:!1,enumerable:!1,configurable:!1},isReverted:{value:()=>"REVERTED"===r,writable:!1,enumerable:!1,configurable:!1},isError:{value:()=>"ERROR"===r,writable:!1,enumerable:!1,configurable:!1}})}match;isSuccess;isReverted;isError;static isSuccess(t){return t.execution_status===ic.SUCCEEDED}static isReverted(t){return t.execution_status===ic.REVERTED}},cf={[ic.SUCCEEDED]:{statusReceipt:"SUCCEEDED",getBaseData:t=>t,getValue:t=>t},[ic.REVERTED]:{statusReceipt:"REVERTED",getBaseData:t=>t,getValue:t=>t}};function cp(t){let e;let r=cf[t.execution_status];if(r){let{statusReceipt:n,getBaseData:i,getValue:a}=r,s=a(t);e={...i(t),statusReceipt:n,value:s,match:t=>n in t?t[n](s):t._(),isSuccess:()=>"SUCCEEDED"===n,isReverted:()=>"REVERTED"===n,isError:()=>!1}}else{let t=Error("Unknown response type");e={statusReceipt:"ERROR",value:t,match:e=>"ERROR"in e?e.ERROR(t):e._(),isSuccess:()=>!1,isReverted:()=>!1,isError:()=>!0}}return Object.setPrototypeOf(e,ch.prototype),Object.defineProperty(e,"constructor",{value:ch,writable:!1,enumerable:!1,configurable:!1}),e}r0({},{encodeData:()=>cM,encodeType:()=>cT,encodeValue:()=>cN,getDependencies:()=>cv,getMessageHash:()=>cC,getStructHash:()=>cD,getTypeHash:()=>cS,isMerkleTreeType:()=>cA,prepareSelector:()=>cw,validateTypedData:()=>cI,verifyMessage:()=>ck}),r0({},{MerkleTree:()=>cg,proofMerklePath:()=>function t(e,r,n,i=s6){if(0===n.length)return e===r;let[a,...s]=n;return t(e,cg.hash(r,a,i),s,i)}});var cg=class t{leaves;branches=[];root;hashMethod;constructor(t,e=s6){this.hashMethod=e,this.leaves=t,this.root=this.build(t)}build(e){if(1===e.length)return e[0];e.length!==this.leaves.length&&this.branches.push(e);let r=[];for(let n=0;n<e.length;n+=2)n+1===e.length?r.push(t.hash(e[n],"0x0",this.hashMethod)):r.push(t.hash(e[n],e[n+1],this.hashMethod));return this.build(r)}static hash(t,e,r=s6){let[n,i]=[BigInt(t),BigInt(e)].sort((t,e)=>t>=e?1:-1);return r(n,i)}getProof(e,r=this.leaves,n=[]){let i=r.indexOf(e);if(-1===i)throw Error("leaf not found");if(1===r.length)return n;let a=i%2==0,s=(a?r[i+1]:r[i-1])??"0x0",o=[...n,s],c=this.leaves.length===r.length?-1:this.branches.findIndex(t=>t.length===r.length),l=this.branches[c+1]??[this.root];return this.getProof(t.hash(a?e:s,a?s:e,this.hashMethod),l,o)}},cy={u256:JSON.parse('[{ "name": "low", "type": "u128" }, { "name": "high", "type": "u128" }]'),TokenAmount:JSON.parse('[{ "name": "token_address", "type": "ContractAddress" }, { "name": "amount", "type": "u256" }]'),NftId:JSON.parse('[{ "name": "collection_address", "type": "ContractAddress" }, { "name": "token_id", "type": "u256" }]')},cm={[r5.TypedDataRevision.ACTIVE]:{domain:"StarknetDomain",hashMethod:on,hashMerkleMethod:or,escapeTypeString:t=>`"${t}"`,presetTypes:cy},[r5.TypedDataRevision.LEGACY]:{domain:"StarkNetDomain",hashMethod:s9,hashMerkleMethod:s6,escapeTypeString:t=>t,presetTypes:{}}};function c_(t,e,{min:r,max:n}){let i=BigInt(t);iv(i>=r&&i<=n,`${i} (${e}) is out of bounds [${r}, ${n}]`)}function cE({types:t,domain:e}){return cm[r5.TypedDataRevision.ACTIVE].domain in t&&e.revision?.toString()===r5.TypedDataRevision.ACTIVE?r5.TypedDataRevision.ACTIVE:cm[r5.TypedDataRevision.LEGACY].domain in t&&(e.revision??r5.TypedDataRevision.LEGACY)===r5.TypedDataRevision.LEGACY?r5.TypedDataRevision.LEGACY:void 0}function cb(t){try{return ij(t)}catch(e){if(iC(t))return ij(ao(t));throw Error(`Invalid BigNumberish: ${t}`)}}function cI(t){return!!(t.message&&t.primaryType&&t.types&&cE(t))}function cw(t){return iL(t)?t:i5(t)}function cA(t){return"merkletree"===t.type}function cv(t,e,r=[],n="",i=r5.TypedDataRevision.LEGACY){let a=[e];return"*"===e[e.length-1]?a=[e.slice(0,-1)]:i===r5.TypedDataRevision.ACTIVE&&("enum"===e?a=[n]:e.match(/^\(.*\)$/)&&(a=e.slice(1,-1).split(",").map(t=>"*"===t[t.length-1]?t.slice(0,-1):t))),a.filter(e=>!r.includes(e)&&t[e]).reduce((e,r)=>[...e,...[r,...t[r].reduce((e,r)=>[...e,...cv(t,r.type,e,r.contains,i).filter(t=>!e.includes(t))],[])].filter(t=>!e.includes(t))],[])}function cT(t,e,r=r5.TypedDataRevision.LEGACY){let n=r===r5.TypedDataRevision.ACTIVE?{...t,...cm[r].presetTypes}:t,[i,...a]=cv(n,e,void 0,void 0,r),s=i?[i,...a.sort()]:[],o=cm[r].escapeTypeString;return s.map(t=>{let e=n[t].map(t=>{let e="enum"===t.type&&r===r5.TypedDataRevision.ACTIVE?t.contains:t.type,n=e.match(/^\(.*\)$/)?`(${e.slice(1,-1).split(",").map(t=>t?o(t):t).join(",")})`:o(e);return`${o(t.name)}:${n}`});return`${o(t)}(${e})`}).join("")}function cS(t,e,r=r5.TypedDataRevision.LEGACY){return i5(cT(t,e,r))}function cN(t,e,r,n={},i=r5.TypedDataRevision.LEGACY){if(t[e])return[e,cD(t,e,r,i)];if(cm[i].presetTypes[e])return[e,cD(cm[i].presetTypes,e,r,i)];if(e.endsWith("*")){let n=r.map(r=>cN(t,e.slice(0,-1),r,void 0,i)[1]);return[e,cm[i].hashMethod(n)]}switch(e){case"enum":if(i===r5.TypedDataRevision.ACTIVE){let[a,s]=Object.entries(r)[0],o=t[n.parent].find(t=>t.name===n.key),c=t[o.contains],l=c.find(t=>t.name===a),u=c.indexOf(l),d=l.type.slice(1,-1).split(",").map((e,r)=>e?cN(t,e,s[r],void 0,i)[1]:e);return[e,cm[i].hashMethod([u,...d])]}return[e,cb(r)];case"merkletree":{let e=function(t,e){if(e.parent&&e.key){let r=t[e.parent].find(t=>t.name===e.key);if(!cA(r))throw Error(`${e.key} is not a merkle tree`);if(r.contains.endsWith("*"))throw Error(`Merkle tree contain property must not be an array but was given ${e.key}`);return r.contains}return"raw"}(t,n),{root:a}=new cg(r.map(r=>cN(t,e,r,void 0,i)[1]),cm[i].hashMerkleMethod);return["felt",a]}case"selector":return["felt",cw(r)];case"string":if(i===r5.TypedDataRevision.ACTIVE){let t=ad(r),n=[t.data.length,...t.data,t.pending_word,t.pending_word_len];return[e,cm[i].hashMethod(n)]}return[e,cb(r)];case"i128":if(i===r5.TypedDataRevision.ACTIVE){let t=BigInt(r);return c_(t,e,nP),[e,cb(t<0n?nA+t:t)]}return[e,cb(r)];case"timestamp":case"u128":return i===r5.TypedDataRevision.ACTIVE&&c_(r,e,nL),[e,cb(r)];case"felt":case"shortstring":return i===r5.TypedDataRevision.ACTIVE&&c_(cb(r),e,nN),[e,cb(r)];case"ClassHash":case"ContractAddress":return i===r5.TypedDataRevision.ACTIVE&&c_(r,e,nN),[e,cb(r)];case"bool":return i===r5.TypedDataRevision.ACTIVE&&iv(iM(r),`Type mismatch for ${e} ${r}`),[e,cb(r)];default:if(i===r5.TypedDataRevision.ACTIVE)throw Error(`Unsupported type: ${e}`);return[e,cb(r)]}}function cM(t,e,r,n=r5.TypedDataRevision.LEGACY){let[i,a]=(t[e]??cm[n].presetTypes[e]).reduce(([i,a],s)=>{if(void 0===r[s.name]||null===r[s.name]&&"enum"!==s.type)throw Error(`Cannot encode data: missing data for '${s.name}'`);let o=r[s.name],c={parent:e,key:s.name},[l,u]=cN(t,s.type,o,c,n);return[[...i,l],[...a,u]]},[["felt"],[cS(t,e,n)]]);return[i,a]}function cD(t,e,r,n=r5.TypedDataRevision.LEGACY){return cm[n].hashMethod(cM(t,e,r,n)[1])}function cC(t,e){if(!cI(t))throw Error("Typed data does not match JSON sc
7hema");let r=cE(t),{domain:n,hashMethod:i}=cm[r];return i([ao("StarkNet Message"),cD(t.types,n,t.domain,r),e,cD(t.types,t.primaryType,t.message,r)])}function ck(t,e,r,n){let i=cI(t);if(!i0(t)&&!i)throw Error("message has a wrong format.");if(i&&void 0===n)throw Error("When providing a TypedData in message parameter, the accountAddress parameter has to be provided.");if(i&&!i0(n))throw Error("accountAddress shall be a BigNumberish");let a=i?cC(t,n):ij(t),s=Array.isArray(e)?new eC.Signature(BigInt(e[0]),BigInt(e[1])):e,o=ij(r);return eC.verify(s,a,o)}async function cO(t,e,r,n,i,a){let s;let o=cI(e);if(!i0(e)&&!o)throw Error("message has a wrong format.");if(!i0(n))throw Error("accountAddress shall be a BigNumberish");let c=o?cC(e,n):ij(e),l=a||{okResponse:[],nokResponse:["0x0","0x00"],error:["argent/invalid-signature","0x617267656e742f696e76616c69642d7369676e6174757265","is invalid, with respect to the public key","0x697320696e76616c6964","INVALID_SIG","0x494e56414c49445f534947"]};for(let e of i?[i]:["isValidSignature","is_valid_signature"])try{let i=await t.callContract({contractAddress:ij(n),entrypoint:e,calldata:sC.compile({hash:iR(c).toString(),signature:oA(r)})});if(l.nokResponse.includes(i[0].toString()))return!1;if(0===l.okResponse.length||l.okResponse.includes(i[0].toString()))return!0;throw Error("signatureVerificationResponse Error: response is not part of known responses")}catch(t){if(l.error.some(e=>t.message.includes(e)))return!1;s=t}throw Error(`Signature verification Error: ${s}`)}async function cL(t,e=t.blockIdentifier){let r=await t.getBlockWithTxHashes(e);return{l1DataGasPrice:BigInt(r.l1_data_gas_price.price_in_fri),l1GasPrice:BigInt(r.l1_gas_price.price_in_fri),l2GasPrice:BigInt(r.l2_gas_price.price_in_fri)}}var cx=class{responseParser;channel;constructor(t){if(t&&"channel"in t)this.channel=t.channel,this.responseParser="responseParser"in t?t.responseParser:new o7;else{if(t&&t.specVersion){if(op("0.8",t.specVersion))this.channel=new n3.RpcChannel({...t,waitMode:!1});else if(op("0.9",t.specVersion))this.channel=new o6.RpcChannel({...t,waitMode:!1});else throw Error(`unsupported channel for spec version: ${t.specVersion}`)}else if(op("0.8",n2.get("rpcVersion")))this.channel=new n3.RpcChannel({...t,waitMode:!1});else if(op("0.9",n2.get("rpcVersion")))this.channel=new o6.RpcChannel({...t,waitMode:!1});else throw Error("unable to define spec version for channel");this.responseParser=new o7(t?.resourceBoundsOverhead)}}static async create(t){let e=new n3.RpcChannel({...t}),r=await e.getSpecVersion();if(og(r)||n5.warn(`Using incompatible node spec version ${r}`),op("0.8",r))return new this({...t,specVersion:nQ.v0_8_1});if(op("0.9",r))return new this({...t,specVersion:nQ.v0_9_0});throw new a4(`Provided RPC node specification version ${r} is not compatible with the SDK. SDK supported RPC versions ${Object.keys(nQ).toString()}`)}fetch(t,e,r=0){return this.channel.fetch(t,e,r)}async getChainId(){return this.channel.getChainId()}readSpecVersion(){return this.channel.readSpecVersion()}async getSpecVersion(){return this.channel.getSpecVersion()}setUpSpecVersion(){return this.channel.setUpSpecVersion()}async getStarknetVersion(t){return this.channel.getStarknetVersion(t)}async getNonceForAddress(t,e){return this.channel.getNonceForAddress(t,e)}async getBlock(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.channel.getBlockLatestAccepted()}async getBlockNumber(){return this.channel.getBlockNumber()}async getBlockWithTxHashes(t){return this.channel.getBlockWithTxHashes(t)}async getBlockWithTxs(t){return this.channel.getBlockWithTxs(t)}async waitForBlock(t=il.LATEST,e=5e3){if(t===il.LATEST||"pending"===t)return;let r=await this.getBlockNumber(),n=t===il.PRE_CONFIRMED?r+1:Number(ij(t));if(n<=r)return;let{retries:i}=this.channel,a=i,s=!1;for(;!s;)if(await this.getBlockNumber()===n?s=!0:await oH(e),(a-=1)<=0)throw Error(`waitForBlock() timed-out after ${i} tries.`)}async getL1GasPrice(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseL1GasPriceResponse)}async getGasPrices(t=this.channel.blockIdentifier){if(this.channel instanceof o6.RpcChannel)return cL(this.channel,t);throw new a4("Unsupported method for RPC version")}async getL1MessageHash(t){let e=await this.channel.getTransactionByHash(t);iv("L1_HANDLER"===e.type,"This L2 transaction is not a L1 message.");let{calldata:r,contract_address:n,entry_point_selector:i,nonce:a}=e;return i6([r[0],n,a,i,r.length-1,...r.slice(1)])}async getBlockWithReceipts(t){return this.channel.getBlockWithReceipts(t)}getStateUpdate=this.getBlockStateUpdate;async getBlockStateUpdate(t){return this.channel.getBlockStateUpdate(t)}async getBlockTransactionsTraces(t){return this.channel.getBlockTransactionsTraces(t)}async getBlockTransactionCount(t){return this.channel.getBlockTransactionCount(t)}async getTransaction(t){return this.channel.getTransactionByHash(t)}async getTransactionByHash(t){return this.channel.getTransactionByHash(t)}async getTransactionByBlockIdAndIndex(t,e){return this.channel.getTransactionByBlockIdAndIndex(t,e)}async getTransactionReceipt(t){let e=await this.channel.getTransactionReceipt(t);return cp(this.responseParser.parseTransactionReceipt(e))}async getTransactionTrace(t){return this.channel.getTransactionTrace(t)}async getTransactionStatus(t){return this.channel.getTransactionStatus(t)}async getSimulateTransaction(t,e){return this.channel.simulateTransaction(t,e).then(t=>this.responseParser.parseSimulateTransactionResponse(t))}async waitForTransaction(t,e){return cp(await this.channel.waitForTransaction(t,e))}async fastWaitForTransaction(t,e,r,n){if(this.channel instanceof o6.RpcChannel)return await this.channel.fastWaitForTransaction(t,e,r,n);throw Error("Unsupported channel type")}async getStorageAt(t,e,r){return this.channel.getStorageAt(t,e,r)}async getClassHashAt(t,e){return this.channel.getClassHashAt(t,e)}async getClassByHash(t){return this.getClass(t)}async getClass(t,e){return this.channel.getClass(t,e).then(this.responseParser.parseContractClassResponse)}async getClassAt(t,e){return this.channel.getClassAt(t,e).then(this.responseParser.parseContractClassResponse)}async getContractVersion(t,e,{blockIdentifier:r=this.channel.blockIdentifier,compiler:n=!0}={}){let i;if(t)i=await this.getClassAt(t,r);else if(e)i=await this.getClass(e,r);else throw Error("getContractVersion require contractAddress or classHash");return oP(i)?n?{cairo:"1",compiler:aH(i.abi).compiler}:{cairo:"1",compiler:void 0}:{cairo:"0",compiler:"0"}}
7async getInvokeEstimateFee(t,e,r,n){return(await this.getEstimateFeeBulk([{type:r5.ETransactionType.INVOKE,...t,...e}],{blockIdentifier:r,skipValidate:n}))[0]}async getDeclareEstimateFee(t,e,r,n){return(await this.getEstimateFeeBulk([{type:r5.ETransactionType.DECLARE,...t,...e}],{blockIdentifier:r,skipValidate:n}))[0]}async getDeployAccountEstimateFee(t,e,r,n){return(await this.getEstimateFeeBulk([{type:r5.ETransactionType.DEPLOY_ACCOUNT,...t,...e}],{blockIdentifier:r,skipValidate:n}))[0]}async getEstimateFeeBulk(t,e){return this.channel.getEstimateFee(t,e).then(t=>this.responseParser.parseFeeEstimateBulkResponse(t))}async invokeFunction(t,e){return this.channel.invoke(t,e)}async declareContract(t,e){return this.channel.declare(t,e)}async deployAccountContract(t,e){return this.channel.deployAccount(t,e)}async callContract(t,e){return this.channel.callContract(t,e)}async estimateMessageFee(t,e){return this.channel.estimateMessageFee(t,e)}async getSyncingStats(){return this.channel.getSyncingStats()}async getEvents(t){if(this.channel instanceof n3.RpcChannel||this.channel instanceof o6.RpcChannel)return this.channel.getEvents(t);throw Error("Unsupported channel type")}async verifyMessageInStarknet(t,e,r,n,i){return cO(this,t,e,r,n,i)}async isClassDeclared(t,e){let r;if(!t.classHash&&"contract"in t)r=oU(t,await this.channel.getStarknetVersion()).classHash;else if(t.classHash)r=t.classHash;else throw Error("contractClassIdentifier type not satisfied");try{return await this.getClass(r,e) instanceof Object}catch(t){if(t instanceof a4)return!1;throw t}}async prepareInvocations(t){let e=[];for(let r of t)r.type===r5.ETransactionType.DECLARE?await this.isClassDeclared("payload"in r?r.payload:r)||e.unshift(r):e.push(r);return e}async getL1MessagesStatus(t){return this.channel.getMessagesStatus(t)}async getStorageProof(t,e,r,n){return this.channel.getStorageProof(t,e,r,n)}async getCompiledCasm(t){return this.channel.getCompiledCasm(t)}async getEstimateTip(t,e={}){return cd(this,t,e)}};r0({},{StarknetIdContract:()=>cY,StarknetIdIdentityContract:()=>cW,StarknetIdMulticallContract:()=>cZ,StarknetIdPfpContract:()=>cX,StarknetIdPopContract:()=>c0,StarknetIdVerifierContract:()=>cQ,dynamicCallData:()=>c5,dynamicFelt:()=>c4,execution:()=>c2,getStarknetIdContract:()=>c$,getStarknetIdIdentityContract:()=>cq,getStarknetIdMulticallContract:()=>cG,getStarknetIdPfpContract:()=>cJ,getStarknetIdPopContract:()=>c1,getStarknetIdVerifierContract:()=>cK,isStarkDomain:()=>c3,useDecoded:()=>cF,useEncoded:()=>cH});var cR="abcdefghijklmnopqrstuvwxyz0123456789-",cB=BigInt(cR.length+1),cj="这来",cP=BigInt(cR.length),cU=BigInt(cj.length),cz=BigInt(cj.length+1);function cV(t){let e=0;for(;t.endsWith(cj[cj.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function cF(t){let e="";return(t.forEach(t=>{for(;t!==nE;){let r=t%cB;if(t/=cB,r===BigInt(cR.length)){let r=t/cz;if(r===nE){let n=t%cz;t=r,n===nE?e+=cR[0]:e+=cj[Number(n)-1]}else e+=cj[Number(t%cU)],t/=cU}else e+=cR[Number(r)]}let[r,n]=cV(e);n&&(e=r+(n%2==0?cj[cj.length-1].repeat(n/2-1)+cj[0]+cR[1]:cj[cj.length-1].repeat((n-1)/2+1))),e+="."}),e)?e.concat("stark"):e}function cH(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(cj[0]+cR[1])){let[e,r]=cV(t.substring(0,t.length-2));t=e+cj[cj.length-1].repeat(2*(r+1))}else{let[e,r]=cV(t);r&&(t=e+cj[cj.length-1].repeat(1+2*(r-1)))}for(let n=0;n<t.length;n+=1){let i=t[n],a=cR.indexOf(i),s=BigInt(cR.indexOf(i));-1!==a?n===t.length-1&&t[n]===cR[0]?(e+=r*cP,r*=cB*cB):(e+=r*s,r*=cB):-1!==cj.indexOf(i)&&(e+=r*cP,r*=cB,e+=r*BigInt((n===t.length-1?1:0)+cj.indexOf(i)),r*=cU)}return e}var cY={MAINNET:"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",TESTNET_SEPOLIA:"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"};function c$(t){switch(t){case nZ.SN_MAIN:return cY.MAINNET;case nZ.SN_SEPOLIA:return cY.TESTNET_SEPOLIA;default:throw Error("Starknet.id is not yet deployed on this network")}}var cW={MAINNET:"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",TESTNET_SEPOLIA:"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"};function cq(t){switch(t){case nZ.SN_MAIN:return cW.MAINNET;
7case nZ.SN_SEPOLIA:return cW.TESTNET_SEPOLIA;default:throw Error("Starknet.id verifier contract is not yet deployed on this network")}}var cZ="0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";function cG(t){switch(t){case nZ.SN_MAIN:case nZ.SN_SEPOLIA:return cZ;default:throw Error("Starknet.id multicall contract is not yet deployed on this network")}}var cQ={MAINNET:"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",TESTNET_SEPOLIA:"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"};function cK(t){switch(t){case nZ.SN_MAIN:return cQ.MAINNET;case nZ.SN_SEPOLIA:return cQ.TESTNET_SEPOLIA;default:throw Error("Starknet.id verifier contract is not yet deployed on this network")}}var cX={MAINNET:"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",TESTNET_SEPOLIA:"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"};function cJ(t){switch(t){case nZ.SN_MAIN:return cX.MAINNET;case nZ.SN_SEPOLIA:return cX.TESTNET_SEPOLIA;default:throw Error("Starknet.id profile picture verifier contract is not yet deployed on this network")}}var c0={MAINNET:"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",TESTNET_SEPOLIA:"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"};function c1(t){switch(t){case nZ.SN_MAIN:return c0.MAINNET;case nZ.SN_SEPOLIA:return c0.TESTNET_SEPOLIA;default:throw Error("Starknet.id proof of personhood verifier contract is not yet deployed on this network")}}function c2(t,e,r){return new aZ({Static:t,IfEqual:e?aW(e[0],e[1],e[2]):void 0,IfNotEqual:r?aW(r[0],r[1],r[2]):void 0})}function c4(t,e){return new aZ({Hardcoded:t,Reference:e?aW(e[0],e[1]):void 0})}function c5(t,e,r){return new aZ({Hardcoded:t,Reference:e?aW(e[0],e[1]):void 0,ArrayReference:r?aW(r[0],r[1]):void 0})}function c3(t){return/^(?:[a-z0-9-]{1,48}(?:[a-z0-9-]{1,48}[a-z0-9-])?\.)*[a-z0-9-]{1,48}\.stark$/.test(t)}var c6=class t{async getStarkName(e,r){return t.getStarkName(this,e,r)}async getAddressFromStarkName(e,r){return t.getAddressFromStarkName(this,e,r)}async getStarkProfile(e,r,n,i,a,s,o){return t.getStarkProfile(this,e,r,n,i,a,s,o)}static async getStarkName(t,e,r){let n=await t.getChainId(),i=r??c$(n);try{let r=(await t.callContract({contractAddress:i,entrypoint:"address_to_domain",calldata:sC.compile({address:e,hint:[]})})).map(t=>BigInt(t)).slice(1),n=cF(r);if(!n)throw Error("Starkname not found");return n}catch(t){if(t instanceof Error&&"Starkname not found"===t.message)throw t;throw Error("Could not get stark name")}}static async getAddressFromStarkName(t,e,r){let n=e.endsWith(".stark")?e:`${e}.stark`;if(!c3(n))throw Error("Invalid domain, must be a valid .stark domain");let i=await t.getChainId(),a=r??c$(i);try{let e=n.replace(".stark","").split(".").map(t=>cH(t).toString(10));return(await t.callContract({contractAddress:a,entrypoint:"domain_to_address",calldata:sC.compile({domain:e,hint:[]})}))[0]}catch{throw Error("Could not get address from stark name")}}static async getStarkProfile(t,e,r,n,i,a,s,o){let c=await t.getChainId(),l=r??c$(c),u=n??cq(c),d=i??cK(c),h=a??cJ(c),f=s??c1(c),p=o??cG(c);try{let r=[{execution:c2({}),to:c5(l),selector:c5(i5("address_to_domain")),calldata:[c5(e),c5("0")]},{execution:c2({}),to:c4(l),selector:c4(i5("domain_to_id")),calldata:[c5(void 0,void 0,[0,0])]},{execution:c2({}),to:c4(u),selector:c4(i5("get_verifier_data")),calldata:[c5(void 0,[1,0]),c5(ao("twitter")),c5(d),c5("0")]},{execution:c2({}),to:c4(u),selector:c4(i5("get_verifier_data")),calldata:[c5(void 0,[1,0]),c5(ao("github")),c5(d),c5("0")]},{execution:c2({}),to:c4(u),selector:c4(i5("get_verifier_data")),calldata:[c5(void 0,[1,0]),c5(ao("discord")),c5(d),c5("0")]},{execution:c2({}),to:c4(u),selector:c4(i5("get_verifier_data")),calldata:[c5(void 0,[1,0]),c5(ao("proof_of_personhood")),c5(f),c5("0")]},{execution:c2({}),to:c4(u),selector:c4(i5("get_verifier_data")),calldata:[c5(void 0,[1,0]),c5(ao("nft_pp_contract")),c5(h),c5("0")]},{execution:c2({}),to:c4(u),selector:c4(i5("get_extended_verifier_data")),calldata:[c5(void 0,[1,0]),c5(ao("nft_pp_id")),c5("2"),c5(h),c5("0")]},{execution:c2(void 0,void 0,[6,0,0]),to:c4(void 0,[6,0]),selector:c4(i5("tokenURI")),calldata:[c5(void 0,[7,1]),c5(void 0,[7,2])]}],n=await t.callContract({contractAddress:p,entrypoint:"aggregate",calldata:sC.compile({calls:r})});if(Array.isArray(n)){let t=parseInt(n[0],16),e=[],r=1;for(let i=0;i<t;i+=1)if(r<n.length){let t=parseInt(n[r],16);r+=1;let i=n.slice(r,r+t);e.push(i),r+=t}else break;let i=cF(e[0].slice(1).map(t=>BigInt(t))),a="0x0"!==e[2][0]?BigInt(e[2][0]).toString():void 0,s="0x0"!==e[3][0]?BigInt(e[3][0]).toString():void 0,o="0x0"!==e[4][0]?BigInt(e[4][0]).toString():void 0,c="0x1"===e[5][0],l=("0x9"===n[0]?e[8].slice(1).map(t=>ac(t)).join(""):void 0)||`https://starknet.id/api/identicons/${BigInt(e[1][0]).toString()}`;
7return{name:i,twitter:a,github:s,discord:o,proofOfPersonhood:c,profilePicture:l}}throw Error("Error while calling aggregate function")}catch(t){if(t instanceof Error)throw t;throw Error("Could not get user stark profile data from address")}}};function c8(t){return cH(t.endsWith(".brother")?t.replace(".brother",""):t)}function c9(t){let e=cF([t]);return e.endsWith(".stark")?e.replace(".stark",".brother"):e?`${e}.brother`:e}function c7(t){return nZ.SN_MAIN,"0x0212f1c57700f5a3913dd11efba540196aad4cf67772f7090c62709dd804fa74"}var lt=class t{async getBrotherName(e,r){return t.getBrotherName(this,e,r)}async getAddressFromBrotherName(e,r){return t.getAddressFromBrotherName(this,e,r)}async getBrotherProfile(e,r){return t.getBrotherProfile(this,e,r)}static async getBrotherName(t,e,r){let n=await t.getChainId(),i=r??c7(n);try{let r=await t.callContract({contractAddress:i,entrypoint:"getPrimary",calldata:sC.compile({user:e})});if(!r[0]||"0x0"===r[0])throw Error("Brother name not found");let n=BigInt(r[0]);return c9(n)}catch(t){if(t instanceof Error&&"Brother name not found"===t.message)throw t;throw Error("Could not get brother name")}}static async getAddressFromBrotherName(t,e,r){let n=e.endsWith(".brother")?e:`${e}.brother`;if(!n.endsWith(".brother"))throw Error("Invalid domain, must be a valid .brother domain");let i=await t.getChainId(),a=r??c7(i);try{let e=await t.callContract({contractAddress:a,entrypoint:"get_details_by_domain",calldata:sC.compile({domain:c8(n)})});if(!e[0]||"0x0"===e[1])throw Error("Could not get address from brother name");return e[1]}catch{throw Error("Could not get address from brother name")}}static async getBrotherProfile(t,e,r){let n=await t.getChainId(),i=r??c7(n);try{let r=await t.callContract({contractAddress:i,entrypoint:"getPrimary",calldata:sC.compile({user:e})});if(!r[0]||"0x0"===r[0])throw Error("Brother profile not found");let n=BigInt(r[0]),a=c9(n).replace(".brother",""),s=await t.callContract({contractAddress:i,entrypoint:"get_details_by_domain",calldata:sC.compile({domain:c8(a)})});return{name:a,resolver:s[1],tokenId:s[2],expiryDate:parseInt(s[3],16),lastTransferTime:parseInt(s[4],16)}}catch(t){if(t instanceof Error&&"Brother profile not found"===t.message)throw t;throw Error("Could not get brother profile")}}},le=class extends(0,rZ.Mixin)(cx,c6,lt){},lr=new cx({default:!0}),ln=class{pk;constructor(t=eC.utils.randomPrivateKey()){this.pk=t instanceof Uint8Array?ni(t):ij(t)}async getPubKey(){return eC.getStarkKey(this.pk)}async signMessage(t,e){let r=cC(t,e);return this.signRaw(r)}async signTransaction(t,e){let r;let n=o2(t,e.cairoVersion);if(Object.values(r5.ETransactionVersion3).includes(e.version))r=sX({...e,senderAddress:e.walletAddress,compiledCalldata:n,version:e.version,nonceDataAvailabilityMode:ok(e.nonceDataAvailabilityMode),feeDataAvailabilityMode:ok(e.feeDataAvailabilityMode)});else throw Error("unsupported signTransaction version");return this.signRaw(r)}async signDeployAccountTransaction(t){let e;let r=sC.compile(t.constructorCalldata);if(Object.values(r5.ETransactionVersion3).includes(t.version))e=s0({...t,salt:t.addressSalt,compiledConstructorCalldata:r,version:t.version,nonceDataAvailabilityMode:ok(t.nonceDataAvailabilityMode),feeDataAvailabilityMode:ok(t.feeDataAvailabilityMode)});else throw Error("unsupported signDeployAccountTransaction version");return this.signRaw(e)}async signDeclareTransaction(t){let e;if(Object.values(r5.ETransactionVersion3).includes(t.version))e=sJ({...t,version:t.version,nonceDataAvailabilityMode:ok(t.nonceDataAvailabilityMode),feeDataAvailabilityMode:ok(t.feeDataAvailabilityMode)});else throw Error("unsupported signDeclareTransaction version");return this.signRaw(e)}async signRaw(t){return eC.sign(t,this.pk)}};function li(t){return new a_(t).toBigInt()}function la(t){return a_.is(t)}function ls(t){return new a_(t).toUint256HexString()}function lo(t){let e=function(t){let e=na(ij(iC(t)?ns(t):t)).padStart(64,"0");return ns(e)}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw Error("Invalid Address Format");return iH(e,nE,nT-1n,"Starknet Address"),e}function lc(t){return"calldata_len"in t?{To:t.to,Selector:t.selector,Calldata:t.calldata}:t}function ll(t){let e=t.calldata??[],r=Array.isArray(e)?e:sC.compile(e);return{to:t.contractAddress,selector:i5(t.entrypoint),calldata:r}}function lu(t,e){let r=ll(t);return"1"===e?{...r,calldata_len:r.calldata.length,calldata:r.calldata}:{To:r.to,Selector:r.selector,Calldata:r.calldata}}function ld(t,e){return{name:"Account.execute_from_outside",version:e,chainId:t,..."2"===e?{revision:"1"}:{}}}function lh(t,e,r,n,i){return"1"===i?{types:iy,primaryType:"OutsideExecution",domain:ld(t,i),message:{...e,nonce:r,calls_len:n.length,calls:n.map(t=>lu(t,i))}}:{types:im,primaryType:"OutsideExecution",domain:ld(t,i),message:{Caller:e.caller,Nonce:r,"Execute After":e.execute_after,"Execute Before":e.execute_before,Calls:n.map(t=>lu(t,i))}}}function lf(t){let e=t.outsideExecution,r=oA(t.signature);return sC.compile({outside_execution:e,signature:r})}function lp(t){return(Array.isArray(t)?t:[t]).map(t=>{let e;if(t.version===i_.V1)e="execute_from_outside";else if(t.version===i_.V2)e="execute_from_outside_v2";else throw Error("Unsupported OutsideExecution version");return{contractAddress:ij(t.signerAddress),entrypoint:e,calldata:lf(t)}})}async function lg(t,e,r){let n={contractAddress:ij(e),entrypoint:"supports_interface",calldata:[ij(r)]};try{let e=await t.callContract(n);return 0n!==BigInt(e[0])}catch{return!1}}r0({},{bnToUint256:()=>ls,isUint256:()=>la,uint256ToBN:()=>li}),r0({},{buildExecuteFromOutsideCall:()=>lp,buildExecuteFromOutsideCallData:()=>lf,getOutsideCall:()=>ll,getTypedData:()=>lh,toOutsideCallV2:()=>lc}),r0({},{supportsInterface:()=>lg}),r0({}
7,{assertCallsAreStrictlyEqual:()=>lE,assertPaymasterTransactionSafety:()=>lb,getDefaultPaymasterNodeUrl:()=>ly});var ly=(t,e=!1)=>{e||n5.info("Using default public node url, please provide nodeUrl in provider options!");let r=nJ[t??nq.SN_SEPOLIA],n=Math.floor(Math.random()*r.length);return r[n]},lm=(t,e)=>{let r=lc(t[t.length-1]);iv(BigInt(sC.toCalldata(r.Calldata)[1])===BigInt(e),"Gas token value is not equal to the provided gas fees")},l_=(t,e)=>{iv(BigInt(lc(t[t.length-1]).To)===BigInt(e),"Gas token address is not equal to the provided gas token")};function lE(t,e){let r="Provided calls are not strictly equal to the returned calls";iv(e.length-1===t.length,`${r}: Expected ${t.length+1} calls, got ${e.length}`);for(let n=0;n<t.length;n+=1){let i=t[n],a=lc(e[n]),s=t=>iR(t).toString(16).toLowerCase();iv(s(i.contractAddress)===s(a.To),`${r}: Contract address mismatch at call ${n}. Expected: ${i.contractAddress}, Got: ${a.To}`),iv(i5(i.entrypoint)===a.Selector,`${r}: Entrypoint mismatch at call ${n}. Expected: ${i.entrypoint}, Got: ${a.Selector}`);let o=sC.toCalldata(i.calldata),c=sC.toCalldata(a.Calldata);iv(o.length===c.length,`${r}: Calldata length mismatch at call ${n}. Expected length: ${o.length}, Got length: ${c.length}`);for(let t=0;t<o.length;t+=1)iv(BigInt(o[t])===BigInt(c[t]),`${r}: Calldata value mismatch at call ${n}, parameter ${t}. Expected: ${o[t]}, Got: ${c[t]}`)}}var lb=(t,e,r,n)=>{if("sponsored"!==r.feeMode.mode&&("invoke"===t.type||"deploy_and_invoke"===t.type)){let i="calls"in t.typed_data.message?t.typed_data.message.calls:t.typed_data.message.Calls;lE(e,i),l_(i,r.feeMode.gasToken),n&&(iv(t.fee.suggested_max_fee_in_gas_token<=n,"Gas token price is too high"),lm(i,t.fee.suggested_max_fee_in_gas_token))}},lI=t=>t.map(t=>({to:t.contractAddress,selector:i5(t.entrypoint),calldata:sC.toHex(t.calldata)})),lw=t=>"sponsored"===t.mode?{mode:"sponsored"}:{mode:"default",gas_token:t.gasToken},lA=t=>"sponsored"===t.mode?{mode:"sponsored"}:{mode:"default",gasToken:t.gas_token},lv=t=>t?{execute_after:t.executeAfter||1,execute_before:t.executeBefore}:void 0,lT=t=>t?{executeAfter:t.execute_after,executeBefore:t.execute_before}:void 0,lS=t=>({version:t.version,feeMode:lA(t.fee_mode),timeBounds:lT(t.time_bounds)}),lN={headers:{"Content-Type":"application/json"}},lM=class t{nodeUrl;headers;baseFetch;requestId;constructor(e){if(e instanceof t){this.nodeUrl=e.nodeUrl,this.headers={...lN.headers,...e.headers},this.baseFetch=e.baseFetch,this.requestId=e.requestId;return}if(e&&"nodeUrl"in e&&"headers"in e&&"baseFetch"in e){this.nodeUrl=e.nodeUrl??ly(void 0),this.headers={...lN.headers,...e.headers},this.baseFetch=e.baseFetch??oF,this.requestId=0;return}let{nodeUrl:r,headers:n,baseFetch:i}=e||{};r&&Object.values(nq).includes(r)?this.nodeUrl=ly(r,e?.default):r?this.nodeUrl=r:this.nodeUrl=ly(void 0,e?.default),this.baseFetch=i??oF,this.headers={...lN.headers,...n},this.requestId=0}fetch(t,e,r=0){let n={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:iw(n),headers:this.headers})}errorHandler(t,e,r,n){if(r)throw new a5(r,t,e);if(n instanceof a4)throw n;if(n)throw Error(n.message)}async fetchEndpoint(t,e){try{this.requestId+=1;let r=await this.fetch(t,e,this.requestId),{error:n,result:i}=await r.json();return this.errorHandler(t,e,n),i}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async isAvailable(){return this.fetchEndpoint("paymaster_isAvailable")}async buildTransaction(t,e){let r;switch(t.type){case"invoke":case"deploy_and_invoke":r={...t,invoke:{user_address:t.invoke.userAddress,calls:lI(t.invoke.calls)}};break;default:r=t}let n={version:e.version,fee_mode:lw(e.feeMode),time_bounds:lv(e.timeBounds)},i=await this.fetchEndpoint("paymaster_buildTransaction",{transaction:r,parameters:n}),a={gas_token_price_in_strk:BigInt(i.fee.gas_token_price_in_strk),estimated_fee_in_strk:BigInt(i.fee.estimated_fee_in_strk),estimated_fee_in_gas_token:BigInt(i.fee.estimated_fee_in_gas_token),suggested_max_fee_in_strk:BigInt(i.fee.suggested_max_fee_in_strk),suggested_max_fee_in_gas_token:BigInt(i.fee.suggested_max_fee_in_gas_token)};switch(i.type){case"invoke":return{type:"invoke",typed_data:i.typed_data,parameters:lS(i.parameters),fee:a};case"deploy_and_invoke":return{type:"deploy_and_invoke",deployment:i.deployment,typed_data:i.typed_data,parameters:lS(i.parameters),fee:a};default:return{type:"deploy",deployment:i.deployment,parameters:lS(i.parameters),fee:a}}}async executeTransaction(t,e){let r;switch(t.type){case"invoke":case"deploy_and_invoke":r={...t,invoke:{user_address:t.invoke.userAddress,typed_data:t.invoke.typedData,signature:oT(t.invoke.signature)}};break;default:r=t}let n={version:e.version,fee_mode:lw(e.feeMode),time_bounds:lv(e.timeBounds)};return this.fetchEndpoint("paymaster_executeTransaction",{transaction:r,parameters:n})}
7async getSupportedTokens(){return this.fetchEndpoint("paymaster_getSupportedTokens").then(t=>t.map(t=>({token_address:t.token_address,decimals:t.decimals,priceInStrk:BigInt(t.price_in_strk)})))}},lD=new lM({default:!0}),lC=class{address;entryPoint;constructor(t,e){this.address=t??nz.ADDRESS,this.entryPoint=e??nz.ENTRYPOINT}buildDeployerCall(t,e){let r=[].concat(t).map(t=>{let{classHash:r,salt:n,unique:i=!0,constructorCalldata:a=[],abi:s}=t,o=oX(a,()=>{if(s){let t=new sC(s),e=Object.values(a);return t.validate(iu.DEPLOY,"constructor",e),t.compile("constructor",e)}return sC.compile(a)}),c=n??ow();return{call:{contractAddress:ij(this.address),entrypoint:this.entryPoint,calldata:[r,c,iQ(i),o.length,...o]},address:s7(i?eC.pedersen(e,c):c,r,o,i?this.address:0)}});return{calls:r.map(t=>t.call),addresses:r.map(t=>t.address)}}parseDeployerEvent(t){if(!t.events?.length)throw Error("Deployer emitted event is empty");let e=t.events.find(t=>ij(t.from_address)===ij(this.address))||{data:[]};return{transaction_hash:t.transaction_hash,contract_address:e.data[0],address:e.data[0],deployer:e.data[1],unique:e.data[2],classHash:e.data[3],calldata_len:e.data[4],calldata:e.data.slice(5,5+parseInt(e.data[4],16)),salt:e.data[e.data.length-1]}}},lk=new lC(nz.ADDRESS,nz.ENTRYPOINT);new lC(nU.ADDRESS,nU.ENTRYPOINT);var lO=class extends le{signer;address;cairoVersion;transactionVersion;paymaster;deployer;defaultTipType;constructor(t){let{provider:e,address:r,signer:n,cairoVersion:i,transactionVersion:a,paymaster:s,defaultTipType:o}=t;super(e),this.address=r.toLowerCase(),this.signer=iC(n)||n instanceof Uint8Array?new ln(n):n,i&&(this.cairoVersion=i.toString()),this.transactionVersion=a??n2.get("transactionVersion"),this.paymaster=s?new lM(s):lD,this.deployer=t.deployer??lk,this.defaultTipType=o??n2.get("defaultTipType"),n5.debug("Account setup",{transactionVersion:this.transactionVersion,cairoVersion:this.cairoVersion,channel:this.channel.id})}static async create(){throw new a4("Not supported")}async getNonce(t){return super.getNonceForAddress(this.address,t)}async getNonceSafe(t){try{return iR(t??await this.getNonce())}catch(t){return 0n}}async getCairoVersion(t){if(!this.cairoVersion){let{cairo:e}=t?await super.getContractVersion(void 0,t):await super.getContractVersion(this.address);this.cairoVersion=e}return this.cairoVersion}async estimateInvokeFee(t,e={}){let r=[{type:r5.ETransactionType.INVOKE,payload:[t].flat()}];return(await this.estimateFeeBulk(r,e))[0]}async estimateDeclareFee(t,e={}){iv(oP(t.contract),"Declare fee estimation is not supported for Cairo0 contracts");let r=[{type:r5.ETransactionType.DECLARE,payload:oU(t,await this.channel.getStarknetVersion())}];return(await this.estimateFeeBulk(r,e))[0]}async estimateAccountDeployFee({classHash:t,addressSalt:e=0,constructorCalldata:r=[],contractAddress:n},i={}){let a=sC.compile(r),s=n??s7(e,t,a,0),o=[{type:r5.ETransactionType.DEPLOY_ACCOUNT,payload:{classHash:t,constructorCalldata:a,addressSalt:e,contractAddress:s}}];return(await this.estimateFeeBulk(o,i))[0]}async estimateDeployFee(t,e={}){let{calls:r}=this.deployer.buildDeployerCall(t,this.address);return this.estimateInvokeFee(r,e)}async estimateFeeBulk(t,e={}){if(!t.length)throw TypeError("Invocations should be non-empty array");if(e.resourceBounds)return[oM(e.resourceBounds)];let{nonce:r,blockIdentifier:n,version:i,skipValidate:a}=e,s=await this.resolveDetailsWithTip(e),o=await this.accountInvocationsFactory(t,{...ox(s),versions:[oO(oL(this.transactionVersion)||n9.F3,i)],nonce:r,blockIdentifier:n,skipValidate:a});return super.getEstimateFeeBulk(o,{blockIdentifier:n,skipValidate:a})}async simulateTransaction(t,e={}){if(!t.length)throw TypeError("Invocations should be non-empty array");let{nonce:r,blockIdentifier:n,skipValidate:i=!0,skipExecute:a,version:s}=e,o=await this.resolveDetailsWithTip(e),c=await this.accountInvocationsFactory(t,{...ox(o),versions:[this.resolveTransactionVersion(s)],nonce:r,blockIdentifier:n,skipValidate:i});return super.getSimulateTransaction(c,{blockIdentifier:n,skipValidate:i,skipExecute:a})}async execute(t,e={}){let r=[t].flat(),n=await this.resolveDetailsWithTip(e),{resourceBounds:i}=e,a=i;a||(a=(await this.estimateInvokeFee(r,n)).resourceBounds);let s=(await this.accountInvocationsFactory([{type:r5.ETransactionType.INVOKE,payload:r}],{...ox(n),resourceBounds:a,versions:[this.resolveTransactionVersion(e.version)],nonce:e.nonce,skipValidate:!1}))[0];return this.invokeFunction({contractAddress:s.contractAddress,calldata:s.calldata,signature:s.signature},{...ox(n),resourceBounds:s.resourceBounds,nonce:s.nonce,version:s.version})}
7async fastExecute(t,e={},r={}){iv(this.channel instanceof o6.RpcChannel,"Wrong Rpc version in Provider. At least Rpc v0.9 required."),iv(this.channel.blockIdentifier===il.PRE_CONFIRMED,"Provider needs to be initialized with `pre_confirmed` blockIdentifier option.");let n=BigInt(e.nonce??await this.getNonceForAddress(this.address,il.PRE_CONFIRMED)),i={...e,nonce:n},a=await this.execute(t,i),s=await this.fastWaitForTransaction(a.transaction_hash,this.address,n,r);return{txResult:a,isReady:s}}async declareIfNot(t,e={}){let r=oU(t,await this.channel.getStarknetVersion());try{await this.getClassByHash(r.classHash)}catch(r){return this.declare(t,e)}return{transaction_hash:"",class_hash:r.classHash}}async declare(t,e={}){iv(oP(t.contract),n0.declareNonSierra);let r=oU(t,await this.channel.getStarknetVersion()),n=await this.resolveDetailsWithTip(e),{resourceBounds:i}=e,a=i;a||(a=(await this.estimateDeclareFee(t,n)).resourceBounds);let s=(await this.accountInvocationsFactory([{type:r5.ETransactionType.DECLARE,payload:r}],{...ox(n),resourceBounds:a,versions:[this.resolveTransactionVersion(e.version)],nonce:e.nonce,skipValidate:!1}))[0];return super.declareContract({senderAddress:s.senderAddress,signature:s.signature,contract:s.contract,compiledClassHash:s.compiledClassHash},{...ox(n),nonce:s.nonce,resourceBounds:s.resourceBounds,version:s.version})}async deploy(t,e={}){let{calls:r,addresses:n}=this.deployer.buildDeployerCall(t,this.address);return{...await this.execute(r,e),contract_address:n}}async deployContract(t,e={}){let r=await this.deploy(t,e),n=await this.waitForTransaction(r.transaction_hash,e);return this.deployer.parseDeployerEvent(n)}async declareAndDeploy(t,e={}){let r=await this.declareIfNot(t,e);if(""!==r.transaction_hash){let t=await this.waitForTransaction(r.transaction_hash,e);r={...r,...t}}let n=await this.deployContract({...t,classHash:r.class_hash},e);return{declare:{...r},deploy:n}}deploySelf=this.deployAccount;async deployAccount({classHash:t,constructorCalldata:e=[],addressSalt:r=0,contractAddress:n},i={}){let a=sC.compile(e),s=n??s7(r,t,a,0),o=await this.resolveDetailsWithTip(i),{resourceBounds:c}=i,l=c;l||(l=(await this.estimateAccountDeployFee({classHash:t,constructorCalldata:e,addressSalt:r,contractAddress:s},o)).resourceBounds);let u=(await this.accountInvocationsFactory([{type:r5.ETransactionType.DEPLOY_ACCOUNT,payload:{classHash:t,constructorCalldata:a,addressSalt:r,contractAddress:s}}],{...ox(o),resourceBounds:l,versions:[this.resolveTransactionVersion(i.version)],nonce:nE,skipValidate:!1}))[0];return super.deployAccountContract({classHash:u.classHash,addressSalt:u.addressSalt,constructorCalldata:u.constructorCalldata,signature:u.signature},{...ox(o),nonce:u.nonce,resourceBounds:u.resourceBounds,version:u.version})}async signMessage(t){return this.signer.signMessage(t,this.address)}async hashMessage(t){return cC(t,this.address)}async getSnip9Version(){return await lg(this,this.address,nH)?i_.V2:await lg(this,this.address,nF)?i_.V1:i_.UNSUPPORTED}async isValidSnip9Nonce(t){try{let e={contractAddress:this.address,entrypoint:"is_valid_outside_execution_nonce",calldata:[ij(t)]},r=await this.callContract(e);return 0n!==BigInt(r[0])}catch(t){throw Error(`Failed to check if nonce is valid: ${t}`)}}async getSnip9Nonce(){let t=ow();return await this.isValidSnip9Nonce(t)?t:this.getSnip9Nonce()}async getOutsideTransaction(t,e,r,n){if(!iL(t.caller)&&"ANY_CALLER"!==t.caller)throw Error(`The caller ${t.caller} is not valid.`);
7let i=iL(t.caller)?t.caller:nV,a=[e].flat(),s=r??await this.getSnip9Version();if(!s)throw Error("This account is not handling outside transactions.");let o=n?ij(n):await this.getSnip9Nonce(),c=lh(await this.getChainId(),{caller:i,execute_after:t.execute_after,execute_before:t.execute_before},o,a,s),l=await this.signMessage(c);return{outsideExecution:{caller:i,nonce:o,execute_after:t.execute_after,execute_before:t.execute_before,calls:a.map(ll)},signature:l,signerAddress:this.address,version:s}}async executeFromOutside(t,e){let r=lp(t);return this.execute(r,e)}async resolveDetailsWithTip(t){return{...t,tip:t.tip??(await this.getEstimateTip())[this.defaultTipType]}}resolveTransactionVersion(t){return oO(this.transactionVersion||n9.V3,t)}async buildInvocation(t,e){let r=o2(t,await this.getCairoVersion()),n=e.skipValidate?[]:await this.signer.signTransaction(t,e);return{...ox(e),contractAddress:this.address,calldata:r,signature:n}}async buildDeclarePayload(t,e){let{classHash:r,contract:n,compiledClassHash:i}=oU(t,await this.channel.getStarknetVersion()),a=o$(n);iv(!iS(i)&&(e.version===n9.F3||e.version===n9.V3),"V3 Transaction work with Cairo1 Contracts and require compiledClassHash");let s=e.skipValidate?[]:await this.signer.signDeclareTransaction({...e,...ox(e),classHash:r,compiledClassHash:i,senderAddress:e.walletAddress});return{senderAddress:e.walletAddress,signature:s,contract:a,compiledClassHash:i}}async buildAccountDeployPayload({classHash:t,addressSalt:e=0,constructorCalldata:r=[],contractAddress:n},i){let a=sC.compile(r),s=n??s7(e,t,a,0),o=i.skipValidate?[]:await this.signer.signDeployAccountTransaction({...i,...ox(i),classHash:t,contractAddress:s,addressSalt:e,constructorCalldata:a});return{...ox(i),classHash:t,addressSalt:e,constructorCalldata:a,signature:o}}async accountInvocationsFactory(t,e){let{nonce:r,blockIdentifier:n,skipValidate:i=!0}=e,a=await this.getNonceSafe(r),s=await this.getChainId(),o=e.versions.map(t=>oO(t)),c="payload"in t[0]?t[0].payload:t[0],l=t[0].type===r5.ETransactionType.DEPLOY_ACCOUNT?await this.getCairoVersion(c.classHash):await this.getCairoVersion();return Promise.all([].concat(t).map(async(t,r)=>{let c="payload"in t?t.payload:t,u={...ox(e),walletAddress:this.address,nonce:iR(Number(a)+r),chainId:s,cairoVersion:l,version:o[0],skipValidate:i},d={type:t.type,nonce:iR(Number(a)+r),blockIdentifier:n,version:o[0]};if(t.type===r5.ETransactionType.INVOKE){let t=await this.buildInvocation([].concat(c),u);return{...d,...t,...u}}if(t.type===r5.ETransactionType.DEPLOY){let{calls:t}=this.deployer.buildDeployerCall(c,this.address),e=await this.buildInvocation(t,u);return{...d,...e,...u,type:r5.ETransactionType.INVOKE}}if(t.type===r5.ETransactionType.DECLARE){iv(oP(c.contract),"Declare fee estimation is not supported for Cairo0 contracts");let t=await this.buildDeclarePayload(c,u);return{...d,...t,...u}}if(t.type===r5.ETransactionType.DEPLOY_ACCOUNT){let t=await this.buildAccountDeployPayload(c,u);return{...d,...t,...u}}throw Error(`accountInvocationsFactory: unsupported transaction type: ${t}`)}))}async buildPaymasterTransaction(t,e){let r;
7if(!e.deploymentData&&await this.getSnip9Version()===i_.UNSUPPORTED)throw Error("Account is not compatible with SNIP-9");let n={version:"0x1",feeMode:e.feeMode,timeBounds:e.timeBounds};return r=e.deploymentData?t.length>0?{type:"deploy_and_invoke",invoke:{userAddress:this.address,calls:t},deployment:e.deploymentData}:{type:"deploy",deployment:e.deploymentData}:{type:"invoke",invoke:{userAddress:this.address,calls:t}},this.paymaster.buildTransaction(r,n)}async estimatePaymasterTransactionFee(t,e){return(await this.buildPaymasterTransaction(t,e)).fee}async preparePaymasterTransaction(t){let e;switch(t.type){case"deploy_and_invoke":{let r=await this.signMessage(t.typed_data);e={type:"deploy_and_invoke",invoke:{userAddress:this.address,typedData:t.typed_data,signature:oT(r)},deployment:t.deployment};break}case"invoke":{let r=await this.signMessage(t.typed_data);e={type:"invoke",invoke:{userAddress:this.address,typedData:t.typed_data,signature:oT(r)}};break}case"deploy":e={type:"deploy",deployment:t.deployment};break;default:throw Error("Invalid transaction type")}return e}async executePaymasterTransaction(t,e,r){let n=await this.buildPaymasterTransaction(t,e);lb(n,t,e,r);let i=await this.preparePaymasterTransaction(n);return this.paymaster.executeTransaction(i,n.parameters).then(t=>({transaction_hash:t.transaction_hash}))}async getStarkName(t=this.address,e){return super.getStarkName(t,e)}};function lL(t,e=!1){return t.request({type:"wallet_requestAccounts",params:{silent_mode:e}})}function lx(t){return t.request({type:"wallet_getPermissions"})}function lR(t,e){return t.request({type:"wallet_watchAsset",params:e})}function lB(t,e){return t.request({type:"wallet_addStarknetChain",params:e})}function lj(t,e){return t.request({type:"wallet_switchStarknetChain",params:{chainId:e}})}function lP(t){return t.request({type:"wallet_requestChainId"})}function lU(t){return t.request({type:"wallet_deploymentData"})}function lz(t,e){return t.request({type:"wallet_addInvokeTransaction",params:e})}function lV(t,e){return t.request({type:"wallet_addDeclareTransaction",params:e})}function lF(t,e){return t.request({type:"wallet_signTypedData",params:e})}function lH(t){return t.request({type:"wallet_supportedSpecs"})}function lY(t,e){t.on("accountsChanged",e)}function l$(t,e){t.on("networkChanged",e)}r0({},{addDeclareTransaction:()=>lV,addInvokeTransaction:()=>lz,addStarknetChain:()=>lB,deploymentData:()=>lU,getPermissions:()=>lx,onAccountChange:()=>lY,onNetworkChanged:()=>l$,requestAccounts:()=>lL,requestChainId:()=>
7lP,signMessage:()=>lF,supportedSpecs:()=>lH,switchStarknetChain:()=>lj,watchAsset:()=>lR});var lW=class t extends lO{walletProvider;constructor(t){super({...t,signer:""}),this.walletProvider=t.walletProvider,this.walletProvider.on("accountsChanged",t=>{t&&(this.address=t[0].toLowerCase())}),this.walletProvider.on("networkChanged",t=>{t&&this.channel.setChainId(t)})}onAccountChange(t){lY(this.walletProvider,t)}onNetworkChanged(t){l$(this.walletProvider,t)}requestAccounts(t=!1){return lL(this.walletProvider,t)}getPermissions(){return lx(this.walletProvider)}switchStarknetChain(t){return lj(this.walletProvider,t)}watchAsset(t){return lR(this.walletProvider,t)}addStarknetChain(t){return lB(this.walletProvider,t)}execute(t){let e=[].concat(t).map(t=>{let{contractAddress:e,entrypoint:r,calldata:n}=t;return{contract_address:e,entry_point:r,calldata:n}});return lz(this.walletProvider,{calls:e})}async declare(t){let e=oU(t,await this.channel.getStarknetVersion()),r=t.contract,n={...r,abi:iw(r.abi)};if(!e.compiledClassHash)throw Error("compiledClassHash is required");let i={compiled_class_hash:e.compiledClassHash,contract_class:n};return lV(this.walletProvider,i)}async deploy(t){let{calls:e,addresses:r}=this.deployer.buildDeployerCall(t,this.address);return{...await this.execute(e),contract_address:r}}signMessage(t){return lF(this.walletProvider,t)}static async connect(e,r,n,i,a=!1){let[s]=await lL(r,a);return new t({provider:e,walletProvider:r,address:s,cairoVersion:n,paymaster:i})}static async connectSilent(e,r,n,i){return t.connect(e,r,n,i,!0)}};function lq(t){return"event"===t.type}function lZ(t){return aV(t)?function(t){let e=t.filter(t=>lq(t)&&"struct"===t.kind),r=t.filter(t=>lq(t)&&"enum"===t.kind);return e.reduce((t,e)=>{let n=[],{name:i}=e,a=!1,s=t=>t.type===i;for(;;){let t=r.find(t=>t.variants.some(s));if(iS(t))break;let e=t.variants.find(s);n.unshift(e.name),"flat"===e.kind&&(a=!0),i=t.name}if(0===n.length)throw Error("inconsistency in ABI events definition.");a&&(n=[n[n.length-1]]);let o=n.pop(),c={[ns(eC.keccak(nt(o)).toString(16))]:e};for(;n.length>0;)c={[ns(eC.keccak(nt(n.pop())).toString(16))]:c};return function t(e,r){let n={...e};return iO(e)&&iO(r)&&Object.keys(r).forEach(i=>{iO(r[i])&&i in e?n[i]=t(e[i],r[i]):Object.assign(n,{[i]:r[i]})}),n}(t,c={...c})},{})}(t):t.filter(t=>"event"===t.type).reduce((t,e)=>{let r=e.name,n={...e};return n.name=r,{...t,[ns(eC.keccak(nt(r)).toString(16))]:n}},{})}function lG(t,e,r,n,i){return t.flat().reduce((t,a)=>{let s=JSON.parse(JSON.stringify(a)),o=e[s.keys.shift()??0];if(!o)return t;for(;!o.name;){let t=s.keys.shift();iv(!!t,'Not enough data in "keys" property of this event.'),o=o[t]}let c={};c[o.name]={};let l=s.keys[Symbol.iterator](),u=s.data[Symbol.iterator](),d=o.members?.filter(t=>"key"===t.kind)||o.keys,h=o.members?.filter(t=>"data"===t.kind)||o.data;return d.forEach(t=>{c[o.name][t.name]=sb({responseIterator:l,output:t,structs:r,enums:n,parser:i,parsedResult:c[o.name]})}),h.forEach(t=>{c[o.name][t.name]=sb({responseIterator:u,output:t,structs:r,enums:n,parser:i,parsedResult:c[o.name]})}),"block_hash"in s&&(c.block_hash=s.block_hash),"block_number"in s&&(c.block_number=s.block_number),"transaction_hash"in s&&(c.transaction_hash=s.transaction_hash),t.push(c),t},[])}function lQ(t,e){return async function(...r){let n={...t.withOptionsProps};return t.withOptionsProps=void 0,t.call(e.name,r,{parseRequest:t.parseRequest,parseResponse:t.parseResponse,...n})}}function lK(t,e){return"view"===e.stateMutability||"view"===e.state_mutability?lQ(t,e):async function(...r){let n={...t.withOptionsProps};return t.withOptionsProps=void 0,t.invoke(e.name,r,{parseRequest:t.parseRequest,...n})}}r0({},{getAbiEvents:()=>lZ,isAbiEvent:()=>lq,parseEvents:()=>lG});var lX=class t{abi;address;providerOrAccount;classHash;parseRequest;parseResponse;structs;events;functions;callStatic;populateTransaction;estimateFee;callData;withOptionsProps;parsingStrategy;constructor(t){this.parsingStrategy=t.parsingStrategy;let e=sd(t.abi,t.parsingStrategy);this.abi=e.getLegacyFormat(),this.address=t.address&&t.address.toLowerCase(),this.providerOrAccount=t.providerOrAccount??lr,this.parseRequest=t.parseRequest??!0,this.parseResponse=t.parseResponse??!0,this.classHash=t.classHash,this.callData=new sC(t.abi,t.parsingStrategy),this.structs=sC.getAbiStruct(t.abi),this.events=lZ(t.abi);let r={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}
7),this.abi.forEach(t=>{var e,n;if("function"!==t.type)return;let i=t.name;this[i]||Object.defineProperty(this,i,{...r,value:lK(this,t)}),this.functions[i]||Object.defineProperty(this.functions,i,{...r,value:lK(this,t)}),this.callStatic[i]||Object.defineProperty(this.callStatic,i,{...r,value:lQ(this,t)}),this.populateTransaction[i]||Object.defineProperty(this.populateTransaction,i,{...r,value:(e=this,function(...r){return e.populate(t.name,r)})}),this.estimateFee[i]||Object.defineProperty(this.estimateFee,i,{...r,value:(n=this,function(...e){let r={...n.withOptionsProps};return n.withOptionsProps=void 0,n.estimate(t.name,e,r)})})})}withOptions(t){return this.withOptionsProps=t,this}attach(t,e){if(this.address=t,e){let t=sd(e,this.parsingStrategy);this.abi=t.getLegacyFormat(),this.callData=new sC(e,this.parsingStrategy),this.structs=sC.getAbiStruct(e),this.events=lZ(e)}}async isDeployed(){try{await this.providerOrAccount.getClassHashAt(this.address)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Contract not deployed at address ${this.address}: ${t}`)}return this}async call(t,e=[],{parseRequest:r=!0,parseResponse:n=!0,formatResponse:i,blockIdentifier:a}={}){iv(null!==this.address,"contract is not connected to an address");let s=oX(e,()=>r?(this.callData.validate(iu.CALL,t,e),this.callData.compile(t,e)):(n5.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),e));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:s,entrypoint:t},a).then(e=>n?i?this.callData.format(t,e,i):this.callData.parse(t,e):e)}async invoke(t,e=[],r={}){let{parseRequest:n=!0,signature:i,waitForTransaction:a,...s}=r;iv(null!==this.address,"contract is not connected to an address");let o=oX(e,()=>n?(this.callData.validate(iu.INVOKE,t,e),this.callData.compile(t,e)):(n5.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),e)),c={contractAddress:this.address,calldata:o,entrypoint:t};if(ig(this.providerOrAccount)){if(s.paymasterDetails){let r={contractAddress:this.address,entrypoint:t,calldata:e};return this.providerOrAccount.executePaymasterTransaction([r],s.paymasterDetails,s.maxFeeInGasToken)}let r=await this.providerOrAccount.execute(c,{...s});if(a){let t=await this.providerOrAccount.waitForTransaction(r.transaction_hash);if(t.isSuccess())return t;throw Error("Transaction failed",{cause:t})}return r}if(!s.nonce)throw Error("Manual nonce is required when invoking a function without an account");return n5.warn(`Invoking ${t} without an account.`),this.providerOrAccount.invokeFunction({...c,signature:i},{...s,nonce:s.nonce})}async estimate(t,e=[],r={}){iv(null!==this.address,"contract is not connected to an address"),oX(e,()=>!1)||this.callData.validate(iu.INVOKE,t,e);let n=this.populate(t,e);if(ig(this.providerOrAccount)){if(r.paymasterDetails){let n={contractAddress:this.address,entrypoint:t,calldata:e};return this.providerOrAccount.estimatePaymasterTransactionFee([n],r.paymasterDetails)}return this.providerOrAccount.estimateInvokeFee(n,r)}throw Error("Contract must be connected to the account contract to estimate")}populate(t,e=[]){let r=oX(e,()=>this.callData.compile(t,e));return{contractAddress:this.address,entrypoint:t,calldata:r}}parseEvents(t){let e=[];return t.match({SUCCEEDED:t=>{e=lG(t.events?.map(e=>({block_hash:t.block_hash,block_number:t.block_number,transaction_hash:t.transaction_hash,...e})).filter(t=>ij(t.from_address)===ij(this.address),[])||[],this.events,this.structs,sC.getAbiEnum(this.abi),this.callData.parser)},_:()=>{throw Error("This transaction was not successful.")}}),Object.defineProperty(e,"getByPath",{value:t=>{let r=e.find(e=>Object.keys(e).some(e=>e.includes(t))),n=Object.keys(r||{}).find(e=>e.includes(t));return n&&r?r[n]:null},writable:!1,enumerable:!1,configurable:!1}),e}isCairo1(){return ah.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typedv2(t){return this}static async factory(e,r={}){let n,i,a;let{account:s,parseRequest:o=!0}=e;if("classHash"in e&&e.classHash&&!("contract"in e))i=e.classHash.toString(),n=e.abi?e.abi:(await s.getClass(i)).abi,a=(await s.deployContract({classHash:i,constructorCalldata:e.constructorCalldata,salt:e.salt,unique:e.unique,abi:o?n:void 0},r)).contract_address;else{let t=o$(e.contract);n=e.abi?e.abi:oW(t);let{declare:{class_hash:c},deploy:{contract_address:l}}=await s.declareAndDeploy({...e,abi:o?n:void 0},r);i=c.toString(),a=l}return iv(!!a,"Deployment of the contract failed"),new t({abi:n,address:a,providerOrAccount:s,classHash:i,parseRequest:e.parseRequest,parseResponse:e.parseResponse,parsingStrategy:e.parsingStrategy})}};r5.TypedDataRevision}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.