edge-currency-accountbased 2.2.3 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/android/src/main/assets/edge-currency-accountbased/1944.chunk.js +4 -0
- package/android/src/main/assets/edge-currency-accountbased/2153.chunk.js +2 -0
- package/android/src/main/assets/edge-currency-accountbased/2821.chunk.js +2 -0
- package/android/src/main/assets/edge-currency-accountbased/2896.chunk.js +35 -0
- package/android/src/main/assets/edge-currency-accountbased/2945.chunk.js +25 -0
- package/android/src/main/assets/edge-currency-accountbased/3491.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/{620.chunk.js → 3620.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/{666.chunk.js → 3666.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/3720.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/{978.chunk.js → 3978.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/4251.chunk.js +4 -0
- package/android/src/main/assets/edge-currency-accountbased/4431.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/4618.chunk.js +20 -0
- package/android/src/main/assets/edge-currency-accountbased/{627.chunk.js → 4627.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/4650.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/{826.chunk.js → 5179.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/{835.chunk.js → 5835.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/5836.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/6266.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/6291.chunk.js +58 -0
- package/android/src/main/assets/edge-currency-accountbased/6341.chunk.js +44 -0
- package/android/src/main/assets/edge-currency-accountbased/7221.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/7428.chunk.js +6 -0
- package/android/src/main/assets/edge-currency-accountbased/{481.chunk.js → 7481.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/7542.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/7786.chunk.js +2 -0
- package/android/src/main/assets/edge-currency-accountbased/8190.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/{689.chunk.js → 8689.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/{726.chunk.js → 8726.chunk.js} +1 -1
- package/android/src/main/assets/edge-currency-accountbased/9068.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/{223.chunk.js → 9223.chunk.js} +2 -2
- package/android/src/main/assets/edge-currency-accountbased/9539.chunk.js +10 -0
- package/android/src/main/assets/edge-currency-accountbased/{645.chunk.js → 9645.chunk.js} +6 -6
- package/android/src/main/assets/edge-currency-accountbased/9669.chunk.js +7 -0
- package/android/src/main/assets/edge-currency-accountbased/algorand.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/bnb.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +2 -18
- package/android/src/main/assets/edge-currency-accountbased/eos.chunk.js +5 -5
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/filecoin.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/fio.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/hedera.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/polkadot.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/ripple.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/solana.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/stellar.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/tezos.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/tron.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/zcash.chunk.js +2 -2
- package/lib/ethereum/info/avalancheInfo.js +8 -0
- package/lib/ethereum/info/ethereumInfo.js +8 -0
- package/lib/filecoin/FilecoinEngine.js +112 -79
- package/lib/filecoin/Filfox.js +68 -1
- package/lib/filecoin/filecoinInfo.js +8 -3
- package/lib/filecoin/filecoinTypes.js +1 -6
- package/lib/zcash/ZcashEngine.js +11 -9
- package/package.json +1 -1
- package/android/src/main/assets/edge-currency-accountbased/124.chunk.js +0 -35
- package/android/src/main/assets/edge-currency-accountbased/17.chunk.js +0 -58
- package/android/src/main/assets/edge-currency-accountbased/190.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/221.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/298.chunk.js +0 -44
- package/android/src/main/assets/edge-currency-accountbased/431.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/491.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/539.chunk.js +0 -10
- package/android/src/main/assets/edge-currency-accountbased/542.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/618.chunk.js +0 -20
- package/android/src/main/assets/edge-currency-accountbased/650.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/68.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/720.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/786.chunk.js +0 -2
- package/android/src/main/assets/edge-currency-accountbased/836.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/935.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/944.chunk.js +0 -4
- package/android/src/main/assets/edge-currency-accountbased/945.chunk.js +0 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[
|
|
1
|
+
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[9645],{39386:function(Ee,g,L){"use strict";/**
|
|
2
2
|
* Support for translating between Uint8Array instances and JavaScript
|
|
3
3
|
* native types.
|
|
4
4
|
*
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
* @license MIT
|
|
106
106
|
* @author Peter A. Bigot
|
|
107
107
|
* @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}
|
|
108
|
-
*/var j=this&&this.__extends||function(){var w=function(b,l){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,y){u.__proto__=y}||function(u,y){for(var C in y)Object.prototype.hasOwnProperty.call(y,C)&&(u[C]=y[C])},w(b,l)};return function(b,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");w(b,l);function u(){this.constructor=b}b.prototype=l===null?Object.create(l):(u.prototype=l.prototype,new u)}}();g.__esModule=!0,g.s16=g.s8=g.nu64be=g.u48be=g.u40be=g.u32be=g.u24be=g.u16be=g.nu64=g.u48=g.u40=g.u32=g.u24=g.u16=g.u8=g.offset=g.greedy=g.Constant=g.UTF8=g.CString=g.Blob=g.Boolean=g.BitField=g.BitStructure=g.VariantLayout=g.Union=g.UnionLayoutDiscriminator=g.UnionDiscriminator=g.Structure=g.Sequence=g.DoubleBE=g.Double=g.FloatBE=g.Float=g.NearInt64BE=g.NearInt64=g.NearUInt64BE=g.NearUInt64=g.IntBE=g.Int=g.UIntBE=g.UInt=g.OffsetLayout=g.GreedyCount=g.ExternalLayout=g.bindConstructorLayout=g.nameWithProperty=g.Layout=g.uint8ArrayToBuffer=g.checkUint8Array=void 0,g.constant=g.utf8=g.cstr=g.blob=g.unionLayoutDiscriminator=g.union=g.seq=g.bits=g.struct=g.f64be=g.f64=g.f32be=g.f32=g.ns64be=g.s48be=g.s40be=g.s32be=g.s24be=g.s16be=g.ns64=g.s48=g.s40=g.s32=g.s24=void 0;var J=D(48764);function B(w){if(!(w instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}g.checkUint8Array=B;function K(w){return B(w),J.Buffer.from(w.buffer,w.byteOffset,w.length)}g.uint8ArrayToBuffer=K;var N=function(){function w(b,l){if(!Number.isInteger(b))throw new TypeError("span must be an integer");this.span=b,this.property=l}return w.prototype.makeDestinationObject=function(){return{}},w.prototype.decode=function(b,l){throw new Error("Layout is abstract")},w.prototype.encode=function(b,l,u){throw new Error("Layout is abstract")},w.prototype.getSpan=function(b,l){if(0>this.span)throw new RangeError("indeterminate span");return this.span},w.prototype.replicate=function(b){var l=Object.create(this.constructor.prototype);return Object.assign(l,this),l.property=b,l},w.prototype.fromArray=function(b){},w}();g.Layout=N;function I(w,b){return b.property?w+"["+b.property+"]":w}g.nameWithProperty=I;function E(w,b){if(typeof w!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(w,"layout_"))throw new Error("Class is already bound to a layout");if(!(b&&b instanceof N))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(b,"boundConstructor_"))throw new Error("layout is already bound to a constructor");w.layout_=b,b.boundConstructor_=w,b.makeDestinationObject=function(){return new w},Object.defineProperty(w.prototype,"encode",{value:function(l,u){return b.encode(this,l,u)},writable:!0}),Object.defineProperty(w,"decode",{value:function(l,u){return b.decode(l,u)},writable:!0})}g.bindConstructorLayout=E;var h=function(w){j(b,w);function b(){return w!==null&&w.apply(this,arguments)||this}return b.prototype.isCount=function(){throw new Error("ExternalLayout is abstract")},b}(N);g.ExternalLayout=h;var f=function(w){j(b,w);function b(l,u){var y=this;if(l===void 0&&(l=1),!Number.isInteger(l)||0>=l)throw new TypeError("elementSpan must be a (positive) integer");return y=w.call(this,-1,u)||this,y.elementSpan=l,y}return b.prototype.isCount=function(){return!0},b.prototype.decode=function(l,u){B(l),u===void 0&&(u=0);var y=l.length-u;return Math.floor(y/this.elementSpan)},b.prototype.encode=function(l,u,y){return 0},b}(h);g.GreedyCount=f;var O=function(w){j(b,w);function b(l,u,y){var C=this;if(!(l instanceof N))throw new TypeError("layout must be a Layout");if(u===void 0)u=0;else if(!Number.isInteger(u))throw new TypeError("offset must be integer or undefined");return C=w.call(this,l.span,y||l.property)||this,C.layout=l,C.offset=u,C}return b.prototype.isCount=function(){return this.layout instanceof _||this.layout instanceof P},b.prototype.decode=function(l,u){return u===void 0&&(u=0),this.layout.decode(l,u+this.offset)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),this.layout.encode(l,u,y+this.offset)},b}(h);g.OffsetLayout=O;var _=function(w){j(b,w);function b(l,u){var y=w.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readUIntLE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeUIntLE(l,y,this.span),this.span},b}(N);g.UInt=_;var P=function(w){j(b,w);function b(l,u){var y=w.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readUIntBE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeUIntBE(l,y,this.span),this.span},b}(N);g.UIntBE=P;var R=function(w){j(b,w);function b(l,u){var y=w.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readIntLE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeIntLE(l,y,this.span),this.span},b}(N);g.Int=R;var m=function(w){j(b,w);function b(l,u){var y=w.call(this,l,u)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readIntBE(u,this.span)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeIntBE(l,y,this.span),this.span},b}(N);g.IntBE=m;var T=Math.pow(2,32);function F(w){var b=Math.floor(w/T),l=w-b*T;return{hi32:b,lo32:l}}function U(w,b){return w*T+b}var G=function(w){j(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=K(l),C=y.readUInt32LE(u),L=y.readUInt32LE(u+4);return U(L,C)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=F(l),L=K(u);return L.writeUInt32LE(C.lo32,y),L.writeUInt32LE(C.hi32,y+4),8},b}(N);g.NearUInt64=G;var H=function(w){j(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=K(l),C=y.readUInt32BE(u),L=y.readUInt32BE(u+4);return U(C,L)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=F(l),L=K(u);return L.writeUInt32BE(C.hi32,y),L.writeUInt32BE(C.lo32,y+4),8},b}(N);g.NearUInt64BE=H;var se=function(w){j(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=K(l),C=y.readUInt32LE(u),L=y.readInt32LE(u+4);return U(L,C)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=F(l),L=K(u);return L.writeUInt32LE(C.lo32,y),L.writeInt32LE(C.hi32,y+4),8},b}(N);g.NearInt64=se;var A=function(w){j(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=K(l),C=y.readInt32BE(u),L=y.readUInt32BE(u+4);return U(C,L)},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=F(l),L=K(u);return L.writeInt32BE(C.hi32,y),L.writeUInt32BE(C.lo32,y+4),8},b}(N);g.NearInt64BE=A;var ye=function(w){j(b,w);function b(l){return w.call(this,4,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readFloatLE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeFloatLE(l,y),4},b}(N);g.Float=ye;var Y=function(w){j(b,w);function b(l){return w.call(this,4,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readFloatBE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeFloatBE(l,y),4},b}(N);g.FloatBE=Y;var ce=function(w){j(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readDoubleLE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeDoubleLE(l,y),8},b}(N);g.Double=ce;var oe=function(w){j(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,u){return u===void 0&&(u=0),K(l).readDoubleBE(u)},b.prototype.encode=function(l,u,y){return y===void 0&&(y=0),K(u).writeDoubleBE(l,y),8},b}(N);g.DoubleBE=oe;var ue=function(w){j(b,w);function b(l,u,y){var C=this;if(!(l instanceof N))throw new TypeError("elementLayout must be a Layout");if(!(u instanceof h&&u.isCount()||Number.isInteger(u)&&0<=u))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var L=-1;return!(u instanceof h)&&0<l.span&&(L=u*l.span),C=w.call(this,L,y)||this,C.elementLayout=l,C.count=u,C}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0,C=this.count;if(C instanceof h&&(C=C.decode(l,u)),0<this.elementLayout.span)y=C*this.elementLayout.span;else for(var L=0;L<C;)y+=this.elementLayout.getSpan(l,u+y),++L;return y},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=[],C=0,L=this.count;for(L instanceof h&&(L=L.decode(l,u));C<L;)y.push(this.elementLayout.decode(l,u)),u+=this.elementLayout.getSpan(l,u),C+=1;return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=this.elementLayout,L=l.reduce(function(k,_e){return k+C.encode(_e,u,y+k)},0);return this.count instanceof h&&this.count.encode(l.length,u,y),L},b}(N);g.Sequence=ue;var Z=function(w){j(b,w);function b(l,u,y){var C=this;if(!(Array.isArray(l)&&l.reduce(function(Ne,qe){return Ne&&qe instanceof N},!0)))throw new TypeError("fields must be array of Layout instances");typeof u=="boolean"&&y===void 0&&(y=u,u=void 0);for(var L=0,k=l;L<k.length;L++){var _e=k[L];if(0>_e.span&&_e.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout")}var be=-1;try{be=l.reduce(function(Ne,qe){return Ne+qe.getSpan()},0)}catch{}return C=w.call(this,be,u)||this,C.fields=l,C.decodePrefixes=!!y,C}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0;try{y=this.fields.reduce(function(C,L){var k=L.getSpan(l,u);return u+=k,C+k},0)}catch{throw new RangeError("indeterminate span")}return y},b.prototype.decode=function(l,u){B(l),u===void 0&&(u=0);for(var y=this.makeDestinationObject(),C=0,L=this.fields;C<L.length;C++){var k=L[C];if(k.property!==void 0&&(y[k.property]=k.decode(l,u)),u+=k.getSpan(l,u),this.decodePrefixes&&l.length===u)break}return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);for(var C=y,L=0,k=0,_e=0,be=this.fields;_e<be.length;_e++){var Ne=be[_e],qe=Ne.span;if(k=0<qe?qe:0,Ne.property!==void 0){var $t=l[Ne.property];$t!==void 0&&(k=Ne.encode($t,u,y),0>qe&&(qe=Ne.getSpan(u,y)))}L=y,y+=qe}return L+k-C},b.prototype.fromArray=function(l){for(var u=this.makeDestinationObject(),y=0,C=this.fields;y<C.length;y++){var L=C[y];L.property!==void 0&&0<l.length&&(u[L.property]=l.shift())}return u},b.prototype.layoutFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=this.fields;u<y.length;u++){var C=y[u];if(C.property===l)return C}},b.prototype.offsetOf=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=0,C=this.fields;y<C.length;y++){var L=C[y];if(L.property===l)return u;0>L.span?u=-1:0<=u&&(u+=L.span)}},b}(N);g.Structure=Z;var M=function(){function w(b){this.property=b}return w.prototype.decode=function(b,l){throw new Error("UnionDiscriminator is abstract")},w.prototype.encode=function(b,l,u){throw new Error("UnionDiscriminator is abstract")},w}();g.UnionDiscriminator=M;var re=function(w){j(b,w);function b(l,u){var y=this;if(!(l instanceof h&&l.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return y=w.call(this,u||l.property||"variant")||this,y.layout=l,y}return b.prototype.decode=function(l,u){return this.layout.decode(l,u)},b.prototype.encode=function(l,u,y){return this.layout.encode(l,u,y)},b}(M);g.UnionLayoutDiscriminator=re;var ie=function(w){j(b,w);function b(l,u,y){var C=this,L=l instanceof _||l instanceof P,k;if(L)k=new re(new O(l));else if(l instanceof h&&l.isCount())k=new re(l);else if(l instanceof M)k=l;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(u===void 0&&(u=null),!(u===null||u instanceof N))throw new TypeError("defaultLayout must be null or a Layout");if(u!==null){if(0>u.span)throw new Error("defaultLayout must have constant span");u.property===void 0&&(u=u.replicate("content"))}var _e=-1;u&&(_e=u.span,0<=_e&&L&&(_e+=k.layout.span)),C=w.call(this,_e,y)||this,C.discriminator=k,C.usesPrefixDiscriminator=L,C.defaultLayout=u,C.registry={};var be=C.defaultGetSourceVariant.bind(C);return C.getSourceVariant=function(Ne){return be(Ne)},C.configGetSourceVariant=function(Ne){be=Ne.bind(this)},C}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=this.getVariant(l,u);if(!y)throw new Error("unable to determine span for unrecognized variant");return y.getSpan(l,u)},b.prototype.defaultGetSourceVariant=function(l){if(Object.prototype.hasOwnProperty.call(l,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(l,this.defaultLayout.property))return;var u=this.registry[l[this.discriminator.property]];if(u&&(!u.layout||u.property&&Object.prototype.hasOwnProperty.call(l,u.property)))return u}else for(var y in this.registry){var u=this.registry[y];if(u.property&&Object.prototype.hasOwnProperty.call(l,u.property))return u}throw new Error("unable to infer src variant")},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y,C=this.discriminator,L=C.decode(l,u),k=this.registry[L];if(k===void 0){var _e=this.defaultLayout,be=0;this.usesPrefixDiscriminator&&(be=C.layout.span),y=this.makeDestinationObject(),y[C.property]=L,y[_e.property]=_e.decode(l,u+be)}else y=k.decode(l,u);return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=this.getSourceVariant(l);if(C===void 0){var L=this.discriminator,k=this.defaultLayout,_e=0;return this.usesPrefixDiscriminator&&(_e=L.layout.span),L.encode(l[L.property],u,y),_e+k.encode(l[k.property],u,y+_e)}return C.encode(l,u,y)},b.prototype.addVariant=function(l,u,y){var C=new ge(this,l,u,y);return this.registry[l]=C,C},b.prototype.getVariant=function(l,u){var y;return l instanceof Uint8Array?(u===void 0&&(u=0),y=this.discriminator.decode(l,u)):y=l,this.registry[y]},b}(N);g.Union=ie;var ge=function(w){j(b,w);function b(l,u,y,C){var L=this;if(!(l instanceof ie))throw new TypeError("union must be a Union");if(!Number.isInteger(u)||0>u)throw new TypeError("variant must be a (non-negative) integer");if(typeof y=="string"&&C===void 0&&(C=y,y=null),y){if(!(y instanceof N))throw new TypeError("layout must be a Layout");if(l.defaultLayout!==null&&0<=y.span&&y.span>l.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof C!="string")throw new TypeError("variant must have a String property")}var k=l.span;return 0>l.span&&(k=y?y.span:0,0<=k&&l.usesPrefixDiscriminator&&(k+=l.discriminator.layout.span)),L=w.call(this,k,C)||this,L.union=l,L.variant=u,L.layout=y||null,L}return b.prototype.getSpan=function(l,u){if(0<=this.span)return this.span;u===void 0&&(u=0);var y=0;this.union.usesPrefixDiscriminator&&(y=this.union.discriminator.layout.span);var C=0;return this.layout&&(C=this.layout.getSpan(l,u+y)),y+C},b.prototype.decode=function(l,u){var y=this.makeDestinationObject();if(u===void 0&&(u=0),this!==this.union.getVariant(l,u))throw new Error("variant mismatch");var C=0;this.union.usesPrefixDiscriminator&&(C=this.union.discriminator.layout.span);var L=this.property;return this.layout?y[L]=this.layout.decode(l,u+C):L?y[L]=!0:this.union.usesPrefixDiscriminator&&(y[this.union.discriminator.property]=this.variant),y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=0;this.union.usesPrefixDiscriminator&&(C=this.union.discriminator.layout.span);var L=this.property;if(this.layout&&!Object.prototype.hasOwnProperty.call(l,L))throw new TypeError("variant lacks property "+L);this.union.discriminator.encode(this.variant,u,y);var k=C;if(this.layout&&(this.layout.encode(l[L],u,y+C),k+=this.layout.getSpan(u,y+C),0<=this.union.span&&k>this.union.span))throw new Error("encoded variant overruns containing union");return k},b.prototype.fromArray=function(l){if(this.layout)return this.layout.fromArray(l)},b}(N);g.VariantLayout=ge;function me(w){return 0>w&&(w+=4294967296),w}var Oe=function(w){j(b,w);function b(l,u,y){var C=this;if(!(l instanceof _||l instanceof P))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof u=="string"&&y===void 0&&(y=u,u=!1),4<l.span)throw new RangeError("word cannot exceed 32 bits");C=w.call(this,l.span,y)||this,C.word=l,C.msb=!!u,C.fields=[];var L=0;return C._packedSetValue=function(k){return L=me(k),this},C._packedGetValue=function(){return L},C}return b.prototype.decode=function(l,u){var y=this.makeDestinationObject();u===void 0&&(u=0);var C=this.word.decode(l,u);this._packedSetValue(C);for(var L=0,k=this.fields;L<k.length;L++){var _e=k[L];_e.property!==void 0&&(y[_e.property]=_e.decode(C))}return y},b.prototype.encode=function(l,u,y){y===void 0&&(y=0);var C=this.word.decode(u,y);this._packedSetValue(C);for(var L=0,k=this.fields;L<k.length;L++){var _e=k[L];if(_e.property!==void 0){var be=l[_e.property];be!==void 0&&_e.encode(be)}}return this.word.encode(this._packedGetValue(),u,y)},b.prototype.addField=function(l,u){var y=new Ve(this,l,u);return this.fields.push(y),y},b.prototype.addBoolean=function(l){var u=new fe(this,l);return this.fields.push(u),u},b.prototype.fieldFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var u=0,y=this.fields;u<y.length;u++){var C=y[u];if(C.property===l)return C}},b}(N);g.BitStructure=Oe;var Ve=function(){function w(b,l,u){if(!(b instanceof Oe))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(l)||0>=l)throw new TypeError("bits must be positive integer");var y=8*b.span,C=b.fields.reduce(function(L,k){return L+k.bits},0);if(l+C>y)throw new Error("bits too long for span remainder ("+(y-C)+" of "+y+" remain)");this.container=b,this.bits=l,this.valueMask=(1<<l)-1,l===32&&(this.valueMask=4294967295),this.start=C,this.container.msb&&(this.start=y-C-l),this.wordMask=me(this.valueMask<<this.start),this.property=u}return w.prototype.decode=function(b,l){var u=this.container._packedGetValue(),y=me(u&this.wordMask),C=y>>>this.start;return C},w.prototype.encode=function(b){if(!Number.isInteger(b)||b!==me(b&this.valueMask))throw new TypeError(I("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var l=this.container._packedGetValue(),u=me(b<<this.start);this.container._packedSetValue(me(l&~this.wordMask)|u)},w}();g.BitField=Ve;var fe=function(w){j(b,w);function b(l,u){return w.call(this,l,1,u)||this}return b.prototype.decode=function(l,u){return!!Ve.prototype.decode.call(this,l,u)},b.prototype.encode=function(l){return typeof l=="boolean"&&(l=+l),Ve.prototype.encode.call(this,l)},b}(Ve);g.Boolean=fe;var Je=function(w){j(b,w);function b(l,u){var y=this;if(!(l instanceof h&&l.isCount()||Number.isInteger(l)&&0<=l))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var C=-1;return l instanceof h||(C=l),y=w.call(this,C,u)||this,y.length=l,y}return b.prototype.getSpan=function(l,u){var y=this.span;return 0>y&&(y=this.length.decode(l,u)),y},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.span;return 0>y&&(y=this.length.decode(l,u)),K(l).slice(u,u+y)},b.prototype.encode=function(l,u,y){var C=this.length;if(this.length instanceof h&&(C=l.length),!(l instanceof Uint8Array&&C===l.length))throw new TypeError(I("Blob.encode",this)+" requires (length "+C+") Uint8Array as src");if(y+C>u.length)throw new RangeError("encoding overruns Uint8Array");var L=K(l);return K(u).write(L.toString("hex"),y,C,"hex"),this.length instanceof h&&this.length.encode(C,u,y),C},b}(N);g.Blob=Je;var Mt=function(w){j(b,w);function b(l){return w.call(this,-1,l)||this}return b.prototype.getSpan=function(l,u){B(l),u===void 0&&(u=0);for(var y=u;y<l.length&&l[y]!==0;)y+=1;return 1+y-u},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.getSpan(l,u);return K(l).slice(u,u+y-1).toString("utf-8")},b.prototype.encode=function(l,u,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var C=J.Buffer.from(l,"utf8"),L=C.length;if(y+L>u.length)throw new RangeError("encoding overruns Buffer");var k=K(u);return C.copy(k,y),k[y+L]=0,L+1},b}(N);g.CString=Mt;var De=function(w){j(b,w);function b(l,u){var y=this;if(typeof l=="string"&&u===void 0&&(u=l,l=void 0),l===void 0)l=-1;else if(!Number.isInteger(l))throw new TypeError("maxSpan must be an integer");return y=w.call(this,-1,u)||this,y.maxSpan=l,y}return b.prototype.getSpan=function(l,u){return B(l),u===void 0&&(u=0),l.length-u},b.prototype.decode=function(l,u){u===void 0&&(u=0);var y=this.getSpan(l,u);if(0<=this.maxSpan&&this.maxSpan<y)throw new RangeError("text length exceeds maxSpan");return K(l).slice(u,u+y).toString("utf-8")},b.prototype.encode=function(l,u,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var C=J.Buffer.from(l,"utf8"),L=C.length;if(0<=this.maxSpan&&this.maxSpan<L)throw new RangeError("text length exceeds maxSpan");if(y+L>u.length)throw new RangeError("encoding overruns Buffer");return C.copy(K(u),y),L},b}(N);g.UTF8=De;var $e=function(w){j(b,w);function b(l,u){var y=w.call(this,0,u)||this;return y.value=l,y}return b.prototype.decode=function(l,u){return this.value},b.prototype.encode=function(l,u,y){return 0},b}(N);g.Constant=$e,g.greedy=function(w,b){return new f(w,b)},g.offset=function(w,b,l){return new O(w,b,l)},g.u8=function(w){return new _(1,w)},g.u16=function(w){return new _(2,w)},g.u24=function(w){return new _(3,w)},g.u32=function(w){return new _(4,w)},g.u40=function(w){return new _(5,w)},g.u48=function(w){return new _(6,w)},g.nu64=function(w){return new G(w)},g.u16be=function(w){return new P(2,w)},g.u24be=function(w){return new P(3,w)},g.u32be=function(w){return new P(4,w)},g.u40be=function(w){return new P(5,w)},g.u48be=function(w){return new P(6,w)},g.nu64be=function(w){return new H(w)},g.s8=function(w){return new R(1,w)},g.s16=function(w){return new R(2,w)},g.s24=function(w){return new R(3,w)},g.s32=function(w){return new R(4,w)},g.s40=function(w){return new R(5,w)},g.s48=function(w){return new R(6,w)},g.ns64=function(w){return new se(w)},g.s16be=function(w){return new m(2,w)},g.s24be=function(w){return new m(3,w)},g.s32be=function(w){return new m(4,w)},g.s40be=function(w){return new m(5,w)},g.s48be=function(w){return new m(6,w)},g.ns64be=function(w){return new A(w)},g.f32=function(w){return new ye(w)},g.f32be=function(w){return new Y(w)},g.f64=function(w){return new ce(w)},g.f64be=function(w){return new oe(w)},g.struct=function(w,b,l){return new Z(w,b,l)},g.bits=function(w,b,l){return new Oe(w,b,l)},g.seq=function(w,b,l){return new ue(w,b,l)},g.union=function(w,b,l){return new ie(w,b,l)},g.unionLayoutDiscriminator=function(w,b){return new re(w,b)},g.blob=function(w,b){return new Je(w,b)},g.cstr=function(w){return new Mt(w)},g.utf8=function(w,b){return new De(w,b)},g.constant=function(w,b){return new $e(w,b)}},75885:function(ve,g,D){"use strict";D.r(g),D.d(g,{Account:function(){return Ls},Authorized:function(){return Gn},BLOCKHASH_CACHE_TIMEOUT_MS:function(){return Un},BPF_LOADER_DEPRECATED_PROGRAM_ID:function(){return Ds},BPF_LOADER_PROGRAM_ID:function(){return Zs},BpfLoader:function(){return Js},Connection:function(){return ca},Ed25519Program:function(){return pr},Enum:function(){return Cs},EpochSchedule:function(){return Pn},FeeCalculatorLayout:function(){return An},Keypair:function(){return Wt},LAMPORTS_PER_SOL:function(){return va},Loader:function(){return It},Lockup:function(){return Xt},MAX_SEED_LENGTH:function(){return kn},Message:function(){return kt},NONCE_ACCOUNT_LENGTH:function(){return Tr},NonceAccount:function(){return fr},PACKET_DATA_SIZE:function(){return Yt},PublicKey:function(){return le},SOLANA_SCHEMA:function(){return Ht},STAKE_CONFIG_ID:function(){return Vn},STAKE_INSTRUCTION_LAYOUTS:function(){return je},SYSTEM_INSTRUCTION_LAYOUTS:function(){return Pe},SYSVAR_CLOCK_PUBKEY:function(){return _t},SYSVAR_EPOCH_SCHEDULE_PUBKEY:function(){return $s},SYSVAR_INSTRUCTIONS_PUBKEY:function(){return js},SYSVAR_RECENT_BLOCKHASHES_PUBKEY:function(){return or},SYSVAR_RENT_PUBKEY:function(){return Zt},SYSVAR_REWARDS_PUBKEY:function(){return Vs},SYSVAR_SLOT_HASHES_PUBKEY:function(){return Gs},SYSVAR_SLOT_HISTORY_PUBKEY:function(){return Hs},SYSVAR_STAKE_HISTORY_PUBKEY:function(){return ar},Secp256k1Program:function(){return Kt},SendTransactionError:function(){return Or},StakeAuthorizationLayout:function(){return fa},StakeInstruction:function(){return ua},StakeProgram:function(){return yr},Struct:function(){return Pr},SystemInstruction:function(){return qs},SystemProgram:function(){return et},Transaction:function(){return Ce},TransactionInstruction:function(){return Ze},VALIDATOR_INFO_KEY:function(){return Yn},VOTE_PROGRAM_ID:function(){return ya},ValidatorInfo:function(){return zr},VoteAccount:function(){return Mr},clusterApiUrl:function(){return Sa},sendAndConfirmRawTransaction:function(){return Ea},sendAndConfirmTransaction:function(){return cr}});var j=D(50780),J=D.n(j),B=D(64285),K=D(13550),N=D.n(K),I=D(77191),E=D.n(I),h=D(25532),f=D(39386);class O extends TypeError{constructor(e,t){let r;const{message:n,...a}=e,{path:d}=e,S=d.length===0?n:"At path: "+d.join(".")+" -- "+n;super(S),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var x;return(x=r)!=null?x:r=[e,...t()]}}}function _(i){return P(i)&&typeof i[Symbol.iterator]=="function"}function P(i){return typeof i=="object"&&i!=null}function R(i){if(Object.prototype.toString.call(i)!=="[object Object]")return!1;const e=Object.getPrototypeOf(i);return e===null||e===Object.prototype}function m(i){return typeof i=="string"?JSON.stringify(i):""+i}function T(i){const{done:e,value:t}=i.next();return e?void 0:t}function F(i,e,t,r){if(i===!0)return;i===!1?i={}:typeof i=="string"&&(i={message:i});const{path:n,branch:a}=e,{type:d}=t,{refinement:S,message:x="Expected a value of type `"+d+"`"+(S?" with refinement `"+S+"`":"")+", but received: `"+m(r)+"`"}=i;return{value:r,type:d,refinement:S,key:n[n.length-1],path:n,branch:a,...i,message:x}}function*U(i,e,t,r){_(i)||(i=[i]);for(const n of i){const a=F(n,e,t,r);a&&(yield a)}}function*G(i,e,t={}){const{path:r=[],branch:n=[i],coerce:a=!1,mask:d=!1}=t,S={path:r,branch:n};if(a&&(i=e.coercer(i,S),d&&e.type!=="type"&&P(e.schema)&&P(i)&&!Array.isArray(i)))for(const z in i)e.schema[z]===void 0&&delete i[z];let x=!0;for(const z of e.validator(i,S))x=!1,yield[z,void 0];for(let[z,q,X]of e.entries(i,S)){const ne=G(q,X,{path:z===void 0?r:[...r,z],branch:z===void 0?n:[...n,q],coerce:a,mask:d});for(const te of ne)te[0]?(x=!1,yield[te[0],void 0]):a&&(q=te[1],z===void 0?i=q:i instanceof Map?i.set(z,q):i instanceof Set?i.add(q):P(i)&&(i[z]=q))}if(x)for(const z of e.refiner(i,S))x=!1,yield[z,void 0];x&&(yield[void 0,i])}class H{constructor(e){const{type:t,schema:r,validator:n,refiner:a,coercer:d=x=>x,entries:S=function*(){}}=e;this.type=t,this.schema=r,this.entries=S,this.coercer=d,n?this.validator=(x,z)=>{const q=n(x,z);return U(q,z,this,x)}:this.validator=()=>[],a?this.refiner=(x,z)=>{const q=a(x,z);return U(q,z,this,x)}:this.refiner=()=>[]}assert(e){return se(e,this)}create(e){return A(e,this)}is(e){return Y(e,this)}mask(e){return ye(e,this)}validate(e,t={}){return ce(e,this,t)}}function se(i,e){const t=ce(i,e);if(t[0])throw t[0]}function A(i,e){const t=ce(i,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function ye(i,e){const t=ce(i,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Y(i,e){return!ce(i,e)[0]}function ce(i,e,t={}){const r=G(i,e,t),n=T(r);return n[0]?[new O(n[0],function*(){for(const d of r)d[0]&&(yield d[0])}),void 0]:[void 0,n[1]]}function oe(...i){const e=i.map(r=>r.schema),t=Object.assign({},...e);return _e(t)}function ue(i,e){return new H({type:i,schema:null,validator:e})}function Z(i,e){return new H({...i,refiner:(t,r)=>t===void 0||i.refiner(t,r),validator(t,r){return t===void 0?!0:(e(t,r),i.validator(t,r))}})}function M(i){return new H({type:"dynamic",schema:null,*entries(e,t){yield*i(e,t).entries(e,t)},validator(e,t){return i(e,t).validator(e,t)},coercer(e,t){return i(e,t).coercer(e,t)}})}function re(i){let e;return new H({type:"lazy",schema:null,*entries(t,r){var n;(n=e)!=null||(e=i()),yield*e.entries(t,r)},validator(t,r){var n;return(n=e)!=null||(e=i()),e.validator(t,r)},coercer(t,r){var n;return(n=e)!=null||(e=i()),e.coercer(t,r)}})}function ie(i,e){const{schema:t}=i,r={...t};for(const n of e)delete r[n];return _e(r)}function ge(i){const e=i instanceof H?{...i.schema}:{...i};for(const t in e)e[t]=be(e[t]);return _e(e)}function me(i,e){const{schema:t}=i,r={};for(const n of e)r[n]=t[n];return _e(r)}function Oe(i,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),ue(i,e)}function Ve(){return ue("any",()=>!0)}function fe(i){return new H({type:"array",schema:i,*entries(e){if(i&&Array.isArray(e))for(const[t,r]of e.entries())yield[t,r,i]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+m(e)}})}function Je(){return ue("boolean",i=>typeof i=="boolean")}function Mt(){return ue("date",i=>i instanceof Date&&!isNaN(i.getTime())||"Expected a valid `Date` object, but received: "+m(i))}function De(i){const e={},t=i.map(r=>m(r)).join();for(const r of i)e[r]=r;return new H({type:"enums",schema:e,validator(r){return i.includes(r)||"Expected one of `"+t+"`, but received: "+m(r)}})}function $e(){return ue("func",i=>typeof i=="function"||"Expected a function, but received: "+m(i))}function w(i){return ue("instance",e=>e instanceof i||"Expected a `"+i.name+"` instance, but received: "+m(e))}function b(){return ue("integer",i=>typeof i=="number"&&!isNaN(i)&&Number.isInteger(i)||"Expected an integer, but received: "+m(i))}function l(i){return new H({type:"intersection",schema:null,*entries(e,t){for(const r of i)yield*r.entries(e,t)},*validator(e,t){for(const r of i)yield*r.validator(e,t)},*refiner(e,t){for(const r of i)yield*r.refiner(e,t)}})}function u(i){const e=m(i),t=typeof i;return new H({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?i:null,validator(r){return r===i||"Expected the literal `"+e+"`, but received: "+m(r)}})}function y(i,e){return new H({type:"map",schema:null,*entries(t){if(i&&e&&t instanceof Map)for(const[r,n]of t.entries())yield[r,r,i],yield[r,n,e]},coercer(t){return t instanceof Map?new Map(t):t},validator(t){return t instanceof Map||"Expected a `Map` object, but received: "+m(t)}})}function C(){return ue("never",()=>!1)}function L(i){return new H({...i,validator:(e,t)=>e===null||i.validator(e,t),refiner:(e,t)=>e===null||i.refiner(e,t)})}function k(){return ue("number",i=>typeof i=="number"&&!isNaN(i)||"Expected a number, but received: "+m(i))}function _e(i){const e=i?Object.keys(i):[],t=C();return new H({type:"object",schema:i||null,*entries(r){if(i&&P(r)){const n=new Set(Object.keys(r));for(const a of e)n.delete(a),yield[a,r[a],i[a]];for(const a of n)yield[a,r[a],t]}},validator(r){return P(r)||"Expected an object, but received: "+m(r)},coercer(r){return P(r)?{...r}:r}})}function be(i){return new H({...i,validator:(e,t)=>e===void 0||i.validator(e,t),refiner:(e,t)=>e===void 0||i.refiner(e,t)})}function Ne(i,e){return new H({type:"record",schema:null,*entries(t){if(P(t))for(const r in t){const n=t[r];yield[r,r,i],yield[r,n,e]}},validator(t){return P(t)||"Expected an object, but received: "+m(t)}})}function qe(){return ue("regexp",i=>i instanceof RegExp)}function $t(i){return new H({type:"set",schema:null,*entries(e){if(i&&e instanceof Set)for(const t of e)yield[t,t,i]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||"Expected a `Set` object, but received: "+m(e)}})}function ae(){return ue("string",i=>typeof i=="string"||"Expected a string, but received: "+m(i))}function Pt(i){const e=C();return new H({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const r=Math.max(i.length,t.length);for(let n=0;n<r;n++)yield[n,t[n],i[n]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+m(t)}})}function Q(i){const e=Object.keys(i);return new H({type:"type",schema:i,*entries(t){if(P(t))for(const r of e)yield[r,t[r],i[r]]},validator(t){return P(t)||"Expected an object, but received: "+m(t)}})}function Xe(i){const e=i.map(t=>t.type).join(" | ");return new H({type:"union",schema:null,validator(t,r){const n=[];for(const a of i){const[...d]=G(t,a,r),[S]=d;if(S[0])for(const[x]of d)x&&n.push(x);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+m(t),...n]}})}function yt(){return ue("unknown",()=>!0)}function it(i,e,t){return new H({...i,coercer:(r,n)=>Y(r,e)?i.coercer(t(r,n),n):i.coercer(r,n)})}function st(i,e,t={}){return it(i,yt(),r=>{const n=typeof e=="function"?e():e;if(r===void 0)return n;if(!t.strict&&R(r)&&R(n)){const a={...r};let d=!1;for(const S in n)a[S]===void 0&&(a[S]=n[S],d=!0);if(d)return a}return r})}function er(i){return it(i,ae(),e=>e.trim())}function jr(i){const e="Expected an empty "+i.type;return o(i,"empty",t=>{if(t instanceof Map||t instanceof Set){const{size:r}=t;return r===0||e+" but received one with a size of `"+r+"`"}else{const{length:r}=t;return r===0||e+" but received one with a length of `"+r+"`"}})}function gt(i,e,t={}){const{exclusive:r}=t;return o(i,"max",n=>r?n<e:n<=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function Vr(i,e,t={}){const{exclusive:r}=t;return o(i,"min",n=>r?n>e:n>=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function c(i,e){return o(i,"pattern",t=>e.test(t)||"Expected a "+i.type+" matching `/"+e.source+'/` but received "'+t+'"')}function s(i,e,t=e){const r="Expected a "+i.type,n=e===t?"of `"+e+"`":"between `"+e+"` and `"+t+"`";return o(i,"size",a=>{if(typeof a=="number"||a instanceof Date)return e<=a&&a<=t||r+" "+n+" but received `"+a+"`";if(a instanceof Map||a instanceof Set){const{size:d}=a;return e<=d&&d<=t||r+" with a size "+n+" but received one with a size of `"+d+"`"}else{const{length:d}=a;return e<=d&&d<=t||r+" with a length "+n+" but received one with a length of `"+d+"`"}})}function o(i,e,t){return new H({...i,*refiner(r,n){yield*i.refiner(r,n);const a=t(r,n),d=U(a,n,i,r);for(const S of d)yield{...S,refinement:e}}})}var p=D(83937),v=D(31198),W=D.n(v),V=D(75134),Ee=D.n(V),Ue=D(91094),Re=D.n(Ue);const de=i=>B.lW.isBuffer(i)?i:i instanceof Uint8Array?B.lW.from(i.buffer,i.byteOffset,i.byteLength):B.lW.from(i);var Ae=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof D.g<"u"?D.g:typeof self<"u"?self:{};function Jn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Gr={},ke={},jt=Hr;function Hr(i,e){if(!i)throw new Error(e||"Assertion failed")}Hr.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Er={exports:{}};typeof Object.create=="function"?Er.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Er.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var Xn=jt,Qn=Er.exports;ke.inherits=Qn;function ei(i,e){return(i.charCodeAt(e)&64512)!==55296||e<0||e+1>=i.length?!1:(i.charCodeAt(e+1)&64512)===56320}function ti(i,e){if(Array.isArray(i))return i.slice();if(!i)return[];var t=[];if(typeof i=="string")if(e){if(e==="hex")for(i=i.replace(/[^a-z0-9]+/ig,""),i.length%2!==0&&(i="0"+i),n=0;n<i.length;n+=2)t.push(parseInt(i[n]+i[n+1],16))}else for(var r=0,n=0;n<i.length;n++){var a=i.charCodeAt(n);a<128?t[r++]=a:a<2048?(t[r++]=a>>6|192,t[r++]=a&63|128):ei(i,n)?(a=65536+((a&1023)<<10)+(i.charCodeAt(++n)&1023),t[r++]=a>>18|240,t[r++]=a>>12&63|128,t[r++]=a>>6&63|128,t[r++]=a&63|128):(t[r++]=a>>12|224,t[r++]=a>>6&63|128,t[r++]=a&63|128)}else for(n=0;n<i.length;n++)t[n]=i[n]|0;return t}ke.toArray=ti;function ri(i){for(var e="",t=0;t<i.length;t++)e+=Yr(i[t].toString(16));return e}ke.toHex=ri;function qr(i){var e=i>>>24|i>>>8&65280|i<<8&16711680|(i&255)<<24;return e>>>0}ke.htonl=qr;function ni(i,e){for(var t="",r=0;r<i.length;r++){var n=i[r];e==="little"&&(n=qr(n)),t+=Zr(n.toString(16))}return t}ke.toHex32=ni;function Yr(i){return i.length===1?"0"+i:i}ke.zero2=Yr;function Zr(i){return i.length===7?"0"+i:i.length===6?"00"+i:i.length===5?"000"+i:i.length===4?"0000"+i:i.length===3?"00000"+i:i.length===2?"000000"+i:i.length===1?"0000000"+i:i}ke.zero8=Zr;function ii(i,e,t,r){var n=t-e;Xn(n%4===0);for(var a=new Array(n/4),d=0,S=e;d<a.length;d++,S+=4){var x;r==="big"?x=i[S]<<24|i[S+1]<<16|i[S+2]<<8|i[S+3]:x=i[S+3]<<24|i[S+2]<<16|i[S+1]<<8|i[S],a[d]=x>>>0}return a}ke.join32=ii;function si(i,e){for(var t=new Array(i.length*4),r=0,n=0;r<i.length;r++,n+=4){var a=i[r];e==="big"?(t[n]=a>>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}ke.split32=si;function oi(i,e){return i>>>e|i<<32-e}ke.rotr32=oi;function ai(i,e){return i<<e|i>>>32-e}ke.rotl32=ai;function ci(i,e){return i+e>>>0}ke.sum32=ci;function ui(i,e,t){return i+e+t>>>0}ke.sum32_3=ui;function fi(i,e,t,r){return i+e+t+r>>>0}ke.sum32_4=fi;function li(i,e,t,r,n){return i+e+t+r+n>>>0}ke.sum32_5=li;function hi(i,e,t,r){var n=i[e],a=i[e+1],d=r+a>>>0,S=(d<r?1:0)+t+n;i[e]=S>>>0,i[e+1]=d}ke.sum64=hi;function di(i,e,t,r){var n=e+r>>>0,a=(n<e?1:0)+i+t;return a>>>0}ke.sum64_hi=di;function pi(i,e,t,r){var n=e+r;return n>>>0}ke.sum64_lo=pi;function yi(i,e,t,r,n,a,d,S){var x=0,z=e;z=z+r>>>0,x+=z<e?1:0,z=z+a>>>0,x+=z<a?1:0,z=z+S>>>0,x+=z<S?1:0;var q=i+t+n+d+x;return q>>>0}ke.sum64_4_hi=yi;function gi(i,e,t,r,n,a,d,S){var x=e+r+a+S;return x>>>0}ke.sum64_4_lo=gi;function bi(i,e,t,r,n,a,d,S,x,z){var q=0,X=e;X=X+r>>>0,q+=X<e?1:0,X=X+a>>>0,q+=X<a?1:0,X=X+S>>>0,q+=X<S?1:0,X=X+z>>>0,q+=X<z?1:0;var ne=i+t+n+d+x+q;return ne>>>0}ke.sum64_5_hi=bi;function mi(i,e,t,r,n,a,d,S,x,z){var q=e+r+a+S+z;return q>>>0}ke.sum64_5_lo=mi;function wi(i,e,t){var r=e<<32-t|i>>>t;return r>>>0}ke.rotr64_hi=wi;function Ei(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.rotr64_lo=Ei;function Si(i,e,t){return i>>>t}ke.shr64_hi=Si;function vi(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.shr64_lo=vi;var Tt={},Jr=ke,ki=jt;function tr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Tt.BlockHash=tr,tr.prototype.update=function(e,t){if(e=Jr.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Jr.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},tr.prototype.digest=function(e){return this.update(this._pad()),ki(this.pending===null),this._digest(e)},tr.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var a=1;a<r;a++)n[a]=0;if(e<<=3,this.endian==="big"){for(var d=8;d<this.padLength;d++)n[a++]=0;n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=e>>>24&255,n[a++]=e>>>16&255,n[a++]=e>>>8&255,n[a++]=e&255}else for(n[a++]=e&255,n[a++]=e>>>8&255,n[a++]=e>>>16&255,n[a++]=e>>>24&255,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,d=8;d<this.padLength;d++)n[a++]=0;return n};var Ut={},ct={},_i=ke,ut=_i.rotr32;function Ii(i,e,t,r){if(i===0)return Xr(e,t,r);if(i===1||i===3)return en(e,t,r);if(i===2)return Qr(e,t,r)}ct.ft_1=Ii;function Xr(i,e,t){return i&e^~i&t}ct.ch32=Xr;function Qr(i,e,t){return i&e^i&t^e&t}ct.maj32=Qr;function en(i,e,t){return i^e^t}ct.p32=en;function xi(i){return ut(i,2)^ut(i,13)^ut(i,22)}ct.s0_256=xi;function Ai(i){return ut(i,6)^ut(i,11)^ut(i,25)}ct.s1_256=Ai;function Ri(i){return ut(i,7)^ut(i,18)^i>>>3}ct.g0_256=Ri;function Bi(i){return ut(i,17)^ut(i,19)^i>>>10}ct.g1_256=Bi;var Ct=ke,Pi=Tt,Ti=ct,Sr=Ct.rotl32,Vt=Ct.sum32,Ui=Ct.sum32_5,Ci=Ti.ft_1,tn=Pi.BlockHash,Oi=[1518500249,1859775393,2400959708,3395469782];function ft(){if(!(this instanceof ft))return new ft;tn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ct.inherits(ft,tn);var Ni=ft;ft.blockSize=512,ft.outSize=160,ft.hmacStrength=80,ft.padLength=64,ft.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Sr(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var a=this.h[0],d=this.h[1],S=this.h[2],x=this.h[3],z=this.h[4];for(n=0;n<r.length;n++){var q=~~(n/20),X=Ui(Sr(a,5),Ci(q,d,S,x),z,r[n],Oi[q]);z=x,x=S,S=Sr(d,30),d=a,a=X}this.h[0]=Vt(this.h[0],a),this.h[1]=Vt(this.h[1],d),this.h[2]=Vt(this.h[2],S),this.h[3]=Vt(this.h[3],x),this.h[4]=Vt(this.h[4],z)},ft.prototype._digest=function(e){return e==="hex"?Ct.toHex32(this.h,"big"):Ct.split32(this.h,"big")};var Ot=ke,Fi=Tt,Nt=ct,Li=jt,ot=Ot.sum32,Di=Ot.sum32_4,Wi=Ot.sum32_5,Ki=Nt.ch32,zi=Nt.maj32,Mi=Nt.s0_256,$i=Nt.s1_256,ji=Nt.g0_256,Vi=Nt.g1_256,rn=Fi.BlockHash,Gi=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function lt(){if(!(this instanceof lt))return new lt;rn.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Gi,this.W=new Array(64)}Ot.inherits(lt,rn);var nn=lt;lt.blockSize=512,lt.outSize=256,lt.hmacStrength=192,lt.padLength=64,lt.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Di(Vi(r[n-2]),r[n-7],ji(r[n-15]),r[n-16]);var a=this.h[0],d=this.h[1],S=this.h[2],x=this.h[3],z=this.h[4],q=this.h[5],X=this.h[6],ne=this.h[7];for(Li(this.k.length===r.length),n=0;n<r.length;n++){var te=Wi(ne,$i(z),Ki(z,q,X),this.k[n],r[n]),he=ot(Mi(a),zi(a,d,S));ne=X,X=q,q=z,z=ot(x,te),x=S,S=d,d=a,a=ot(te,he)}this.h[0]=ot(this.h[0],a),this.h[1]=ot(this.h[1],d),this.h[2]=ot(this.h[2],S),this.h[3]=ot(this.h[3],x),this.h[4]=ot(this.h[4],z),this.h[5]=ot(this.h[5],q),this.h[6]=ot(this.h[6],X),this.h[7]=ot(this.h[7],ne)},lt.prototype._digest=function(e){return e==="hex"?Ot.toHex32(this.h,"big"):Ot.split32(this.h,"big")};var vr=ke,sn=nn;function bt(){if(!(this instanceof bt))return new bt;sn.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}vr.inherits(bt,sn);var Hi=bt;bt.blockSize=512,bt.outSize=224,bt.hmacStrength=192,bt.padLength=64,bt.prototype._digest=function(e){return e==="hex"?vr.toHex32(this.h.slice(0,7),"big"):vr.split32(this.h.slice(0,7),"big")};var Qe=ke,qi=Tt,Yi=jt,ht=Qe.rotr64_hi,dt=Qe.rotr64_lo,on=Qe.shr64_hi,an=Qe.shr64_lo,Et=Qe.sum64,kr=Qe.sum64_hi,_r=Qe.sum64_lo,Zi=Qe.sum64_4_hi,Ji=Qe.sum64_4_lo,Xi=Qe.sum64_5_hi,Qi=Qe.sum64_5_lo,cn=qi.BlockHash,es=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function at(){if(!(this instanceof at))return new at;cn.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=es,this.W=new Array(160)}Qe.inherits(at,cn);var un=at;at.blockSize=1024,at.outSize=512,at.hmacStrength=192,at.padLength=128,at.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var a=ls(r[n-4],r[n-3]),d=hs(r[n-4],r[n-3]),S=r[n-14],x=r[n-13],z=us(r[n-30],r[n-29]),q=fs(r[n-30],r[n-29]),X=r[n-32],ne=r[n-31];r[n]=Zi(a,d,S,x,z,q,X,ne),r[n+1]=Ji(a,d,S,x,z,q,X,ne)}},at.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],a=this.h[1],d=this.h[2],S=this.h[3],x=this.h[4],z=this.h[5],q=this.h[6],X=this.h[7],ne=this.h[8],te=this.h[9],he=this.h[10],pe=this.h[11],Ie=this.h[12],Le=this.h[13],tt=this.h[14],At=this.h[15];Yi(this.k.length===r.length);for(var wt=0;wt<r.length;wt+=2){var St=tt,Rt=At,Bt=as(ne,te),rt=cs(ne,te),gr=ts(ne,te,he,pe,Ie),br=rs(ne,te,he,pe,Ie,Le),nt=this.k[wt],mr=this.k[wt+1],zt=r[wt],$=r[wt+1],ee=Xi(St,Rt,Bt,rt,gr,br,nt,mr,zt,$),we=Qi(St,Rt,Bt,rt,gr,br,nt,mr,zt,$);St=ss(n,a),Rt=os(n,a),Bt=ns(n,a,d,S,x),rt=is(n,a,d,S,x,z);var Me=kr(St,Rt,Bt,rt),ze=_r(St,Rt,Bt,rt);tt=Ie,At=Le,Ie=he,Le=pe,he=ne,pe=te,ne=kr(q,X,ee,we),te=_r(X,X,ee,we),q=x,X=z,x=d,z=S,d=n,S=a,n=kr(ee,we,Me,ze),a=_r(ee,we,Me,ze)}Et(this.h,0,n,a),Et(this.h,2,d,S),Et(this.h,4,x,z),Et(this.h,6,q,X),Et(this.h,8,ne,te),Et(this.h,10,he,pe),Et(this.h,12,Ie,Le),Et(this.h,14,tt,At)},at.prototype._digest=function(e){return e==="hex"?Qe.toHex32(this.h,"big"):Qe.split32(this.h,"big")};function ts(i,e,t,r,n){var a=i&t^~i&n;return a<0&&(a+=4294967296),a}function rs(i,e,t,r,n,a){var d=e&r^~e&a;return d<0&&(d+=4294967296),d}function ns(i,e,t,r,n){var a=i&t^i&n^t&n;return a<0&&(a+=4294967296),a}function is(i,e,t,r,n,a){var d=e&r^e&a^r&a;return d<0&&(d+=4294967296),d}function ss(i,e){var t=ht(i,e,28),r=ht(e,i,2),n=ht(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function os(i,e){var t=dt(i,e,28),r=dt(e,i,2),n=dt(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function as(i,e){var t=ht(i,e,14),r=ht(i,e,18),n=ht(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function cs(i,e){var t=dt(i,e,14),r=dt(i,e,18),n=dt(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function us(i,e){var t=ht(i,e,1),r=ht(i,e,8),n=on(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function fs(i,e){var t=dt(i,e,1),r=dt(i,e,8),n=an(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function ls(i,e){var t=ht(i,e,19),r=ht(e,i,29),n=on(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}function hs(i,e){var t=dt(i,e,19),r=dt(e,i,29),n=an(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}var Ir=ke,fn=un;function mt(){if(!(this instanceof mt))return new mt;fn.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ir.inherits(mt,fn);var ds=mt;mt.blockSize=1024,mt.outSize=384,mt.hmacStrength=192,mt.padLength=128,mt.prototype._digest=function(e){return e==="hex"?Ir.toHex32(this.h.slice(0,12),"big"):Ir.split32(this.h.slice(0,12),"big")},Ut.sha1=Ni,Ut.sha224=Hi,Ut.sha256=nn,Ut.sha384=ds,Ut.sha512=un;var ln={},vt=ke,ps=Tt,rr=vt.rotl32,hn=vt.sum32,Gt=vt.sum32_3,dn=vt.sum32_4,pn=ps.BlockHash;function pt(){if(!(this instanceof pt))return new pt;pn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}vt.inherits(pt,pn),ln.ripemd160=pt,pt.blockSize=512,pt.outSize=160,pt.hmacStrength=192,pt.padLength=64,pt.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],a=this.h[2],d=this.h[3],S=this.h[4],x=r,z=n,q=a,X=d,ne=S,te=0;te<80;te++){var he=hn(rr(dn(r,yn(te,n,a,d),e[bs[te]+t],ys(te)),ws[te]),S);r=S,S=d,d=rr(a,10),a=n,n=he,he=hn(rr(dn(x,yn(79-te,z,q,X),e[ms[te]+t],gs(te)),Es[te]),ne),x=ne,ne=X,X=rr(q,10),q=z,z=he}he=Gt(this.h[1],a,X),this.h[1]=Gt(this.h[2],d,ne),this.h[2]=Gt(this.h[3],S,x),this.h[3]=Gt(this.h[4],r,z),this.h[4]=Gt(this.h[0],n,q),this.h[0]=he},pt.prototype._digest=function(e){return e==="hex"?vt.toHex32(this.h,"little"):vt.split32(this.h,"little")};function yn(i,e,t,r){return i<=15?e^t^r:i<=31?e&t|~e&r:i<=47?(e|~t)^r:i<=63?e&r|t&~r:e^(t|~r)}function ys(i){return i<=15?0:i<=31?1518500249:i<=47?1859775393:i<=63?2400959708:2840853838}function gs(i){return i<=15?1352829926:i<=31?1548603684:i<=47?1836072691:i<=63?2053994217:0}var bs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ms=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ws=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Es=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Ss=ke,vs=jt;function Ft(i,e,t){if(!(this instanceof Ft))return new Ft(i,e,t);this.Hash=i,this.blockSize=i.blockSize/8,this.outSize=i.outSize/8,this.inner=null,this.outer=null,this._init(Ss.toArray(e,t))}var ks=Ft;Ft.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),vs(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Ft.prototype.update=function(e,t){return this.inner.update(e,t),this},Ft.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(i){var e=i;e.utils=ke,e.common=Tt,e.sha=Ut,e.ripemd=ln,e.hmac=ks,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Gr);var _s=Gr;const Is="logger/5.5.0";let gn=!1,bn=!1;const nr={debug:1,default:2,info:2,warning:3,error:4,off:5};let mn=nr.default,xr=null;function xs(){try{const i=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{i.push(e)}}),i.length)throw new Error("missing "+i.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(i){return i.message}return null}const wn=xs();var Ar;(function(i){i.DEBUG="DEBUG",i.INFO="INFO",i.WARNING="WARNING",i.ERROR="ERROR",i.OFF="OFF"})(Ar||(Ar={}));var Rr;(function(i){i.UNKNOWN_ERROR="UNKNOWN_ERROR",i.NOT_IMPLEMENTED="NOT_IMPLEMENTED",i.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",i.NETWORK_ERROR="NETWORK_ERROR",i.SERVER_ERROR="SERVER_ERROR",i.TIMEOUT="TIMEOUT",i.BUFFER_OVERRUN="BUFFER_OVERRUN",i.NUMERIC_FAULT="NUMERIC_FAULT",i.MISSING_NEW="MISSING_NEW",i.INVALID_ARGUMENT="INVALID_ARGUMENT",i.MISSING_ARGUMENT="MISSING_ARGUMENT",i.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",i.CALL_EXCEPTION="CALL_EXCEPTION",i.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",i.NONCE_EXPIRED="NONCE_EXPIRED",i.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",i.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",i.TRANSACTION_REPLACED="TRANSACTION_REPLACED"})(Rr||(Rr={}));const En="0123456789abcdef";class Fe{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();nr[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(mn>nr[r])&&console.log.apply(console,t)}debug(...e){this._log(Fe.levels.DEBUG,e)}info(...e){this._log(Fe.levels.INFO,e)}warn(...e){this._log(Fe.levels.WARNING,e)}makeError(e,t,r){if(bn)return this.makeError("censored error",t,{});t||(t=Fe.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(S=>{const x=r[S];try{if(x instanceof Uint8Array){let z="";for(let q=0;q<x.length;q++)z+=En[x[q]>>4],z+=En[x[q]&15];n.push(S+"=Uint8Array(0x"+z+")")}else n.push(S+"="+JSON.stringify(x))}catch{n.push(S+"="+JSON.stringify(r[S].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const a=e;n.length&&(e+=" ("+n.join(", ")+")");const d=new Error(e);return d.reason=a,d.code=t,Object.keys(r).forEach(function(S){d[S]=r[S]}),d}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Fe.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){wn&&this.throwError("platform missing String.prototype.normalize",Fe.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:wn})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Fe.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Fe.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",e<t&&this.throwError("missing argument"+r,Fe.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,Fe.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Fe.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Fe.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Fe.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return xr||(xr=new Fe(Is)),xr}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Fe.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),gn){if(!e)return;this.globalLogger().throwError("error censorship permanent",Fe.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}bn=!!e,gn=!!t}static setLogLevel(e){const t=nr[e.toLowerCase()];if(t==null){Fe.globalLogger().warn("invalid log level - "+e);return}mn=t}static from(e){return new Fe(e)}}Fe.errors=Rr,Fe.levels=Ar;const As="bytes/5.5.0",Br=new Fe(As);function Rs(i){return!!i.toHexString}function ir(i){return i.slice||(i.slice=function(){const e=Array.prototype.slice.call(arguments);return ir(new Uint8Array(Array.prototype.slice.apply(i,e)))}),i}function Sn(i){return typeof i=="number"&&i==i&&i%1===0}function Bs(i){if(i==null)return!1;if(i.constructor===Uint8Array)return!0;if(typeof i=="string"||!Sn(i.length)||i.length<0)return!1;for(let e=0;e<i.length;e++){const t=i[e];if(!Sn(t)||t<0||t>=256)return!1}return!0}function Ps(i,e){if(e||(e={}),typeof i=="number"){Br.checkSafeUint53(i,"invalid arrayify value");const t=[];for(;i;)t.unshift(i&255),i=parseInt(String(i/256));return t.length===0&&t.push(0),ir(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof i=="string"&&i.substring(0,2)!=="0x"&&(i="0x"+i),Rs(i)&&(i=i.toHexString()),Ts(i)){let t=i.substring(2);t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Br.throwArgumentError("hex data is odd-length","value",i));const r=[];for(let n=0;n<t.length;n+=2)r.push(parseInt(t.substring(n,n+2),16));return ir(new Uint8Array(r))}return Bs(i)?ir(new Uint8Array(i)):Br.throwArgumentError("invalid arrayify value","value",i)}function Ts(i,e){return!(typeof i!="string"||!i.match(/^0x[0-9A-Fa-f]*$/)||e&&i.length!==2+2*e)}const Us="sha2/5.5.0";new Fe(Us);function vn(i){return"0x"+_s.sha256().update(Ps(i)).digest("hex")}class Pr{constructor(e){Object.assign(this,e)}encode(){return B.lW.from((0,h.serialize)(Ht,this))}static decode(e){return(0,h.deserialize)(Ht,this,e)}static decodeUnchecked(e){return(0,h.deserializeUnchecked)(Ht,this,e)}}class Cs extends Pr{constructor(e){if(super(e),this.enum="",Object.keys(e).length!==1)throw new Error("Enum can only take single value");Object.keys(e).map(t=>{this.enum=t})}}const Ht=new Map,kn=32;function Os(i){return i._bn!==void 0}class le extends Pr{constructor(e){if(super({}),this._bn=void 0,Os(e))this._bn=e._bn;else{if(typeof e=="string"){const t=E().decode(e);if(t.length!=32)throw new Error("Invalid public key input");this._bn=new(N())(t)}else this._bn=new(N())(e);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(e){return this._bn.eq(e._bn)}toBase58(){return E().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const e=this._bn.toArrayLike(B.lW);if(e.length===32)return e;const t=B.lW.alloc(32);return e.copy(t,32-e.length),t}toString(){return this.toBase58()}static async createWithSeed(e,t,r){const n=B.lW.concat([e.toBuffer(),B.lW.from(t),r.toBuffer()]),a=vn(new Uint8Array(n)).slice(2);return new le(B.lW.from(a,"hex"))}static async createProgramAddress(e,t){let r=B.lW.alloc(0);e.forEach(function(d){if(d.length>kn)throw new TypeError("Max seed length exceeded");r=B.lW.concat([r,de(d)])}),r=B.lW.concat([r,t.toBuffer(),B.lW.from("ProgramDerivedAddress")]);let n=vn(new Uint8Array(r)).slice(2),a=new(N())(n,16).toArray(void 0,32);if(_n(a))throw new Error("Invalid seeds, address must fall off the curve");return new le(a)}static async findProgramAddress(e,t){let r=255,n;for(;r!=0;){try{const a=e.concat(B.lW.from([r]));n=await this.createProgramAddress(a,t)}catch(a){if(a instanceof TypeError)throw a;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static isOnCurve(e){return _n(e)==1}}le.default=new le("11111111111111111111111111111111"),Ht.set(le,{kind:"struct",fields:[["_bn","u256"]]});let Se=J().lowlevel;function _n(i){var e=[Se.gf(),Se.gf(),Se.gf(),Se.gf()],t=Se.gf(),r=Se.gf(),n=Se.gf(),a=Se.gf(),d=Se.gf(),S=Se.gf(),x=Se.gf();return Se.set25519(e[2],Ns),Se.unpack25519(e[1],i),Se.S(n,e[1]),Se.M(a,n,Se.D),Se.Z(n,n,e[2]),Se.A(a,e[2],a),Se.S(d,a),Se.S(S,d),Se.M(x,S,d),Se.M(t,x,n),Se.M(t,t,a),Se.pow2523(t,t),Se.M(t,t,n),Se.M(t,t,a),Se.M(t,t,a),Se.M(e[0],t,a),Se.S(r,e[0]),Se.M(r,r,a),In(r,n)&&Se.M(e[0],e[0],Fs),Se.S(r,e[0]),Se.M(r,r,a),In(r,n)?0:1}let Ns=Se.gf([1]),Fs=Se.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function In(i,e){var t=new Uint8Array(32),r=new Uint8Array(32);return Se.pack25519(t,i),Se.pack25519(r,e),Se.crypto_verify_32(t,0,r,0)}class Ls{constructor(e){this._keypair=void 0,e?this._keypair=J().sign.keyPair.fromSecretKey(de(e)):this._keypair=J().sign.keyPair()}get publicKey(){return new le(this._keypair.publicKey)}get secretKey(){return de(this._keypair.secretKey)}}const Ds=new le("BPFLoader1111111111111111111111111111111111"),Te=(i="publicKey")=>f.blob(32,i),Lt=(i="string")=>{const e=f.struct([f.u32("length"),f.u32("lengthPadding"),f.blob(f.offset(f.u32(),-8),"chars")],i),t=e.decode.bind(e),r=e.encode.bind(e);return e.decode=(n,a)=>t(n,a).chars.toString("utf8"),e.encode=(n,a,d)=>{const S={chars:B.lW.from(n,"utf8")};return r(S,a,d)},e.alloc=n=>f.u32().span+f.u32().span+B.lW.from(n,"utf8").length,e},Ws=(i="authorized")=>f.struct([Te("staker"),Te("withdrawer")],i),Ks=(i="lockup")=>f.struct([f.ns64("unixTimestamp"),f.ns64("epoch"),Te("custodian")],i);function zs(i,e){let t=0;return i.layout.fields.forEach(r=>{r.span>=0?t+=r.span:typeof r.alloc=="function"&&(t+=r.alloc(e[r.property]))}),t}function Dt(i){let e=0,t=0;for(;;){let r=i.shift();if(e|=(r&127)<<t*7,t+=1,(r&128)===0)break}return e}function qt(i,e){let t=e;for(;;){let r=t&127;if(t>>=7,t==0){i.push(r);break}else r|=128,i.push(r)}}const sr=32;class kt{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(t=>new le(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){return e<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||e>=this.header.numRequiredSignatures&&e<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];qt(t,e);const r=this.instructions.map(X=>{const{accounts:ne,programIdIndex:te}=X,he=E().decode(X.data);let pe=[];qt(pe,ne.length);let Ie=[];return qt(Ie,he.length),{programIdIndex:te,keyIndicesCount:B.lW.from(pe),keyIndices:B.lW.from(ne),dataLength:B.lW.from(Ie),data:he}});let n=[];qt(n,r.length);let a=B.lW.alloc(Yt);B.lW.from(n).copy(a);let d=n.length;r.forEach(X=>{const te=f.struct([f.u8("programIdIndex"),f.blob(X.keyIndicesCount.length,"keyIndicesCount"),f.seq(f.u8("keyIndex"),X.keyIndices.length,"keyIndices"),f.blob(X.dataLength.length,"dataLength"),f.seq(f.u8("userdatum"),X.data.length,"data")]).encode(X,a,d);d+=te}),a=a.slice(0,d);const S=f.struct([f.blob(1,"numRequiredSignatures"),f.blob(1,"numReadonlySignedAccounts"),f.blob(1,"numReadonlyUnsignedAccounts"),f.blob(t.length,"keyCount"),f.seq(Te("key"),e,"keys"),Te("recentBlockhash")]),x={numRequiredSignatures:B.lW.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:B.lW.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:B.lW.from([this.header.numReadonlyUnsignedAccounts]),keyCount:B.lW.from(t),keys:this.accountKeys.map(X=>de(X.toBytes())),recentBlockhash:E().decode(this.recentBlockhash)};let z=B.lW.alloc(2048);const q=S.encode(x,z);return a.copy(z,q),z.slice(0,q+a.length)}static from(e){let t=[...e];const r=t.shift(),n=t.shift(),a=t.shift(),d=Dt(t);let S=[];for(let ne=0;ne<d;ne++){const te=t.slice(0,sr);t=t.slice(sr),S.push(E().encode(B.lW.from(te)))}const x=t.slice(0,sr);t=t.slice(sr);const z=Dt(t);let q=[];for(let ne=0;ne<z;ne++){const te=t.shift(),he=Dt(t),pe=t.slice(0,he);t=t.slice(he);const Ie=Dt(t),Le=t.slice(0,Ie),tt=E().encode(B.lW.from(Le));t=t.slice(Ie),q.push({programIdIndex:te,accounts:pe,data:tt})}const X={header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:a},recentBlockhash:E().encode(B.lW.from(x)),accountKeys:S,instructions:q};return new kt(X)}}function Ge(i,e){if(!i)throw new Error(e||"Assertion failed")}const Ms=B.lW.alloc(64).fill(0),Yt=1280-40-8,xn=64;class Ze{constructor(e){this.keys=void 0,this.programId=void 0,this.data=B.lW.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}}class Ce{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.nonceInfo=void 0,e&&Object.assign(this,e)}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new Ze(t))}),this}compileMessage(){const{nonceInfo:e}=this;e&&this.instructions[0]!=e.nonceInstruction&&(this.recentBlockhash=e.nonce,this.instructions.unshift(e.nonceInstruction));const{recentBlockhash:t}=this;if(!t)throw new Error("Transaction recentBlockhash required");this.instructions.length<1&&console.warn("No instructions provided");let r;if(this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let pe=0;pe<this.instructions.length;pe++)if(this.instructions[pe].programId===void 0)throw new Error(`Transaction instruction index ${pe} has undefined program id`);const n=[],a=[];this.instructions.forEach(pe=>{pe.keys.forEach(Le=>{a.push({...Le})});const Ie=pe.programId.toString();n.includes(Ie)||n.push(Ie)}),n.forEach(pe=>{a.push({pubkey:new le(pe),isSigner:!1,isWritable:!1})}),a.sort(function(pe,Ie){const Le=pe.pubkey.toBase58().localeCompare(Ie.pubkey.toBase58()),tt=pe.isSigner===Ie.isSigner?0:pe.isSigner?-1:1,At=pe.isWritable===Ie.isWritable?Le:pe.isWritable?-1:1;return tt||At});const d=[];a.forEach(pe=>{const Ie=pe.pubkey.toString(),Le=d.findIndex(tt=>tt.pubkey.toString()===Ie);Le>-1?d[Le].isWritable=d[Le].isWritable||pe.isWritable:d.push(pe)});const S=d.findIndex(pe=>pe.pubkey.equals(r));if(S>-1){const[pe]=d.splice(S,1);pe.isSigner=!0,pe.isWritable=!0,d.unshift(pe)}else d.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const pe of this.signatures){const Ie=d.findIndex(Le=>Le.pubkey.equals(pe.publicKey));if(Ie>-1)d[Ie].isSigner||(d[Ie].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${pe.publicKey.toString()}`)}let x=0,z=0,q=0;const X=[],ne=[];d.forEach(({pubkey:pe,isSigner:Ie,isWritable:Le})=>{Ie?(X.push(pe.toString()),x+=1,Le||(z+=1)):(ne.push(pe.toString()),Le||(q+=1))});const te=X.concat(ne),he=this.instructions.map(pe=>{const{data:Ie,programId:Le}=pe;return{programIdIndex:te.indexOf(Le.toString()),accounts:pe.keys.map(tt=>te.indexOf(tt.pubkey.toString())),data:E().encode(Ie)}});return he.forEach(pe=>{Ge(pe.programIdIndex>=0),pe.accounts.forEach(Ie=>Ge(Ie>=0))}),new kt({header:{numRequiredSignatures:x,numReadonlySignedAccounts:z,numReadonlyUnsignedAccounts:q},accountKeys:te,recentBlockhash:t,instructions:he})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((n,a)=>t[a].equals(n.publicKey))||(this.signatures=t.map(r=>({signature:null,publicKey:r}))),e}serializeMessage(){return this._compile().serialize()}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(r=>{const n=r.toString();return t.has(n)?!1:(t.add(n),!0)}).map(r=>({signature:null,publicKey:r}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}this.signatures=r.map(a=>({signature:null,publicKey:a.publicKey}));const n=this._compile();this._partialSign(n,...r),this._verifySignatures(n.serialize(),!0)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}const n=this._compile();this._partialSign(n,...r)}_partialSign(e,...t){const r=e.serialize();t.forEach(n=>{const a=J().sign.detached(r,n.secretKey);this._addSignature(n.publicKey,de(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){Ge(t.length===64);const r=this.signatures.findIndex(n=>e.equals(n.publicKey));if(r<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=B.lW.from(t)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(e,t){for(const{signature:r,publicKey:n}of this.signatures)if(r===null){if(t)return!1}else if(!J().sign.detached.verify(e,r,n.toBuffer()))return!1;return!0}serialize(e){const{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r&&!this._verifySignatures(n,t))throw new Error("Signature verification failed");return this._serialize(n)}_serialize(e){const{signatures:t}=this,r=[];qt(r,t.length);const n=r.length+t.length*64+e.length,a=B.lW.alloc(n);return Ge(t.length<256),B.lW.from(r).copy(a,0),t.forEach(({signature:d},S)=>{d!==null&&(Ge(d.length===64,"signature has invalid length"),B.lW.from(d).copy(a,r.length+S*64))}),e.copy(a,r.length+t.length*64),Ge(a.length<=Yt,`Transaction too large: ${a.length} > ${Yt}`),a}get keys(){return Ge(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return Ge(this.instructions.length===1),this.instructions[0].programId}get data(){return Ge(this.instructions.length===1),this.instructions[0].data}static from(e){let t=[...e];const r=Dt(t);let n=[];for(let a=0;a<r;a++){const d=t.slice(0,xn);t=t.slice(xn),n.push(E().encode(B.lW.from(d)))}return Ce.populate(kt.from(t),n)}static populate(e,t=[]){const r=new Ce;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((n,a)=>{const d={signature:n==E().encode(Ms)?null:E().decode(n),publicKey:e.accountKeys[a]};r.signatures.push(d)}),e.instructions.forEach(n=>{const a=n.accounts.map(d=>{const S=e.accountKeys[d];return{pubkey:S,isSigner:r.signatures.some(x=>x.publicKey.toString()===S.toString())||e.isAccountSigner(d),isWritable:e.isAccountWritable(d)}});r.instructions.push(new Ze({keys:a,programId:e.accountKeys[n.programIdIndex],data:E().decode(n.data)}))}),r}}const _t=new le("SysvarC1ock11111111111111111111111111111111"),$s=new le("SysvarEpochSchedu1e111111111111111111111111"),js=new le("Sysvar1nstructions1111111111111111111111111"),or=new le("SysvarRecentB1ockHashes11111111111111111111"),Zt=new le("SysvarRent111111111111111111111111111111111"),Vs=new le("SysvarRewards111111111111111111111111111111"),Gs=new le("SysvarS1otHashes111111111111111111111111111"),Hs=new le("SysvarS1otHistory11111111111111111111111111"),ar=new le("SysvarStakeHistory1111111111111111111111111");async function cr(i,e,t,r){const n=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment},a=await i.sendTransaction(e,t,n),d=(await i.confirmTransaction(a,r&&r.commitment)).value;if(d.err)throw new Error(`Transaction ${a} failed (${JSON.stringify(d)})`);return a}function ur(i){return new Promise(e=>setTimeout(e,i))}function We(i,e){const t=i.layout.span>=0?i.layout.span:zs(i,e),r=B.lW.alloc(t),n=Object.assign({instruction:i.index},e);return i.layout.encode(n,r),r}function Ke(i,e){let t;try{t=i.layout.decode(e)}catch(r){throw new Error("invalid instruction; "+r)}if(t.instruction!==i.index)throw new Error(`invalid instruction; instruction index mismatch ${t.instruction} != ${i.index}`);return t}const An=f.nu64("lamportsPerSignature"),Rn=f.struct([f.u32("version"),f.u32("state"),Te("authorizedPubkey"),Te("nonce"),f.struct([An],"feeCalculator")]),Tr=Rn.span;class fr{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=Rn.decode(de(e),0);return new fr({authorizedPubkey:new le(t.authorizedPubkey),nonce:new le(t.nonce).toString(),feeCalculator:t.feeCalculator})}}class qs{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=f.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(Pe))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t,space:r,programId:n}=Ke(Pe.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:r,programId:new le(n)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t}=Ke(Pe.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t,seed:r,programId:n}=Ke(Pe.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:t,seed:r,programId:new le(n)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:t}=Ke(Pe.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,space:n,programId:a}=Ke(Pe.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new le(t),seed:r,space:n,programId:new le(a)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:t}=Ke(Pe.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new le(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,programId:n}=Ke(Pe.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new le(t),seed:r,programId:new le(n)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:t,seed:r,lamports:n,space:a,programId:d}=Ke(Pe.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new le(t),seed:r,lamports:n,space:a,programId:new le(d)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:t}=Ke(Pe.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new le(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Ke(Pe.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Ke(Pe.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t}=Ke(Pe.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new le(t)}}static checkProgramId(e){if(!e.equals(et.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const Pe=Object.freeze({Create:{index:0,layout:f.struct([f.u32("instruction"),f.ns64("lamports"),f.ns64("space"),Te("programId")])},Assign:{index:1,layout:f.struct([f.u32("instruction"),Te("programId")])},Transfer:{index:2,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},CreateWithSeed:{index:3,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),f.ns64("lamports"),f.ns64("space"),Te("programId")])},AdvanceNonceAccount:{index:4,layout:f.struct([f.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:f.struct([f.u32("instruction"),Te("authorized")])},AuthorizeNonceAccount:{index:7,layout:f.struct([f.u32("instruction"),Te("authorized")])},Allocate:{index:8,layout:f.struct([f.u32("instruction"),f.ns64("space")])},AllocateWithSeed:{index:9,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),f.ns64("space"),Te("programId")])},AssignWithSeed:{index:10,layout:f.struct([f.u32("instruction"),Te("base"),Lt("seed"),Te("programId")])},TransferWithSeed:{index:11,layout:f.struct([f.u32("instruction"),f.ns64("lamports"),Lt("seed"),Te("programId")])}});class et{constructor(){}static createAccount(e){const t=Pe.Create,r=We(t,{lamports:e.lamports,space:e.space,programId:de(e.programId.toBuffer())});return new Ze({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:r})}static transfer(e){let t,r;if("basePubkey"in e){const n=Pe.TransferWithSeed;t=We(n,{lamports:e.lamports,seed:e.seed,programId:de(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{const n=Pe.Transfer;t=We(n,{lamports:e.lamports}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new Ze({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;if("basePubkey"in e){const n=Pe.AssignWithSeed;t=We(n,{base:de(e.basePubkey.toBuffer()),seed:e.seed,programId:de(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Pe.Assign;t=We(n,{programId:de(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ze({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=Pe.CreateWithSeed,r=We(t,{base:de(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:de(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new Ze({keys:n,programId:this.programId,data:r})}static createNonceAccount(e){const t=new Ce;"basePubkey"in e&&"seed"in e?t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:Tr,programId:this.programId})):t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:Tr,programId:this.programId}));const r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){const t=Pe.InitializeNonceAccount,r=We(t,{authorized:de(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:Zt,isSigner:!1,isWritable:!1}],programId:this.programId,data:r};return new Ze(n)}static nonceAdvance(e){const t=Pe.AdvanceNonceAccount,r=We(t),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r};return new Ze(n)}static nonceWithdraw(e){const t=Pe.WithdrawNonceAccount,r=We(t,{lamports:e.lamports});return new Ze({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:Zt,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static nonceAuthorize(e){const t=Pe.AuthorizeNonceAccount,r=We(t,{authorized:de(e.newAuthorizedPubkey.toBuffer())});return new Ze({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static allocate(e){let t,r;if("basePubkey"in e){const n=Pe.AllocateWithSeed;t=We(n,{base:de(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:de(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Pe.Allocate;t=We(n,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ze({keys:r,programId:this.programId,data:t})}}et.programId=new le("11111111111111111111111111111111");const Ys=Yt-300;class It{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/It.chunkSize)+1+1)}static async load(e,t,r,n,a){{const X=await e.getMinimumBalanceForRentExemption(a.length),ne=await e.getAccountInfo(r.publicKey,"confirmed");let te=null;if(ne!==null){if(ne.executable)return console.error("Program load failed, account is already executable"),!1;ne.data.length!==a.length&&(te=te||new Ce,te.add(et.allocate({accountPubkey:r.publicKey,space:a.length}))),ne.owner.equals(n)||(te=te||new Ce,te.add(et.assign({accountPubkey:r.publicKey,programId:n}))),ne.lamports<X&&(te=te||new Ce,te.add(et.transfer({fromPubkey:t.publicKey,toPubkey:r.publicKey,lamports:X-ne.lamports})))}else te=new Ce().add(et.createAccount({fromPubkey:t.publicKey,newAccountPubkey:r.publicKey,lamports:X>0?X:1,space:a.length,programId:n}));te!==null&&await cr(e,te,[t,r],{commitment:"confirmed"})}const d=f.struct([f.u32("instruction"),f.u32("offset"),f.u32("bytesLength"),f.u32("bytesLengthPadding"),f.seq(f.u8("byte"),f.offset(f.u32(),-8),"bytes")]),S=It.chunkSize;let x=0,z=a,q=[];for(;z.length>0;){const X=z.slice(0,S),ne=B.lW.alloc(S+16);d.encode({instruction:0,offset:x,bytes:X},ne);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:n,data:ne});q.push(cr(e,te,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await ur(1e3/4),x+=S,z=z.slice(S)}await Promise.all(q);{const X=f.struct([f.u32("instruction")]),ne=B.lW.alloc(X.span);X.encode({instruction:1},ne);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:Zt,isSigner:!1,isWritable:!1}],programId:n,data:ne});await cr(e,te,[t,r],{commitment:"confirmed"})}return!0}}It.chunkSize=Ys;const Zs=new le("BPFLoader2111111111111111111111111111111111");class Js{static getMinNumSignatures(e){return It.getMinNumSignatures(e)}static load(e,t,r,n,a){return It.load(e,t,r,a,n)}}var Ur={exports:{}};(function(i,e){var t=typeof self<"u"?self:Ae,r=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(d){var S={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function x($){return $&&DataView.prototype.isPrototypeOf($)}if(S.arrayBuffer)var z=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],q=ArrayBuffer.isView||function($){return $&&z.indexOf(Object.prototype.toString.call($))>-1};function X($){if(typeof $!="string"&&($=String($)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test($))throw new TypeError("Invalid character in header field name");return $.toLowerCase()}function ne($){return typeof $!="string"&&($=String($)),$}function te($){var ee={next:function(){var we=$.shift();return{done:we===void 0,value:we}}};return S.iterable&&(ee[Symbol.iterator]=function(){return ee}),ee}function he($){this.map={},$ instanceof he?$.forEach(function(ee,we){this.append(we,ee)},this):Array.isArray($)?$.forEach(function(ee){this.append(ee[0],ee[1])},this):$&&Object.getOwnPropertyNames($).forEach(function(ee){this.append(ee,$[ee])},this)}he.prototype.append=function($,ee){$=X($),ee=ne(ee);var we=this.map[$];this.map[$]=we?we+", "+ee:ee},he.prototype.delete=function($){delete this.map[X($)]},he.prototype.get=function($){return $=X($),this.has($)?this.map[$]:null},he.prototype.has=function($){return this.map.hasOwnProperty(X($))},he.prototype.set=function($,ee){this.map[X($)]=ne(ee)},he.prototype.forEach=function($,ee){for(var we in this.map)this.map.hasOwnProperty(we)&&$.call(ee,this.map[we],we,this)},he.prototype.keys=function(){var $=[];return this.forEach(function(ee,we){$.push(we)}),te($)},he.prototype.values=function(){var $=[];return this.forEach(function(ee){$.push(ee)}),te($)},he.prototype.entries=function(){var $=[];return this.forEach(function(ee,we){$.push([we,ee])}),te($)},S.iterable&&(he.prototype[Symbol.iterator]=he.prototype.entries);function pe($){if($.bodyUsed)return Promise.reject(new TypeError("Already read"));$.bodyUsed=!0}function Ie($){return new Promise(function(ee,we){$.onload=function(){ee($.result)},$.onerror=function(){we($.error)}})}function Le($){var ee=new FileReader,we=Ie(ee);return ee.readAsArrayBuffer($),we}function tt($){var ee=new FileReader,we=Ie(ee);return ee.readAsText($),we}function At($){for(var ee=new Uint8Array($),we=new Array(ee.length),Me=0;Me<ee.length;Me++)we[Me]=String.fromCharCode(ee[Me]);return we.join("")}function wt($){if($.slice)return $.slice(0);var ee=new Uint8Array($.byteLength);return ee.set(new Uint8Array($)),ee.buffer}function St(){return this.bodyUsed=!1,this._initBody=function($){this._bodyInit=$,$?typeof $=="string"?this._bodyText=$:S.blob&&Blob.prototype.isPrototypeOf($)?this._bodyBlob=$:S.formData&&FormData.prototype.isPrototypeOf($)?this._bodyFormData=$:S.searchParams&&URLSearchParams.prototype.isPrototypeOf($)?this._bodyText=$.toString():S.arrayBuffer&&S.blob&&x($)?(this._bodyArrayBuffer=wt($.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):S.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf($)||q($))?this._bodyArrayBuffer=wt($):this._bodyText=$=Object.prototype.toString.call($):this._bodyText="",this.headers.get("content-type")||(typeof $=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):S.searchParams&&URLSearchParams.prototype.isPrototypeOf($)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},S.blob&&(this.blob=function(){var $=pe(this);if($)return $;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?pe(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Le)}),this.text=function(){var $=pe(this);if($)return $;if(this._bodyBlob)return tt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(At(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},S.formData&&(this.formData=function(){return this.text().then(gr)}),this.json=function(){return this.text().then(JSON.parse)},this}var Rt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Bt($){var ee=$.toUpperCase();return Rt.indexOf(ee)>-1?ee:$}function rt($,ee){ee=ee||{};var we=ee.body;if($ instanceof rt){if($.bodyUsed)throw new TypeError("Already read");this.url=$.url,this.credentials=$.credentials,ee.headers||(this.headers=new he($.headers)),this.method=$.method,this.mode=$.mode,this.signal=$.signal,!we&&$._bodyInit!=null&&(we=$._bodyInit,$.bodyUsed=!0)}else this.url=String($);if(this.credentials=ee.credentials||this.credentials||"same-origin",(ee.headers||!this.headers)&&(this.headers=new he(ee.headers)),this.method=Bt(ee.method||this.method||"GET"),this.mode=ee.mode||this.mode||null,this.signal=ee.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&we)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(we)}rt.prototype.clone=function(){return new rt(this,{body:this._bodyInit})};function gr($){var ee=new FormData;return $.trim().split("&").forEach(function(we){if(we){var Me=we.split("="),ze=Me.shift().replace(/\+/g," "),Be=Me.join("=").replace(/\+/g," ");ee.append(decodeURIComponent(ze),decodeURIComponent(Be))}}),ee}function br($){var ee=new he,we=$.replace(/\r?\n[\t ]+/g," ");return we.split(/\r?\n/).forEach(function(Me){var ze=Me.split(":"),Be=ze.shift().trim();if(Be){var wr=ze.join(":").trim();ee.append(Be,wr)}}),ee}St.call(rt.prototype);function nt($,ee){ee||(ee={}),this.type="default",this.status=ee.status===void 0?200:ee.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in ee?ee.statusText:"OK",this.headers=new he(ee.headers),this.url=ee.url||"",this._initBody($)}St.call(nt.prototype),nt.prototype.clone=function(){return new nt(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new he(this.headers),url:this.url})},nt.error=function(){var $=new nt(null,{status:0,statusText:""});return $.type="error",$};var mr=[301,302,303,307,308];nt.redirect=function($,ee){if(mr.indexOf(ee)===-1)throw new RangeError("Invalid status code");return new nt(null,{status:ee,headers:{location:$}})},d.DOMException=a.DOMException;try{new d.DOMException}catch{d.DOMException=function(ee,we){this.message=ee,this.name=we;var Me=Error(ee);this.stack=Me.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function zt($,ee){return new Promise(function(we,Me){var ze=new rt($,ee);if(ze.signal&&ze.signal.aborted)return Me(new d.DOMException("Aborted","AbortError"));var Be=new XMLHttpRequest;function wr(){Be.abort()}Be.onload=function(){var Qt={status:Be.status,statusText:Be.statusText,headers:br(Be.getAllResponseHeaders()||"")};Qt.url="responseURL"in Be?Be.responseURL:Qt.headers.get("X-Request-URL");var $r="response"in Be?Be.response:Be.responseText;we(new nt($r,Qt))},Be.onerror=function(){Me(new TypeError("Network request failed"))},Be.ontimeout=function(){Me(new TypeError("Network request failed"))},Be.onabort=function(){Me(new d.DOMException("Aborted","AbortError"))},Be.open(ze.method,ze.url,!0),ze.credentials==="include"?Be.withCredentials=!0:ze.credentials==="omit"&&(Be.withCredentials=!1),"responseType"in Be&&S.blob&&(Be.responseType="blob"),ze.headers.forEach(function(Qt,$r){Be.setRequestHeader($r,Qt)}),ze.signal&&(ze.signal.addEventListener("abort",wr),Be.onreadystatechange=function(){Be.readyState===4&&ze.signal.removeEventListener("abort",wr)}),Be.send(typeof ze._bodyInit>"u"?null:ze._bodyInit)})}return zt.polyfill=!0,a.fetch||(a.fetch=zt,a.Headers=he,a.Request=rt,a.Response=nt),d.Headers=he,d.Request=rt,d.Response=nt,d.fetch=zt,Object.defineProperty(d,"__esModule",{value:!0}),d})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var n=r;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,i.exports=e})(Ur,Ur.exports);var Bn=Jn(Ur.exports);const Jt=32;function Cr(i){let e=0;for(;i>1;)i/=2,e++;return e}function Xs(i){return i===0?1:(i--,i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,i|=i>>32,i+1)}class Pn{constructor(e,t,r,n,a){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=r,this.firstNormalEpoch=n,this.firstNormalSlot=a}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const t=Cr(Xs(e+Jt+1))-Cr(Jt)-1,r=this.getSlotsInEpoch(t),n=e-(r-Jt);return[t,n]}else{const t=e-this.firstNormalSlot,r=Math.floor(t/this.slotsPerEpoch),n=this.firstNormalEpoch+r,a=t%this.slotsPerEpoch;return[n,a]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*Jt:(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+Cr(Jt)):this.slotsPerEpoch}}class Or extends Error{constructor(e,t){super(e),this.logs=void 0,this.logs=t}}const Qs=1e3/(160/64);function eo(i,e){let t;const r=new Promise(n=>{t=setTimeout(()=>n(null),e)});return Promise.race([i,r]).then(n=>(clearTimeout(t),n))}function to(i){let e=new URL(i);const t=e.protocol==="https:";return e.protocol=t?"wss:":"ws:",e.host="",e.port!==""&&(e.port=String(Number(e.port)+1)),e.toString()}const He=it(w(le),ae(),i=>new le(i)),Tn=Pt([ae(),u("base64")]),Nr=it(w(B.lW),Tn,i=>B.lW.from(i[0],"base64")),Un=30*1e3;function Cn(i){return Xe([Q({jsonrpc:u("2.0"),id:ae(),result:i}),Q({jsonrpc:u("2.0"),id:ae(),error:Q({code:yt(),message:ae(),data:be(Ve())})})])}const ro=Cn(yt());function xe(i){return it(Cn(i),ro,e=>"error"in e?e:{...e,result:A(e.result,i)})}function Ye(i){return xe(Q({context:Q({slot:k()}),value:i}))}function lr(i){return Q({context:Q({slot:k()}),value:i})}const no=Q({foundation:k(),foundationTerm:k(),initial:k(),taper:k(),terminal:k()}),io=xe(fe(L(Q({epoch:k(),effectiveSlot:k(),amount:k(),postBalance:k()})))),so=Q({epoch:k(),slotIndex:k(),slotsInEpoch:k(),absoluteSlot:k(),blockHeight:be(k()),transactionCount:be(k())}),oo=Q({slotsPerEpoch:k(),leaderScheduleSlotOffset:k(),warmup:Je(),firstNormalEpoch:k(),firstNormalSlot:k()}),ao=Ne(ae(),fe(k())),xt=L(Xe([Q({}),ae()])),co=Q({err:xt}),uo=u("receivedSignature"),fo=Q({"solana-core":ae(),"feature-set":be(k())}),lo=Ye(Q({err:L(Xe([Q({}),ae()])),logs:L(fe(ae())),accounts:be(L(fe(Q({executable:Je(),owner:ae(),lamports:k(),data:fe(ae()),rentEpoch:be(k())})))),unitsConsumed:be(k())}));function ho(i,e,t,r,n){let a;return r&&(a=async(S,x)=>{const z=await new Promise((q,X)=>{try{r(S,x,(ne,te)=>q([ne,te]))}catch(ne){X(ne)}});return await Bn(...z)}),new(W())(async(S,x)=>{const q={method:"POST",body:S,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{})};try{let X=5,ne,te=500;for(;a?ne=await a(i,q):ne=await Bn(i,q),!(ne.status!==429||n===!0||(X-=1,X===0));)console.log(`Server responded with ${ne.status} ${ne.statusText}. Retrying after ${te}ms delay...`),await ur(te),te*=2;const he=await ne.text();ne.ok?x(null,he):x(new Error(`${ne.status} ${ne.statusText}: ${he}`))}catch(X){X instanceof Error&&x(X)}finally{}},{})}function po(i){return(e,t)=>new Promise((r,n)=>{i.request(e,t,(a,d)=>{if(a){n(a);return}r(d)})})}function yo(i){return e=>new Promise((t,r)=>{e.length===0&&t([]);const n=e.map(a=>i.request(a.methodName,a.args));i.request(n,(a,d)=>{if(a){r(a);return}t(d)})})}const go=xe(no),bo=xe(so),mo=xe(oo),wo=xe(ao),Eo=xe(k()),So=Ye(Q({total:k(),circulating:k(),nonCirculating:k(),nonCirculatingAccounts:fe(He)})),Fr=Q({amount:ae(),uiAmount:L(k()),decimals:k(),uiAmountString:be(ae())}),vo=Ye(fe(Q({address:He,amount:ae(),uiAmount:L(k()),decimals:k(),uiAmountString:be(ae())}))),ko=Ye(fe(Q({pubkey:He,account:Q({executable:Je(),owner:He,lamports:k(),data:Nr,rentEpoch:k()})}))),Lr=Q({program:ae(),parsed:yt(),space:k()}),_o=Ye(fe(Q({pubkey:He,account:Q({executable:Je(),owner:He,lamports:k(),data:Lr,rentEpoch:k()})}))),Io=Ye(fe(Q({lamports:k(),address:He}))),hr=Q({executable:Je(),owner:He,lamports:k(),data:Nr,rentEpoch:k()}),xo=Q({pubkey:He,account:hr}),Ao=it(Xe([w(B.lW),Lr]),Xe([Tn,Lr]),i=>Array.isArray(i)?A(i,Nr):i),Dr=Q({executable:Je(),owner:He,lamports:k(),data:Ao,rentEpoch:k()}),Ro=Q({pubkey:He,account:Dr}),Bo=Q({state:Xe([u("active"),u("inactive"),u("activating"),u("deactivating")]),active:k(),inactive:k()}),Po=xe(fe(Q({signature:ae(),slot:k(),err:xt,memo:L(ae()),blockTime:be(L(k()))}))),To=xe(fe(Q({signature:ae(),slot:k(),err:xt,memo:L(ae()),blockTime:be(L(k()))}))),Uo=Q({subscription:k(),result:lr(hr)}),Co=Q({pubkey:He,account:hr}),Oo=Q({subscription:k(),result:lr(Co)}),No=Q({parent:k(),slot:k(),root:k()}),Fo=Q({subscription:k(),result:No}),Lo=Xe([Q({type:Xe([u("firstShredReceived"),u("completed"),u("optimisticConfirmation"),u("root")]),slot:k(),timestamp:k()}),Q({type:u("createdBank"),parent:k(),slot:k(),timestamp:k()}),Q({type:u("frozen"),slot:k(),timestamp:k(),stats:Q({numTransactionEntries:k(),numSuccessfulTransactions:k(),numFailedTransactions:k(),maxTransactionsPerEntry:k()})}),Q({type:u("dead"),slot:k(),timestamp:k(),err:ae()})]),Do=Q({subscription:k(),result:Lo}),Wo=Q({subscription:k(),result:lr(Xe([co,uo]))}),Ko=Q({subscription:k(),result:k()}),zo=Q({pubkey:ae(),gossip:L(ae()),tpu:L(ae()),rpc:L(ae()),version:L(ae())}),On=Q({votePubkey:ae(),nodePubkey:ae(),activatedStake:k(),epochVoteAccount:Je(),epochCredits:fe(Pt([k(),k(),k()])),commission:k(),lastVote:k(),rootSlot:L(k())}),Mo=xe(Q({current:fe(On),delinquent:fe(On)})),$o=Xe([u("processed"),u("confirmed"),u("finalized")]),jo=Q({slot:k(),confirmations:L(k()),err:xt,confirmationStatus:be($o)}),Vo=Ye(fe(L(jo))),Go=xe(k()),Nn=Q({signatures:fe(ae()),message:Q({accountKeys:fe(ae()),header:Q({numRequiredSignatures:k(),numReadonlySignedAccounts:k(),numReadonlyUnsignedAccounts:k()}),instructions:fe(Q({accounts:fe(k()),data:ae(),programIdIndex:k()})),recentBlockhash:ae()})}),Fn=Q({parsed:yt(),program:ae(),programId:He}),Ln=Q({accounts:fe(He),data:ae(),programId:He}),Ho=Xe([Ln,Fn]),qo=Xe([Q({parsed:yt(),program:ae(),programId:ae()}),Q({accounts:fe(ae()),data:ae(),programId:ae()})]),Dn=it(Ho,qo,i=>"accounts"in i?A(i,Ln):A(i,Fn)),Yo=Q({signatures:fe(ae()),message:Q({accountKeys:fe(Q({pubkey:He,signer:Je(),writable:Je()})),instructions:fe(Dn),recentBlockhash:ae()})}),dr=Q({accountIndex:k(),mint:ae(),owner:be(ae()),uiTokenAmount:Fr}),Wn=Q({err:xt,fee:k(),innerInstructions:be(L(fe(Q({index:k(),instructions:fe(Q({accounts:fe(k()),data:ae(),programIdIndex:k()}))})))),preBalances:fe(k()),postBalances:fe(k()),logMessages:be(L(fe(ae()))),preTokenBalances:be(L(fe(dr))),postTokenBalances:be(L(fe(dr)))}),Zo=Q({err:xt,fee:k(),innerInstructions:be(L(fe(Q({index:k(),instructions:fe(Dn)})))),preBalances:fe(k()),postBalances:fe(k()),logMessages:be(L(fe(ae()))),preTokenBalances:be(L(fe(dr))),postTokenBalances:be(L(fe(dr)))}),Jo=xe(L(Q({blockhash:ae(),previousBlockhash:ae(),parentSlot:k(),transactions:fe(Q({transaction:Nn,meta:L(Wn)})),rewards:be(fe(Q({pubkey:ae(),lamports:k(),postBalance:L(k()),rewardType:L(ae())}))),blockTime:L(k())}))),Xo=xe(L(Q({blockhash:ae(),previousBlockhash:ae(),parentSlot:k(),signatures:fe(ae()),blockTime:L(k())}))),Qo=xe(L(Q({slot:k(),meta:Wn,blockTime:be(L(k())),transaction:Nn}))),Kn=xe(L(Q({slot:k(),transaction:Yo,meta:L(Zo),blockTime:be(L(k()))}))),ea=Ye(Q({blockhash:ae(),feeCalculator:Q({lamportsPerSignature:k()})})),ta=Q({slot:k(),numTransactions:k(),numSlots:k(),samplePeriodSecs:k()}),ra=xe(fe(ta)),na=Ye(L(Q({feeCalculator:Q({lamportsPerSignature:k()})}))),ia=xe(ae()),sa=xe(ae()),oa=Q({err:xt,logs:fe(ae()),signature:ae()}),aa=Q({result:lr(oa),subscription:k()});class ca{constructor(e,t){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={recentBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._accountChangeSubscriptionCounter=0,this._accountChangeSubscriptions={},this._programAccountChangeSubscriptionCounter=0,this._programAccountChangeSubscriptions={},this._rootSubscriptionCounter=0,this._rootSubscriptions={},this._signatureSubscriptionCounter=0,this._signatureSubscriptions={},this._slotSubscriptionCounter=0,this._slotSubscriptions={},this._logsSubscriptionCounter=0,this._logsSubscriptions={},this._slotUpdateSubscriptionCounter=0,this._slotUpdateSubscriptions={};let r=new URL(e);const n=r.protocol==="https:";let a,d,S,x;t&&typeof t=="string"?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,a=t.wsEndpoint,d=t.httpHeaders,S=t.fetchMiddleware,x=t.disableRetryOnRateLimit),this._rpcEndpoint=e,this._rpcWsEndpoint=a||to(e),this._rpcClient=ho(r.toString(),n,d,S,x),this._rpcRequest=po(this._rpcClient),this._rpcBatchRequest=yo(this._rpcClient),this._rpcWebSocket=new p.K(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}async getBalanceAndContext(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getBalance",r),a=A(n,Ye(k()));if("error"in a)throw new Error("failed to get balance for "+e.toBase58()+": "+a.error.message);return a.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+r)})}async getBlockTime(e){const t=await this._rpcRequest("getBlockTime",[e]),r=A(t,xe(L(k())));if("error"in r)throw new Error("failed to get block time for slot "+e+": "+r.error.message);return r.result}async getMinimumLedgerSlot(){const e=await this._rpcRequest("minimumLedgerSlot",[]),t=A(e,xe(k()));if("error"in t)throw new Error("failed to get minimum ledger slot: "+t.error.message);return t.result}async getFirstAvailableBlock(){const e=await this._rpcRequest("getFirstAvailableBlock",[]),t=A(e,Eo);if("error"in t)throw new Error("failed to get first available block: "+t.error.message);return t.result}async getSupply(e){let t={};typeof e=="string"?t={commitment:e}:e?t={...e,commitment:e&&e.commitment||this.commitment}:t={commitment:this.commitment};const r=await this._rpcRequest("getSupply",[t]),n=A(r,So);if("error"in n)throw new Error("failed to get supply: "+n.error.message);return n.result}async getTokenSupply(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenSupply",r),a=A(n,Ye(Fr));if("error"in a)throw new Error("failed to get token supply: "+a.error.message);return a.result}async getTokenAccountBalance(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenAccountBalance",r),a=A(n,Ye(Fr));if("error"in a)throw new Error("failed to get token account balance: "+a.error.message);return a.result}async getTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"base64"),d=await this._rpcRequest("getTokenAccountsByOwner",a),S=A(d,ko);if("error"in S)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+S.error.message);return S.result}async getParsedTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"jsonParsed"),d=await this._rpcRequest("getTokenAccountsByOwner",a),S=A(d,_o);if("error"in S)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+S.error.message);return S.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},r=t.filter||t.commitment?[t]:[],n=await this._rpcRequest("getLargestAccounts",r),a=A(n,Io);if("error"in a)throw new Error("failed to get largest accounts: "+a.error.message);return a.result}async getTokenLargestAccounts(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenLargestAccounts",r),a=A(n,vo);if("error"in a)throw new Error("failed to get token largest accounts: "+a.error.message);return a.result}async getAccountInfoAndContext(e,t){const r=this._buildArgs([e.toBase58()],t,"base64"),n=await this._rpcRequest("getAccountInfo",r),a=A(n,Ye(L(hr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getParsedAccountInfo(e,t){const r=this._buildArgs([e.toBase58()],t,"jsonParsed"),n=await this._rpcRequest("getAccountInfo",r),a=A(n,Ye(L(Dr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(r){throw new Error("failed to get info about account "+e.toBase58()+": "+r)}}async getMultipleAccountsInfo(e,t){const r=e.map(z=>z.toBase58());let n,a="base64";t&&(typeof t=="string"?(n=t,a="base64"):(n=t.commitment,a=t.encoding||"base64"));const d=this._buildArgs([r],n,a),S=await this._rpcRequest("getMultipleAccounts",d),x=A(S,Ye(fe(L(Dr))));if("error"in x)throw new Error("failed to get info for accounts "+r+": "+x.error.message);return x.result.value}async getStakeActivation(e,t,r){const n=this._buildArgs([e.toBase58()],t,void 0,r!==void 0?{epoch:r}:void 0),a=await this._rpcRequest("getStakeActivation",n),d=A(a,xe(Bo));if("error"in d)throw new Error(`failed to get Stake Activation ${e.toBase58()}: ${d.error.message}`);return d.result}async getProgramAccounts(e,t){const r={};let n,a;t&&(typeof t=="string"?n=t:(n=t.commitment,a=t.encoding,t.dataSlice&&(r.dataSlice=t.dataSlice),t.filters&&(r.filters=t.filters)));const d=this._buildArgs([e.toBase58()],n,a||"base64",r),S=await this._rpcRequest("getProgramAccounts",d),x=A(S,xe(fe(xo)));if("error"in x)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+x.error.message);return x.result}async getParsedProgramAccounts(e,t){const r={};let n;t&&(typeof t=="string"?n=t:(n=t.commitment,t.filters&&(r.filters=t.filters)));const a=this._buildArgs([e.toBase58()],n,"jsonParsed",r),d=await this._rpcRequest("getProgramAccounts",a),S=A(d,xe(fe(Ro)));if("error"in S)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+S.error.message);return S.result}async confirmTransaction(e,t){let r;try{r=E().decode(e)}catch{throw new Error("signature must be base58 encoded: "+e)}Ge(r.length===64,"signature has invalid length");const n=Date.now(),a=t||this.commitment;let d,S=null;const x=new Promise((q,X)=>{try{d=this.onSignature(e,(ne,te)=>{d=void 0,S={context:te,value:ne},q(null)},a)}catch(ne){X(ne)}});let z=this._confirmTransactionInitialTimeout||60*1e3;switch(a){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{z=this._confirmTransactionInitialTimeout||30*1e3;break}}try{await eo(x,z)}finally{d&&this.removeSignatureListener(d)}if(S===null){const q=(Date.now()-n)/1e3;throw new Error(`Transaction was not confirmed in ${q.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`)}return S}async getClusterNodes(){const e=await this._rpcRequest("getClusterNodes",[]),t=A(e,xe(fe(zo)));if("error"in t)throw new Error("failed to get cluster nodes: "+t.error.message);return t.result}async getVoteAccounts(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getVoteAccounts",t),n=A(r,Mo);if("error"in n)throw new Error("failed to get vote accounts: "+n.error.message);return n.result}async getSlot(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlot",t),n=A(r,xe(k()));if("error"in n)throw new Error("failed to get slot: "+n.error.message);return n.result}async getSlotLeader(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlotLeader",t),n=A(r,xe(ae()));if("error"in n)throw new Error("failed to get slot leader: "+n.error.message);return n.result}async getSlotLeaders(e,t){const r=[e,t],n=await this._rpcRequest("getSlotLeaders",r),a=A(n,xe(fe(He)));if("error"in a)throw new Error("failed to get slot leaders: "+a.error.message);return a.result}async getSignatureStatus(e,t){const{context:r,value:n}=await this.getSignatureStatuses([e],t);Ge(n.length===1);const a=n[0];return{context:r,value:a}}async getSignatureStatuses(e,t){const r=[e];t&&r.push(t);const n=await this._rpcRequest("getSignatureStatuses",r),a=A(n,Vo);if("error"in a)throw new Error("failed to get signature status: "+a.error.message);return a.result}async getTransactionCount(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getTransactionCount",t),n=A(r,xe(k()));if("error"in n)throw new Error("failed to get transaction count: "+n.error.message);return n.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getInflationGovernor",t),n=A(r,go);if("error"in n)throw new Error("failed to get inflation: "+n.error.message);return n.result}async getInflationReward(e,t,r){const n=this._buildArgs([e.map(S=>S.toBase58())],r,void 0,{epoch:t}),a=await this._rpcRequest("getInflationReward",n),d=A(a,io);if("error"in d)throw new Error("failed to get inflation reward: "+d.error.message);return d.result}async getEpochInfo(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getEpochInfo",t),n=A(r,bo);if("error"in n)throw new Error("failed to get epoch info: "+n.error.message);return n.result}async getEpochSchedule(){const e=await this._rpcRequest("getEpochSchedule",[]),t=A(e,mo);if("error"in t)throw new Error("failed to get epoch schedule: "+t.error.message);const r=t.result;return new Pn(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot)}async getLeaderSchedule(){const e=await this._rpcRequest("getLeaderSchedule",[]),t=A(e,wo);if("error"in t)throw new Error("failed to get leader schedule: "+t.error.message);return t.result}async getMinimumBalanceForRentExemption(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getMinimumBalanceForRentExemption",r),a=A(n,Go);return"error"in a?(console.warn("Unable to fetch minimum balance for rent exemption"),0):a.result}async getRecentBlockhashAndContext(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getRecentBlockhash",t),n=A(r,ea);if("error"in n)throw new Error("failed to get recent blockhash: "+n.error.message);return n.result}async getRecentPerformanceSamples(e){const t=this._buildArgs(e?[e]:[]),r=await this._rpcRequest("getRecentPerformanceSamples",t),n=A(r,ra);if("error"in n)throw new Error("failed to get recent performance samples: "+n.error.message);return n.result}async getFeeCalculatorForBlockhash(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getFeeCalculatorForBlockhash",r),a=A(n,na);if("error"in a)throw new Error("failed to get fee calculator: "+a.error.message);const{context:d,value:S}=a.result;return{context:d,value:S!==null?S.feeCalculator:null}}async getFeeForMessage(e,t){const r=e.serialize().toString("base64"),n=this._buildArgs([r],t),a=await this._rpcRequest("getFeeForMessage",n),d=A(a,Ye(L(k())));if("error"in d)throw new Error("failed to get slot: "+d.error.message);if(d.result===null)throw new Error("invalid blockhash");return d.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getVersion(){const e=await this._rpcRequest("getVersion",[]),t=A(e,xe(fo));if("error"in t)throw new Error("failed to get version: "+t.error.message);return t.result}async getGenesisHash(){const e=await this._rpcRequest("getGenesisHash",[]),t=A(e,xe(ae()));if("error"in t)throw new Error("failed to get genesis hash: "+t.error.message);return t.result}async getBlock(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedBlock",r),a=A(n,Jo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;return d&&{...d,transactions:d.transactions.map(({transaction:S,meta:x})=>{const z=new kt(S.message);return{meta:x,transaction:{...S,message:z}}})}}async getTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedTransaction",r),a=A(n,Qo);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);const d=a.result;return d&&{...d,transaction:{...d.transaction,message:new kt(d.transaction.message)}}}async getConfirmedBlock(e,t){const r=await this.getBlock(e,{commitment:t});if(!r)throw new Error("Confirmed block "+e+" not found");return{...r,transactions:r.transactions.map(({transaction:n,meta:a})=>({meta:a,transaction:Ce.populate(n.message,n.signatures)}))}}async getBlocks(e,t,r){const n=this._buildArgsAtLeastConfirmed(t!==void 0?[e,t]:[e],r),a=await this._rpcRequest("getConfirmedBlocks",n),d=A(a,xe(fe(k())));if("error"in d)throw new Error("failed to get blocks: "+d.error.message);return d.result}async getConfirmedBlockSignatures(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=await this._rpcRequest("getConfirmedBlock",r),a=A(n,Xo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;if(!d)throw new Error("Confirmed block "+e+" not found");return d}async getConfirmedTransaction(e,t){const r=await this.getTransaction(e,{commitment:t});if(!r)return r;const{message:n,signatures:a}=r.transaction;return{...r,transaction:Ce.populate(n,a)}}async getParsedConfirmedTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),n=await this._rpcRequest("getConfirmedTransaction",r),a=A(n,Kn);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);return a.result}async getParsedConfirmedTransactions(e,t){const r=e.map(d=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([d],t,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(d=>{const S=A(d,Kn);if("error"in S)throw new Error("failed to get confirmed transactions: "+S.error.message);return S.result})}async getConfirmedSignaturesForAddress(e,t,r){let n={},a=await this.getFirstAvailableBlock();for(;!("until"in n)&&(t--,!(t<=0||t<a));)try{const x=await this.getConfirmedBlockSignatures(t,"finalized");x.signatures.length>0&&(n.until=x.signatures[x.signatures.length-1].toString())}catch(x){if(x instanceof Error&&x.message.includes("skipped"))continue;throw x}let d=await this.getSlot("finalized");for(;!("before"in n)&&(r++,!(r>d));)try{const x=await this.getConfirmedBlockSignatures(r);x.signatures.length>0&&(n.before=x.signatures[x.signatures.length-1].toString())}catch(x){if(x instanceof Error&&x.message.includes("skipped"))continue;throw x}return(await this.getConfirmedSignaturesForAddress2(e,n)).map(x=>x.signature)}async getConfirmedSignaturesForAddress2(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getConfirmedSignaturesForAddress2",n),d=A(a,Po);if("error"in d)throw new Error("failed to get confirmed signatures for address: "+d.error.message);return d.result}async getSignaturesForAddress(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getSignaturesForAddress",n),d=A(a,To);if("error"in d)throw new Error("failed to get signatures for address: "+d.error.message);return d.result}async getNonceAndContext(e,t){const{context:r,value:n}=await this.getAccountInfoAndContext(e,t);let a=null;return n!==null&&(a=fr.fromAccountData(n.data)),{context:r,value:a}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+r)})}async requestAirdrop(e,t){const r=await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),n=A(r,ia);if("error"in n)throw new Error("airdrop to "+e.toBase58()+" failed: "+n.error.message);return n.result}async _recentBlockhash(e){if(!e){for(;this._pollingBlockhash;)await ur(100);const r=Date.now()-this._blockhashInfo.lastFetch>=Un;if(this._blockhashInfo.recentBlockhash!==null&&!r)return this._blockhashInfo.recentBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now();for(let t=0;t<50;t++){const{blockhash:r}=await this.getRecentBlockhash("finalized");if(this._blockhashInfo.recentBlockhash!=r)return this._blockhashInfo={recentBlockhash:r,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},r;await ur(Qs/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(e,t,r){let n;if(e instanceof Ce?n=e:n=Ce.populate(e),n.nonceInfo&&t)n.sign(...t);else{let te=this._disableBlockhashCaching;for(;n.recentBlockhash=await this._recentBlockhash(te),!!t;){if(n.sign(...t),!n.signature)throw new Error("!signature");const he=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(he)&&!this._blockhashInfo.transactionSignatures.includes(he)){this._blockhashInfo.simulatedSignatures.push(he);break}else te=!0}}const a=n._compile(),d=a.serialize(),x=n._serialize(d).toString("base64"),z={encoding:"base64",commitment:this.commitment};if(r){const te=(Array.isArray(r)?r:a.nonProgramIds()).map(he=>he.toBase58());z.accounts={encoding:"base64",addresses:te}}t&&(z.sigVerify=!0);const q=[x,z],X=await this._rpcRequest("simulateTransaction",q),ne=A(X,lo);if("error"in ne){let te;if("data"in ne.error&&(te=ne.error.data.logs,te&&Array.isArray(te))){const he=`
|
|
109
|
-
`,
|
|
110
|
-
`,X=q+z.join(q);console.error(x.error.message,X)}throw new Or("failed to send transaction: "+x.error.message,z)}return x.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{this._rpcWebSocket.notify("ping").catch(()=>{})},5e3),this._updateSubscriptions()}_wsOnError(e){console.error("ws error:",e.message)}_wsOnClose(e){if(this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),e===1e3){this._updateSubscriptions();return}this._resetSubscriptions()}async _subscribe(e,t,r){if(e.subscriptionId==null){e.subscriptionId="subscribing";try{const n=await this._rpcWebSocket.call(t,r);typeof n=="number"&&e.subscriptionId==="subscribing"&&(e.subscriptionId=n)}catch(n){e.subscriptionId==="subscribing"&&(e.subscriptionId=null),n instanceof Error&&console.error(`${t} error for argument`,r,n.message)}}}async _unsubscribe(e,t){const r=e.subscriptionId;if(r!=null&&typeof r!="string"){const n=r;try{await this._rpcWebSocket.call(t,[n])}catch(a){a instanceof Error&&console.error(`${t} error:`,a.message)}}}_resetSubscriptions(){Object.values(this._accountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._programAccountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._rootSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._signatureSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotUpdateSubscriptions).forEach(e=>e.subscriptionId=null)}_updateSubscriptions(){const e=Object.keys(this._accountChangeSubscriptions).map(Number),t=Object.keys(this._programAccountChangeSubscriptions).map(Number),r=Object.keys(this._slotSubscriptions).map(Number),n=Object.keys(this._slotUpdateSubscriptions).map(Number),a=Object.keys(this._signatureSubscriptions).map(Number),d=Object.keys(this._rootSubscriptions).map(Number),S=Object.keys(this._logsSubscriptions).map(Number);if(e.length===0&&t.length===0&&r.length===0&&n.length===0&&a.length===0&&d.length===0&&S.length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null,this._rpcWebSocket.close()},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}for(let x of e){const z=this._accountChangeSubscriptions[x];this._subscribe(z,"accountSubscribe",this._buildArgs([z.publicKey],z.commitment,"base64"))}for(let x of t){const z=this._programAccountChangeSubscriptions[x];this._subscribe(z,"programSubscribe",this._buildArgs([z.programId],z.commitment,"base64",{filters:z.filters}))}for(let x of r){const z=this._slotSubscriptions[x];this._subscribe(z,"slotSubscribe",[])}for(let x of n){const z=this._slotUpdateSubscriptions[x];this._subscribe(z,"slotsUpdatesSubscribe",[])}for(let x of a){const z=this._signatureSubscriptions[x],q=[z.signature];z.options&&q.push(z.options),this._subscribe(z,"signatureSubscribe",q)}for(let x of d){const z=this._rootSubscriptions[x];this._subscribe(z,"rootSubscribe",[])}for(let x of S){const z=this._logsSubscriptions[x];let q;typeof z.filter=="object"?q={mentions:[z.filter.toString()]}:q=z.filter,this._subscribe(z,"logsSubscribe",this._buildArgs([q],z.commitment))}}_wsOnAccountNotification(e){const t=A(e,Uo);for(const r of Object.values(this._accountChangeSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result.value,t.result.context);return}}onAccountChange(e,t,r){const n=++this._accountChangeSubscriptionCounter;return this._accountChangeSubscriptions[n]={publicKey:e.toBase58(),callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeAccountChangeListener(e){if(this._accountChangeSubscriptions[e]){const t=this._accountChangeSubscriptions[e];delete this._accountChangeSubscriptions[e],await this._unsubscribe(t,"accountUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown account change id: ${e}`)}_wsOnProgramAccountNotification(e){const t=A(e,Oo);for(const r of Object.values(this._programAccountChangeSubscriptions))if(r.subscriptionId===t.subscription){const{value:n,context:a}=t.result;r.callback({accountId:n.pubkey,accountInfo:n.account},a);return}}onProgramAccountChange(e,t,r,n){const a=++this._programAccountChangeSubscriptionCounter;return this._programAccountChangeSubscriptions[a]={programId:e.toBase58(),callback:t,commitment:r,subscriptionId:null,filters:n},this._updateSubscriptions(),a}async removeProgramAccountChangeListener(e){if(this._programAccountChangeSubscriptions[e]){const t=this._programAccountChangeSubscriptions[e];delete this._programAccountChangeSubscriptions[e],await this._unsubscribe(t,"programUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown program account change id: ${e}`)}onLogs(e,t,r){const n=++this._logsSubscriptionCounter;return this._logsSubscriptions[n]={filter:e,callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeOnLogsListener(e){if(!this._logsSubscriptions[e])throw new Error(`Unknown logs id: ${e}`);const t=this._logsSubscriptions[e];delete this._logsSubscriptions[e],await this._unsubscribe(t,"logsUnsubscribe"),this._updateSubscriptions()}_wsOnLogsNotification(e){const t=A(e,aa),r=Object.keys(this._logsSubscriptions).map(Number);for(let n of r){const a=this._logsSubscriptions[n];if(a.subscriptionId===t.subscription){a.callback(t.result.value,t.result.context);return}}}_wsOnSlotNotification(e){const t=A(e,Fo);for(const r of Object.values(this._slotSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotChange(e){const t=++this._slotSubscriptionCounter;return this._slotSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotChangeListener(e){if(this._slotSubscriptions[e]){const t=this._slotSubscriptions[e];delete this._slotSubscriptions[e],await this._unsubscribe(t,"slotUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot change id: ${e}`)}_wsOnSlotUpdatesNotification(e){const t=A(e,Do);for(const r of Object.values(this._slotUpdateSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotUpdate(e){const t=++this._slotUpdateSubscriptionCounter;return this._slotUpdateSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotUpdateListener(e){if(this._slotUpdateSubscriptions[e]){const t=this._slotUpdateSubscriptions[e];delete this._slotUpdateSubscriptions[e],await this._unsubscribe(t,"slotsUpdatesUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot update id: ${e}`)}_buildArgs(e,t,r,n){const a=t||this._commitment;if(a||r||n){let d={};r&&(d.encoding=r),a&&(d.commitment=a),n&&(d=Object.assign(d,n)),e.push(d)}return e}_buildArgsAtLeastConfirmed(e,t,r,n){const a=t||this._commitment;if(a&&!["confirmed","finalized"].includes(a))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,r,n)}_wsOnSignatureNotification(e){const t=A(e,Wo);for(const[r,n]of Object.entries(this._signatureSubscriptions))if(n.subscriptionId===t.subscription){t.result.value==="receivedSignature"?n.callback({type:"received"},t.result.context):(delete this._signatureSubscriptions[Number(r)],this._updateSubscriptions(),n.callback({type:"status",result:t.result.value},t.result.context));return}}onSignature(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:(a,d)=>{a.type==="status"&&t(a.result,d)},options:{commitment:r},subscriptionId:null},this._updateSubscriptions(),n}onSignatureWithOptions(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:t,options:r,subscriptionId:null},this._updateSubscriptions(),n}async removeSignatureListener(e){if(this._signatureSubscriptions[e]){const t=this._signatureSubscriptions[e];delete this._signatureSubscriptions[e],await this._unsubscribe(t,"signatureUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown signature result id: ${e}`)}_wsOnRootNotification(e){const t=A(e,Ko);for(const r of Object.values(this._rootSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onRootChange(e){const t=++this._rootSubscriptionCounter;return this._rootSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeRootChangeListener(e){if(this._rootSubscriptions[e]){const t=this._rootSubscriptions[e];delete this._rootSubscriptions[e],await this._unsubscribe(t,"rootUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown root change id: ${e}`)}}class Wt{constructor(e){this._keypair=void 0,e?this._keypair=e:this._keypair=J().sign.keyPair()}static generate(){return new Wt(J().sign.keyPair())}static fromSecretKey(e,t){const r=J().sign.keyPair.fromSecretKey(e);if(!t||!t.skipValidation){const a=new TextEncoder().encode("@solana/web3.js-validation-v1"),d=J().sign.detached(a,r.secretKey);if(!J().sign.detached.verify(a,d,r.publicKey))throw new Error("provided secretKey is invalid")}return new Wt(r)}static fromSeed(e){return new Wt(J().sign.keyPair.fromSeed(e))}get publicKey(){return new le(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const zn=64,Mn=32,$n=64,jn=f.struct([f.u8("numSignatures"),f.u8("padding"),f.u16("signatureOffset"),f.u16("signatureInstructionIndex"),f.u16("publicKeyOffset"),f.u16("publicKeyInstructionIndex"),f.u16("messageDataOffset"),f.u16("messageDataSize"),f.u16("messageInstructionIndex")]);class pr{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,instructionIndex:a}=e;Ge(t.length===Mn,`Public Key must be ${Mn} bytes but received ${t.length} bytes`),Ge(n.length===$n,`Signature must be ${$n} bytes but received ${n.length} bytes`);const d=jn.span,S=d+t.length,x=S+n.length,z=1,q=B.lW.alloc(x+r.length);return jn.encode({numSignatures:z,padding:0,signatureOffset:S,signatureInstructionIndex:a,publicKeyOffset:d,publicKeyInstructionIndex:a,messageDataOffset:x,messageDataSize:r.length,messageInstructionIndex:a},q),q.fill(t,d),q.fill(n,S),q.fill(r,x),new Ze({keys:[],programId:pr.programId,data:q})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;Ge(t.length===zn,`Private key must be ${zn} bytes but received ${t.length} bytes`);try{const a=Wt.fromSecretKey(t),d=a.publicKey.toBytes(),S=J().sign.detached(r,a.secretKey);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:S,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}pr.programId=new le("Ed25519SigVerify111111111111111111111111111");const Vn=new le("StakeConfig11111111111111111111111111111111");class Gn{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class Xt{constructor(e,t,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=r}}Xt.default=new Xt(0,0,le.default);class ua{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=f.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(je))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t,lockup:r}=Ke(je.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new Gn(new le(t.staker),new le(t.withdrawer)),lockup:new Xt(r.unixTimestamp,r.epoch,new le(r.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),Ke(je.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,stakeAuthorizationType:r}=Ke(je.Authorize,e.data),n={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new le(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(n.custodianPubkey=e.keys[3].pubkey),n}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:t,stakeAuthorizationType:r,authoritySeed:n,authorityOwner:a}=Ke(je.AuthorizeWithSeed,e.data),d={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:n,authorityOwner:new le(a),newAuthorizedPubkey:new le(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(d.custodianPubkey=e.keys[3].pubkey),d}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=Ke(je.Split,e.data);return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}static decodeMerge(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Ke(je.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Ke(je.Withdraw,e.data),r={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(r.custodianPubkey=e.keys[5].pubkey),r}static decodeDeactivate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Ke(je.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(yr.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const je=Object.freeze({Initialize:{index:0,layout:f.struct([f.u32("instruction"),Ws(),Ks()])},Authorize:{index:1,layout:f.struct([f.u32("instruction"),Te("newAuthorized"),f.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:f.struct([f.u32("instruction")])},Split:{index:3,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},Withdraw:{index:4,layout:f.struct([f.u32("instruction"),f.ns64("lamports")])},Deactivate:{index:5,layout:f.struct([f.u32("instruction")])},Merge:{index:7,layout:f.struct([f.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:f.struct([f.u32("instruction"),Te("newAuthorized"),f.u32("stakeAuthorizationType"),Lt("authoritySeed"),Te("authorityOwner")])}}),fa=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class yr{constructor(){}static initialize(e){const{stakePubkey:t,authorized:r,lockup:n}=e,a=n||Xt.default,d=je.Initialize,S=We(d,{authorized:{staker:de(r.staker.toBuffer()),withdrawer:de(r.withdrawer.toBuffer())},lockup:{unixTimestamp:a.unixTimestamp,epoch:a.epoch,custodian:de(a.custodian.toBuffer())}}),x={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Zt,isSigner:!1,isWritable:!1}],programId:this.programId,data:S};return new Ze(x)}static createAccountWithSeed(e){const t=new Ce;t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static createAccount(e){const t=new Ce;t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:r,votePubkey:n}=e,a=je.Delegate,d=We(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:ar,isSigner:!1,isWritable:!1},{pubkey:Vn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static authorize(e){const{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:a,custodianPubkey:d}=e,S=je.Authorize,x=We(S,{newAuthorized:de(n.toBuffer()),stakeAuthorizationType:a.index}),z=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&z.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:z,programId:this.programId,data:x})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:r,authoritySeed:n,authorityOwner:a,newAuthorizedPubkey:d,stakeAuthorizationType:S,custodianPubkey:x}=e,z=je.AuthorizeWithSeed,q=We(z,{newAuthorized:de(d.toBuffer()),stakeAuthorizationType:S.index,authoritySeed:n,authorityOwner:de(a.toBuffer())}),X=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:_t,isSigner:!1,isWritable:!1}];return x&&X.push({pubkey:x,isSigner:!1,isWritable:!1}),new Ce().add({keys:X,programId:this.programId,data:q})}static split(e){const{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:n,lamports:a}=e,d=new Ce;d.add(et.createAccount({fromPubkey:r,newAccountPubkey:n,lamports:0,space:this.space,programId:this.programId}));const S=je.Split,x=We(S,{lamports:a});return d.add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:x})}static merge(e){const{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:n}=e,a=je.Merge,d=We(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:r,toPubkey:n,lamports:a,custodianPubkey:d}=e,S=je.Withdraw,x=We(S,{lamports:a}),z=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:ar,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&z.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:z,programId:this.programId,data:x})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:r}=e,n=je.Deactivate,a=We(n);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}}yr.programId=new le("Stake11111111111111111111111111111111111111"),yr.space=200;const{publicKeyCreate:la,ecdsaSign:ha}=Ee(),Hn=32,Wr=20,qn=64,da=11,Kr=f.struct([f.u8("numSignatures"),f.u16("signatureOffset"),f.u8("signatureInstructionIndex"),f.u16("ethAddressOffset"),f.u8("ethAddressInstructionIndex"),f.u16("messageDataOffset"),f.u16("messageDataSize"),f.u8("messageInstructionIndex"),f.blob(20,"ethAddress"),f.blob(64,"signature"),f.u8("recoveryId")]);class Kt{constructor(){}static publicKeyToEthAddress(e){Ge(e.length===qn,`Public key must be ${qn} bytes but received ${e.length} bytes`);try{return B.lW.from(Re().keccak_256.update(de(e)).digest()).slice(-Wr)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,recoveryId:a,instructionIndex:d}=e;return Kt.createInstructionWithEthAddress({ethAddress:Kt.publicKeyToEthAddress(t),message:r,signature:n,recoveryId:a,instructionIndex:d})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:r,signature:n,recoveryId:a,instructionIndex:d=0}=e;let S;typeof t=="string"?t.startsWith("0x")?S=B.lW.from(t.substr(2),"hex"):S=B.lW.from(t,"hex"):S=t,Ge(S.length===Wr,`Address must be ${Wr} bytes but received ${S.length} bytes`);const x=1+da,z=x,q=x+S.length,X=q+n.length+1,ne=1,te=B.lW.alloc(Kr.span+r.length);return Kr.encode({numSignatures:ne,signatureOffset:q,signatureInstructionIndex:d,ethAddressOffset:z,ethAddressInstructionIndex:d,messageDataOffset:X,messageDataSize:r.length,messageInstructionIndex:d,signature:de(n),ethAddress:de(S),recoveryId:a},te),te.fill(de(r),Kr.span),new Ze({keys:[],programId:Kt.programId,data:te})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;Ge(t.length===Hn,`Private key must be ${Hn} bytes but received ${t.length} bytes`);try{const a=de(t),d=la(a,!1).slice(1),S=B.lW.from(Re().keccak_256.update(de(r)).digest()),{signature:x,recid:z}=ha(S,a);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:x,recoveryId:z,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}Kt.programId=new le("KeccakSecp256k11111111111111111111111111111");const Yn=new le("Va1idator1nfo111111111111111111111111111111"),pa=Q({name:ae(),website:be(ae()),details:be(ae()),keybaseUsername:be(ae())});class zr{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let r=[...e];if(Dt(r)!==2)return null;const a=[];for(let d=0;d<2;d++){const S=new le(r.slice(0,32));r=r.slice(32);const x=r.slice(0,1)[0]===1;r=r.slice(1),a.push({publicKey:S,isSigner:x})}if(a[0].publicKey.equals(Yn)&&a[1].isSigner){const d=Lt().decode(B.lW.from(r)),S=JSON.parse(d);return se(S,pa),new zr(a[1].publicKey,S)}return null}}const ya=new le("Vote111111111111111111111111111111111111111"),ga=f.struct([Te("nodePubkey"),Te("authorizedWithdrawer"),f.u8("commission"),f.nu64(),f.seq(f.struct([f.nu64("slot"),f.u32("confirmationCount")]),f.offset(f.u32(),-8),"votes"),f.u8("rootSlotValid"),f.nu64("rootSlot"),f.nu64(),f.seq(f.struct([f.nu64("epoch"),Te("authorizedVoter")]),f.offset(f.u32(),-8),"authorizedVoters"),f.struct([f.seq(f.struct([Te("authorizedPubkey"),f.nu64("epochOfLastAuthorizedSwitch"),f.nu64("targetEpoch")]),32,"buf"),f.nu64("idx"),f.u8("isEmpty")],"priorVoters"),f.nu64(),f.seq(f.struct([f.nu64("epoch"),f.nu64("credits"),f.nu64("prevCredits")]),f.offset(f.u32(),-8),"epochCredits"),f.struct([f.nu64("slot"),f.nu64("timestamp")],"lastTimestamp")]);class Mr{constructor(e){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){const r=ga.decode(de(e),4);let n=r.rootSlot;return r.rootSlotValid||(n=null),new Mr({nodePubkey:new le(r.nodePubkey),authorizedWithdrawer:new le(r.authorizedWithdrawer),commission:r.commission,votes:r.votes,rootSlot:n,authorizedVoters:r.authorizedVoters.map(ba),priorVoters:wa(r.priorVoters),epochCredits:r.epochCredits,lastTimestamp:r.lastTimestamp})}}function ba({epoch:i,authorizedVoter:e}){return{epoch:i,authorizedVoter:new le(e)}}function ma({authorizedPubkey:i,epochOfLastAuthorizedSwitch:e,targetEpoch:t}){return{authorizedPubkey:new le(i),epochOfLastAuthorizedSwitch:e,targetEpoch:t}}function wa({buf:i,idx:e,isEmpty:t}){return t?[]:[...i.slice(e+1).map(ma),...i.slice(0,e)]}async function Ea(i,e,t){const r=t&&{skipPreflight:t.skipPreflight,preflightCommitment:t.preflightCommitment||t.commitment},n=await i.sendRawTransaction(e,r),a=(await i.confirmTransaction(n,t&&t.commitment)).value;if(a.err)throw new Error(`Raw transaction ${n} failed (${JSON.stringify(a)})`);return n}const Zn={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com"}};function Sa(i,e){const t=e===!1?"http":"https";if(!i)return Zn[t].devnet;const r=Zn[t][i];if(!r)throw new Error(`Unknown ${t} cluster: ${i}`);return r}const va=1e9},64285:function(ve,g,D){"use strict";var j;/*!
|
|
108
|
+
*/var z=this&&this.__extends||function(){var w=function(b,l){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,y){f.__proto__=y}||function(f,y){for(var F in y)Object.prototype.hasOwnProperty.call(y,F)&&(f[F]=y[F])},w(b,l)};return function(b,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");w(b,l);function f(){this.constructor=b}b.prototype=l===null?Object.create(l):(f.prototype=l.prototype,new f)}}();g.__esModule=!0,g.s16=g.s8=g.nu64be=g.u48be=g.u40be=g.u32be=g.u24be=g.u16be=g.nu64=g.u48=g.u40=g.u32=g.u24=g.u16=g.u8=g.offset=g.greedy=g.Constant=g.UTF8=g.CString=g.Blob=g.Boolean=g.BitField=g.BitStructure=g.VariantLayout=g.Union=g.UnionLayoutDiscriminator=g.UnionDiscriminator=g.Structure=g.Sequence=g.DoubleBE=g.Double=g.FloatBE=g.Float=g.NearInt64BE=g.NearInt64=g.NearUInt64BE=g.NearUInt64=g.IntBE=g.Int=g.UIntBE=g.UInt=g.OffsetLayout=g.GreedyCount=g.ExternalLayout=g.bindConstructorLayout=g.nameWithProperty=g.Layout=g.uint8ArrayToBuffer=g.checkUint8Array=void 0,g.constant=g.utf8=g.cstr=g.blob=g.unionLayoutDiscriminator=g.union=g.seq=g.bits=g.struct=g.f64be=g.f64=g.f32be=g.f32=g.ns64be=g.s48be=g.s40be=g.s32be=g.s24be=g.s16be=g.ns64=g.s48=g.s40=g.s32=g.s24=void 0;var J=L(48764);function B(w){if(!(w instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}g.checkUint8Array=B;function K(w){return B(w),J.Buffer.from(w.buffer,w.byteOffset,w.length)}g.uint8ArrayToBuffer=K;var N=function(){function w(b,l){if(!Number.isInteger(b))throw new TypeError("span must be an integer");this.span=b,this.property=l}return w.prototype.makeDestinationObject=function(){return{}},w.prototype.decode=function(b,l){throw new Error("Layout is abstract")},w.prototype.encode=function(b,l,f){throw new Error("Layout is abstract")},w.prototype.getSpan=function(b,l){if(0>this.span)throw new RangeError("indeterminate span");return this.span},w.prototype.replicate=function(b){var l=Object.create(this.constructor.prototype);return Object.assign(l,this),l.property=b,l},w.prototype.fromArray=function(b){},w}();g.Layout=N;function I(w,b){return b.property?w+"["+b.property+"]":w}g.nameWithProperty=I;function E(w,b){if(typeof w!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(w,"layout_"))throw new Error("Class is already bound to a layout");if(!(b&&b instanceof N))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(b,"boundConstructor_"))throw new Error("layout is already bound to a constructor");w.layout_=b,b.boundConstructor_=w,b.makeDestinationObject=function(){return new w},Object.defineProperty(w.prototype,"encode",{value:function(l,f){return b.encode(this,l,f)},writable:!0}),Object.defineProperty(w,"decode",{value:function(l,f){return b.decode(l,f)},writable:!0})}g.bindConstructorLayout=E;var h=function(w){z(b,w);function b(){return w!==null&&w.apply(this,arguments)||this}return b.prototype.isCount=function(){throw new Error("ExternalLayout is abstract")},b}(N);g.ExternalLayout=h;var u=function(w){z(b,w);function b(l,f){var y=this;if(l===void 0&&(l=1),!Number.isInteger(l)||0>=l)throw new TypeError("elementSpan must be a (positive) integer");return y=w.call(this,-1,f)||this,y.elementSpan=l,y}return b.prototype.isCount=function(){return!0},b.prototype.decode=function(l,f){B(l),f===void 0&&(f=0);var y=l.length-f;return Math.floor(y/this.elementSpan)},b.prototype.encode=function(l,f,y){return 0},b}(h);g.GreedyCount=u;var O=function(w){z(b,w);function b(l,f,y){var F=this;if(!(l instanceof N))throw new TypeError("layout must be a Layout");if(f===void 0)f=0;else if(!Number.isInteger(f))throw new TypeError("offset must be integer or undefined");return F=w.call(this,l.span,y||l.property)||this,F.layout=l,F.offset=f,F}return b.prototype.isCount=function(){return this.layout instanceof k||this.layout instanceof U},b.prototype.decode=function(l,f){return f===void 0&&(f=0),this.layout.decode(l,f+this.offset)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),this.layout.encode(l,f,y+this.offset)},b}(h);g.OffsetLayout=O;var k=function(w){z(b,w);function b(l,f){var y=w.call(this,l,f)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readUIntLE(f,this.span)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeUIntLE(l,y,this.span),this.span},b}(N);g.UInt=k;var U=function(w){z(b,w);function b(l,f){var y=w.call(this,l,f)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readUIntBE(f,this.span)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeUIntBE(l,y,this.span),this.span},b}(N);g.UIntBE=U;var T=function(w){z(b,w);function b(l,f){var y=w.call(this,l,f)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readIntLE(f,this.span)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeIntLE(l,y,this.span),this.span},b}(N);g.Int=T;var m=function(w){z(b,w);function b(l,f){var y=w.call(this,l,f)||this;if(6<y.span)throw new RangeError("span must not exceed 6 bytes");return y}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readIntBE(f,this.span)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeIntBE(l,y,this.span),this.span},b}(N);g.IntBE=m;var C=Math.pow(2,32);function A(w){var b=Math.floor(w/C),l=w-b*C;return{hi32:b,lo32:l}}function R(w,b){return w*C+b}var V=function(w){z(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=K(l),F=y.readUInt32LE(f),D=y.readUInt32LE(f+4);return R(D,F)},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=A(l),D=K(f);return D.writeUInt32LE(F.lo32,y),D.writeUInt32LE(F.hi32,y+4),8},b}(N);g.NearUInt64=V;var H=function(w){z(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=K(l),F=y.readUInt32BE(f),D=y.readUInt32BE(f+4);return R(F,D)},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=A(l),D=K(f);return D.writeUInt32BE(F.hi32,y),D.writeUInt32BE(F.lo32,y+4),8},b}(N);g.NearUInt64BE=H;var ne=function(w){z(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=K(l),F=y.readUInt32LE(f),D=y.readInt32LE(f+4);return R(D,F)},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=A(l),D=K(f);return D.writeUInt32LE(F.lo32,y),D.writeInt32LE(F.hi32,y+4),8},b}(N);g.NearInt64=ne;var x=function(w){z(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=K(l),F=y.readInt32BE(f),D=y.readUInt32BE(f+4);return R(F,D)},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=A(l),D=K(f);return D.writeInt32BE(F.hi32,y),D.writeUInt32BE(F.lo32,y+4),8},b}(N);g.NearInt64BE=x;var fe=function(w){z(b,w);function b(l){return w.call(this,4,l)||this}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readFloatLE(f)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeFloatLE(l,y),4},b}(N);g.Float=fe;var q=function(w){z(b,w);function b(l){return w.call(this,4,l)||this}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readFloatBE(f)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeFloatBE(l,y),4},b}(N);g.FloatBE=q;var ce=function(w){z(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readDoubleLE(f)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeDoubleLE(l,y),8},b}(N);g.Double=ce;var re=function(w){z(b,w);function b(l){return w.call(this,8,l)||this}return b.prototype.decode=function(l,f){return f===void 0&&(f=0),K(l).readDoubleBE(f)},b.prototype.encode=function(l,f,y){return y===void 0&&(y=0),K(f).writeDoubleBE(l,y),8},b}(N);g.DoubleBE=re;var ae=function(w){z(b,w);function b(l,f,y){var F=this;if(!(l instanceof N))throw new TypeError("elementLayout must be a Layout");if(!(f instanceof h&&f.isCount()||Number.isInteger(f)&&0<=f))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var D=-1;return!(f instanceof h)&&0<l.span&&(D=f*l.span),F=w.call(this,D,y)||this,F.elementLayout=l,F.count=f,F}return b.prototype.getSpan=function(l,f){if(0<=this.span)return this.span;f===void 0&&(f=0);var y=0,F=this.count;if(F instanceof h&&(F=F.decode(l,f)),0<this.elementLayout.span)y=F*this.elementLayout.span;else for(var D=0;D<F;)y+=this.elementLayout.getSpan(l,f+y),++D;return y},b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=[],F=0,D=this.count;for(D instanceof h&&(D=D.decode(l,f));F<D;)y.push(this.elementLayout.decode(l,f)),f+=this.elementLayout.getSpan(l,f),F+=1;return y},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=this.elementLayout,D=l.reduce(function(_,_e){return _+F.encode(_e,f,y+_)},0);return this.count instanceof h&&this.count.encode(l.length,f,y),D},b}(N);g.Sequence=ae;var Y=function(w){z(b,w);function b(l,f,y){var F=this;if(!(Array.isArray(l)&&l.reduce(function(Ne,qe){return Ne&&qe instanceof N},!0)))throw new TypeError("fields must be array of Layout instances");typeof f=="boolean"&&y===void 0&&(y=f,f=void 0);for(var D=0,_=l;D<_.length;D++){var _e=_[D];if(0>_e.span&&_e.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout")}var be=-1;try{be=l.reduce(function(Ne,qe){return Ne+qe.getSpan()},0)}catch{}return F=w.call(this,be,f)||this,F.fields=l,F.decodePrefixes=!!y,F}return b.prototype.getSpan=function(l,f){if(0<=this.span)return this.span;f===void 0&&(f=0);var y=0;try{y=this.fields.reduce(function(F,D){var _=D.getSpan(l,f);return f+=_,F+_},0)}catch{throw new RangeError("indeterminate span")}return y},b.prototype.decode=function(l,f){B(l),f===void 0&&(f=0);for(var y=this.makeDestinationObject(),F=0,D=this.fields;F<D.length;F++){var _=D[F];if(_.property!==void 0&&(y[_.property]=_.decode(l,f)),f+=_.getSpan(l,f),this.decodePrefixes&&l.length===f)break}return y},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);for(var F=y,D=0,_=0,_e=0,be=this.fields;_e<be.length;_e++){var Ne=be[_e],qe=Ne.span;if(_=0<qe?qe:0,Ne.property!==void 0){var $t=l[Ne.property];$t!==void 0&&(_=Ne.encode($t,f,y),0>qe&&(qe=Ne.getSpan(f,y)))}D=y,y+=qe}return D+_-F},b.prototype.fromArray=function(l){for(var f=this.makeDestinationObject(),y=0,F=this.fields;y<F.length;y++){var D=F[y];D.property!==void 0&&0<l.length&&(f[D.property]=l.shift())}return f},b.prototype.layoutFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var f=0,y=this.fields;f<y.length;f++){var F=y[f];if(F.property===l)return F}},b.prototype.offsetOf=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var f=0,y=0,F=this.fields;y<F.length;y++){var D=F[y];if(D.property===l)return f;0>D.span?f=-1:0<=f&&(f+=D.span)}},b}(N);g.Structure=Y;var $=function(){function w(b){this.property=b}return w.prototype.decode=function(b,l){throw new Error("UnionDiscriminator is abstract")},w.prototype.encode=function(b,l,f){throw new Error("UnionDiscriminator is abstract")},w}();g.UnionDiscriminator=$;var ie=function(w){z(b,w);function b(l,f){var y=this;if(!(l instanceof h&&l.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return y=w.call(this,f||l.property||"variant")||this,y.layout=l,y}return b.prototype.decode=function(l,f){return this.layout.decode(l,f)},b.prototype.encode=function(l,f,y){return this.layout.encode(l,f,y)},b}($);g.UnionLayoutDiscriminator=ie;var oe=function(w){z(b,w);function b(l,f,y){var F=this,D=l instanceof k||l instanceof U,_;if(D)_=new ie(new O(l));else if(l instanceof h&&l.isCount())_=new ie(l);else if(l instanceof $)_=l;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(f===void 0&&(f=null),!(f===null||f instanceof N))throw new TypeError("defaultLayout must be null or a Layout");if(f!==null){if(0>f.span)throw new Error("defaultLayout must have constant span");f.property===void 0&&(f=f.replicate("content"))}var _e=-1;f&&(_e=f.span,0<=_e&&D&&(_e+=_.layout.span)),F=w.call(this,_e,y)||this,F.discriminator=_,F.usesPrefixDiscriminator=D,F.defaultLayout=f,F.registry={};var be=F.defaultGetSourceVariant.bind(F);return F.getSourceVariant=function(Ne){return be(Ne)},F.configGetSourceVariant=function(Ne){be=Ne.bind(this)},F}return b.prototype.getSpan=function(l,f){if(0<=this.span)return this.span;f===void 0&&(f=0);var y=this.getVariant(l,f);if(!y)throw new Error("unable to determine span for unrecognized variant");return y.getSpan(l,f)},b.prototype.defaultGetSourceVariant=function(l){if(Object.prototype.hasOwnProperty.call(l,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(l,this.defaultLayout.property))return;var f=this.registry[l[this.discriminator.property]];if(f&&(!f.layout||f.property&&Object.prototype.hasOwnProperty.call(l,f.property)))return f}else for(var y in this.registry){var f=this.registry[y];if(f.property&&Object.prototype.hasOwnProperty.call(l,f.property))return f}throw new Error("unable to infer src variant")},b.prototype.decode=function(l,f){f===void 0&&(f=0);var y,F=this.discriminator,D=F.decode(l,f),_=this.registry[D];if(_===void 0){var _e=this.defaultLayout,be=0;this.usesPrefixDiscriminator&&(be=F.layout.span),y=this.makeDestinationObject(),y[F.property]=D,y[_e.property]=_e.decode(l,f+be)}else y=_.decode(l,f);return y},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=this.getSourceVariant(l);if(F===void 0){var D=this.discriminator,_=this.defaultLayout,_e=0;return this.usesPrefixDiscriminator&&(_e=D.layout.span),D.encode(l[D.property],f,y),_e+_.encode(l[_.property],f,y+_e)}return F.encode(l,f,y)},b.prototype.addVariant=function(l,f,y){var F=new ge(this,l,f,y);return this.registry[l]=F,F},b.prototype.getVariant=function(l,f){var y;return l instanceof Uint8Array?(f===void 0&&(f=0),y=this.discriminator.decode(l,f)):y=l,this.registry[y]},b}(N);g.Union=oe;var ge=function(w){z(b,w);function b(l,f,y,F){var D=this;if(!(l instanceof oe))throw new TypeError("union must be a Union");if(!Number.isInteger(f)||0>f)throw new TypeError("variant must be a (non-negative) integer");if(typeof y=="string"&&F===void 0&&(F=y,y=null),y){if(!(y instanceof N))throw new TypeError("layout must be a Layout");if(l.defaultLayout!==null&&0<=y.span&&y.span>l.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof F!="string")throw new TypeError("variant must have a String property")}var _=l.span;return 0>l.span&&(_=y?y.span:0,0<=_&&l.usesPrefixDiscriminator&&(_+=l.discriminator.layout.span)),D=w.call(this,_,F)||this,D.union=l,D.variant=f,D.layout=y||null,D}return b.prototype.getSpan=function(l,f){if(0<=this.span)return this.span;f===void 0&&(f=0);var y=0;this.union.usesPrefixDiscriminator&&(y=this.union.discriminator.layout.span);var F=0;return this.layout&&(F=this.layout.getSpan(l,f+y)),y+F},b.prototype.decode=function(l,f){var y=this.makeDestinationObject();if(f===void 0&&(f=0),this!==this.union.getVariant(l,f))throw new Error("variant mismatch");var F=0;this.union.usesPrefixDiscriminator&&(F=this.union.discriminator.layout.span);var D=this.property;return this.layout?y[D]=this.layout.decode(l,f+F):D?y[D]=!0:this.union.usesPrefixDiscriminator&&(y[this.union.discriminator.property]=this.variant),y},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=0;this.union.usesPrefixDiscriminator&&(F=this.union.discriminator.layout.span);var D=this.property;if(this.layout&&!Object.prototype.hasOwnProperty.call(l,D))throw new TypeError("variant lacks property "+D);this.union.discriminator.encode(this.variant,f,y);var _=F;if(this.layout&&(this.layout.encode(l[D],f,y+F),_+=this.layout.getSpan(f,y+F),0<=this.union.span&&_>this.union.span))throw new Error("encoded variant overruns containing union");return _},b.prototype.fromArray=function(l){if(this.layout)return this.layout.fromArray(l)},b}(N);g.VariantLayout=ge;function me(w){return 0>w&&(w+=4294967296),w}var Oe=function(w){z(b,w);function b(l,f,y){var F=this;if(!(l instanceof k||l instanceof U))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof f=="string"&&y===void 0&&(y=f,f=!1),4<l.span)throw new RangeError("word cannot exceed 32 bits");F=w.call(this,l.span,y)||this,F.word=l,F.msb=!!f,F.fields=[];var D=0;return F._packedSetValue=function(_){return D=me(_),this},F._packedGetValue=function(){return D},F}return b.prototype.decode=function(l,f){var y=this.makeDestinationObject();f===void 0&&(f=0);var F=this.word.decode(l,f);this._packedSetValue(F);for(var D=0,_=this.fields;D<_.length;D++){var _e=_[D];_e.property!==void 0&&(y[_e.property]=_e.decode(F))}return y},b.prototype.encode=function(l,f,y){y===void 0&&(y=0);var F=this.word.decode(f,y);this._packedSetValue(F);for(var D=0,_=this.fields;D<_.length;D++){var _e=_[D];if(_e.property!==void 0){var be=l[_e.property];be!==void 0&&_e.encode(be)}}return this.word.encode(this._packedGetValue(),f,y)},b.prototype.addField=function(l,f){var y=new Ve(this,l,f);return this.fields.push(y),y},b.prototype.addBoolean=function(l){var f=new le(this,l);return this.fields.push(f),f},b.prototype.fieldFor=function(l){if(typeof l!="string")throw new TypeError("property must be string");for(var f=0,y=this.fields;f<y.length;f++){var F=y[f];if(F.property===l)return F}},b}(N);g.BitStructure=Oe;var Ve=function(){function w(b,l,f){if(!(b instanceof Oe))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(l)||0>=l)throw new TypeError("bits must be positive integer");var y=8*b.span,F=b.fields.reduce(function(D,_){return D+_.bits},0);if(l+F>y)throw new Error("bits too long for span remainder ("+(y-F)+" of "+y+" remain)");this.container=b,this.bits=l,this.valueMask=(1<<l)-1,l===32&&(this.valueMask=4294967295),this.start=F,this.container.msb&&(this.start=y-F-l),this.wordMask=me(this.valueMask<<this.start),this.property=f}return w.prototype.decode=function(b,l){var f=this.container._packedGetValue(),y=me(f&this.wordMask),F=y>>>this.start;return F},w.prototype.encode=function(b){if(!Number.isInteger(b)||b!==me(b&this.valueMask))throw new TypeError(I("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var l=this.container._packedGetValue(),f=me(b<<this.start);this.container._packedSetValue(me(l&~this.wordMask)|f)},w}();g.BitField=Ve;var le=function(w){z(b,w);function b(l,f){return w.call(this,l,1,f)||this}return b.prototype.decode=function(l,f){return!!Ve.prototype.decode.call(this,l,f)},b.prototype.encode=function(l){return typeof l=="boolean"&&(l=+l),Ve.prototype.encode.call(this,l)},b}(Ve);g.Boolean=le;var Je=function(w){z(b,w);function b(l,f){var y=this;if(!(l instanceof h&&l.isCount()||Number.isInteger(l)&&0<=l))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var F=-1;return l instanceof h||(F=l),y=w.call(this,F,f)||this,y.length=l,y}return b.prototype.getSpan=function(l,f){var y=this.span;return 0>y&&(y=this.length.decode(l,f)),y},b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=this.span;return 0>y&&(y=this.length.decode(l,f)),K(l).slice(f,f+y)},b.prototype.encode=function(l,f,y){var F=this.length;if(this.length instanceof h&&(F=l.length),!(l instanceof Uint8Array&&F===l.length))throw new TypeError(I("Blob.encode",this)+" requires (length "+F+") Uint8Array as src");if(y+F>f.length)throw new RangeError("encoding overruns Uint8Array");var D=K(l);return K(f).write(D.toString("hex"),y,F,"hex"),this.length instanceof h&&this.length.encode(F,f,y),F},b}(N);g.Blob=Je;var Mt=function(w){z(b,w);function b(l){return w.call(this,-1,l)||this}return b.prototype.getSpan=function(l,f){B(l),f===void 0&&(f=0);for(var y=f;y<l.length&&l[y]!==0;)y+=1;return 1+y-f},b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=this.getSpan(l,f);return K(l).slice(f,f+y-1).toString("utf-8")},b.prototype.encode=function(l,f,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var F=J.Buffer.from(l,"utf8"),D=F.length;if(y+D>f.length)throw new RangeError("encoding overruns Buffer");var _=K(f);return F.copy(_,y),_[y+D]=0,D+1},b}(N);g.CString=Mt;var De=function(w){z(b,w);function b(l,f){var y=this;if(typeof l=="string"&&f===void 0&&(f=l,l=void 0),l===void 0)l=-1;else if(!Number.isInteger(l))throw new TypeError("maxSpan must be an integer");return y=w.call(this,-1,f)||this,y.maxSpan=l,y}return b.prototype.getSpan=function(l,f){return B(l),f===void 0&&(f=0),l.length-f},b.prototype.decode=function(l,f){f===void 0&&(f=0);var y=this.getSpan(l,f);if(0<=this.maxSpan&&this.maxSpan<y)throw new RangeError("text length exceeds maxSpan");return K(l).slice(f,f+y).toString("utf-8")},b.prototype.encode=function(l,f,y){y===void 0&&(y=0),typeof l!="string"&&(l=l.toString());var F=J.Buffer.from(l,"utf8"),D=F.length;if(0<=this.maxSpan&&this.maxSpan<D)throw new RangeError("text length exceeds maxSpan");if(y+D>f.length)throw new RangeError("encoding overruns Buffer");return F.copy(K(f),y),D},b}(N);g.UTF8=De;var $e=function(w){z(b,w);function b(l,f){var y=w.call(this,0,f)||this;return y.value=l,y}return b.prototype.decode=function(l,f){return this.value},b.prototype.encode=function(l,f,y){return 0},b}(N);g.Constant=$e,g.greedy=function(w,b){return new u(w,b)},g.offset=function(w,b,l){return new O(w,b,l)},g.u8=function(w){return new k(1,w)},g.u16=function(w){return new k(2,w)},g.u24=function(w){return new k(3,w)},g.u32=function(w){return new k(4,w)},g.u40=function(w){return new k(5,w)},g.u48=function(w){return new k(6,w)},g.nu64=function(w){return new V(w)},g.u16be=function(w){return new U(2,w)},g.u24be=function(w){return new U(3,w)},g.u32be=function(w){return new U(4,w)},g.u40be=function(w){return new U(5,w)},g.u48be=function(w){return new U(6,w)},g.nu64be=function(w){return new H(w)},g.s8=function(w){return new T(1,w)},g.s16=function(w){return new T(2,w)},g.s24=function(w){return new T(3,w)},g.s32=function(w){return new T(4,w)},g.s40=function(w){return new T(5,w)},g.s48=function(w){return new T(6,w)},g.ns64=function(w){return new ne(w)},g.s16be=function(w){return new m(2,w)},g.s24be=function(w){return new m(3,w)},g.s32be=function(w){return new m(4,w)},g.s40be=function(w){return new m(5,w)},g.s48be=function(w){return new m(6,w)},g.ns64be=function(w){return new x(w)},g.f32=function(w){return new fe(w)},g.f32be=function(w){return new q(w)},g.f64=function(w){return new ce(w)},g.f64be=function(w){return new re(w)},g.struct=function(w,b,l){return new Y(w,b,l)},g.bits=function(w,b,l){return new Oe(w,b,l)},g.seq=function(w,b,l){return new ae(w,b,l)},g.union=function(w,b,l){return new oe(w,b,l)},g.unionLayoutDiscriminator=function(w,b){return new ie(w,b)},g.blob=function(w,b){return new Je(w,b)},g.cstr=function(w){return new Mt(w)},g.utf8=function(w,b){return new De(w,b)},g.constant=function(w,b){return new $e(w,b)}},75885:function(Ee,g,L){"use strict";L.r(g),L.d(g,{Account:function(){return Ls},Authorized:function(){return Gn},BLOCKHASH_CACHE_TIMEOUT_MS:function(){return Un},BPF_LOADER_DEPRECATED_PROGRAM_ID:function(){return Ds},BPF_LOADER_PROGRAM_ID:function(){return Zs},BpfLoader:function(){return Js},Connection:function(){return ca},Ed25519Program:function(){return pr},Enum:function(){return Cs},EpochSchedule:function(){return Pn},FeeCalculatorLayout:function(){return An},Keypair:function(){return Wt},LAMPORTS_PER_SOL:function(){return va},Loader:function(){return It},Lockup:function(){return Xt},MAX_SEED_LENGTH:function(){return kn},Message:function(){return kt},NONCE_ACCOUNT_LENGTH:function(){return Tr},NonceAccount:function(){return fr},PACKET_DATA_SIZE:function(){return Yt},PublicKey:function(){return he},SOLANA_SCHEMA:function(){return Ht},STAKE_CONFIG_ID:function(){return Vn},STAKE_INSTRUCTION_LAYOUTS:function(){return je},SYSTEM_INSTRUCTION_LAYOUTS:function(){return Pe},SYSVAR_CLOCK_PUBKEY:function(){return _t},SYSVAR_EPOCH_SCHEDULE_PUBKEY:function(){return $s},SYSVAR_INSTRUCTIONS_PUBKEY:function(){return js},SYSVAR_RECENT_BLOCKHASHES_PUBKEY:function(){return or},SYSVAR_RENT_PUBKEY:function(){return Zt},SYSVAR_REWARDS_PUBKEY:function(){return Vs},SYSVAR_SLOT_HASHES_PUBKEY:function(){return Gs},SYSVAR_SLOT_HISTORY_PUBKEY:function(){return Hs},SYSVAR_STAKE_HISTORY_PUBKEY:function(){return ar},Secp256k1Program:function(){return Kt},SendTransactionError:function(){return Or},StakeAuthorizationLayout:function(){return fa},StakeInstruction:function(){return ua},StakeProgram:function(){return yr},Struct:function(){return Pr},SystemInstruction:function(){return qs},SystemProgram:function(){return et},Transaction:function(){return Ce},TransactionInstruction:function(){return Ze},VALIDATOR_INFO_KEY:function(){return Yn},VOTE_PROGRAM_ID:function(){return ya},ValidatorInfo:function(){return zr},VoteAccount:function(){return Mr},clusterApiUrl:function(){return Sa},sendAndConfirmRawTransaction:function(){return Ea},sendAndConfirmTransaction:function(){return cr}});var z=L(50780),J=L.n(z),B=L(64285),K=L(13550),N=L.n(K),I=L(77191),E=L.n(I),h=L(25532),u=L(39386);class O extends TypeError{constructor(e,t){let r;const{message:n,...a}=e,{path:d}=e,S=d.length===0?n:"At path: "+d.join(".")+" -- "+n;super(S),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>{var P;return(P=r)!=null?P:r=[e,...t()]}}}function k(i){return U(i)&&typeof i[Symbol.iterator]=="function"}function U(i){return typeof i=="object"&&i!=null}function T(i){if(Object.prototype.toString.call(i)!=="[object Object]")return!1;const e=Object.getPrototypeOf(i);return e===null||e===Object.prototype}function m(i){return typeof i=="string"?JSON.stringify(i):""+i}function C(i){const{done:e,value:t}=i.next();return e?void 0:t}function A(i,e,t,r){if(i===!0)return;i===!1?i={}:typeof i=="string"&&(i={message:i});const{path:n,branch:a}=e,{type:d}=t,{refinement:S,message:P="Expected a value of type `"+d+"`"+(S?" with refinement `"+S+"`":"")+", but received: `"+m(r)+"`"}=i;return{value:r,type:d,refinement:S,key:n[n.length-1],path:n,branch:a,...i,message:P}}function*R(i,e,t,r){k(i)||(i=[i]);for(const n of i){const a=A(n,e,t,r);a&&(yield a)}}function*V(i,e,t={}){const{path:r=[],branch:n=[i],coerce:a=!1,mask:d=!1}=t,S={path:r,branch:n};if(a&&(i=e.coercer(i,S),d&&e.type!=="type"&&U(e.schema)&&U(i)&&!Array.isArray(i)))for(const M in i)e.schema[M]===void 0&&delete i[M];let P=!0;for(const M of e.validator(i,S))P=!1,yield[M,void 0];for(let[M,Z,X]of e.entries(i,S)){const se=V(Z,X,{path:M===void 0?r:[...r,M],branch:M===void 0?n:[...n,Z],coerce:a,mask:d});for(const te of se)te[0]?(P=!1,yield[te[0],void 0]):a&&(Z=te[1],M===void 0?i=Z:i instanceof Map?i.set(M,Z):i instanceof Set?i.add(Z):U(i)&&(i[M]=Z))}if(P)for(const M of e.refiner(i,S))P=!1,yield[M,void 0];P&&(yield[void 0,i])}class H{constructor(e){const{type:t,schema:r,validator:n,refiner:a,coercer:d=P=>P,entries:S=function*(){}}=e;this.type=t,this.schema=r,this.entries=S,this.coercer=d,n?this.validator=(P,M)=>{const Z=n(P,M);return R(Z,M,this,P)}:this.validator=()=>[],a?this.refiner=(P,M)=>{const Z=a(P,M);return R(Z,M,this,P)}:this.refiner=()=>[]}assert(e){return ne(e,this)}create(e){return x(e,this)}is(e){return q(e,this)}mask(e){return fe(e,this)}validate(e,t={}){return ce(e,this,t)}}function ne(i,e){const t=ce(i,e);if(t[0])throw t[0]}function x(i,e){const t=ce(i,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function fe(i,e){const t=ce(i,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function q(i,e){return!ce(i,e)[0]}function ce(i,e,t={}){const r=V(i,e,t),n=C(r);return n[0]?[new O(n[0],function*(){for(const d of r)d[0]&&(yield d[0])}),void 0]:[void 0,n[1]]}function re(...i){const e=i.map(r=>r.schema),t=Object.assign({},...e);return _e(t)}function ae(i,e){return new H({type:i,schema:null,validator:e})}function Y(i,e){return new H({...i,refiner:(t,r)=>t===void 0||i.refiner(t,r),validator(t,r){return t===void 0?!0:(e(t,r),i.validator(t,r))}})}function $(i){return new H({type:"dynamic",schema:null,*entries(e,t){yield*i(e,t).entries(e,t)},validator(e,t){return i(e,t).validator(e,t)},coercer(e,t){return i(e,t).coercer(e,t)}})}function ie(i){let e;return new H({type:"lazy",schema:null,*entries(t,r){var n;(n=e)!=null||(e=i()),yield*e.entries(t,r)},validator(t,r){var n;return(n=e)!=null||(e=i()),e.validator(t,r)},coercer(t,r){var n;return(n=e)!=null||(e=i()),e.coercer(t,r)}})}function oe(i,e){const{schema:t}=i,r={...t};for(const n of e)delete r[n];return _e(r)}function ge(i){const e=i instanceof H?{...i.schema}:{...i};for(const t in e)e[t]=be(e[t]);return _e(e)}function me(i,e){const{schema:t}=i,r={};for(const n of e)r[n]=t[n];return _e(r)}function Oe(i,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),ae(i,e)}function Ve(){return ae("any",()=>!0)}function le(i){return new H({type:"array",schema:i,*entries(e){if(i&&Array.isArray(e))for(const[t,r]of e.entries())yield[t,r,i]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+m(e)}})}function Je(){return ae("boolean",i=>typeof i=="boolean")}function Mt(){return ae("date",i=>i instanceof Date&&!isNaN(i.getTime())||"Expected a valid `Date` object, but received: "+m(i))}function De(i){const e={},t=i.map(r=>m(r)).join();for(const r of i)e[r]=r;return new H({type:"enums",schema:e,validator(r){return i.includes(r)||"Expected one of `"+t+"`, but received: "+m(r)}})}function $e(){return ae("func",i=>typeof i=="function"||"Expected a function, but received: "+m(i))}function w(i){return ae("instance",e=>e instanceof i||"Expected a `"+i.name+"` instance, but received: "+m(e))}function b(){return ae("integer",i=>typeof i=="number"&&!isNaN(i)&&Number.isInteger(i)||"Expected an integer, but received: "+m(i))}function l(i){return new H({type:"intersection",schema:null,*entries(e,t){for(const r of i)yield*r.entries(e,t)},*validator(e,t){for(const r of i)yield*r.validator(e,t)},*refiner(e,t){for(const r of i)yield*r.refiner(e,t)}})}function f(i){const e=m(i),t=typeof i;return new H({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?i:null,validator(r){return r===i||"Expected the literal `"+e+"`, but received: "+m(r)}})}function y(i,e){return new H({type:"map",schema:null,*entries(t){if(i&&e&&t instanceof Map)for(const[r,n]of t.entries())yield[r,r,i],yield[r,n,e]},coercer(t){return t instanceof Map?new Map(t):t},validator(t){return t instanceof Map||"Expected a `Map` object, but received: "+m(t)}})}function F(){return ae("never",()=>!1)}function D(i){return new H({...i,validator:(e,t)=>e===null||i.validator(e,t),refiner:(e,t)=>e===null||i.refiner(e,t)})}function _(){return ae("number",i=>typeof i=="number"&&!isNaN(i)||"Expected a number, but received: "+m(i))}function _e(i){const e=i?Object.keys(i):[],t=F();return new H({type:"object",schema:i||null,*entries(r){if(i&&U(r)){const n=new Set(Object.keys(r));for(const a of e)n.delete(a),yield[a,r[a],i[a]];for(const a of n)yield[a,r[a],t]}},validator(r){return U(r)||"Expected an object, but received: "+m(r)},coercer(r){return U(r)?{...r}:r}})}function be(i){return new H({...i,validator:(e,t)=>e===void 0||i.validator(e,t),refiner:(e,t)=>e===void 0||i.refiner(e,t)})}function Ne(i,e){return new H({type:"record",schema:null,*entries(t){if(U(t))for(const r in t){const n=t[r];yield[r,r,i],yield[r,n,e]}},validator(t){return U(t)||"Expected an object, but received: "+m(t)}})}function qe(){return ae("regexp",i=>i instanceof RegExp)}function $t(i){return new H({type:"set",schema:null,*entries(e){if(i&&e instanceof Set)for(const t of e)yield[t,t,i]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||"Expected a `Set` object, but received: "+m(e)}})}function ue(){return ae("string",i=>typeof i=="string"||"Expected a string, but received: "+m(i))}function Pt(i){const e=F();return new H({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){const r=Math.max(i.length,t.length);for(let n=0;n<r;n++)yield[n,t[n],i[n]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+m(t)}})}function Q(i){const e=Object.keys(i);return new H({type:"type",schema:i,*entries(t){if(U(t))for(const r of e)yield[r,t[r],i[r]]},validator(t){return U(t)||"Expected an object, but received: "+m(t)}})}function Xe(i){const e=i.map(t=>t.type).join(" | ");return new H({type:"union",schema:null,validator(t,r){const n=[];for(const a of i){const[...d]=V(t,a,r),[S]=d;if(S[0])for(const[P]of d)P&&n.push(P);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+m(t),...n]}})}function yt(){return ae("unknown",()=>!0)}function it(i,e,t){return new H({...i,coercer:(r,n)=>q(r,e)?i.coercer(t(r,n),n):i.coercer(r,n)})}function st(i,e,t={}){return it(i,yt(),r=>{const n=typeof e=="function"?e():e;if(r===void 0)return n;if(!t.strict&&T(r)&&T(n)){const a={...r};let d=!1;for(const S in n)a[S]===void 0&&(a[S]=n[S],d=!0);if(d)return a}return r})}function er(i){return it(i,ue(),e=>e.trim())}function jr(i){const e="Expected an empty "+i.type;return o(i,"empty",t=>{if(t instanceof Map||t instanceof Set){const{size:r}=t;return r===0||e+" but received one with a size of `"+r+"`"}else{const{length:r}=t;return r===0||e+" but received one with a length of `"+r+"`"}})}function gt(i,e,t={}){const{exclusive:r}=t;return o(i,"max",n=>r?n<e:n<=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function Vr(i,e,t={}){const{exclusive:r}=t;return o(i,"min",n=>r?n>e:n>=e||"Expected a "+i.type+" greater than "+(r?"":"or equal to ")+e+" but received `"+n+"`")}function c(i,e){return o(i,"pattern",t=>e.test(t)||"Expected a "+i.type+" matching `/"+e.source+'/` but received "'+t+'"')}function s(i,e,t=e){const r="Expected a "+i.type,n=e===t?"of `"+e+"`":"between `"+e+"` and `"+t+"`";return o(i,"size",a=>{if(typeof a=="number"||a instanceof Date)return e<=a&&a<=t||r+" "+n+" but received `"+a+"`";if(a instanceof Map||a instanceof Set){const{size:d}=a;return e<=d&&d<=t||r+" with a size "+n+" but received one with a size of `"+d+"`"}else{const{length:d}=a;return e<=d&&d<=t||r+" with a length "+n+" but received one with a length of `"+d+"`"}})}function o(i,e,t){return new H({...i,*refiner(r,n){yield*i.refiner(r,n);const a=t(r,n),d=R(a,n,i,r);for(const S of d)yield{...S,refinement:e}}})}var p=L(83937),v=L(31198),W=L.n(v),G=L(75134),Se=L.n(G),Ue=L(91094),Re=L.n(Ue);const pe=i=>B.lW.isBuffer(i)?i:i instanceof Uint8Array?B.lW.from(i.buffer,i.byteOffset,i.byteLength):B.lW.from(i);var Ae=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof L.g<"u"?L.g:typeof self<"u"?self:{};function Jn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Gr={},ke={},jt=Hr;function Hr(i,e){if(!i)throw new Error(e||"Assertion failed")}Hr.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Er={exports:{}};typeof Object.create=="function"?Er.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Er.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var Xn=jt,Qn=Er.exports;ke.inherits=Qn;function ei(i,e){return(i.charCodeAt(e)&64512)!==55296||e<0||e+1>=i.length?!1:(i.charCodeAt(e+1)&64512)===56320}function ti(i,e){if(Array.isArray(i))return i.slice();if(!i)return[];var t=[];if(typeof i=="string")if(e){if(e==="hex")for(i=i.replace(/[^a-z0-9]+/ig,""),i.length%2!==0&&(i="0"+i),n=0;n<i.length;n+=2)t.push(parseInt(i[n]+i[n+1],16))}else for(var r=0,n=0;n<i.length;n++){var a=i.charCodeAt(n);a<128?t[r++]=a:a<2048?(t[r++]=a>>6|192,t[r++]=a&63|128):ei(i,n)?(a=65536+((a&1023)<<10)+(i.charCodeAt(++n)&1023),t[r++]=a>>18|240,t[r++]=a>>12&63|128,t[r++]=a>>6&63|128,t[r++]=a&63|128):(t[r++]=a>>12|224,t[r++]=a>>6&63|128,t[r++]=a&63|128)}else for(n=0;n<i.length;n++)t[n]=i[n]|0;return t}ke.toArray=ti;function ri(i){for(var e="",t=0;t<i.length;t++)e+=Yr(i[t].toString(16));return e}ke.toHex=ri;function qr(i){var e=i>>>24|i>>>8&65280|i<<8&16711680|(i&255)<<24;return e>>>0}ke.htonl=qr;function ni(i,e){for(var t="",r=0;r<i.length;r++){var n=i[r];e==="little"&&(n=qr(n)),t+=Zr(n.toString(16))}return t}ke.toHex32=ni;function Yr(i){return i.length===1?"0"+i:i}ke.zero2=Yr;function Zr(i){return i.length===7?"0"+i:i.length===6?"00"+i:i.length===5?"000"+i:i.length===4?"0000"+i:i.length===3?"00000"+i:i.length===2?"000000"+i:i.length===1?"0000000"+i:i}ke.zero8=Zr;function ii(i,e,t,r){var n=t-e;Xn(n%4===0);for(var a=new Array(n/4),d=0,S=e;d<a.length;d++,S+=4){var P;r==="big"?P=i[S]<<24|i[S+1]<<16|i[S+2]<<8|i[S+3]:P=i[S+3]<<24|i[S+2]<<16|i[S+1]<<8|i[S],a[d]=P>>>0}return a}ke.join32=ii;function si(i,e){for(var t=new Array(i.length*4),r=0,n=0;r<i.length;r++,n+=4){var a=i[r];e==="big"?(t[n]=a>>>24,t[n+1]=a>>>16&255,t[n+2]=a>>>8&255,t[n+3]=a&255):(t[n+3]=a>>>24,t[n+2]=a>>>16&255,t[n+1]=a>>>8&255,t[n]=a&255)}return t}ke.split32=si;function oi(i,e){return i>>>e|i<<32-e}ke.rotr32=oi;function ai(i,e){return i<<e|i>>>32-e}ke.rotl32=ai;function ci(i,e){return i+e>>>0}ke.sum32=ci;function ui(i,e,t){return i+e+t>>>0}ke.sum32_3=ui;function fi(i,e,t,r){return i+e+t+r>>>0}ke.sum32_4=fi;function li(i,e,t,r,n){return i+e+t+r+n>>>0}ke.sum32_5=li;function hi(i,e,t,r){var n=i[e],a=i[e+1],d=r+a>>>0,S=(d<r?1:0)+t+n;i[e]=S>>>0,i[e+1]=d}ke.sum64=hi;function di(i,e,t,r){var n=e+r>>>0,a=(n<e?1:0)+i+t;return a>>>0}ke.sum64_hi=di;function pi(i,e,t,r){var n=e+r;return n>>>0}ke.sum64_lo=pi;function yi(i,e,t,r,n,a,d,S){var P=0,M=e;M=M+r>>>0,P+=M<e?1:0,M=M+a>>>0,P+=M<a?1:0,M=M+S>>>0,P+=M<S?1:0;var Z=i+t+n+d+P;return Z>>>0}ke.sum64_4_hi=yi;function gi(i,e,t,r,n,a,d,S){var P=e+r+a+S;return P>>>0}ke.sum64_4_lo=gi;function bi(i,e,t,r,n,a,d,S,P,M){var Z=0,X=e;X=X+r>>>0,Z+=X<e?1:0,X=X+a>>>0,Z+=X<a?1:0,X=X+S>>>0,Z+=X<S?1:0,X=X+M>>>0,Z+=X<M?1:0;var se=i+t+n+d+P+Z;return se>>>0}ke.sum64_5_hi=bi;function mi(i,e,t,r,n,a,d,S,P,M){var Z=e+r+a+S+M;return Z>>>0}ke.sum64_5_lo=mi;function wi(i,e,t){var r=e<<32-t|i>>>t;return r>>>0}ke.rotr64_hi=wi;function Ei(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.rotr64_lo=Ei;function Si(i,e,t){return i>>>t}ke.shr64_hi=Si;function vi(i,e,t){var r=i<<32-t|e>>>t;return r>>>0}ke.shr64_lo=vi;var Tt={},Jr=ke,ki=jt;function tr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Tt.BlockHash=tr,tr.prototype.update=function(e,t){if(e=Jr.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Jr.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},tr.prototype.digest=function(e){return this.update(this._pad()),ki(this.pending===null),this._digest(e)},tr.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var a=1;a<r;a++)n[a]=0;if(e<<=3,this.endian==="big"){for(var d=8;d<this.padLength;d++)n[a++]=0;n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=e>>>24&255,n[a++]=e>>>16&255,n[a++]=e>>>8&255,n[a++]=e&255}else for(n[a++]=e&255,n[a++]=e>>>8&255,n[a++]=e>>>16&255,n[a++]=e>>>24&255,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,d=8;d<this.padLength;d++)n[a++]=0;return n};var Ut={},ct={},_i=ke,ut=_i.rotr32;function Ii(i,e,t,r){if(i===0)return Xr(e,t,r);if(i===1||i===3)return en(e,t,r);if(i===2)return Qr(e,t,r)}ct.ft_1=Ii;function Xr(i,e,t){return i&e^~i&t}ct.ch32=Xr;function Qr(i,e,t){return i&e^i&t^e&t}ct.maj32=Qr;function en(i,e,t){return i^e^t}ct.p32=en;function xi(i){return ut(i,2)^ut(i,13)^ut(i,22)}ct.s0_256=xi;function Ai(i){return ut(i,6)^ut(i,11)^ut(i,25)}ct.s1_256=Ai;function Ri(i){return ut(i,7)^ut(i,18)^i>>>3}ct.g0_256=Ri;function Bi(i){return ut(i,17)^ut(i,19)^i>>>10}ct.g1_256=Bi;var Ct=ke,Pi=Tt,Ti=ct,Sr=Ct.rotl32,Vt=Ct.sum32,Ui=Ct.sum32_5,Ci=Ti.ft_1,tn=Pi.BlockHash,Oi=[1518500249,1859775393,2400959708,3395469782];function ft(){if(!(this instanceof ft))return new ft;tn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ct.inherits(ft,tn);var Ni=ft;ft.blockSize=512,ft.outSize=160,ft.hmacStrength=80,ft.padLength=64,ft.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Sr(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var a=this.h[0],d=this.h[1],S=this.h[2],P=this.h[3],M=this.h[4];for(n=0;n<r.length;n++){var Z=~~(n/20),X=Ui(Sr(a,5),Ci(Z,d,S,P),M,r[n],Oi[Z]);M=P,P=S,S=Sr(d,30),d=a,a=X}this.h[0]=Vt(this.h[0],a),this.h[1]=Vt(this.h[1],d),this.h[2]=Vt(this.h[2],S),this.h[3]=Vt(this.h[3],P),this.h[4]=Vt(this.h[4],M)},ft.prototype._digest=function(e){return e==="hex"?Ct.toHex32(this.h,"big"):Ct.split32(this.h,"big")};var Ot=ke,Fi=Tt,Nt=ct,Li=jt,ot=Ot.sum32,Di=Ot.sum32_4,Wi=Ot.sum32_5,Ki=Nt.ch32,zi=Nt.maj32,Mi=Nt.s0_256,$i=Nt.s1_256,ji=Nt.g0_256,Vi=Nt.g1_256,rn=Fi.BlockHash,Gi=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function lt(){if(!(this instanceof lt))return new lt;rn.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Gi,this.W=new Array(64)}Ot.inherits(lt,rn);var nn=lt;lt.blockSize=512,lt.outSize=256,lt.hmacStrength=192,lt.padLength=64,lt.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Di(Vi(r[n-2]),r[n-7],ji(r[n-15]),r[n-16]);var a=this.h[0],d=this.h[1],S=this.h[2],P=this.h[3],M=this.h[4],Z=this.h[5],X=this.h[6],se=this.h[7];for(Li(this.k.length===r.length),n=0;n<r.length;n++){var te=Wi(se,$i(M),Ki(M,Z,X),this.k[n],r[n]),de=ot(Mi(a),zi(a,d,S));se=X,X=Z,Z=M,M=ot(P,te),P=S,S=d,d=a,a=ot(te,de)}this.h[0]=ot(this.h[0],a),this.h[1]=ot(this.h[1],d),this.h[2]=ot(this.h[2],S),this.h[3]=ot(this.h[3],P),this.h[4]=ot(this.h[4],M),this.h[5]=ot(this.h[5],Z),this.h[6]=ot(this.h[6],X),this.h[7]=ot(this.h[7],se)},lt.prototype._digest=function(e){return e==="hex"?Ot.toHex32(this.h,"big"):Ot.split32(this.h,"big")};var vr=ke,sn=nn;function bt(){if(!(this instanceof bt))return new bt;sn.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}vr.inherits(bt,sn);var Hi=bt;bt.blockSize=512,bt.outSize=224,bt.hmacStrength=192,bt.padLength=64,bt.prototype._digest=function(e){return e==="hex"?vr.toHex32(this.h.slice(0,7),"big"):vr.split32(this.h.slice(0,7),"big")};var Qe=ke,qi=Tt,Yi=jt,ht=Qe.rotr64_hi,dt=Qe.rotr64_lo,on=Qe.shr64_hi,an=Qe.shr64_lo,Et=Qe.sum64,kr=Qe.sum64_hi,_r=Qe.sum64_lo,Zi=Qe.sum64_4_hi,Ji=Qe.sum64_4_lo,Xi=Qe.sum64_5_hi,Qi=Qe.sum64_5_lo,cn=qi.BlockHash,es=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function at(){if(!(this instanceof at))return new at;cn.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=es,this.W=new Array(160)}Qe.inherits(at,cn);var un=at;at.blockSize=1024,at.outSize=512,at.hmacStrength=192,at.padLength=128,at.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var a=ls(r[n-4],r[n-3]),d=hs(r[n-4],r[n-3]),S=r[n-14],P=r[n-13],M=us(r[n-30],r[n-29]),Z=fs(r[n-30],r[n-29]),X=r[n-32],se=r[n-31];r[n]=Zi(a,d,S,P,M,Z,X,se),r[n+1]=Ji(a,d,S,P,M,Z,X,se)}},at.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],a=this.h[1],d=this.h[2],S=this.h[3],P=this.h[4],M=this.h[5],Z=this.h[6],X=this.h[7],se=this.h[8],te=this.h[9],de=this.h[10],ye=this.h[11],Ie=this.h[12],Le=this.h[13],tt=this.h[14],At=this.h[15];Yi(this.k.length===r.length);for(var wt=0;wt<r.length;wt+=2){var St=tt,Rt=At,Bt=as(se,te),rt=cs(se,te),gr=ts(se,te,de,ye,Ie),br=rs(se,te,de,ye,Ie,Le),nt=this.k[wt],mr=this.k[wt+1],zt=r[wt],j=r[wt+1],ee=Xi(St,Rt,Bt,rt,gr,br,nt,mr,zt,j),we=Qi(St,Rt,Bt,rt,gr,br,nt,mr,zt,j);St=ss(n,a),Rt=os(n,a),Bt=ns(n,a,d,S,P),rt=is(n,a,d,S,P,M);var Me=kr(St,Rt,Bt,rt),ze=_r(St,Rt,Bt,rt);tt=Ie,At=Le,Ie=de,Le=ye,de=se,ye=te,se=kr(Z,X,ee,we),te=_r(X,X,ee,we),Z=P,X=M,P=d,M=S,d=n,S=a,n=kr(ee,we,Me,ze),a=_r(ee,we,Me,ze)}Et(this.h,0,n,a),Et(this.h,2,d,S),Et(this.h,4,P,M),Et(this.h,6,Z,X),Et(this.h,8,se,te),Et(this.h,10,de,ye),Et(this.h,12,Ie,Le),Et(this.h,14,tt,At)},at.prototype._digest=function(e){return e==="hex"?Qe.toHex32(this.h,"big"):Qe.split32(this.h,"big")};function ts(i,e,t,r,n){var a=i&t^~i&n;return a<0&&(a+=4294967296),a}function rs(i,e,t,r,n,a){var d=e&r^~e&a;return d<0&&(d+=4294967296),d}function ns(i,e,t,r,n){var a=i&t^i&n^t&n;return a<0&&(a+=4294967296),a}function is(i,e,t,r,n,a){var d=e&r^e&a^r&a;return d<0&&(d+=4294967296),d}function ss(i,e){var t=ht(i,e,28),r=ht(e,i,2),n=ht(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function os(i,e){var t=dt(i,e,28),r=dt(e,i,2),n=dt(e,i,7),a=t^r^n;return a<0&&(a+=4294967296),a}function as(i,e){var t=ht(i,e,14),r=ht(i,e,18),n=ht(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function cs(i,e){var t=dt(i,e,14),r=dt(i,e,18),n=dt(e,i,9),a=t^r^n;return a<0&&(a+=4294967296),a}function us(i,e){var t=ht(i,e,1),r=ht(i,e,8),n=on(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function fs(i,e){var t=dt(i,e,1),r=dt(i,e,8),n=an(i,e,7),a=t^r^n;return a<0&&(a+=4294967296),a}function ls(i,e){var t=ht(i,e,19),r=ht(e,i,29),n=on(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}function hs(i,e){var t=dt(i,e,19),r=dt(e,i,29),n=an(i,e,6),a=t^r^n;return a<0&&(a+=4294967296),a}var Ir=ke,fn=un;function mt(){if(!(this instanceof mt))return new mt;fn.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ir.inherits(mt,fn);var ds=mt;mt.blockSize=1024,mt.outSize=384,mt.hmacStrength=192,mt.padLength=128,mt.prototype._digest=function(e){return e==="hex"?Ir.toHex32(this.h.slice(0,12),"big"):Ir.split32(this.h.slice(0,12),"big")},Ut.sha1=Ni,Ut.sha224=Hi,Ut.sha256=nn,Ut.sha384=ds,Ut.sha512=un;var ln={},vt=ke,ps=Tt,rr=vt.rotl32,hn=vt.sum32,Gt=vt.sum32_3,dn=vt.sum32_4,pn=ps.BlockHash;function pt(){if(!(this instanceof pt))return new pt;pn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}vt.inherits(pt,pn),ln.ripemd160=pt,pt.blockSize=512,pt.outSize=160,pt.hmacStrength=192,pt.padLength=64,pt.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],a=this.h[2],d=this.h[3],S=this.h[4],P=r,M=n,Z=a,X=d,se=S,te=0;te<80;te++){var de=hn(rr(dn(r,yn(te,n,a,d),e[bs[te]+t],ys(te)),ws[te]),S);r=S,S=d,d=rr(a,10),a=n,n=de,de=hn(rr(dn(P,yn(79-te,M,Z,X),e[ms[te]+t],gs(te)),Es[te]),se),P=se,se=X,X=rr(Z,10),Z=M,M=de}de=Gt(this.h[1],a,X),this.h[1]=Gt(this.h[2],d,se),this.h[2]=Gt(this.h[3],S,P),this.h[3]=Gt(this.h[4],r,M),this.h[4]=Gt(this.h[0],n,Z),this.h[0]=de},pt.prototype._digest=function(e){return e==="hex"?vt.toHex32(this.h,"little"):vt.split32(this.h,"little")};function yn(i,e,t,r){return i<=15?e^t^r:i<=31?e&t|~e&r:i<=47?(e|~t)^r:i<=63?e&r|t&~r:e^(t|~r)}function ys(i){return i<=15?0:i<=31?1518500249:i<=47?1859775393:i<=63?2400959708:2840853838}function gs(i){return i<=15?1352829926:i<=31?1548603684:i<=47?1836072691:i<=63?2053994217:0}var bs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ms=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ws=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Es=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Ss=ke,vs=jt;function Ft(i,e,t){if(!(this instanceof Ft))return new Ft(i,e,t);this.Hash=i,this.blockSize=i.blockSize/8,this.outSize=i.outSize/8,this.inner=null,this.outer=null,this._init(Ss.toArray(e,t))}var ks=Ft;Ft.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),vs(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},Ft.prototype.update=function(e,t){return this.inner.update(e,t),this},Ft.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(i){var e=i;e.utils=ke,e.common=Tt,e.sha=Ut,e.ripemd=ln,e.hmac=ks,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Gr);var _s=Gr;const Is="logger/5.5.0";let gn=!1,bn=!1;const nr={debug:1,default:2,info:2,warning:3,error:4,off:5};let mn=nr.default,xr=null;function xs(){try{const i=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{i.push(e)}}),i.length)throw new Error("missing "+i.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(i){return i.message}return null}const wn=xs();var Ar;(function(i){i.DEBUG="DEBUG",i.INFO="INFO",i.WARNING="WARNING",i.ERROR="ERROR",i.OFF="OFF"})(Ar||(Ar={}));var Rr;(function(i){i.UNKNOWN_ERROR="UNKNOWN_ERROR",i.NOT_IMPLEMENTED="NOT_IMPLEMENTED",i.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",i.NETWORK_ERROR="NETWORK_ERROR",i.SERVER_ERROR="SERVER_ERROR",i.TIMEOUT="TIMEOUT",i.BUFFER_OVERRUN="BUFFER_OVERRUN",i.NUMERIC_FAULT="NUMERIC_FAULT",i.MISSING_NEW="MISSING_NEW",i.INVALID_ARGUMENT="INVALID_ARGUMENT",i.MISSING_ARGUMENT="MISSING_ARGUMENT",i.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",i.CALL_EXCEPTION="CALL_EXCEPTION",i.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",i.NONCE_EXPIRED="NONCE_EXPIRED",i.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",i.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",i.TRANSACTION_REPLACED="TRANSACTION_REPLACED"})(Rr||(Rr={}));const En="0123456789abcdef";class Fe{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();nr[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(mn>nr[r])&&console.log.apply(console,t)}debug(...e){this._log(Fe.levels.DEBUG,e)}info(...e){this._log(Fe.levels.INFO,e)}warn(...e){this._log(Fe.levels.WARNING,e)}makeError(e,t,r){if(bn)return this.makeError("censored error",t,{});t||(t=Fe.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach(S=>{const P=r[S];try{if(P instanceof Uint8Array){let M="";for(let Z=0;Z<P.length;Z++)M+=En[P[Z]>>4],M+=En[P[Z]&15];n.push(S+"=Uint8Array(0x"+M+")")}else n.push(S+"="+JSON.stringify(P))}catch{n.push(S+"="+JSON.stringify(r[S].toString()))}}),n.push(`code=${t}`),n.push(`version=${this.version}`);const a=e;n.length&&(e+=" ("+n.join(", ")+")");const d=new Error(e);return d.reason=a,d.code=t,Object.keys(r).forEach(function(S){d[S]=r[S]}),d}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Fe.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){wn&&this.throwError("platform missing String.prototype.normalize",Fe.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:wn})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Fe.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Fe.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",e<t&&this.throwError("missing argument"+r,Fe.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,Fe.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Fe.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Fe.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Fe.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return xr||(xr=new Fe(Is)),xr}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Fe.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),gn){if(!e)return;this.globalLogger().throwError("error censorship permanent",Fe.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}bn=!!e,gn=!!t}static setLogLevel(e){const t=nr[e.toLowerCase()];if(t==null){Fe.globalLogger().warn("invalid log level - "+e);return}mn=t}static from(e){return new Fe(e)}}Fe.errors=Rr,Fe.levels=Ar;const As="bytes/5.5.0",Br=new Fe(As);function Rs(i){return!!i.toHexString}function ir(i){return i.slice||(i.slice=function(){const e=Array.prototype.slice.call(arguments);return ir(new Uint8Array(Array.prototype.slice.apply(i,e)))}),i}function Sn(i){return typeof i=="number"&&i==i&&i%1===0}function Bs(i){if(i==null)return!1;if(i.constructor===Uint8Array)return!0;if(typeof i=="string"||!Sn(i.length)||i.length<0)return!1;for(let e=0;e<i.length;e++){const t=i[e];if(!Sn(t)||t<0||t>=256)return!1}return!0}function Ps(i,e){if(e||(e={}),typeof i=="number"){Br.checkSafeUint53(i,"invalid arrayify value");const t=[];for(;i;)t.unshift(i&255),i=parseInt(String(i/256));return t.length===0&&t.push(0),ir(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof i=="string"&&i.substring(0,2)!=="0x"&&(i="0x"+i),Rs(i)&&(i=i.toHexString()),Ts(i)){let t=i.substring(2);t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":Br.throwArgumentError("hex data is odd-length","value",i));const r=[];for(let n=0;n<t.length;n+=2)r.push(parseInt(t.substring(n,n+2),16));return ir(new Uint8Array(r))}return Bs(i)?ir(new Uint8Array(i)):Br.throwArgumentError("invalid arrayify value","value",i)}function Ts(i,e){return!(typeof i!="string"||!i.match(/^0x[0-9A-Fa-f]*$/)||e&&i.length!==2+2*e)}const Us="sha2/5.5.0";new Fe(Us);function vn(i){return"0x"+_s.sha256().update(Ps(i)).digest("hex")}class Pr{constructor(e){Object.assign(this,e)}encode(){return B.lW.from((0,h.serialize)(Ht,this))}static decode(e){return(0,h.deserialize)(Ht,this,e)}static decodeUnchecked(e){return(0,h.deserializeUnchecked)(Ht,this,e)}}class Cs extends Pr{constructor(e){if(super(e),this.enum="",Object.keys(e).length!==1)throw new Error("Enum can only take single value");Object.keys(e).map(t=>{this.enum=t})}}const Ht=new Map,kn=32;function Os(i){return i._bn!==void 0}class he extends Pr{constructor(e){if(super({}),this._bn=void 0,Os(e))this._bn=e._bn;else{if(typeof e=="string"){const t=E().decode(e);if(t.length!=32)throw new Error("Invalid public key input");this._bn=new(N())(t)}else this._bn=new(N())(e);if(this._bn.byteLength()>32)throw new Error("Invalid public key input")}}equals(e){return this._bn.eq(e._bn)}toBase58(){return E().encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){return this.toBuffer()}toBuffer(){const e=this._bn.toArrayLike(B.lW);if(e.length===32)return e;const t=B.lW.alloc(32);return e.copy(t,32-e.length),t}toString(){return this.toBase58()}static async createWithSeed(e,t,r){const n=B.lW.concat([e.toBuffer(),B.lW.from(t),r.toBuffer()]),a=vn(new Uint8Array(n)).slice(2);return new he(B.lW.from(a,"hex"))}static async createProgramAddress(e,t){let r=B.lW.alloc(0);e.forEach(function(d){if(d.length>kn)throw new TypeError("Max seed length exceeded");r=B.lW.concat([r,pe(d)])}),r=B.lW.concat([r,t.toBuffer(),B.lW.from("ProgramDerivedAddress")]);let n=vn(new Uint8Array(r)).slice(2),a=new(N())(n,16).toArray(void 0,32);if(_n(a))throw new Error("Invalid seeds, address must fall off the curve");return new he(a)}static async findProgramAddress(e,t){let r=255,n;for(;r!=0;){try{const a=e.concat(B.lW.from([r]));n=await this.createProgramAddress(a,t)}catch(a){if(a instanceof TypeError)throw a;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}static isOnCurve(e){return _n(e)==1}}he.default=new he("11111111111111111111111111111111"),Ht.set(he,{kind:"struct",fields:[["_bn","u256"]]});let ve=J().lowlevel;function _n(i){var e=[ve.gf(),ve.gf(),ve.gf(),ve.gf()],t=ve.gf(),r=ve.gf(),n=ve.gf(),a=ve.gf(),d=ve.gf(),S=ve.gf(),P=ve.gf();return ve.set25519(e[2],Ns),ve.unpack25519(e[1],i),ve.S(n,e[1]),ve.M(a,n,ve.D),ve.Z(n,n,e[2]),ve.A(a,e[2],a),ve.S(d,a),ve.S(S,d),ve.M(P,S,d),ve.M(t,P,n),ve.M(t,t,a),ve.pow2523(t,t),ve.M(t,t,n),ve.M(t,t,a),ve.M(t,t,a),ve.M(e[0],t,a),ve.S(r,e[0]),ve.M(r,r,a),In(r,n)&&ve.M(e[0],e[0],Fs),ve.S(r,e[0]),ve.M(r,r,a),In(r,n)?0:1}let Ns=ve.gf([1]),Fs=ve.gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function In(i,e){var t=new Uint8Array(32),r=new Uint8Array(32);return ve.pack25519(t,i),ve.pack25519(r,e),ve.crypto_verify_32(t,0,r,0)}class Ls{constructor(e){this._keypair=void 0,e?this._keypair=J().sign.keyPair.fromSecretKey(pe(e)):this._keypair=J().sign.keyPair()}get publicKey(){return new he(this._keypair.publicKey)}get secretKey(){return pe(this._keypair.secretKey)}}const Ds=new he("BPFLoader1111111111111111111111111111111111"),Te=(i="publicKey")=>u.blob(32,i),Lt=(i="string")=>{const e=u.struct([u.u32("length"),u.u32("lengthPadding"),u.blob(u.offset(u.u32(),-8),"chars")],i),t=e.decode.bind(e),r=e.encode.bind(e);return e.decode=(n,a)=>t(n,a).chars.toString("utf8"),e.encode=(n,a,d)=>{const S={chars:B.lW.from(n,"utf8")};return r(S,a,d)},e.alloc=n=>u.u32().span+u.u32().span+B.lW.from(n,"utf8").length,e},Ws=(i="authorized")=>u.struct([Te("staker"),Te("withdrawer")],i),Ks=(i="lockup")=>u.struct([u.ns64("unixTimestamp"),u.ns64("epoch"),Te("custodian")],i);function zs(i,e){let t=0;return i.layout.fields.forEach(r=>{r.span>=0?t+=r.span:typeof r.alloc=="function"&&(t+=r.alloc(e[r.property]))}),t}function Dt(i){let e=0,t=0;for(;;){let r=i.shift();if(e|=(r&127)<<t*7,t+=1,(r&128)===0)break}return e}function qt(i,e){let t=e;for(;;){let r=t&127;if(t>>=7,t==0){i.push(r);break}else r|=128,i.push(r)}}const sr=32;class kt{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(t=>new he(t)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(t=>this.indexToProgramIds.set(t.programIdIndex,this.accountKeys[t.programIdIndex]))}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){return e<this.header.numRequiredSignatures-this.header.numReadonlySignedAccounts||e>=this.header.numRequiredSignatures&&e<this.accountKeys.length-this.header.numReadonlyUnsignedAccounts}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,t)=>!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];qt(t,e);const r=this.instructions.map(X=>{const{accounts:se,programIdIndex:te}=X,de=E().decode(X.data);let ye=[];qt(ye,se.length);let Ie=[];return qt(Ie,de.length),{programIdIndex:te,keyIndicesCount:B.lW.from(ye),keyIndices:B.lW.from(se),dataLength:B.lW.from(Ie),data:de}});let n=[];qt(n,r.length);let a=B.lW.alloc(Yt);B.lW.from(n).copy(a);let d=n.length;r.forEach(X=>{const te=u.struct([u.u8("programIdIndex"),u.blob(X.keyIndicesCount.length,"keyIndicesCount"),u.seq(u.u8("keyIndex"),X.keyIndices.length,"keyIndices"),u.blob(X.dataLength.length,"dataLength"),u.seq(u.u8("userdatum"),X.data.length,"data")]).encode(X,a,d);d+=te}),a=a.slice(0,d);const S=u.struct([u.blob(1,"numRequiredSignatures"),u.blob(1,"numReadonlySignedAccounts"),u.blob(1,"numReadonlyUnsignedAccounts"),u.blob(t.length,"keyCount"),u.seq(Te("key"),e,"keys"),Te("recentBlockhash")]),P={numRequiredSignatures:B.lW.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:B.lW.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:B.lW.from([this.header.numReadonlyUnsignedAccounts]),keyCount:B.lW.from(t),keys:this.accountKeys.map(X=>pe(X.toBytes())),recentBlockhash:E().decode(this.recentBlockhash)};let M=B.lW.alloc(2048);const Z=S.encode(P,M);return a.copy(M,Z),M.slice(0,Z+a.length)}static from(e){let t=[...e];const r=t.shift(),n=t.shift(),a=t.shift(),d=Dt(t);let S=[];for(let se=0;se<d;se++){const te=t.slice(0,sr);t=t.slice(sr),S.push(E().encode(B.lW.from(te)))}const P=t.slice(0,sr);t=t.slice(sr);const M=Dt(t);let Z=[];for(let se=0;se<M;se++){const te=t.shift(),de=Dt(t),ye=t.slice(0,de);t=t.slice(de);const Ie=Dt(t),Le=t.slice(0,Ie),tt=E().encode(B.lW.from(Le));t=t.slice(Ie),Z.push({programIdIndex:te,accounts:ye,data:tt})}const X={header:{numRequiredSignatures:r,numReadonlySignedAccounts:n,numReadonlyUnsignedAccounts:a},recentBlockhash:E().encode(B.lW.from(P)),accountKeys:S,instructions:Z};return new kt(X)}}function Ge(i,e){if(!i)throw new Error(e||"Assertion failed")}const Ms=B.lW.alloc(64).fill(0),Yt=1280-40-8,xn=64;class Ze{constructor(e){this.keys=void 0,this.programId=void 0,this.data=B.lW.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}}class Ce{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.nonceInfo=void 0,e&&Object.assign(this,e)}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(t=>{"instructions"in t?this.instructions=this.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?this.instructions.push(t):this.instructions.push(new Ze(t))}),this}compileMessage(){const{nonceInfo:e}=this;e&&this.instructions[0]!=e.nonceInstruction&&(this.recentBlockhash=e.nonce,this.instructions.unshift(e.nonceInstruction));const{recentBlockhash:t}=this;if(!t)throw new Error("Transaction recentBlockhash required");this.instructions.length<1&&console.warn("No instructions provided");let r;if(this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let ye=0;ye<this.instructions.length;ye++)if(this.instructions[ye].programId===void 0)throw new Error(`Transaction instruction index ${ye} has undefined program id`);const n=[],a=[];this.instructions.forEach(ye=>{ye.keys.forEach(Le=>{a.push({...Le})});const Ie=ye.programId.toString();n.includes(Ie)||n.push(Ie)}),n.forEach(ye=>{a.push({pubkey:new he(ye),isSigner:!1,isWritable:!1})}),a.sort(function(ye,Ie){const Le=ye.pubkey.toBase58().localeCompare(Ie.pubkey.toBase58()),tt=ye.isSigner===Ie.isSigner?0:ye.isSigner?-1:1,At=ye.isWritable===Ie.isWritable?Le:ye.isWritable?-1:1;return tt||At});const d=[];a.forEach(ye=>{const Ie=ye.pubkey.toString(),Le=d.findIndex(tt=>tt.pubkey.toString()===Ie);Le>-1?d[Le].isWritable=d[Le].isWritable||ye.isWritable:d.push(ye)});const S=d.findIndex(ye=>ye.pubkey.equals(r));if(S>-1){const[ye]=d.splice(S,1);ye.isSigner=!0,ye.isWritable=!0,d.unshift(ye)}else d.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const ye of this.signatures){const Ie=d.findIndex(Le=>Le.pubkey.equals(ye.publicKey));if(Ie>-1)d[Ie].isSigner||(d[Ie].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${ye.publicKey.toString()}`)}let P=0,M=0,Z=0;const X=[],se=[];d.forEach(({pubkey:ye,isSigner:Ie,isWritable:Le})=>{Ie?(X.push(ye.toString()),P+=1,Le||(M+=1)):(se.push(ye.toString()),Le||(Z+=1))});const te=X.concat(se),de=this.instructions.map(ye=>{const{data:Ie,programId:Le}=ye;return{programIdIndex:te.indexOf(Le.toString()),accounts:ye.keys.map(tt=>te.indexOf(tt.pubkey.toString())),data:E().encode(Ie)}});return de.forEach(ye=>{Ge(ye.programIdIndex>=0),ye.accounts.forEach(Ie=>Ge(Ie>=0))}),new kt({header:{numRequiredSignatures:P,numReadonlySignedAccounts:M,numReadonlyUnsignedAccounts:Z},accountKeys:te,recentBlockhash:t,instructions:de})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((n,a)=>t[a].equals(n.publicKey))||(this.signatures=t.map(r=>({signature:null,publicKey:r}))),e}serializeMessage(){return this._compile().serialize()}setSigners(...e){if(e.length===0)throw new Error("No signers");const t=new Set;this.signatures=e.filter(r=>{const n=r.toString();return t.has(n)?!1:(t.add(n),!0)}).map(r=>({signature:null,publicKey:r}))}sign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}this.signatures=r.map(a=>({signature:null,publicKey:a.publicKey}));const n=this._compile();this._partialSign(n,...r),this._verifySignatures(n.serialize(),!0)}partialSign(...e){if(e.length===0)throw new Error("No signers");const t=new Set,r=[];for(const a of e){const d=a.publicKey.toString();t.has(d)||(t.add(d),r.push(a))}const n=this._compile();this._partialSign(n,...r)}_partialSign(e,...t){const r=e.serialize();t.forEach(n=>{const a=J().sign.detached(r,n.secretKey);this._addSignature(n.publicKey,pe(a))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){Ge(t.length===64);const r=this.signatures.findIndex(n=>e.equals(n.publicKey));if(r<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=B.lW.from(t)}verifySignatures(){return this._verifySignatures(this.serializeMessage(),!0)}_verifySignatures(e,t){for(const{signature:r,publicKey:n}of this.signatures)if(r===null){if(t)return!1}else if(!J().sign.detached.verify(e,r,n.toBuffer()))return!1;return!0}serialize(e){const{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r&&!this._verifySignatures(n,t))throw new Error("Signature verification failed");return this._serialize(n)}_serialize(e){const{signatures:t}=this,r=[];qt(r,t.length);const n=r.length+t.length*64+e.length,a=B.lW.alloc(n);return Ge(t.length<256),B.lW.from(r).copy(a,0),t.forEach(({signature:d},S)=>{d!==null&&(Ge(d.length===64,"signature has invalid length"),B.lW.from(d).copy(a,r.length+S*64))}),e.copy(a,r.length+t.length*64),Ge(a.length<=Yt,`Transaction too large: ${a.length} > ${Yt}`),a}get keys(){return Ge(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return Ge(this.instructions.length===1),this.instructions[0].programId}get data(){return Ge(this.instructions.length===1),this.instructions[0].data}static from(e){let t=[...e];const r=Dt(t);let n=[];for(let a=0;a<r;a++){const d=t.slice(0,xn);t=t.slice(xn),n.push(E().encode(B.lW.from(d)))}return Ce.populate(kt.from(t),n)}static populate(e,t=[]){const r=new Ce;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),t.forEach((n,a)=>{const d={signature:n==E().encode(Ms)?null:E().decode(n),publicKey:e.accountKeys[a]};r.signatures.push(d)}),e.instructions.forEach(n=>{const a=n.accounts.map(d=>{const S=e.accountKeys[d];return{pubkey:S,isSigner:r.signatures.some(P=>P.publicKey.toString()===S.toString())||e.isAccountSigner(d),isWritable:e.isAccountWritable(d)}});r.instructions.push(new Ze({keys:a,programId:e.accountKeys[n.programIdIndex],data:E().decode(n.data)}))}),r}}const _t=new he("SysvarC1ock11111111111111111111111111111111"),$s=new he("SysvarEpochSchedu1e111111111111111111111111"),js=new he("Sysvar1nstructions1111111111111111111111111"),or=new he("SysvarRecentB1ockHashes11111111111111111111"),Zt=new he("SysvarRent111111111111111111111111111111111"),Vs=new he("SysvarRewards111111111111111111111111111111"),Gs=new he("SysvarS1otHashes111111111111111111111111111"),Hs=new he("SysvarS1otHistory11111111111111111111111111"),ar=new he("SysvarStakeHistory1111111111111111111111111");async function cr(i,e,t,r){const n=r&&{skipPreflight:r.skipPreflight,preflightCommitment:r.preflightCommitment||r.commitment},a=await i.sendTransaction(e,t,n),d=(await i.confirmTransaction(a,r&&r.commitment)).value;if(d.err)throw new Error(`Transaction ${a} failed (${JSON.stringify(d)})`);return a}function ur(i){return new Promise(e=>setTimeout(e,i))}function We(i,e){const t=i.layout.span>=0?i.layout.span:zs(i,e),r=B.lW.alloc(t),n=Object.assign({instruction:i.index},e);return i.layout.encode(n,r),r}function Ke(i,e){let t;try{t=i.layout.decode(e)}catch(r){throw new Error("invalid instruction; "+r)}if(t.instruction!==i.index)throw new Error(`invalid instruction; instruction index mismatch ${t.instruction} != ${i.index}`);return t}const An=u.nu64("lamportsPerSignature"),Rn=u.struct([u.u32("version"),u.u32("state"),Te("authorizedPubkey"),Te("nonce"),u.struct([An],"feeCalculator")]),Tr=Rn.span;class fr{constructor(e){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}static fromAccountData(e){const t=Rn.decode(pe(e),0);return new fr({authorizedPubkey:new he(t.authorizedPubkey),nonce:new he(t.nonce).toString(),feeCalculator:t.feeCalculator})}}class qs{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=u.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(Pe))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a SystemInstruction");return n}static decodeCreateAccount(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t,space:r,programId:n}=Ke(Pe.Create,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:t,space:r,programId:new he(n)}}static decodeTransfer(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{lamports:t}=Ke(Pe.Transfer,e.data);return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}static decodeTransferWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t,seed:r,programId:n}=Ke(Pe.TransferWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:t,seed:r,programId:new he(n)}}static decodeAllocate(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{space:t}=Ke(Pe.Allocate,e.data);return{accountPubkey:e.keys[0].pubkey,space:t}}static decodeAllocateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,space:n,programId:a}=Ke(Pe.AllocateWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new he(t),seed:r,space:n,programId:new he(a)}}static decodeAssign(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{programId:t}=Ke(Pe.Assign,e.data);return{accountPubkey:e.keys[0].pubkey,programId:new he(t)}}static decodeAssignWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);const{base:t,seed:r,programId:n}=Ke(Pe.AssignWithSeed,e.data);return{accountPubkey:e.keys[0].pubkey,basePubkey:new he(t),seed:r,programId:new he(n)}}static decodeCreateWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{base:t,seed:r,lamports:n,space:a,programId:d}=Ke(Pe.CreateWithSeed,e.data);return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new he(t),seed:r,lamports:n,space:a,programId:new he(d)}}static decodeNonceInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{authorized:t}=Ke(Pe.InitializeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new he(t)}}static decodeNonceAdvance(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Ke(Pe.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static decodeNonceWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Ke(Pe.WithdrawNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}static decodeNonceAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t}=Ke(Pe.AuthorizeNonceAccount,e.data);return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new he(t)}}static checkProgramId(e){if(!e.equals(et.programId))throw new Error("invalid instruction; programId is not SystemProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const Pe=Object.freeze({Create:{index:0,layout:u.struct([u.u32("instruction"),u.ns64("lamports"),u.ns64("space"),Te("programId")])},Assign:{index:1,layout:u.struct([u.u32("instruction"),Te("programId")])},Transfer:{index:2,layout:u.struct([u.u32("instruction"),u.ns64("lamports")])},CreateWithSeed:{index:3,layout:u.struct([u.u32("instruction"),Te("base"),Lt("seed"),u.ns64("lamports"),u.ns64("space"),Te("programId")])},AdvanceNonceAccount:{index:4,layout:u.struct([u.u32("instruction")])},WithdrawNonceAccount:{index:5,layout:u.struct([u.u32("instruction"),u.ns64("lamports")])},InitializeNonceAccount:{index:6,layout:u.struct([u.u32("instruction"),Te("authorized")])},AuthorizeNonceAccount:{index:7,layout:u.struct([u.u32("instruction"),Te("authorized")])},Allocate:{index:8,layout:u.struct([u.u32("instruction"),u.ns64("space")])},AllocateWithSeed:{index:9,layout:u.struct([u.u32("instruction"),Te("base"),Lt("seed"),u.ns64("space"),Te("programId")])},AssignWithSeed:{index:10,layout:u.struct([u.u32("instruction"),Te("base"),Lt("seed"),Te("programId")])},TransferWithSeed:{index:11,layout:u.struct([u.u32("instruction"),u.ns64("lamports"),Lt("seed"),Te("programId")])}});class et{constructor(){}static createAccount(e){const t=Pe.Create,r=We(t,{lamports:e.lamports,space:e.space,programId:pe(e.programId.toBuffer())});return new Ze({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:r})}static transfer(e){let t,r;if("basePubkey"in e){const n=Pe.TransferWithSeed;t=We(n,{lamports:e.lamports,seed:e.seed,programId:pe(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}else{const n=Pe.Transfer;t=We(n,{lamports:e.lamports}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]}return new Ze({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;if("basePubkey"in e){const n=Pe.AssignWithSeed;t=We(n,{base:pe(e.basePubkey.toBuffer()),seed:e.seed,programId:pe(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Pe.Assign;t=We(n,{programId:pe(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ze({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=Pe.CreateWithSeed,r=We(t,{base:pe(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:pe(e.programId.toBuffer())});let n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new Ze({keys:n,programId:this.programId,data:r})}static createNonceAccount(e){const t=new Ce;"basePubkey"in e&&"seed"in e?t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:Tr,programId:this.programId})):t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:Tr,programId:this.programId}));const r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){const t=Pe.InitializeNonceAccount,r=We(t,{authorized:pe(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:Zt,isSigner:!1,isWritable:!1}],programId:this.programId,data:r};return new Ze(n)}static nonceAdvance(e){const t=Pe.AdvanceNonceAccount,r=We(t),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r};return new Ze(n)}static nonceWithdraw(e){const t=Pe.WithdrawNonceAccount,r=We(t,{lamports:e.lamports});return new Ze({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:or,isSigner:!1,isWritable:!1},{pubkey:Zt,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static nonceAuthorize(e){const t=Pe.AuthorizeNonceAccount,r=We(t,{authorized:pe(e.newAuthorizedPubkey.toBuffer())});return new Ze({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}static allocate(e){let t,r;if("basePubkey"in e){const n=Pe.AllocateWithSeed;t=We(n,{base:pe(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:pe(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]}else{const n=Pe.Allocate;t=We(n,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]}return new Ze({keys:r,programId:this.programId,data:t})}}et.programId=new he("11111111111111111111111111111111");const Ys=Yt-300;class It{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/It.chunkSize)+1+1)}static async load(e,t,r,n,a){{const X=await e.getMinimumBalanceForRentExemption(a.length),se=await e.getAccountInfo(r.publicKey,"confirmed");let te=null;if(se!==null){if(se.executable)return console.error("Program load failed, account is already executable"),!1;se.data.length!==a.length&&(te=te||new Ce,te.add(et.allocate({accountPubkey:r.publicKey,space:a.length}))),se.owner.equals(n)||(te=te||new Ce,te.add(et.assign({accountPubkey:r.publicKey,programId:n}))),se.lamports<X&&(te=te||new Ce,te.add(et.transfer({fromPubkey:t.publicKey,toPubkey:r.publicKey,lamports:X-se.lamports})))}else te=new Ce().add(et.createAccount({fromPubkey:t.publicKey,newAccountPubkey:r.publicKey,lamports:X>0?X:1,space:a.length,programId:n}));te!==null&&await cr(e,te,[t,r],{commitment:"confirmed"})}const d=u.struct([u.u32("instruction"),u.u32("offset"),u.u32("bytesLength"),u.u32("bytesLengthPadding"),u.seq(u.u8("byte"),u.offset(u.u32(),-8),"bytes")]),S=It.chunkSize;let P=0,M=a,Z=[];for(;M.length>0;){const X=M.slice(0,S),se=B.lW.alloc(S+16);d.encode({instruction:0,offset:P,bytes:X},se);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:n,data:se});Z.push(cr(e,te,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")&&await ur(1e3/4),P+=S,M=M.slice(S)}await Promise.all(Z);{const X=u.struct([u.u32("instruction")]),se=B.lW.alloc(X.span);X.encode({instruction:1},se);const te=new Ce().add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:Zt,isSigner:!1,isWritable:!1}],programId:n,data:se});await cr(e,te,[t,r],{commitment:"confirmed"})}return!0}}It.chunkSize=Ys;const Zs=new he("BPFLoader2111111111111111111111111111111111");class Js{static getMinNumSignatures(e){return It.getMinNumSignatures(e)}static load(e,t,r,n,a){return It.load(e,t,r,a,n)}}var Ur={exports:{}};(function(i,e){var t=typeof self<"u"?self:Ae,r=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(d){var S={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function P(j){return j&&DataView.prototype.isPrototypeOf(j)}if(S.arrayBuffer)var M=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Z=ArrayBuffer.isView||function(j){return j&&M.indexOf(Object.prototype.toString.call(j))>-1};function X(j){if(typeof j!="string"&&(j=String(j)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(j))throw new TypeError("Invalid character in header field name");return j.toLowerCase()}function se(j){return typeof j!="string"&&(j=String(j)),j}function te(j){var ee={next:function(){var we=j.shift();return{done:we===void 0,value:we}}};return S.iterable&&(ee[Symbol.iterator]=function(){return ee}),ee}function de(j){this.map={},j instanceof de?j.forEach(function(ee,we){this.append(we,ee)},this):Array.isArray(j)?j.forEach(function(ee){this.append(ee[0],ee[1])},this):j&&Object.getOwnPropertyNames(j).forEach(function(ee){this.append(ee,j[ee])},this)}de.prototype.append=function(j,ee){j=X(j),ee=se(ee);var we=this.map[j];this.map[j]=we?we+", "+ee:ee},de.prototype.delete=function(j){delete this.map[X(j)]},de.prototype.get=function(j){return j=X(j),this.has(j)?this.map[j]:null},de.prototype.has=function(j){return this.map.hasOwnProperty(X(j))},de.prototype.set=function(j,ee){this.map[X(j)]=se(ee)},de.prototype.forEach=function(j,ee){for(var we in this.map)this.map.hasOwnProperty(we)&&j.call(ee,this.map[we],we,this)},de.prototype.keys=function(){var j=[];return this.forEach(function(ee,we){j.push(we)}),te(j)},de.prototype.values=function(){var j=[];return this.forEach(function(ee){j.push(ee)}),te(j)},de.prototype.entries=function(){var j=[];return this.forEach(function(ee,we){j.push([we,ee])}),te(j)},S.iterable&&(de.prototype[Symbol.iterator]=de.prototype.entries);function ye(j){if(j.bodyUsed)return Promise.reject(new TypeError("Already read"));j.bodyUsed=!0}function Ie(j){return new Promise(function(ee,we){j.onload=function(){ee(j.result)},j.onerror=function(){we(j.error)}})}function Le(j){var ee=new FileReader,we=Ie(ee);return ee.readAsArrayBuffer(j),we}function tt(j){var ee=new FileReader,we=Ie(ee);return ee.readAsText(j),we}function At(j){for(var ee=new Uint8Array(j),we=new Array(ee.length),Me=0;Me<ee.length;Me++)we[Me]=String.fromCharCode(ee[Me]);return we.join("")}function wt(j){if(j.slice)return j.slice(0);var ee=new Uint8Array(j.byteLength);return ee.set(new Uint8Array(j)),ee.buffer}function St(){return this.bodyUsed=!1,this._initBody=function(j){this._bodyInit=j,j?typeof j=="string"?this._bodyText=j:S.blob&&Blob.prototype.isPrototypeOf(j)?this._bodyBlob=j:S.formData&&FormData.prototype.isPrototypeOf(j)?this._bodyFormData=j:S.searchParams&&URLSearchParams.prototype.isPrototypeOf(j)?this._bodyText=j.toString():S.arrayBuffer&&S.blob&&P(j)?(this._bodyArrayBuffer=wt(j.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):S.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(j)||Z(j))?this._bodyArrayBuffer=wt(j):this._bodyText=j=Object.prototype.toString.call(j):this._bodyText="",this.headers.get("content-type")||(typeof j=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):S.searchParams&&URLSearchParams.prototype.isPrototypeOf(j)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},S.blob&&(this.blob=function(){var j=ye(this);if(j)return j;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?ye(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Le)}),this.text=function(){var j=ye(this);if(j)return j;if(this._bodyBlob)return tt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(At(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},S.formData&&(this.formData=function(){return this.text().then(gr)}),this.json=function(){return this.text().then(JSON.parse)},this}var Rt=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Bt(j){var ee=j.toUpperCase();return Rt.indexOf(ee)>-1?ee:j}function rt(j,ee){ee=ee||{};var we=ee.body;if(j instanceof rt){if(j.bodyUsed)throw new TypeError("Already read");this.url=j.url,this.credentials=j.credentials,ee.headers||(this.headers=new de(j.headers)),this.method=j.method,this.mode=j.mode,this.signal=j.signal,!we&&j._bodyInit!=null&&(we=j._bodyInit,j.bodyUsed=!0)}else this.url=String(j);if(this.credentials=ee.credentials||this.credentials||"same-origin",(ee.headers||!this.headers)&&(this.headers=new de(ee.headers)),this.method=Bt(ee.method||this.method||"GET"),this.mode=ee.mode||this.mode||null,this.signal=ee.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&we)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(we)}rt.prototype.clone=function(){return new rt(this,{body:this._bodyInit})};function gr(j){var ee=new FormData;return j.trim().split("&").forEach(function(we){if(we){var Me=we.split("="),ze=Me.shift().replace(/\+/g," "),Be=Me.join("=").replace(/\+/g," ");ee.append(decodeURIComponent(ze),decodeURIComponent(Be))}}),ee}function br(j){var ee=new de,we=j.replace(/\r?\n[\t ]+/g," ");return we.split(/\r?\n/).forEach(function(Me){var ze=Me.split(":"),Be=ze.shift().trim();if(Be){var wr=ze.join(":").trim();ee.append(Be,wr)}}),ee}St.call(rt.prototype);function nt(j,ee){ee||(ee={}),this.type="default",this.status=ee.status===void 0?200:ee.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in ee?ee.statusText:"OK",this.headers=new de(ee.headers),this.url=ee.url||"",this._initBody(j)}St.call(nt.prototype),nt.prototype.clone=function(){return new nt(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new de(this.headers),url:this.url})},nt.error=function(){var j=new nt(null,{status:0,statusText:""});return j.type="error",j};var mr=[301,302,303,307,308];nt.redirect=function(j,ee){if(mr.indexOf(ee)===-1)throw new RangeError("Invalid status code");return new nt(null,{status:ee,headers:{location:j}})},d.DOMException=a.DOMException;try{new d.DOMException}catch{d.DOMException=function(ee,we){this.message=ee,this.name=we;var Me=Error(ee);this.stack=Me.stack},d.DOMException.prototype=Object.create(Error.prototype),d.DOMException.prototype.constructor=d.DOMException}function zt(j,ee){return new Promise(function(we,Me){var ze=new rt(j,ee);if(ze.signal&&ze.signal.aborted)return Me(new d.DOMException("Aborted","AbortError"));var Be=new XMLHttpRequest;function wr(){Be.abort()}Be.onload=function(){var Qt={status:Be.status,statusText:Be.statusText,headers:br(Be.getAllResponseHeaders()||"")};Qt.url="responseURL"in Be?Be.responseURL:Qt.headers.get("X-Request-URL");var $r="response"in Be?Be.response:Be.responseText;we(new nt($r,Qt))},Be.onerror=function(){Me(new TypeError("Network request failed"))},Be.ontimeout=function(){Me(new TypeError("Network request failed"))},Be.onabort=function(){Me(new d.DOMException("Aborted","AbortError"))},Be.open(ze.method,ze.url,!0),ze.credentials==="include"?Be.withCredentials=!0:ze.credentials==="omit"&&(Be.withCredentials=!1),"responseType"in Be&&S.blob&&(Be.responseType="blob"),ze.headers.forEach(function(Qt,$r){Be.setRequestHeader($r,Qt)}),ze.signal&&(ze.signal.addEventListener("abort",wr),Be.onreadystatechange=function(){Be.readyState===4&&ze.signal.removeEventListener("abort",wr)}),Be.send(typeof ze._bodyInit>"u"?null:ze._bodyInit)})}return zt.polyfill=!0,a.fetch||(a.fetch=zt,a.Headers=de,a.Request=rt,a.Response=nt),d.Headers=de,d.Request=rt,d.Response=nt,d.fetch=zt,Object.defineProperty(d,"__esModule",{value:!0}),d})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var n=r;e=n.fetch,e.default=n.fetch,e.fetch=n.fetch,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,i.exports=e})(Ur,Ur.exports);var Bn=Jn(Ur.exports);const Jt=32;function Cr(i){let e=0;for(;i>1;)i/=2,e++;return e}function Xs(i){return i===0?1:(i--,i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,i|=i>>32,i+1)}class Pn{constructor(e,t,r,n,a){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=t,this.warmup=r,this.firstNormalEpoch=n,this.firstNormalSlot=a}getEpoch(e){return this.getEpochAndSlotIndex(e)[0]}getEpochAndSlotIndex(e){if(e<this.firstNormalSlot){const t=Cr(Xs(e+Jt+1))-Cr(Jt)-1,r=this.getSlotsInEpoch(t),n=e-(r-Jt);return[t,n]}else{const t=e-this.firstNormalSlot,r=Math.floor(t/this.slotsPerEpoch),n=this.firstNormalEpoch+r,a=t%this.slotsPerEpoch;return[n,a]}}getFirstSlotInEpoch(e){return e<=this.firstNormalEpoch?(Math.pow(2,e)-1)*Jt:(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}getSlotsInEpoch(e){return e<this.firstNormalEpoch?Math.pow(2,e+Cr(Jt)):this.slotsPerEpoch}}class Or extends Error{constructor(e,t){super(e),this.logs=void 0,this.logs=t}}const Qs=1e3/(160/64);function eo(i,e){let t;const r=new Promise(n=>{t=setTimeout(()=>n(null),e)});return Promise.race([i,r]).then(n=>(clearTimeout(t),n))}function to(i){let e=new URL(i);const t=e.protocol==="https:";return e.protocol=t?"wss:":"ws:",e.host="",e.port!==""&&(e.port=String(Number(e.port)+1)),e.toString()}const He=it(w(he),ue(),i=>new he(i)),Tn=Pt([ue(),f("base64")]),Nr=it(w(B.lW),Tn,i=>B.lW.from(i[0],"base64")),Un=30*1e3;function Cn(i){return Xe([Q({jsonrpc:f("2.0"),id:ue(),result:i}),Q({jsonrpc:f("2.0"),id:ue(),error:Q({code:yt(),message:ue(),data:be(Ve())})})])}const ro=Cn(yt());function xe(i){return it(Cn(i),ro,e=>"error"in e?e:{...e,result:x(e.result,i)})}function Ye(i){return xe(Q({context:Q({slot:_()}),value:i}))}function lr(i){return Q({context:Q({slot:_()}),value:i})}const no=Q({foundation:_(),foundationTerm:_(),initial:_(),taper:_(),terminal:_()}),io=xe(le(D(Q({epoch:_(),effectiveSlot:_(),amount:_(),postBalance:_()})))),so=Q({epoch:_(),slotIndex:_(),slotsInEpoch:_(),absoluteSlot:_(),blockHeight:be(_()),transactionCount:be(_())}),oo=Q({slotsPerEpoch:_(),leaderScheduleSlotOffset:_(),warmup:Je(),firstNormalEpoch:_(),firstNormalSlot:_()}),ao=Ne(ue(),le(_())),xt=D(Xe([Q({}),ue()])),co=Q({err:xt}),uo=f("receivedSignature"),fo=Q({"solana-core":ue(),"feature-set":be(_())}),lo=Ye(Q({err:D(Xe([Q({}),ue()])),logs:D(le(ue())),accounts:be(D(le(Q({executable:Je(),owner:ue(),lamports:_(),data:le(ue()),rentEpoch:be(_())})))),unitsConsumed:be(_())}));function ho(i,e,t,r,n){let a;return r&&(a=async(S,P)=>{const M=await new Promise((Z,X)=>{try{r(S,P,(se,te)=>Z([se,te]))}catch(se){X(se)}});return await Bn(...M)}),new(W())(async(S,P)=>{const Z={method:"POST",body:S,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{})};try{let X=5,se,te=500;for(;a?se=await a(i,Z):se=await Bn(i,Z),!(se.status!==429||n===!0||(X-=1,X===0));)console.log(`Server responded with ${se.status} ${se.statusText}. Retrying after ${te}ms delay...`),await ur(te),te*=2;const de=await se.text();se.ok?P(null,de):P(new Error(`${se.status} ${se.statusText}: ${de}`))}catch(X){X instanceof Error&&P(X)}finally{}},{})}function po(i){return(e,t)=>new Promise((r,n)=>{i.request(e,t,(a,d)=>{if(a){n(a);return}r(d)})})}function yo(i){return e=>new Promise((t,r)=>{e.length===0&&t([]);const n=e.map(a=>i.request(a.methodName,a.args));i.request(n,(a,d)=>{if(a){r(a);return}t(d)})})}const go=xe(no),bo=xe(so),mo=xe(oo),wo=xe(ao),Eo=xe(_()),So=Ye(Q({total:_(),circulating:_(),nonCirculating:_(),nonCirculatingAccounts:le(He)})),Fr=Q({amount:ue(),uiAmount:D(_()),decimals:_(),uiAmountString:be(ue())}),vo=Ye(le(Q({address:He,amount:ue(),uiAmount:D(_()),decimals:_(),uiAmountString:be(ue())}))),ko=Ye(le(Q({pubkey:He,account:Q({executable:Je(),owner:He,lamports:_(),data:Nr,rentEpoch:_()})}))),Lr=Q({program:ue(),parsed:yt(),space:_()}),_o=Ye(le(Q({pubkey:He,account:Q({executable:Je(),owner:He,lamports:_(),data:Lr,rentEpoch:_()})}))),Io=Ye(le(Q({lamports:_(),address:He}))),hr=Q({executable:Je(),owner:He,lamports:_(),data:Nr,rentEpoch:_()}),xo=Q({pubkey:He,account:hr}),Ao=it(Xe([w(B.lW),Lr]),Xe([Tn,Lr]),i=>Array.isArray(i)?x(i,Nr):i),Dr=Q({executable:Je(),owner:He,lamports:_(),data:Ao,rentEpoch:_()}),Ro=Q({pubkey:He,account:Dr}),Bo=Q({state:Xe([f("active"),f("inactive"),f("activating"),f("deactivating")]),active:_(),inactive:_()}),Po=xe(le(Q({signature:ue(),slot:_(),err:xt,memo:D(ue()),blockTime:be(D(_()))}))),To=xe(le(Q({signature:ue(),slot:_(),err:xt,memo:D(ue()),blockTime:be(D(_()))}))),Uo=Q({subscription:_(),result:lr(hr)}),Co=Q({pubkey:He,account:hr}),Oo=Q({subscription:_(),result:lr(Co)}),No=Q({parent:_(),slot:_(),root:_()}),Fo=Q({subscription:_(),result:No}),Lo=Xe([Q({type:Xe([f("firstShredReceived"),f("completed"),f("optimisticConfirmation"),f("root")]),slot:_(),timestamp:_()}),Q({type:f("createdBank"),parent:_(),slot:_(),timestamp:_()}),Q({type:f("frozen"),slot:_(),timestamp:_(),stats:Q({numTransactionEntries:_(),numSuccessfulTransactions:_(),numFailedTransactions:_(),maxTransactionsPerEntry:_()})}),Q({type:f("dead"),slot:_(),timestamp:_(),err:ue()})]),Do=Q({subscription:_(),result:Lo}),Wo=Q({subscription:_(),result:lr(Xe([co,uo]))}),Ko=Q({subscription:_(),result:_()}),zo=Q({pubkey:ue(),gossip:D(ue()),tpu:D(ue()),rpc:D(ue()),version:D(ue())}),On=Q({votePubkey:ue(),nodePubkey:ue(),activatedStake:_(),epochVoteAccount:Je(),epochCredits:le(Pt([_(),_(),_()])),commission:_(),lastVote:_(),rootSlot:D(_())}),Mo=xe(Q({current:le(On),delinquent:le(On)})),$o=Xe([f("processed"),f("confirmed"),f("finalized")]),jo=Q({slot:_(),confirmations:D(_()),err:xt,confirmationStatus:be($o)}),Vo=Ye(le(D(jo))),Go=xe(_()),Nn=Q({signatures:le(ue()),message:Q({accountKeys:le(ue()),header:Q({numRequiredSignatures:_(),numReadonlySignedAccounts:_(),numReadonlyUnsignedAccounts:_()}),instructions:le(Q({accounts:le(_()),data:ue(),programIdIndex:_()})),recentBlockhash:ue()})}),Fn=Q({parsed:yt(),program:ue(),programId:He}),Ln=Q({accounts:le(He),data:ue(),programId:He}),Ho=Xe([Ln,Fn]),qo=Xe([Q({parsed:yt(),program:ue(),programId:ue()}),Q({accounts:le(ue()),data:ue(),programId:ue()})]),Dn=it(Ho,qo,i=>"accounts"in i?x(i,Ln):x(i,Fn)),Yo=Q({signatures:le(ue()),message:Q({accountKeys:le(Q({pubkey:He,signer:Je(),writable:Je()})),instructions:le(Dn),recentBlockhash:ue()})}),dr=Q({accountIndex:_(),mint:ue(),owner:be(ue()),uiTokenAmount:Fr}),Wn=Q({err:xt,fee:_(),innerInstructions:be(D(le(Q({index:_(),instructions:le(Q({accounts:le(_()),data:ue(),programIdIndex:_()}))})))),preBalances:le(_()),postBalances:le(_()),logMessages:be(D(le(ue()))),preTokenBalances:be(D(le(dr))),postTokenBalances:be(D(le(dr)))}),Zo=Q({err:xt,fee:_(),innerInstructions:be(D(le(Q({index:_(),instructions:le(Dn)})))),preBalances:le(_()),postBalances:le(_()),logMessages:be(D(le(ue()))),preTokenBalances:be(D(le(dr))),postTokenBalances:be(D(le(dr)))}),Jo=xe(D(Q({blockhash:ue(),previousBlockhash:ue(),parentSlot:_(),transactions:le(Q({transaction:Nn,meta:D(Wn)})),rewards:be(le(Q({pubkey:ue(),lamports:_(),postBalance:D(_()),rewardType:D(ue())}))),blockTime:D(_())}))),Xo=xe(D(Q({blockhash:ue(),previousBlockhash:ue(),parentSlot:_(),signatures:le(ue()),blockTime:D(_())}))),Qo=xe(D(Q({slot:_(),meta:Wn,blockTime:be(D(_())),transaction:Nn}))),Kn=xe(D(Q({slot:_(),transaction:Yo,meta:D(Zo),blockTime:be(D(_()))}))),ea=Ye(Q({blockhash:ue(),feeCalculator:Q({lamportsPerSignature:_()})})),ta=Q({slot:_(),numTransactions:_(),numSlots:_(),samplePeriodSecs:_()}),ra=xe(le(ta)),na=Ye(D(Q({feeCalculator:Q({lamportsPerSignature:_()})}))),ia=xe(ue()),sa=xe(ue()),oa=Q({err:xt,logs:le(ue()),signature:ue()}),aa=Q({result:lr(oa),subscription:_()});class ca{constructor(e,t){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={recentBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._accountChangeSubscriptionCounter=0,this._accountChangeSubscriptions={},this._programAccountChangeSubscriptionCounter=0,this._programAccountChangeSubscriptions={},this._rootSubscriptionCounter=0,this._rootSubscriptions={},this._signatureSubscriptionCounter=0,this._signatureSubscriptions={},this._slotSubscriptionCounter=0,this._slotSubscriptions={},this._logsSubscriptionCounter=0,this._logsSubscriptions={},this._slotUpdateSubscriptionCounter=0,this._slotUpdateSubscriptions={};let r=new URL(e);const n=r.protocol==="https:";let a,d,S,P;t&&typeof t=="string"?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,a=t.wsEndpoint,d=t.httpHeaders,S=t.fetchMiddleware,P=t.disableRetryOnRateLimit),this._rpcEndpoint=e,this._rpcWsEndpoint=a||to(e),this._rpcClient=ho(r.toString(),n,d,S,P),this._rpcRequest=po(this._rpcClient),this._rpcBatchRequest=yo(this._rpcClient),this._rpcWebSocket=new p.K(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}async getBalanceAndContext(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getBalance",r),a=x(n,Ye(_()));if("error"in a)throw new Error("failed to get balance for "+e.toBase58()+": "+a.error.message);return a.result}async getBalance(e,t){return await this.getBalanceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get balance of account "+e.toBase58()+": "+r)})}async getBlockTime(e){const t=await this._rpcRequest("getBlockTime",[e]),r=x(t,xe(D(_())));if("error"in r)throw new Error("failed to get block time for slot "+e+": "+r.error.message);return r.result}async getMinimumLedgerSlot(){const e=await this._rpcRequest("minimumLedgerSlot",[]),t=x(e,xe(_()));if("error"in t)throw new Error("failed to get minimum ledger slot: "+t.error.message);return t.result}async getFirstAvailableBlock(){const e=await this._rpcRequest("getFirstAvailableBlock",[]),t=x(e,Eo);if("error"in t)throw new Error("failed to get first available block: "+t.error.message);return t.result}async getSupply(e){let t={};typeof e=="string"?t={commitment:e}:e?t={...e,commitment:e&&e.commitment||this.commitment}:t={commitment:this.commitment};const r=await this._rpcRequest("getSupply",[t]),n=x(r,So);if("error"in n)throw new Error("failed to get supply: "+n.error.message);return n.result}async getTokenSupply(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenSupply",r),a=x(n,Ye(Fr));if("error"in a)throw new Error("failed to get token supply: "+a.error.message);return a.result}async getTokenAccountBalance(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenAccountBalance",r),a=x(n,Ye(Fr));if("error"in a)throw new Error("failed to get token account balance: "+a.error.message);return a.result}async getTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"base64"),d=await this._rpcRequest("getTokenAccountsByOwner",a),S=x(d,ko);if("error"in S)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+S.error.message);return S.result}async getParsedTokenAccountsByOwner(e,t,r){let n=[e.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const a=this._buildArgs(n,r,"jsonParsed"),d=await this._rpcRequest("getTokenAccountsByOwner",a),S=x(d,_o);if("error"in S)throw new Error("failed to get token accounts owned by account "+e.toBase58()+": "+S.error.message);return S.result}async getLargestAccounts(e){const t={...e,commitment:e&&e.commitment||this.commitment},r=t.filter||t.commitment?[t]:[],n=await this._rpcRequest("getLargestAccounts",r),a=x(n,Io);if("error"in a)throw new Error("failed to get largest accounts: "+a.error.message);return a.result}async getTokenLargestAccounts(e,t){const r=this._buildArgs([e.toBase58()],t),n=await this._rpcRequest("getTokenLargestAccounts",r),a=x(n,vo);if("error"in a)throw new Error("failed to get token largest accounts: "+a.error.message);return a.result}async getAccountInfoAndContext(e,t){const r=this._buildArgs([e.toBase58()],t,"base64"),n=await this._rpcRequest("getAccountInfo",r),a=x(n,Ye(D(hr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getParsedAccountInfo(e,t){const r=this._buildArgs([e.toBase58()],t,"jsonParsed"),n=await this._rpcRequest("getAccountInfo",r),a=x(n,Ye(D(Dr)));if("error"in a)throw new Error("failed to get info about account "+e.toBase58()+": "+a.error.message);return a.result}async getAccountInfo(e,t){try{return(await this.getAccountInfoAndContext(e,t)).value}catch(r){throw new Error("failed to get info about account "+e.toBase58()+": "+r)}}async getMultipleAccountsInfo(e,t){const r=e.map(M=>M.toBase58());let n,a="base64";t&&(typeof t=="string"?(n=t,a="base64"):(n=t.commitment,a=t.encoding||"base64"));const d=this._buildArgs([r],n,a),S=await this._rpcRequest("getMultipleAccounts",d),P=x(S,Ye(le(D(Dr))));if("error"in P)throw new Error("failed to get info for accounts "+r+": "+P.error.message);return P.result.value}async getStakeActivation(e,t,r){const n=this._buildArgs([e.toBase58()],t,void 0,r!==void 0?{epoch:r}:void 0),a=await this._rpcRequest("getStakeActivation",n),d=x(a,xe(Bo));if("error"in d)throw new Error(`failed to get Stake Activation ${e.toBase58()}: ${d.error.message}`);return d.result}async getProgramAccounts(e,t){const r={};let n,a;t&&(typeof t=="string"?n=t:(n=t.commitment,a=t.encoding,t.dataSlice&&(r.dataSlice=t.dataSlice),t.filters&&(r.filters=t.filters)));const d=this._buildArgs([e.toBase58()],n,a||"base64",r),S=await this._rpcRequest("getProgramAccounts",d),P=x(S,xe(le(xo)));if("error"in P)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+P.error.message);return P.result}async getParsedProgramAccounts(e,t){const r={};let n;t&&(typeof t=="string"?n=t:(n=t.commitment,t.filters&&(r.filters=t.filters)));const a=this._buildArgs([e.toBase58()],n,"jsonParsed",r),d=await this._rpcRequest("getProgramAccounts",a),S=x(d,xe(le(Ro)));if("error"in S)throw new Error("failed to get accounts owned by program "+e.toBase58()+": "+S.error.message);return S.result}async confirmTransaction(e,t){let r;try{r=E().decode(e)}catch{throw new Error("signature must be base58 encoded: "+e)}Ge(r.length===64,"signature has invalid length");const n=Date.now(),a=t||this.commitment;let d,S=null;const P=new Promise((Z,X)=>{try{d=this.onSignature(e,(se,te)=>{d=void 0,S={context:te,value:se},Z(null)},a)}catch(se){X(se)}});let M=this._confirmTransactionInitialTimeout||60*1e3;switch(a){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{M=this._confirmTransactionInitialTimeout||30*1e3;break}}try{await eo(P,M)}finally{d&&this.removeSignatureListener(d)}if(S===null){const Z=(Date.now()-n)/1e3;throw new Error(`Transaction was not confirmed in ${Z.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${e} using the Solana Explorer or CLI tools.`)}return S}async getClusterNodes(){const e=await this._rpcRequest("getClusterNodes",[]),t=x(e,xe(le(zo)));if("error"in t)throw new Error("failed to get cluster nodes: "+t.error.message);return t.result}async getVoteAccounts(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getVoteAccounts",t),n=x(r,Mo);if("error"in n)throw new Error("failed to get vote accounts: "+n.error.message);return n.result}async getSlot(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlot",t),n=x(r,xe(_()));if("error"in n)throw new Error("failed to get slot: "+n.error.message);return n.result}async getSlotLeader(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getSlotLeader",t),n=x(r,xe(ue()));if("error"in n)throw new Error("failed to get slot leader: "+n.error.message);return n.result}async getSlotLeaders(e,t){const r=[e,t],n=await this._rpcRequest("getSlotLeaders",r),a=x(n,xe(le(He)));if("error"in a)throw new Error("failed to get slot leaders: "+a.error.message);return a.result}async getSignatureStatus(e,t){const{context:r,value:n}=await this.getSignatureStatuses([e],t);Ge(n.length===1);const a=n[0];return{context:r,value:a}}async getSignatureStatuses(e,t){const r=[e];t&&r.push(t);const n=await this._rpcRequest("getSignatureStatuses",r),a=x(n,Vo);if("error"in a)throw new Error("failed to get signature status: "+a.error.message);return a.result}async getTransactionCount(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getTransactionCount",t),n=x(r,xe(_()));if("error"in n)throw new Error("failed to get transaction count: "+n.error.message);return n.result}async getTotalSupply(e){return(await this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getInflationGovernor",t),n=x(r,go);if("error"in n)throw new Error("failed to get inflation: "+n.error.message);return n.result}async getInflationReward(e,t,r){const n=this._buildArgs([e.map(S=>S.toBase58())],r,void 0,{epoch:t}),a=await this._rpcRequest("getInflationReward",n),d=x(a,io);if("error"in d)throw new Error("failed to get inflation reward: "+d.error.message);return d.result}async getEpochInfo(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getEpochInfo",t),n=x(r,bo);if("error"in n)throw new Error("failed to get epoch info: "+n.error.message);return n.result}async getEpochSchedule(){const e=await this._rpcRequest("getEpochSchedule",[]),t=x(e,mo);if("error"in t)throw new Error("failed to get epoch schedule: "+t.error.message);const r=t.result;return new Pn(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot)}async getLeaderSchedule(){const e=await this._rpcRequest("getLeaderSchedule",[]),t=x(e,wo);if("error"in t)throw new Error("failed to get leader schedule: "+t.error.message);return t.result}async getMinimumBalanceForRentExemption(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getMinimumBalanceForRentExemption",r),a=x(n,Go);return"error"in a?(console.warn("Unable to fetch minimum balance for rent exemption"),0):a.result}async getRecentBlockhashAndContext(e){const t=this._buildArgs([],e),r=await this._rpcRequest("getRecentBlockhash",t),n=x(r,ea);if("error"in n)throw new Error("failed to get recent blockhash: "+n.error.message);return n.result}async getRecentPerformanceSamples(e){const t=this._buildArgs(e?[e]:[]),r=await this._rpcRequest("getRecentPerformanceSamples",t),n=x(r,ra);if("error"in n)throw new Error("failed to get recent performance samples: "+n.error.message);return n.result}async getFeeCalculatorForBlockhash(e,t){const r=this._buildArgs([e],t),n=await this._rpcRequest("getFeeCalculatorForBlockhash",r),a=x(n,na);if("error"in a)throw new Error("failed to get fee calculator: "+a.error.message);const{context:d,value:S}=a.result;return{context:d,value:S!==null?S.feeCalculator:null}}async getFeeForMessage(e,t){const r=e.serialize().toString("base64"),n=this._buildArgs([r],t),a=await this._rpcRequest("getFeeForMessage",n),d=x(a,Ye(D(_())));if("error"in d)throw new Error("failed to get slot: "+d.error.message);if(d.result===null)throw new Error("invalid blockhash");return d.result}async getRecentBlockhash(e){try{return(await this.getRecentBlockhashAndContext(e)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getVersion(){const e=await this._rpcRequest("getVersion",[]),t=x(e,xe(fo));if("error"in t)throw new Error("failed to get version: "+t.error.message);return t.result}async getGenesisHash(){const e=await this._rpcRequest("getGenesisHash",[]),t=x(e,xe(ue()));if("error"in t)throw new Error("failed to get genesis hash: "+t.error.message);return t.result}async getBlock(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedBlock",r),a=x(n,Jo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;return d&&{...d,transactions:d.transactions.map(({transaction:S,meta:P})=>{const M=new kt(S.message);return{meta:P,transaction:{...S,message:M}}})}}async getTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t&&t.commitment),n=await this._rpcRequest("getConfirmedTransaction",r),a=x(n,Qo);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);const d=a.result;return d&&{...d,transaction:{...d.transaction,message:new kt(d.transaction.message)}}}async getConfirmedBlock(e,t){const r=await this.getBlock(e,{commitment:t});if(!r)throw new Error("Confirmed block "+e+" not found");return{...r,transactions:r.transactions.map(({transaction:n,meta:a})=>({meta:a,transaction:Ce.populate(n.message,n.signatures)}))}}async getBlocks(e,t,r){const n=this._buildArgsAtLeastConfirmed(t!==void 0?[e,t]:[e],r),a=await this._rpcRequest("getConfirmedBlocks",n),d=x(a,xe(le(_())));if("error"in d)throw new Error("failed to get blocks: "+d.error.message);return d.result}async getConfirmedBlockSignatures(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=await this._rpcRequest("getConfirmedBlock",r),a=x(n,Xo);if("error"in a)throw new Error("failed to get confirmed block: "+a.error.message);const d=a.result;if(!d)throw new Error("Confirmed block "+e+" not found");return d}async getConfirmedTransaction(e,t){const r=await this.getTransaction(e,{commitment:t});if(!r)return r;const{message:n,signatures:a}=r.transaction;return{...r,transaction:Ce.populate(n,a)}}async getParsedConfirmedTransaction(e,t){const r=this._buildArgsAtLeastConfirmed([e],t,"jsonParsed"),n=await this._rpcRequest("getConfirmedTransaction",r),a=x(n,Kn);if("error"in a)throw new Error("failed to get confirmed transaction: "+a.error.message);return a.result}async getParsedConfirmedTransactions(e,t){const r=e.map(d=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([d],t,"jsonParsed")}));return(await this._rpcBatchRequest(r)).map(d=>{const S=x(d,Kn);if("error"in S)throw new Error("failed to get confirmed transactions: "+S.error.message);return S.result})}async getConfirmedSignaturesForAddress(e,t,r){let n={},a=await this.getFirstAvailableBlock();for(;!("until"in n)&&(t--,!(t<=0||t<a));)try{const P=await this.getConfirmedBlockSignatures(t,"finalized");P.signatures.length>0&&(n.until=P.signatures[P.signatures.length-1].toString())}catch(P){if(P instanceof Error&&P.message.includes("skipped"))continue;throw P}let d=await this.getSlot("finalized");for(;!("before"in n)&&(r++,!(r>d));)try{const P=await this.getConfirmedBlockSignatures(r);P.signatures.length>0&&(n.before=P.signatures[P.signatures.length-1].toString())}catch(P){if(P instanceof Error&&P.message.includes("skipped"))continue;throw P}return(await this.getConfirmedSignaturesForAddress2(e,n)).map(P=>P.signature)}async getConfirmedSignaturesForAddress2(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getConfirmedSignaturesForAddress2",n),d=x(a,Po);if("error"in d)throw new Error("failed to get confirmed signatures for address: "+d.error.message);return d.result}async getSignaturesForAddress(e,t,r){const n=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,t),a=await this._rpcRequest("getSignaturesForAddress",n),d=x(a,To);if("error"in d)throw new Error("failed to get signatures for address: "+d.error.message);return d.result}async getNonceAndContext(e,t){const{context:r,value:n}=await this.getAccountInfoAndContext(e,t);let a=null;return n!==null&&(a=fr.fromAccountData(n.data)),{context:r,value:a}}async getNonce(e,t){return await this.getNonceAndContext(e,t).then(r=>r.value).catch(r=>{throw new Error("failed to get nonce for account "+e.toBase58()+": "+r)})}async requestAirdrop(e,t){const r=await this._rpcRequest("requestAirdrop",[e.toBase58(),t]),n=x(r,ia);if("error"in n)throw new Error("airdrop to "+e.toBase58()+" failed: "+n.error.message);return n.result}async _recentBlockhash(e){if(!e){for(;this._pollingBlockhash;)await ur(100);const r=Date.now()-this._blockhashInfo.lastFetch>=Un;if(this._blockhashInfo.recentBlockhash!==null&&!r)return this._blockhashInfo.recentBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const e=Date.now();for(let t=0;t<50;t++){const{blockhash:r}=await this.getRecentBlockhash("finalized");if(this._blockhashInfo.recentBlockhash!=r)return this._blockhashInfo={recentBlockhash:r,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},r;await ur(Qs/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-e}ms`)}finally{this._pollingBlockhash=!1}}async simulateTransaction(e,t,r){let n;if(e instanceof Ce?n=e:n=Ce.populate(e),n.nonceInfo&&t)n.sign(...t);else{let te=this._disableBlockhashCaching;for(;n.recentBlockhash=await this._recentBlockhash(te),!!t;){if(n.sign(...t),!n.signature)throw new Error("!signature");const de=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(de)&&!this._blockhashInfo.transactionSignatures.includes(de)){this._blockhashInfo.simulatedSignatures.push(de);break}else te=!0}}const a=n._compile(),d=a.serialize(),P=n._serialize(d).toString("base64"),M={encoding:"base64",commitment:this.commitment};if(r){const te=(Array.isArray(r)?r:a.nonProgramIds()).map(de=>de.toBase58());M.accounts={encoding:"base64",addresses:te}}t&&(M.sigVerify=!0);const Z=[P,M],X=await this._rpcRequest("simulateTransaction",Z),se=x(X,lo);if("error"in se){let te;if("data"in se.error&&(te=se.error.data.logs,te&&Array.isArray(te))){const de=`
|
|
109
|
+
`,ye=de+te.join(de);console.error(se.error.message,ye)}throw new Or("failed to simulate transaction: "+se.error.message,te)}return se.result}async sendTransaction(e,t,r){if(e.nonceInfo)e.sign(...t);else{let a=this._disableBlockhashCaching;for(;;){if(e.recentBlockhash=await this._recentBlockhash(a),e.sign(...t),!e.signature)throw new Error("!signature");const d=e.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(d))a=!0;else{this._blockhashInfo.transactionSignatures.push(d);break}}}const n=e.serialize();return await this.sendRawTransaction(n,r)}async sendRawTransaction(e,t){const r=pe(e).toString("base64");return await this.sendEncodedTransaction(r,t)}async sendEncodedTransaction(e,t){const r={encoding:"base64"},n=t&&t.skipPreflight,a=t&&t.preflightCommitment||this.commitment;n&&(r.skipPreflight=n),a&&(r.preflightCommitment=a);const d=[e,r],S=await this._rpcRequest("sendTransaction",d),P=x(S,sa);if("error"in P){let M;if("data"in P.error&&(M=P.error.data.logs,M&&Array.isArray(M))){const Z=`
|
|
110
|
+
`,X=Z+M.join(Z);console.error(P.error.message,X)}throw new Or("failed to send transaction: "+P.error.message,M)}return P.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{this._rpcWebSocket.notify("ping").catch(()=>{})},5e3),this._updateSubscriptions()}_wsOnError(e){console.error("ws error:",e.message)}_wsOnClose(e){if(this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),e===1e3){this._updateSubscriptions();return}this._resetSubscriptions()}async _subscribe(e,t,r){if(e.subscriptionId==null){e.subscriptionId="subscribing";try{const n=await this._rpcWebSocket.call(t,r);typeof n=="number"&&e.subscriptionId==="subscribing"&&(e.subscriptionId=n)}catch(n){e.subscriptionId==="subscribing"&&(e.subscriptionId=null),n instanceof Error&&console.error(`${t} error for argument`,r,n.message)}}}async _unsubscribe(e,t){const r=e.subscriptionId;if(r!=null&&typeof r!="string"){const n=r;try{await this._rpcWebSocket.call(t,[n])}catch(a){a instanceof Error&&console.error(`${t} error:`,a.message)}}}_resetSubscriptions(){Object.values(this._accountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._programAccountChangeSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._rootSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._signatureSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotSubscriptions).forEach(e=>e.subscriptionId=null),Object.values(this._slotUpdateSubscriptions).forEach(e=>e.subscriptionId=null)}_updateSubscriptions(){const e=Object.keys(this._accountChangeSubscriptions).map(Number),t=Object.keys(this._programAccountChangeSubscriptions).map(Number),r=Object.keys(this._slotSubscriptions).map(Number),n=Object.keys(this._slotUpdateSubscriptions).map(Number),a=Object.keys(this._signatureSubscriptions).map(Number),d=Object.keys(this._rootSubscriptions).map(Number),S=Object.keys(this._logsSubscriptions).map(Number);if(e.length===0&&t.length===0&&r.length===0&&n.length===0&&a.length===0&&d.length===0&&S.length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null,this._rpcWebSocket.close()},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}for(let P of e){const M=this._accountChangeSubscriptions[P];this._subscribe(M,"accountSubscribe",this._buildArgs([M.publicKey],M.commitment,"base64"))}for(let P of t){const M=this._programAccountChangeSubscriptions[P];this._subscribe(M,"programSubscribe",this._buildArgs([M.programId],M.commitment,"base64",{filters:M.filters}))}for(let P of r){const M=this._slotSubscriptions[P];this._subscribe(M,"slotSubscribe",[])}for(let P of n){const M=this._slotUpdateSubscriptions[P];this._subscribe(M,"slotsUpdatesSubscribe",[])}for(let P of a){const M=this._signatureSubscriptions[P],Z=[M.signature];M.options&&Z.push(M.options),this._subscribe(M,"signatureSubscribe",Z)}for(let P of d){const M=this._rootSubscriptions[P];this._subscribe(M,"rootSubscribe",[])}for(let P of S){const M=this._logsSubscriptions[P];let Z;typeof M.filter=="object"?Z={mentions:[M.filter.toString()]}:Z=M.filter,this._subscribe(M,"logsSubscribe",this._buildArgs([Z],M.commitment))}}_wsOnAccountNotification(e){const t=x(e,Uo);for(const r of Object.values(this._accountChangeSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result.value,t.result.context);return}}onAccountChange(e,t,r){const n=++this._accountChangeSubscriptionCounter;return this._accountChangeSubscriptions[n]={publicKey:e.toBase58(),callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeAccountChangeListener(e){if(this._accountChangeSubscriptions[e]){const t=this._accountChangeSubscriptions[e];delete this._accountChangeSubscriptions[e],await this._unsubscribe(t,"accountUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown account change id: ${e}`)}_wsOnProgramAccountNotification(e){const t=x(e,Oo);for(const r of Object.values(this._programAccountChangeSubscriptions))if(r.subscriptionId===t.subscription){const{value:n,context:a}=t.result;r.callback({accountId:n.pubkey,accountInfo:n.account},a);return}}onProgramAccountChange(e,t,r,n){const a=++this._programAccountChangeSubscriptionCounter;return this._programAccountChangeSubscriptions[a]={programId:e.toBase58(),callback:t,commitment:r,subscriptionId:null,filters:n},this._updateSubscriptions(),a}async removeProgramAccountChangeListener(e){if(this._programAccountChangeSubscriptions[e]){const t=this._programAccountChangeSubscriptions[e];delete this._programAccountChangeSubscriptions[e],await this._unsubscribe(t,"programUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown program account change id: ${e}`)}onLogs(e,t,r){const n=++this._logsSubscriptionCounter;return this._logsSubscriptions[n]={filter:e,callback:t,commitment:r,subscriptionId:null},this._updateSubscriptions(),n}async removeOnLogsListener(e){if(!this._logsSubscriptions[e])throw new Error(`Unknown logs id: ${e}`);const t=this._logsSubscriptions[e];delete this._logsSubscriptions[e],await this._unsubscribe(t,"logsUnsubscribe"),this._updateSubscriptions()}_wsOnLogsNotification(e){const t=x(e,aa),r=Object.keys(this._logsSubscriptions).map(Number);for(let n of r){const a=this._logsSubscriptions[n];if(a.subscriptionId===t.subscription){a.callback(t.result.value,t.result.context);return}}}_wsOnSlotNotification(e){const t=x(e,Fo);for(const r of Object.values(this._slotSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotChange(e){const t=++this._slotSubscriptionCounter;return this._slotSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotChangeListener(e){if(this._slotSubscriptions[e]){const t=this._slotSubscriptions[e];delete this._slotSubscriptions[e],await this._unsubscribe(t,"slotUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot change id: ${e}`)}_wsOnSlotUpdatesNotification(e){const t=x(e,Do);for(const r of Object.values(this._slotUpdateSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onSlotUpdate(e){const t=++this._slotUpdateSubscriptionCounter;return this._slotUpdateSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeSlotUpdateListener(e){if(this._slotUpdateSubscriptions[e]){const t=this._slotUpdateSubscriptions[e];delete this._slotUpdateSubscriptions[e],await this._unsubscribe(t,"slotsUpdatesUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown slot update id: ${e}`)}_buildArgs(e,t,r,n){const a=t||this._commitment;if(a||r||n){let d={};r&&(d.encoding=r),a&&(d.commitment=a),n&&(d=Object.assign(d,n)),e.push(d)}return e}_buildArgsAtLeastConfirmed(e,t,r,n){const a=t||this._commitment;if(a&&!["confirmed","finalized"].includes(a))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,r,n)}_wsOnSignatureNotification(e){const t=x(e,Wo);for(const[r,n]of Object.entries(this._signatureSubscriptions))if(n.subscriptionId===t.subscription){t.result.value==="receivedSignature"?n.callback({type:"received"},t.result.context):(delete this._signatureSubscriptions[Number(r)],this._updateSubscriptions(),n.callback({type:"status",result:t.result.value},t.result.context));return}}onSignature(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:(a,d)=>{a.type==="status"&&t(a.result,d)},options:{commitment:r},subscriptionId:null},this._updateSubscriptions(),n}onSignatureWithOptions(e,t,r){const n=++this._signatureSubscriptionCounter;return this._signatureSubscriptions[n]={signature:e,callback:t,options:r,subscriptionId:null},this._updateSubscriptions(),n}async removeSignatureListener(e){if(this._signatureSubscriptions[e]){const t=this._signatureSubscriptions[e];delete this._signatureSubscriptions[e],await this._unsubscribe(t,"signatureUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown signature result id: ${e}`)}_wsOnRootNotification(e){const t=x(e,Ko);for(const r of Object.values(this._rootSubscriptions))if(r.subscriptionId===t.subscription){r.callback(t.result);return}}onRootChange(e){const t=++this._rootSubscriptionCounter;return this._rootSubscriptions[t]={callback:e,subscriptionId:null},this._updateSubscriptions(),t}async removeRootChangeListener(e){if(this._rootSubscriptions[e]){const t=this._rootSubscriptions[e];delete this._rootSubscriptions[e],await this._unsubscribe(t,"rootUnsubscribe"),this._updateSubscriptions()}else throw new Error(`Unknown root change id: ${e}`)}}class Wt{constructor(e){this._keypair=void 0,e?this._keypair=e:this._keypair=J().sign.keyPair()}static generate(){return new Wt(J().sign.keyPair())}static fromSecretKey(e,t){const r=J().sign.keyPair.fromSecretKey(e);if(!t||!t.skipValidation){const a=new TextEncoder().encode("@solana/web3.js-validation-v1"),d=J().sign.detached(a,r.secretKey);if(!J().sign.detached.verify(a,d,r.publicKey))throw new Error("provided secretKey is invalid")}return new Wt(r)}static fromSeed(e){return new Wt(J().sign.keyPair.fromSeed(e))}get publicKey(){return new he(this._keypair.publicKey)}get secretKey(){return this._keypair.secretKey}}const zn=64,Mn=32,$n=64,jn=u.struct([u.u8("numSignatures"),u.u8("padding"),u.u16("signatureOffset"),u.u16("signatureInstructionIndex"),u.u16("publicKeyOffset"),u.u16("publicKeyInstructionIndex"),u.u16("messageDataOffset"),u.u16("messageDataSize"),u.u16("messageInstructionIndex")]);class pr{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,instructionIndex:a}=e;Ge(t.length===Mn,`Public Key must be ${Mn} bytes but received ${t.length} bytes`),Ge(n.length===$n,`Signature must be ${$n} bytes but received ${n.length} bytes`);const d=jn.span,S=d+t.length,P=S+n.length,M=1,Z=B.lW.alloc(P+r.length);return jn.encode({numSignatures:M,padding:0,signatureOffset:S,signatureInstructionIndex:a,publicKeyOffset:d,publicKeyInstructionIndex:a,messageDataOffset:P,messageDataSize:r.length,messageInstructionIndex:a},Z),Z.fill(t,d),Z.fill(n,S),Z.fill(r,P),new Ze({keys:[],programId:pr.programId,data:Z})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;Ge(t.length===zn,`Private key must be ${zn} bytes but received ${t.length} bytes`);try{const a=Wt.fromSecretKey(t),d=a.publicKey.toBytes(),S=J().sign.detached(r,a.secretKey);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:S,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}pr.programId=new he("Ed25519SigVerify111111111111111111111111111");const Vn=new he("StakeConfig11111111111111111111111111111111");class Gn{constructor(e,t){this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=t}}class Xt{constructor(e,t,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=r}}Xt.default=new Xt(0,0,he.default);class ua{constructor(){}static decodeInstructionType(e){this.checkProgramId(e.programId);const r=u.u32("instruction").decode(e.data);let n;for(const[a,d]of Object.entries(je))if(d.index==r){n=a;break}if(!n)throw new Error("Instruction type incorrect; not a StakeInstruction");return n}static decodeInitialize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{authorized:t,lockup:r}=Ke(je.Initialize,e.data);return{stakePubkey:e.keys[0].pubkey,authorized:new Gn(new he(t.staker),new he(t.withdrawer)),lockup:new Xt(r.unixTimestamp,r.epoch,new he(r.custodian))}}static decodeDelegate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),Ke(je.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}static decodeAuthorize(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{newAuthorized:t,stakeAuthorizationType:r}=Ke(je.Authorize,e.data),n={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new he(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(n.custodianPubkey=e.keys[3].pubkey),n}static decodeAuthorizeWithSeed(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);const{newAuthorized:t,stakeAuthorizationType:r,authoritySeed:n,authorityOwner:a}=Ke(je.AuthorizeWithSeed,e.data),d={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:n,authorityOwner:new he(a),newAuthorizedPubkey:new he(t),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(d.custodianPubkey=e.keys[3].pubkey),d}static decodeSplit(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);const{lamports:t}=Ke(je.Split,e.data);return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}static decodeMerge(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Ke(je.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}static decodeWithdraw(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);const{lamports:t}=Ke(je.Withdraw,e.data),r={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(r.custodianPubkey=e.keys[5].pubkey),r}static decodeDeactivate(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),Ke(je.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}static checkProgramId(e){if(!e.equals(yr.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(e,t){if(e.length<t)throw new Error(`invalid instruction; found ${e.length} keys, expected at least ${t}`)}}const je=Object.freeze({Initialize:{index:0,layout:u.struct([u.u32("instruction"),Ws(),Ks()])},Authorize:{index:1,layout:u.struct([u.u32("instruction"),Te("newAuthorized"),u.u32("stakeAuthorizationType")])},Delegate:{index:2,layout:u.struct([u.u32("instruction")])},Split:{index:3,layout:u.struct([u.u32("instruction"),u.ns64("lamports")])},Withdraw:{index:4,layout:u.struct([u.u32("instruction"),u.ns64("lamports")])},Deactivate:{index:5,layout:u.struct([u.u32("instruction")])},Merge:{index:7,layout:u.struct([u.u32("instruction")])},AuthorizeWithSeed:{index:8,layout:u.struct([u.u32("instruction"),Te("newAuthorized"),u.u32("stakeAuthorizationType"),Lt("authoritySeed"),Te("authorityOwner")])}}),fa=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class yr{constructor(){}static initialize(e){const{stakePubkey:t,authorized:r,lockup:n}=e,a=n||Xt.default,d=je.Initialize,S=We(d,{authorized:{staker:pe(r.staker.toBuffer()),withdrawer:pe(r.withdrawer.toBuffer())},lockup:{unixTimestamp:a.unixTimestamp,epoch:a.epoch,custodian:pe(a.custodian.toBuffer())}}),P={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Zt,isSigner:!1,isWritable:!1}],programId:this.programId,data:S};return new Ze(P)}static createAccountWithSeed(e){const t=new Ce;t.add(et.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static createAccount(e){const t=new Ce;t.add(et.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:a}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:a}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:r,votePubkey:n}=e,a=je.Delegate,d=We(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:ar,isSigner:!1,isWritable:!1},{pubkey:Vn,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static authorize(e){const{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:a,custodianPubkey:d}=e,S=je.Authorize,P=We(S,{newAuthorized:pe(n.toBuffer()),stakeAuthorizationType:a.index}),M=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&M.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:M,programId:this.programId,data:P})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:r,authoritySeed:n,authorityOwner:a,newAuthorizedPubkey:d,stakeAuthorizationType:S,custodianPubkey:P}=e,M=je.AuthorizeWithSeed,Z=We(M,{newAuthorized:pe(d.toBuffer()),stakeAuthorizationType:S.index,authoritySeed:n,authorityOwner:pe(a.toBuffer())}),X=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:_t,isSigner:!1,isWritable:!1}];return P&&X.push({pubkey:P,isSigner:!1,isWritable:!1}),new Ce().add({keys:X,programId:this.programId,data:Z})}static split(e){const{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:n,lamports:a}=e,d=new Ce;d.add(et.createAccount({fromPubkey:r,newAccountPubkey:n,lamports:0,space:this.space,programId:this.programId}));const S=je.Split,P=We(S,{lamports:a});return d.add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:P})}static merge(e){const{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:n}=e,a=je.Merge,d=We(a);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:ar,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:d})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:r,toPubkey:n,lamports:a,custodianPubkey:d}=e,S=je.Withdraw,P=We(S,{lamports:a}),M=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:ar,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return d&&M.push({pubkey:d,isSigner:!1,isWritable:!1}),new Ce().add({keys:M,programId:this.programId,data:P})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:r}=e,n=je.Deactivate,a=We(n);return new Ce().add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:_t,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:a})}}yr.programId=new he("Stake11111111111111111111111111111111111111"),yr.space=200;const{publicKeyCreate:la,ecdsaSign:ha}=Se(),Hn=32,Wr=20,qn=64,da=11,Kr=u.struct([u.u8("numSignatures"),u.u16("signatureOffset"),u.u8("signatureInstructionIndex"),u.u16("ethAddressOffset"),u.u8("ethAddressInstructionIndex"),u.u16("messageDataOffset"),u.u16("messageDataSize"),u.u8("messageInstructionIndex"),u.blob(20,"ethAddress"),u.blob(64,"signature"),u.u8("recoveryId")]);class Kt{constructor(){}static publicKeyToEthAddress(e){Ge(e.length===qn,`Public key must be ${qn} bytes but received ${e.length} bytes`);try{return B.lW.from(Re().keccak_256.update(pe(e)).digest()).slice(-Wr)}catch(t){throw new Error(`Error constructing Ethereum address: ${t}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,recoveryId:a,instructionIndex:d}=e;return Kt.createInstructionWithEthAddress({ethAddress:Kt.publicKeyToEthAddress(t),message:r,signature:n,recoveryId:a,instructionIndex:d})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:r,signature:n,recoveryId:a,instructionIndex:d=0}=e;let S;typeof t=="string"?t.startsWith("0x")?S=B.lW.from(t.substr(2),"hex"):S=B.lW.from(t,"hex"):S=t,Ge(S.length===Wr,`Address must be ${Wr} bytes but received ${S.length} bytes`);const P=1+da,M=P,Z=P+S.length,X=Z+n.length+1,se=1,te=B.lW.alloc(Kr.span+r.length);return Kr.encode({numSignatures:se,signatureOffset:Z,signatureInstructionIndex:d,ethAddressOffset:M,ethAddressInstructionIndex:d,messageDataOffset:X,messageDataSize:r.length,messageInstructionIndex:d,signature:pe(n),ethAddress:pe(S),recoveryId:a},te),te.fill(pe(r),Kr.span),new Ze({keys:[],programId:Kt.programId,data:te})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;Ge(t.length===Hn,`Private key must be ${Hn} bytes but received ${t.length} bytes`);try{const a=pe(t),d=la(a,!1).slice(1),S=B.lW.from(Re().keccak_256.update(pe(r)).digest()),{signature:P,recid:M}=ha(S,a);return this.createInstructionWithPublicKey({publicKey:d,message:r,signature:P,recoveryId:M,instructionIndex:n})}catch(a){throw new Error(`Error creating instruction; ${a}`)}}}Kt.programId=new he("KeccakSecp256k11111111111111111111111111111");const Yn=new he("Va1idator1nfo111111111111111111111111111111"),pa=Q({name:ue(),website:be(ue()),details:be(ue()),keybaseUsername:be(ue())});class zr{constructor(e,t){this.key=void 0,this.info=void 0,this.key=e,this.info=t}static fromConfigData(e){let r=[...e];if(Dt(r)!==2)return null;const a=[];for(let d=0;d<2;d++){const S=new he(r.slice(0,32));r=r.slice(32);const P=r.slice(0,1)[0]===1;r=r.slice(1),a.push({publicKey:S,isSigner:P})}if(a[0].publicKey.equals(Yn)&&a[1].isSigner){const d=Lt().decode(B.lW.from(r)),S=JSON.parse(d);return ne(S,pa),new zr(a[1].publicKey,S)}return null}}const ya=new he("Vote111111111111111111111111111111111111111"),ga=u.struct([Te("nodePubkey"),Te("authorizedWithdrawer"),u.u8("commission"),u.nu64(),u.seq(u.struct([u.nu64("slot"),u.u32("confirmationCount")]),u.offset(u.u32(),-8),"votes"),u.u8("rootSlotValid"),u.nu64("rootSlot"),u.nu64(),u.seq(u.struct([u.nu64("epoch"),Te("authorizedVoter")]),u.offset(u.u32(),-8),"authorizedVoters"),u.struct([u.seq(u.struct([Te("authorizedPubkey"),u.nu64("epochOfLastAuthorizedSwitch"),u.nu64("targetEpoch")]),32,"buf"),u.nu64("idx"),u.u8("isEmpty")],"priorVoters"),u.nu64(),u.seq(u.struct([u.nu64("epoch"),u.nu64("credits"),u.nu64("prevCredits")]),u.offset(u.u32(),-8),"epochCredits"),u.struct([u.nu64("slot"),u.nu64("timestamp")],"lastTimestamp")]);class Mr{constructor(e){this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}static fromAccountData(e){const r=ga.decode(pe(e),4);let n=r.rootSlot;return r.rootSlotValid||(n=null),new Mr({nodePubkey:new he(r.nodePubkey),authorizedWithdrawer:new he(r.authorizedWithdrawer),commission:r.commission,votes:r.votes,rootSlot:n,authorizedVoters:r.authorizedVoters.map(ba),priorVoters:wa(r.priorVoters),epochCredits:r.epochCredits,lastTimestamp:r.lastTimestamp})}}function ba({epoch:i,authorizedVoter:e}){return{epoch:i,authorizedVoter:new he(e)}}function ma({authorizedPubkey:i,epochOfLastAuthorizedSwitch:e,targetEpoch:t}){return{authorizedPubkey:new he(i),epochOfLastAuthorizedSwitch:e,targetEpoch:t}}function wa({buf:i,idx:e,isEmpty:t}){return t?[]:[...i.slice(e+1).map(ma),...i.slice(0,e)]}async function Ea(i,e,t){const r=t&&{skipPreflight:t.skipPreflight,preflightCommitment:t.preflightCommitment||t.commitment},n=await i.sendRawTransaction(e,r),a=(await i.confirmTransaction(n,t&&t.commitment)).value;if(a.err)throw new Error(`Raw transaction ${n} failed (${JSON.stringify(a)})`);return n}const Zn={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com"}};function Sa(i,e){const t=e===!1?"http":"https";if(!i)return Zn[t].devnet;const r=Zn[t][i];if(!r)throw new Error(`Unknown ${t} cluster: ${i}`);return r}const va=1e9},64285:function(Ee,g,L){"use strict";var z;/*!
|
|
111
111
|
* The buffer module from node.js, for the browser.
|
|
112
112
|
*
|
|
113
113
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
114
114
|
* @license MIT
|
|
115
|
-
*/const J=D(79742),B=D(80645),K=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;g.lW=h,j=H,g.h2=50;const N=2147483647;j=N,h.TYPED_ARRAY_SUPPORT=I(),!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function I(){try{const c=new Uint8Array(1),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(c,s),c.foo()===42}catch{return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.byteOffset}});function E(c){if(c>N)throw new RangeError('The value "'+c+'" is invalid for option "size"');const s=new Uint8Array(c);return Object.setPrototypeOf(s,h.prototype),s}function h(c,s,o){if(typeof c=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return P(c)}return f(c,s,o)}h.poolSize=8192;function f(c,s,o){if(typeof c=="string")return R(c,s);if(ArrayBuffer.isView(c))return T(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(st(c,ArrayBuffer)||c&&st(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(st(c,SharedArrayBuffer)||c&&st(c.buffer,SharedArrayBuffer)))return F(c,s,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const p=c.valueOf&&c.valueOf();if(p!=null&&p!==c)return h.from(p,s,o);const v=U(c);if(v)return v;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return h.from(c[Symbol.toPrimitive]("string"),s,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}h.from=function(c,s,o){return f(c,s,o)},Object.setPrototypeOf(h.prototype,Uint8Array.prototype),Object.setPrototypeOf(h,Uint8Array);function O(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function _(c,s,o){return O(c),c<=0?E(c):s!==void 0?typeof o=="string"?E(c).fill(s,o):E(c).fill(s):E(c)}h.alloc=function(c,s,o){return _(c,s,o)};function P(c){return O(c),E(c<0?0:G(c)|0)}h.allocUnsafe=function(c){return P(c)},h.allocUnsafeSlow=function(c){return P(c)};function R(c,s){if((typeof s!="string"||s==="")&&(s="utf8"),!h.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const o=se(c,s)|0;let p=E(o);const v=p.write(c,s);return v!==o&&(p=p.slice(0,v)),p}function m(c){const s=c.length<0?0:G(c.length)|0,o=E(s);for(let p=0;p<s;p+=1)o[p]=c[p]&255;return o}function T(c){if(st(c,Uint8Array)){const s=new Uint8Array(c);return F(s.buffer,s.byteOffset,s.byteLength)}return m(c)}function F(c,s,o){if(s<0||c.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<s+(o||0))throw new RangeError('"length" is outside of buffer bounds');let p;return s===void 0&&o===void 0?p=new Uint8Array(c):o===void 0?p=new Uint8Array(c,s):p=new Uint8Array(c,s,o),Object.setPrototypeOf(p,h.prototype),p}function U(c){if(h.isBuffer(c)){const s=G(c.length)|0,o=E(s);return o.length===0||c.copy(o,0,0,s),o}if(c.length!==void 0)return typeof c.length!="number"||er(c.length)?E(0):m(c);if(c.type==="Buffer"&&Array.isArray(c.data))return m(c.data)}function G(c){if(c>=N)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+N.toString(16)+" bytes");return c|0}function H(c){return+c!=c&&(c=0),h.alloc(+c)}h.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==h.prototype},h.compare=function(s,o){if(st(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),st(o,Uint8Array)&&(o=h.from(o,o.offset,o.byteLength)),!h.isBuffer(s)||!h.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===o)return 0;let p=s.length,v=o.length;for(let W=0,V=Math.min(p,v);W<V;++W)if(s[W]!==o[W]){p=s[W],v=o[W];break}return p<v?-1:v<p?1:0},h.isEncoding=function(s){switch(String(s).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(s,o){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return h.alloc(0);let p;if(o===void 0)for(o=0,p=0;p<s.length;++p)o+=s[p].length;const v=h.allocUnsafe(o);let W=0;for(p=0;p<s.length;++p){let V=s[p];if(st(V,Uint8Array))W+V.length>v.length?(h.isBuffer(V)||(V=h.from(V)),V.copy(v,W)):Uint8Array.prototype.set.call(v,V,W);else if(h.isBuffer(V))V.copy(v,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=V.length}return v};function se(c,s){if(h.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||st(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);const o=c.length,p=arguments.length>2&&arguments[2]===!0;if(!p&&o===0)return 0;let v=!1;for(;;)switch(s){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Pt(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return yt(c).length;default:if(v)return p?-1:Pt(c).length;s=(""+s).toLowerCase(),v=!0}}h.byteLength=se;function A(c,s,o){let p=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,s>>>=0,o<=s))return"";for(c||(c="utf8");;)switch(c){case"hex":return Je(this,s,o);case"utf8":case"utf-8":return ge(this,s,o);case"ascii":return Ve(this,s,o);case"latin1":case"binary":return fe(this,s,o);case"base64":return ie(this,s,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,s,o);default:if(p)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),p=!0}}h.prototype._isBuffer=!0;function ye(c,s,o){const p=c[s];c[s]=c[o],c[o]=p}h.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<s;o+=2)ye(this,o,o+1);return this},h.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<s;o+=4)ye(this,o,o+3),ye(this,o+1,o+2);return this},h.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<s;o+=8)ye(this,o,o+7),ye(this,o+1,o+6),ye(this,o+2,o+5),ye(this,o+3,o+4);return this},h.prototype.toString=function(){const s=this.length;return s===0?"":arguments.length===0?ge(this,0,s):A.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(s){if(!h.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:h.compare(this,s)===0},h.prototype.inspect=function(){let s="";const o=g.h2;return s=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(s+=" ... "),"<Buffer "+s+">"},K&&(h.prototype[K]=h.prototype.inspect),h.prototype.compare=function(s,o,p,v,W){if(st(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),!h.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(o===void 0&&(o=0),p===void 0&&(p=s?s.length:0),v===void 0&&(v=0),W===void 0&&(W=this.length),o<0||p>s.length||v<0||W>this.length)throw new RangeError("out of range index");if(v>=W&&o>=p)return 0;if(v>=W)return-1;if(o>=p)return 1;if(o>>>=0,p>>>=0,v>>>=0,W>>>=0,this===s)return 0;let V=W-v,Ee=p-o;const Ue=Math.min(V,Ee),Re=this.slice(v,W),de=s.slice(o,p);for(let Ae=0;Ae<Ue;++Ae)if(Re[Ae]!==de[Ae]){V=Re[Ae],Ee=de[Ae];break}return V<Ee?-1:Ee<V?1:0};function Y(c,s,o,p,v){if(c.length===0)return-1;if(typeof o=="string"?(p=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,er(o)&&(o=v?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(v)return-1;o=c.length-1}else if(o<0)if(v)o=0;else return-1;if(typeof s=="string"&&(s=h.from(s,p)),h.isBuffer(s))return s.length===0?-1:ce(c,s,o,p,v);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?v?Uint8Array.prototype.indexOf.call(c,s,o):Uint8Array.prototype.lastIndexOf.call(c,s,o):ce(c,[s],o,p,v);throw new TypeError("val must be string, number or Buffer")}function ce(c,s,o,p,v){let W=1,V=c.length,Ee=s.length;if(p!==void 0&&(p=String(p).toLowerCase(),p==="ucs2"||p==="ucs-2"||p==="utf16le"||p==="utf-16le")){if(c.length<2||s.length<2)return-1;W=2,V/=2,Ee/=2,o/=2}function Ue(de,Ae){return W===1?de[Ae]:de.readUInt16BE(Ae*W)}let Re;if(v){let de=-1;for(Re=o;Re<V;Re++)if(Ue(c,Re)===Ue(s,de===-1?0:Re-de)){if(de===-1&&(de=Re),Re-de+1===Ee)return de*W}else de!==-1&&(Re-=Re-de),de=-1}else for(o+Ee>V&&(o=V-Ee),Re=o;Re>=0;Re--){let de=!0;for(let Ae=0;Ae<Ee;Ae++)if(Ue(c,Re+Ae)!==Ue(s,Ae)){de=!1;break}if(de)return Re}return-1}h.prototype.includes=function(s,o,p){return this.indexOf(s,o,p)!==-1},h.prototype.indexOf=function(s,o,p){return Y(this,s,o,p,!0)},h.prototype.lastIndexOf=function(s,o,p){return Y(this,s,o,p,!1)};function oe(c,s,o,p){o=Number(o)||0;const v=c.length-o;p?(p=Number(p),p>v&&(p=v)):p=v;const W=s.length;p>W/2&&(p=W/2);let V;for(V=0;V<p;++V){const Ee=parseInt(s.substr(V*2,2),16);if(er(Ee))return V;c[o+V]=Ee}return V}function ue(c,s,o,p){return it(Pt(s,c.length-o),c,o,p)}function Z(c,s,o,p){return it(Q(s),c,o,p)}function M(c,s,o,p){return it(yt(s),c,o,p)}function re(c,s,o,p){return it(Xe(s,c.length-o),c,o,p)}h.prototype.write=function(s,o,p,v){if(o===void 0)v="utf8",p=this.length,o=0;else if(p===void 0&&typeof o=="string")v=o,p=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(p)?(p=p>>>0,v===void 0&&(v="utf8")):(v=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const W=this.length-o;if((p===void 0||p>W)&&(p=W),s.length>0&&(p<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");v||(v="utf8");let V=!1;for(;;)switch(v){case"hex":return oe(this,s,o,p);case"utf8":case"utf-8":return ue(this,s,o,p);case"ascii":case"latin1":case"binary":return Z(this,s,o,p);case"base64":return M(this,s,o,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return re(this,s,o,p);default:if(V)throw new TypeError("Unknown encoding: "+v);v=(""+v).toLowerCase(),V=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ie(c,s,o){return s===0&&o===c.length?J.fromByteArray(c):J.fromByteArray(c.slice(s,o))}function ge(c,s,o){o=Math.min(c.length,o);const p=[];let v=s;for(;v<o;){const W=c[v];let V=null,Ee=W>239?4:W>223?3:W>191?2:1;if(v+Ee<=o){let Ue,Re,de,Ae;switch(Ee){case 1:W<128&&(V=W);break;case 2:Ue=c[v+1],(Ue&192)===128&&(Ae=(W&31)<<6|Ue&63,Ae>127&&(V=Ae));break;case 3:Ue=c[v+1],Re=c[v+2],(Ue&192)===128&&(Re&192)===128&&(Ae=(W&15)<<12|(Ue&63)<<6|Re&63,Ae>2047&&(Ae<55296||Ae>57343)&&(V=Ae));break;case 4:Ue=c[v+1],Re=c[v+2],de=c[v+3],(Ue&192)===128&&(Re&192)===128&&(de&192)===128&&(Ae=(W&15)<<18|(Ue&63)<<12|(Re&63)<<6|de&63,Ae>65535&&Ae<1114112&&(V=Ae))}}V===null?(V=65533,Ee=1):V>65535&&(V-=65536,p.push(V>>>10&1023|55296),V=56320|V&1023),p.push(V),v+=Ee}return Oe(p)}const me=4096;function Oe(c){const s=c.length;if(s<=me)return String.fromCharCode.apply(String,c);let o="",p=0;for(;p<s;)o+=String.fromCharCode.apply(String,c.slice(p,p+=me));return o}function Ve(c,s,o){let p="";o=Math.min(c.length,o);for(let v=s;v<o;++v)p+=String.fromCharCode(c[v]&127);return p}function fe(c,s,o){let p="";o=Math.min(c.length,o);for(let v=s;v<o;++v)p+=String.fromCharCode(c[v]);return p}function Je(c,s,o){const p=c.length;(!s||s<0)&&(s=0),(!o||o<0||o>p)&&(o=p);let v="";for(let W=s;W<o;++W)v+=jr[c[W]];return v}function Mt(c,s,o){const p=c.slice(s,o);let v="";for(let W=0;W<p.length-1;W+=2)v+=String.fromCharCode(p[W]+p[W+1]*256);return v}h.prototype.slice=function(s,o){const p=this.length;s=~~s,o=o===void 0?p:~~o,s<0?(s+=p,s<0&&(s=0)):s>p&&(s=p),o<0?(o+=p,o<0&&(o=0)):o>p&&(o=p),o<s&&(o=s);const v=this.subarray(s,o);return Object.setPrototypeOf(v,h.prototype),v};function De(c,s,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+s>o)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=this[s],W=1,V=0;for(;++V<o&&(W*=256);)v+=this[s+V]*W;return v},h.prototype.readUintBE=h.prototype.readUIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=this[s+--o],W=1;for(;o>0&&(W*=256);)v+=this[s+--o]*W;return v},h.prototype.readUint8=h.prototype.readUInt8=function(s,o){return s=s>>>0,o||De(s,1,this.length),this[s]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(s,o){return s=s>>>0,o||De(s,2,this.length),this[s]|this[s+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(s,o){return s=s>>>0,o||De(s,2,this.length),this[s]<<8|this[s+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(s,o){return s=s>>>0,o||De(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(s,o){return s=s>>>0,o||De(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},h.prototype.readBigUInt64LE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,W=this[++s]+this[++s]*2**8+this[++s]*2**16+p*2**24;return BigInt(v)+(BigInt(W)<<BigInt(32))}),h.prototype.readBigUInt64BE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=o*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],W=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p;return(BigInt(v)<<BigInt(32))+BigInt(W)}),h.prototype.readIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=this[s],W=1,V=0;for(;++V<o&&(W*=256);)v+=this[s+V]*W;return W*=128,v>=W&&(v-=Math.pow(2,8*o)),v},h.prototype.readIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=o,W=1,V=this[s+--v];for(;v>0&&(W*=256);)V+=this[s+--v]*W;return W*=128,V>=W&&(V-=Math.pow(2,8*o)),V},h.prototype.readInt8=function(s,o){return s=s>>>0,o||De(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},h.prototype.readInt16LE=function(s,o){s=s>>>0,o||De(s,2,this.length);const p=this[s]|this[s+1]<<8;return p&32768?p|4294901760:p},h.prototype.readInt16BE=function(s,o){s=s>>>0,o||De(s,2,this.length);const p=this[s+1]|this[s]<<8;return p&32768?p|4294901760:p},h.prototype.readInt32LE=function(s,o){return s=s>>>0,o||De(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},h.prototype.readInt32BE=function(s,o){return s=s>>>0,o||De(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},h.prototype.readBigInt64LE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(p<<24);return(BigInt(v)<<BigInt(32))+BigInt(o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),h.prototype.readBigInt64BE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=(o<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(v)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p)}),h.prototype.readFloatLE=function(s,o){return s=s>>>0,o||De(s,4,this.length),B.read(this,s,!0,23,4)},h.prototype.readFloatBE=function(s,o){return s=s>>>0,o||De(s,4,this.length),B.read(this,s,!1,23,4)},h.prototype.readDoubleLE=function(s,o){return s=s>>>0,o||De(s,8,this.length),B.read(this,s,!0,52,8)},h.prototype.readDoubleBE=function(s,o){return s=s>>>0,o||De(s,8,this.length),B.read(this,s,!1,52,8)};function $e(c,s,o,p,v,W){if(!h.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>v||s<W)throw new RangeError('"value" argument is out of bounds');if(o+p>c.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(s,o,p,v){if(s=+s,o=o>>>0,p=p>>>0,!v){const Ee=Math.pow(2,8*p)-1;$e(this,s,o,p,Ee,0)}let W=1,V=0;for(this[o]=s&255;++V<p&&(W*=256);)this[o+V]=s/W&255;return o+p},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(s,o,p,v){if(s=+s,o=o>>>0,p=p>>>0,!v){const Ee=Math.pow(2,8*p)-1;$e(this,s,o,p,Ee,0)}let W=p-1,V=1;for(this[o+W]=s&255;--W>=0&&(V*=256);)this[o+W]=s/V&255;return o+p},h.prototype.writeUint8=h.prototype.writeUInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,255,0),this[o]=s&255,o+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o+3]=s>>>24,this[o+2]=s>>>16,this[o+1]=s>>>8,this[o]=s&255,o+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4};function w(c,s,o,p,v){be(s,p,v,c,o,7);let W=Number(s&BigInt(4294967295));c[o++]=W,W=W>>8,c[o++]=W,W=W>>8,c[o++]=W,W=W>>8,c[o++]=W;let V=Number(s>>BigInt(32)&BigInt(4294967295));return c[o++]=V,V=V>>8,c[o++]=V,V=V>>8,c[o++]=V,V=V>>8,c[o++]=V,o}function b(c,s,o,p,v){be(s,p,v,c,o,7);let W=Number(s&BigInt(4294967295));c[o+7]=W,W=W>>8,c[o+6]=W,W=W>>8,c[o+5]=W,W=W>>8,c[o+4]=W;let V=Number(s>>BigInt(32)&BigInt(4294967295));return c[o+3]=V,V=V>>8,c[o+2]=V,V=V>>8,c[o+1]=V,V=V>>8,c[o]=V,o+8}h.prototype.writeBigUInt64LE=gt(function(s,o=0){return w(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=gt(function(s,o=0){return b(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(s,o,p,v){if(s=+s,o=o>>>0,!v){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let W=0,V=1,Ee=0;for(this[o]=s&255;++W<p&&(V*=256);)s<0&&Ee===0&&this[o+W-1]!==0&&(Ee=1),this[o+W]=(s/V>>0)-Ee&255;return o+p},h.prototype.writeIntBE=function(s,o,p,v){if(s=+s,o=o>>>0,!v){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let W=p-1,V=1,Ee=0;for(this[o+W]=s&255;--W>=0&&(V*=256);)s<0&&Ee===0&&this[o+W+1]!==0&&(Ee=1),this[o+W]=(s/V>>0)-Ee&255;return o+p},h.prototype.writeInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,127,-128),s<0&&(s=255+s+1),this[o]=s&255,o+1},h.prototype.writeInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),this[o]=s&255,this[o+1]=s>>>8,this[o+2]=s>>>16,this[o+3]=s>>>24,o+4},h.prototype.writeInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4},h.prototype.writeBigInt64LE=gt(function(s,o=0){return w(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=gt(function(s,o=0){return b(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function l(c,s,o,p,v,W){if(o+p>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function u(c,s,o,p,v){return s=+s,o=o>>>0,v||l(c,s,o,4,34028234663852886e22,-34028234663852886e22),B.write(c,s,o,p,23,4),o+4}h.prototype.writeFloatLE=function(s,o,p){return u(this,s,o,!0,p)},h.prototype.writeFloatBE=function(s,o,p){return u(this,s,o,!1,p)};function y(c,s,o,p,v){return s=+s,o=o>>>0,v||l(c,s,o,8,17976931348623157e292,-17976931348623157e292),B.write(c,s,o,p,52,8),o+8}h.prototype.writeDoubleLE=function(s,o,p){return y(this,s,o,!0,p)},h.prototype.writeDoubleBE=function(s,o,p){return y(this,s,o,!1,p)},h.prototype.copy=function(s,o,p,v){if(!h.isBuffer(s))throw new TypeError("argument should be a Buffer");if(p||(p=0),!v&&v!==0&&(v=this.length),o>=s.length&&(o=s.length),o||(o=0),v>0&&v<p&&(v=p),v===p||s.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(v<0)throw new RangeError("sourceEnd out of bounds");v>this.length&&(v=this.length),s.length-o<v-p&&(v=s.length-o+p);const W=v-p;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,p,v):Uint8Array.prototype.set.call(s,this.subarray(p,v),o),W},h.prototype.fill=function(s,o,p,v){if(typeof s=="string"){if(typeof o=="string"?(v=o,o=0,p=this.length):typeof p=="string"&&(v=p,p=this.length),v!==void 0&&typeof v!="string")throw new TypeError("encoding must be a string");if(typeof v=="string"&&!h.isEncoding(v))throw new TypeError("Unknown encoding: "+v);if(s.length===1){const V=s.charCodeAt(0);(v==="utf8"&&V<128||v==="latin1")&&(s=V)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));if(o<0||this.length<o||this.length<p)throw new RangeError("Out of range index");if(p<=o)return this;o=o>>>0,p=p===void 0?this.length:p>>>0,s||(s=0);let W;if(typeof s=="number")for(W=o;W<p;++W)this[W]=s;else{const V=h.isBuffer(s)?s:h.from(s,v),Ee=V.length;if(Ee===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(W=0;W<p-o;++W)this[W+o]=V[W%Ee]}return this};const C={};function L(c,s,o){C[c]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${c}]`,this.stack,delete this.name}get code(){return c}set code(v){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:v,writable:!0})}toString(){return`${this.name} [${c}]: ${this.message}`}}}L("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),L("ERR_INVALID_ARG_TYPE",function(c,s){return`The "${c}" argument must be of type number. Received type ${typeof s}`},TypeError),L("ERR_OUT_OF_RANGE",function(c,s,o){let p=`The value of "${c}" is out of range.`,v=o;return Number.isInteger(o)&&Math.abs(o)>2**32?v=k(String(o)):typeof o=="bigint"&&(v=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(v=k(v)),v+="n"),p+=` It must be ${s}. Received ${v}`,p},RangeError);function k(c){let s="",o=c.length;const p=c[0]==="-"?1:0;for(;o>=p+4;o-=3)s=`_${c.slice(o-3,o)}${s}`;return`${c.slice(0,o)}${s}`}function _e(c,s,o){Ne(s,"offset"),(c[s]===void 0||c[s+o]===void 0)&&qe(s,c.length-(o+1))}function be(c,s,o,p,v,W){if(c>o||c<s){const V=typeof s=="bigint"?"n":"";let Ee;throw W>3?s===0||s===BigInt(0)?Ee=`>= 0${V} and < 2${V} ** ${(W+1)*8}${V}`:Ee=`>= -(2${V} ** ${(W+1)*8-1}${V}) and < 2 ** ${(W+1)*8-1}${V}`:Ee=`>= ${s}${V} and <= ${o}${V}`,new C.ERR_OUT_OF_RANGE("value",Ee,c)}_e(p,v,W)}function Ne(c,s){if(typeof c!="number")throw new C.ERR_INVALID_ARG_TYPE(s,"number",c)}function qe(c,s,o){throw Math.floor(c)!==c?(Ne(c,o),new C.ERR_OUT_OF_RANGE(o||"offset","an integer",c)):s<0?new C.ERR_BUFFER_OUT_OF_BOUNDS:new C.ERR_OUT_OF_RANGE(o||"offset",`>= ${o?1:0} and <= ${s}`,c)}const $t=/[^+/0-9A-Za-z-_]/g;function ae(c){if(c=c.split("=")[0],c=c.trim().replace($t,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function Pt(c,s){s=s||1/0;let o;const p=c.length;let v=null;const W=[];for(let V=0;V<p;++V){if(o=c.charCodeAt(V),o>55295&&o<57344){if(!v){if(o>56319){(s-=3)>-1&&W.push(239,191,189);continue}else if(V+1===p){(s-=3)>-1&&W.push(239,191,189);continue}v=o;continue}if(o<56320){(s-=3)>-1&&W.push(239,191,189),v=o;continue}o=(v-55296<<10|o-56320)+65536}else v&&(s-=3)>-1&&W.push(239,191,189);if(v=null,o<128){if((s-=1)<0)break;W.push(o)}else if(o<2048){if((s-=2)<0)break;W.push(o>>6|192,o&63|128)}else if(o<65536){if((s-=3)<0)break;W.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((s-=4)<0)break;W.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return W}function Q(c){const s=[];for(let o=0;o<c.length;++o)s.push(c.charCodeAt(o)&255);return s}function Xe(c,s){let o,p,v;const W=[];for(let V=0;V<c.length&&!((s-=2)<0);++V)o=c.charCodeAt(V),p=o>>8,v=o%256,W.push(v),W.push(p);return W}function yt(c){return J.toByteArray(ae(c))}function it(c,s,o,p){let v;for(v=0;v<p&&!(v+o>=s.length||v>=c.length);++v)s[v+o]=c[v];return v}function st(c,s){return c instanceof s||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===s.name}function er(c){return c!==c}const jr=function(){const c="0123456789abcdef",s=new Array(256);for(let o=0;o<16;++o){const p=o*16;for(let v=0;v<16;++v)s[p+v]=c[o]+c[v]}return s}();function gt(c){return typeof BigInt>"u"?Vr:c}function Vr(){throw new Error("BigInt not supported")}},75134:function(ve,g,D){ve.exports=D(81003)(D(44027))},44027:function(ve,g,D){const j=D(86266).ec,J=new j("secp256k1"),B=J.curve,K=B.n.constructor;function N(f,O){let _=new K(O);if(_.cmp(B.p)>=0)return null;_=_.toRed(B.red);let P=_.redSqr().redIMul(_).redIAdd(B.b).redSqrt();return f===3!==P.isOdd()&&(P=P.redNeg()),J.keyPair({pub:{x:_,y:P}})}function I(f,O,_){let P=new K(O),R=new K(_);if(P.cmp(B.p)>=0||R.cmp(B.p)>=0||(P=P.toRed(B.red),R=R.toRed(B.red),(f===6||f===7)&&R.isOdd()!==(f===7)))return null;const m=P.redSqr().redIMul(P);return R.redSqr().redISub(m.redIAdd(B.b)).isZero()?J.keyPair({pub:{x:P,y:R}}):null}function E(f){const O=f[0];switch(O){case 2:case 3:return f.length!==33?null:N(O,f.subarray(1,33));case 4:case 6:case 7:return f.length!==65?null:I(O,f.subarray(1,33),f.subarray(33,65));default:return null}}function h(f,O){const _=O.encode(null,f.length===33);for(let P=0;P<f.length;++P)f[P]=_[P]}ve.exports={contextRandomize(){return 0},privateKeyVerify(f){const O=new K(f);return O.cmp(B.n)<0&&!O.isZero()?0:1},privateKeyNegate(f){const O=new K(f),_=B.n.sub(O).umod(B.n).toArrayLike(Uint8Array,"be",32);return f.set(_),0},privateKeyTweakAdd(f,O){const _=new K(O);if(_.cmp(B.n)>=0||(_.iadd(new K(f)),_.cmp(B.n)>=0&&_.isub(B.n),_.isZero()))return 1;const P=_.toArrayLike(Uint8Array,"be",32);return f.set(P),0},privateKeyTweakMul(f,O){let _=new K(O);if(_.cmp(B.n)>=0||_.isZero())return 1;_.imul(new K(f)),_.cmp(B.n)>=0&&(_=_.umod(B.n));const P=_.toArrayLike(Uint8Array,"be",32);return f.set(P),0},publicKeyVerify(f){return E(f)===null?1:0},publicKeyCreate(f,O){const _=new K(O);if(_.cmp(B.n)>=0||_.isZero())return 1;const P=J.keyFromPrivate(O).getPublic();return h(f,P),0},publicKeyConvert(f,O){const _=E(O);if(_===null)return 1;const P=_.getPublic();return h(f,P),0},publicKeyNegate(f,O){const _=E(O);if(_===null)return 1;const P=_.getPublic();return P.y=P.y.redNeg(),h(f,P),0},publicKeyCombine(f,O){const _=new Array(O.length);for(let R=0;R<O.length;++R)if(_[R]=E(O[R]),_[R]===null)return 1;let P=_[0].getPublic();for(let R=1;R<_.length;++R)P=P.add(_[R].pub);return P.isInfinity()?2:(h(f,P),0)},publicKeyTweakAdd(f,O,_){const P=E(O);if(P===null)return 1;if(_=new K(_),_.cmp(B.n)>=0)return 2;const R=P.getPublic().add(B.g.mul(_));return R.isInfinity()?2:(h(f,R),0)},publicKeyTweakMul(f,O,_){const P=E(O);if(P===null)return 1;if(_=new K(_),_.cmp(B.n)>=0||_.isZero())return 2;const R=P.getPublic().mul(_);return h(f,R),0},signatureNormalize(f){const O=new K(f.subarray(0,32)),_=new K(f.subarray(32,64));return O.cmp(B.n)>=0||_.cmp(B.n)>=0?1:(_.cmp(J.nh)===1&&f.set(B.n.sub(_).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(f,O){const _=O.subarray(0,32),P=O.subarray(32,64);if(new K(_).cmp(B.n)>=0||new K(P).cmp(B.n)>=0)return 1;const{output:R}=f;let m=R.subarray(4,4+33);m[0]=0,m.set(_,1);let T=33,F=0;for(;T>1&&m[F]===0&&!(m[F+1]&128);--T,++F);if(m=m.subarray(F),m[0]&128||T>1&&m[0]===0&&!(m[1]&128))return 1;let U=R.subarray(6+33,6+33+33);U[0]=0,U.set(P,1);let G=33,H=0;for(;G>1&&U[H]===0&&!(U[H+1]&128);--G,++H);return U=U.subarray(H),U[0]&128||G>1&&U[0]===0&&!(U[1]&128)?1:(f.outputlen=6+T+G,R[0]=48,R[1]=f.outputlen-2,R[2]=2,R[3]=m.length,R.set(m,4),R[4+T]=2,R[5+T]=U.length,R.set(U,6+T),0)},signatureImport(f,O){if(O.length<8||O.length>72||O[0]!==48||O[1]!==O.length-2||O[2]!==2)return 1;const _=O[3];if(_===0||5+_>=O.length||O[4+_]!==2)return 1;const P=O[5+_];if(P===0||6+_+P!==O.length||O[4]&128||_>1&&O[4]===0&&!(O[5]&128)||O[_+6]&128||P>1&&O[_+6]===0&&!(O[_+7]&128))return 1;let R=O.subarray(4,4+_);if(R.length===33&&R[0]===0&&(R=R.subarray(1)),R.length>32)return 1;let m=O.subarray(6+_);if(m.length===33&&m[0]===0&&(m=m.slice(1)),m.length>32)throw new Error("S length is too long");let T=new K(R);T.cmp(B.n)>=0&&(T=new K(0));let F=new K(O.subarray(6+_));return F.cmp(B.n)>=0&&(F=new K(0)),f.set(T.toArrayLike(Uint8Array,"be",32),0),f.set(F.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(f,O,_,P,R){if(R){const F=R;R=U=>{const G=F(O,_,null,P,U);if(!(G instanceof Uint8Array&&G.length===32))throw new Error("This is the way");return new K(G)}}const m=new K(_);if(m.cmp(B.n)>=0||m.isZero())return 1;let T;try{T=J.sign(O,_,{canonical:!0,k:R,pers:P})}catch{return 1}return f.signature.set(T.r.toArrayLike(Uint8Array,"be",32),0),f.signature.set(T.s.toArrayLike(Uint8Array,"be",32),32),f.recid=T.recoveryParam,0},ecdsaVerify(f,O,_){const P={r:f.subarray(0,32),s:f.subarray(32,64)},R=new K(P.r),m=new K(P.s);if(R.cmp(B.n)>=0||m.cmp(B.n)>=0)return 1;if(m.cmp(J.nh)===1||R.isZero()||m.isZero())return 3;const T=E(_);if(T===null)return 2;const F=T.getPublic();return J.verify(O,P,F)?0:3},ecdsaRecover(f,O,_,P){const R={r:O.slice(0,32),s:O.slice(32,64)},m=new K(R.r),T=new K(R.s);if(m.cmp(B.n)>=0||T.cmp(B.n)>=0)return 1;if(m.isZero()||T.isZero())return 2;let F;try{F=J.recoverPubKey(P,R,_)}catch{return 2}return h(f,F),0},ecdh(f,O,_,P,R,m,T){const F=E(O);if(F===null)return 1;const U=new K(_);if(U.cmp(B.n)>=0||U.isZero())return 2;const G=F.getPublic().mul(U);if(R===void 0){const H=G.encode(null,!0),se=J.hash().update(H).digest();for(let A=0;A<32;++A)f[A]=se[A]}else{m||(m=new Uint8Array(32));const H=G.getX().toArray("be",32);for(let Y=0;Y<32;++Y)m[Y]=H[Y];T||(T=new Uint8Array(32));const se=G.getY().toArray("be",32);for(let Y=0;Y<32;++Y)T[Y]=se[Y];const A=R(m,T,P);if(!(A instanceof Uint8Array&&A.length===f.length))return 2;f.set(A)}return 0}}},81003:function(ve){const g={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function D(N,I){if(!N)throw new Error(I)}function j(N,I,E){if(D(I instanceof Uint8Array,`Expected ${N} to be an Uint8Array`),E!==void 0)if(Array.isArray(E)){const h=E.join(", "),f=`Expected ${N} to be an Uint8Array with length [${h}]`;D(E.includes(I.length),f)}else{const h=`Expected ${N} to be an Uint8Array with length ${E}`;D(I.length===E,h)}}function J(N){D(K(N)==="Boolean","Expected compressed to be a Boolean")}function B(N=E=>new Uint8Array(E),I){return typeof N=="function"&&(N=N(I)),j("output",N,I),N}function K(N){return Object.prototype.toString.call(N).slice(8,-1)}ve.exports=N=>({contextRandomize(I){switch(D(I===null||I instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),I!==null&&j("seed",I,32),N.contextRandomize(I)){case 1:throw new Error(g.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(I){return j("private key",I,32),N.privateKeyVerify(I)===0},privateKeyNegate(I){switch(j("private key",I,32),N.privateKeyNegate(I)){case 0:return I;case 1:throw new Error(g.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(I,E){switch(j("private key",I,32),j("tweak",E,32),N.privateKeyTweakAdd(I,E)){case 0:return I;case 1:throw new Error(g.TWEAK_ADD)}},privateKeyTweakMul(I,E){switch(j("private key",I,32),j("tweak",E,32),N.privateKeyTweakMul(I,E)){case 0:return I;case 1:throw new Error(g.TWEAK_MUL)}},publicKeyVerify(I){return j("public key",I,[33,65]),N.publicKeyVerify(I)===0},publicKeyCreate(I,E=!0,h){switch(j("private key",I,32),J(E),h=B(h,E?33:65),N.publicKeyCreate(h,I)){case 0:return h;case 1:throw new Error(g.SECKEY_INVALID);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyConvert(I,E=!0,h){switch(j("public key",I,[33,65]),J(E),h=B(h,E?33:65),N.publicKeyConvert(h,I)){case 0:return h;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyNegate(I,E=!0,h){switch(j("public key",I,[33,65]),J(E),h=B(h,E?33:65),N.publicKeyNegate(h,I)){case 0:return h;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyCombine(I,E=!0,h){D(Array.isArray(I),"Expected public keys to be an Array"),D(I.length>0,"Expected public keys array will have more than zero items");for(const f of I)j("public key",f,[33,65]);switch(J(E),h=B(h,E?33:65),N.publicKeyCombine(h,I)){case 0:return h;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_COMBINE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(I,E,h=!0,f){switch(j("public key",I,[33,65]),j("tweak",E,32),J(h),f=B(f,h?33:65),N.publicKeyTweakAdd(f,I,E)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_ADD)}},publicKeyTweakMul(I,E,h=!0,f){switch(j("public key",I,[33,65]),j("tweak",E,32),J(h),f=B(f,h?33:65),N.publicKeyTweakMul(f,I,E)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_MUL)}},signatureNormalize(I){switch(j("signature",I,64),N.signatureNormalize(I)){case 0:return I;case 1:throw new Error(g.SIG_PARSE)}},signatureExport(I,E){j("signature",I,64),E=B(E,72);const h={output:E,outputlen:72};switch(N.signatureExport(h,I)){case 0:return E.slice(0,h.outputlen);case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},signatureImport(I,E){switch(j("signature",I),E=B(E,64),N.signatureImport(E,I)){case 0:return E;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaSign(I,E,h={},f){j("message",I,32),j("private key",E,32),D(K(h)==="Object","Expected options to be an Object"),h.data!==void 0&&j("options.data",h.data),h.noncefn!==void 0&&D(K(h.noncefn)==="Function","Expected options.noncefn to be a Function"),f=B(f,64);const O={signature:f,recid:null};switch(N.ecdsaSign(O,I,E,h.data,h.noncefn)){case 0:return O;case 1:throw new Error(g.SIGN);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaVerify(I,E,h){switch(j("signature",I,64),j("message",E,32),j("public key",h,[33,65]),N.ecdsaVerify(I,E,h)){case 0:return!0;case 3:return!1;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.PUBKEY_PARSE)}},ecdsaRecover(I,E,h,f=!0,O){switch(j("signature",I,64),D(K(E)==="Number"&&E>=0&&E<=3,"Expected recovery id to be a Number within interval [0, 3]"),j("message",h,32),J(f),O=B(O,f?33:65),N.ecdsaRecover(O,I,E,h)){case 0:return O;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.RECOVER);case 3:throw new Error(g.IMPOSSIBLE_CASE)}},ecdh(I,E,h={},f){switch(j("public key",I,[33,65]),j("private key",E,32),D(K(h)==="Object","Expected options to be an Object"),h.data!==void 0&&j("options.data",h.data),h.hashfn!==void 0?(D(K(h.hashfn)==="Function","Expected options.hashfn to be a Function"),h.xbuf!==void 0&&j("options.xbuf",h.xbuf,32),h.ybuf!==void 0&&j("options.ybuf",h.ybuf,32),j("output",f)):f=B(f,32),N.ecdh(f,I,E,h.data,h.hashfn,h.xbuf,h.ybuf)){case 0:return f;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.ECDH)}}})},25532:function(ve,g,D){"use strict";var j=D(48764).Buffer,J=this&&this.__createBinding||(Object.create?function(Z,M,re,ie){ie===void 0&&(ie=re),Object.defineProperty(Z,ie,{enumerable:!0,get:function(){return M[re]}})}:function(Z,M,re,ie){ie===void 0&&(ie=re),Z[ie]=M[re]}),B=this&&this.__setModuleDefault||(Object.create?function(Z,M){Object.defineProperty(Z,"default",{enumerable:!0,value:M})}:function(Z,M){Z.default=M}),K=this&&this.__decorate||function(Z,M,re,ie){var ge=arguments.length,me=ge<3?M:ie===null?ie=Object.getOwnPropertyDescriptor(M,re):ie,Oe;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")me=Reflect.decorate(Z,M,re,ie);else for(var Ve=Z.length-1;Ve>=0;Ve--)(Oe=Z[Ve])&&(me=(ge<3?Oe(me):ge>3?Oe(M,re,me):Oe(M,re))||me);return ge>3&&me&&Object.defineProperty(M,re,me),me},N=this&&this.__importStar||function(Z){if(Z&&Z.__esModule)return Z;var M={};if(Z!=null)for(var re in Z)re!=="default"&&Object.hasOwnProperty.call(Z,re)&&J(M,Z,re);return B(M,Z),M},I=this&&this.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(g,"__esModule",{value:!0}),g.deserializeUnchecked=g.deserialize=g.serialize=g.BinaryReader=g.BinaryWriter=g.BorshError=g.baseDecode=g.baseEncode=void 0;const E=I(D(13550)),h=I(D(77191)),f=N(D(11379)),O=typeof D.g.TextDecoder!="function"?f.TextDecoder:D.g.TextDecoder,_=new O("utf-8",{fatal:!0});function P(Z){return typeof Z=="string"&&(Z=j.from(Z,"utf8")),h.default.encode(j.from(Z))}g.baseEncode=P;function R(Z){return j.from(h.default.decode(Z))}g.baseDecode=R;const m=1024;class T extends Error{constructor(M){super(M),this.fieldPath=[],this.originalMessage=M}addToFieldPath(M){this.fieldPath.splice(0,0,M),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}g.BorshError=T;class F{constructor(){this.buf=j.alloc(m),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=j.concat([this.buf,j.alloc(m)]))}writeU8(M){this.maybeResize(),this.buf.writeUInt8(M,this.length),this.length+=1}writeU16(M){this.maybeResize(),this.buf.writeUInt16LE(M,this.length),this.length+=2}writeU32(M){this.maybeResize(),this.buf.writeUInt32LE(M,this.length),this.length+=4}writeU64(M){this.maybeResize(),this.writeBuffer(j.from(new E.default(M).toArray("le",8)))}writeU128(M){this.maybeResize(),this.writeBuffer(j.from(new E.default(M).toArray("le",16)))}writeU256(M){this.maybeResize(),this.writeBuffer(j.from(new E.default(M).toArray("le",32)))}writeU512(M){this.maybeResize(),this.writeBuffer(j.from(new E.default(M).toArray("le",64)))}writeBuffer(M){this.buf=j.concat([j.from(this.buf.subarray(0,this.length)),M,j.alloc(m)]),this.length+=M.length}writeString(M){this.maybeResize();const re=j.from(M,"utf8");this.writeU32(re.length),this.writeBuffer(re)}writeFixedArray(M){this.writeBuffer(j.from(M))}writeArray(M,re){this.maybeResize(),this.writeU32(M.length);for(const ie of M)this.maybeResize(),re(ie)}toArray(){return this.buf.subarray(0,this.length)}}g.BinaryWriter=F;function U(Z,M,re){const ie=re.value;re.value=function(...ge){try{return ie.apply(this,ge)}catch(me){if(me instanceof RangeError){const Oe=me.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(Oe)>=0)throw new T("Reached the end of buffer when deserializing")}throw me}}}class G{constructor(M){this.buf=M,this.offset=0}readU8(){const M=this.buf.readUInt8(this.offset);return this.offset+=1,M}readU16(){const M=this.buf.readUInt16LE(this.offset);return this.offset+=2,M}readU32(){const M=this.buf.readUInt32LE(this.offset);return this.offset+=4,M}readU64(){const M=this.readBuffer(8);return new E.default(M,"le")}readU128(){const M=this.readBuffer(16);return new E.default(M,"le")}readU256(){const M=this.readBuffer(32);return new E.default(M,"le")}readU512(){const M=this.readBuffer(64);return new E.default(M,"le")}readBuffer(M){if(this.offset+M>this.buf.length)throw new T(`Expected buffer length ${M} isn't within bounds`);const re=this.buf.slice(this.offset,this.offset+M);return this.offset+=M,re}readString(){const M=this.readU32(),re=this.readBuffer(M);try{return _.decode(re)}catch(ie){throw new T(`Error decoding UTF-8 string: ${ie}`)}}readFixedArray(M){return new Uint8Array(this.readBuffer(M))}readArray(M){const re=this.readU32(),ie=Array();for(let ge=0;ge<re;++ge)ie.push(M());return ie}}K([U],G.prototype,"readU8",null),K([U],G.prototype,"readU16",null),K([U],G.prototype,"readU32",null),K([U],G.prototype,"readU64",null),K([U],G.prototype,"readU128",null),K([U],G.prototype,"readU256",null),K([U],G.prototype,"readU512",null),K([U],G.prototype,"readString",null),K([U],G.prototype,"readFixedArray",null),K([U],G.prototype,"readArray",null),g.BinaryReader=G;function H(Z){return Z.charAt(0).toUpperCase()+Z.slice(1)}function se(Z,M,re,ie,ge){try{if(typeof ie=="string")ge[`write${H(ie)}`](re);else if(ie instanceof Array)if(typeof ie[0]=="number"){if(re.length!==ie[0])throw new T(`Expecting byte array of length ${ie[0]}, but got ${re.length} bytes`);ge.writeFixedArray(re)}else ge.writeArray(re,me=>{se(Z,M,me,ie[0],ge)});else if(ie.kind!==void 0)switch(ie.kind){case"option":{re==null?ge.writeU8(0):(ge.writeU8(1),se(Z,M,re,ie.type,ge));break}default:throw new T(`FieldType ${ie} unrecognized`)}else A(Z,re,ge)}catch(me){throw me instanceof T&&me.addToFieldPath(M),me}}function A(Z,M,re){const ie=Z.get(M.constructor);if(!ie)throw new T(`Class ${M.constructor.name} is missing in schema`);if(ie.kind==="struct")ie.fields.map(([ge,me])=>{se(Z,ge,M[ge],me,re)});else if(ie.kind==="enum"){const ge=M[ie.field];for(let me=0;me<ie.values.length;++me){const[Oe,Ve]=ie.values[me];if(Oe===ge){re.writeU8(me),se(Z,Oe,M[Oe],Ve,re);break}}}else throw new T(`Unexpected schema kind: ${ie.kind} for ${M.constructor.name}`)}function ye(Z,M){const re=new F;return A(Z,M,re),re.toArray()}g.serialize=ye;function Y(Z,M,re,ie){try{return typeof re=="string"?ie[`read${H(re)}`]():re instanceof Array?typeof re[0]=="number"?ie.readFixedArray(re[0]):ie.readArray(()=>Y(Z,M,re[0],ie)):re.kind==="option"?ie.readU8()?Y(Z,M,re.type,ie):void 0:ce(Z,re,ie)}catch(ge){throw ge instanceof T&&ge.addToFieldPath(M),ge}}function ce(Z,M,re){const ie=Z.get(M);if(!ie)throw new T(`Class ${M.name} is missing in schema`);if(ie.kind==="struct"){const ge={};for(const[me,Oe]of Z.get(M).fields)ge[me]=Y(Z,me,Oe,re);return new M(ge)}if(ie.kind==="enum"){const ge=re.readU8();if(ge>=ie.values.length)throw new T(`Enum index: ${ge} is out of range`);const[me,Oe]=ie.values[ge],Ve=Y(Z,me,Oe,re);return new M({[me]:Ve})}throw new T(`Unexpected schema kind: ${ie.kind} for ${M.constructor.name}`)}function oe(Z,M,re){const ie=new G(re),ge=ce(Z,M,ie);if(ie.offset<re.length)throw new T(`Unexpected ${re.length-ie.offset} bytes after deserialized data`);return ge}g.deserialize=oe;function ue(Z,M,re){const ie=new G(re);return ce(Z,M,ie)}g.deserializeUnchecked=ue},37953:function(ve){/*!
|
|
115
|
+
*/const J=L(79742),B=L(80645),K=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;g.lW=h,z=H,g.h2=50;const N=2147483647;z=N,h.TYPED_ARRAY_SUPPORT=I(),!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function I(){try{const c=new Uint8Array(1),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(c,s),c.foo()===42}catch{return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(!!h.isBuffer(this))return this.byteOffset}});function E(c){if(c>N)throw new RangeError('The value "'+c+'" is invalid for option "size"');const s=new Uint8Array(c);return Object.setPrototypeOf(s,h.prototype),s}function h(c,s,o){if(typeof c=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return U(c)}return u(c,s,o)}h.poolSize=8192;function u(c,s,o){if(typeof c=="string")return T(c,s);if(ArrayBuffer.isView(c))return C(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(st(c,ArrayBuffer)||c&&st(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(st(c,SharedArrayBuffer)||c&&st(c.buffer,SharedArrayBuffer)))return A(c,s,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const p=c.valueOf&&c.valueOf();if(p!=null&&p!==c)return h.from(p,s,o);const v=R(c);if(v)return v;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return h.from(c[Symbol.toPrimitive]("string"),s,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}h.from=function(c,s,o){return u(c,s,o)},Object.setPrototypeOf(h.prototype,Uint8Array.prototype),Object.setPrototypeOf(h,Uint8Array);function O(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function k(c,s,o){return O(c),c<=0?E(c):s!==void 0?typeof o=="string"?E(c).fill(s,o):E(c).fill(s):E(c)}h.alloc=function(c,s,o){return k(c,s,o)};function U(c){return O(c),E(c<0?0:V(c)|0)}h.allocUnsafe=function(c){return U(c)},h.allocUnsafeSlow=function(c){return U(c)};function T(c,s){if((typeof s!="string"||s==="")&&(s="utf8"),!h.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const o=ne(c,s)|0;let p=E(o);const v=p.write(c,s);return v!==o&&(p=p.slice(0,v)),p}function m(c){const s=c.length<0?0:V(c.length)|0,o=E(s);for(let p=0;p<s;p+=1)o[p]=c[p]&255;return o}function C(c){if(st(c,Uint8Array)){const s=new Uint8Array(c);return A(s.buffer,s.byteOffset,s.byteLength)}return m(c)}function A(c,s,o){if(s<0||c.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<s+(o||0))throw new RangeError('"length" is outside of buffer bounds');let p;return s===void 0&&o===void 0?p=new Uint8Array(c):o===void 0?p=new Uint8Array(c,s):p=new Uint8Array(c,s,o),Object.setPrototypeOf(p,h.prototype),p}function R(c){if(h.isBuffer(c)){const s=V(c.length)|0,o=E(s);return o.length===0||c.copy(o,0,0,s),o}if(c.length!==void 0)return typeof c.length!="number"||er(c.length)?E(0):m(c);if(c.type==="Buffer"&&Array.isArray(c.data))return m(c.data)}function V(c){if(c>=N)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+N.toString(16)+" bytes");return c|0}function H(c){return+c!=c&&(c=0),h.alloc(+c)}h.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==h.prototype},h.compare=function(s,o){if(st(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),st(o,Uint8Array)&&(o=h.from(o,o.offset,o.byteLength)),!h.isBuffer(s)||!h.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===o)return 0;let p=s.length,v=o.length;for(let W=0,G=Math.min(p,v);W<G;++W)if(s[W]!==o[W]){p=s[W],v=o[W];break}return p<v?-1:v<p?1:0},h.isEncoding=function(s){switch(String(s).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(s,o){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return h.alloc(0);let p;if(o===void 0)for(o=0,p=0;p<s.length;++p)o+=s[p].length;const v=h.allocUnsafe(o);let W=0;for(p=0;p<s.length;++p){let G=s[p];if(st(G,Uint8Array))W+G.length>v.length?(h.isBuffer(G)||(G=h.from(G)),G.copy(v,W)):Uint8Array.prototype.set.call(v,G,W);else if(h.isBuffer(G))G.copy(v,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=G.length}return v};function ne(c,s){if(h.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||st(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);const o=c.length,p=arguments.length>2&&arguments[2]===!0;if(!p&&o===0)return 0;let v=!1;for(;;)switch(s){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Pt(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return yt(c).length;default:if(v)return p?-1:Pt(c).length;s=(""+s).toLowerCase(),v=!0}}h.byteLength=ne;function x(c,s,o){let p=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,s>>>=0,o<=s))return"";for(c||(c="utf8");;)switch(c){case"hex":return Je(this,s,o);case"utf8":case"utf-8":return ge(this,s,o);case"ascii":return Ve(this,s,o);case"latin1":case"binary":return le(this,s,o);case"base64":return oe(this,s,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,s,o);default:if(p)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),p=!0}}h.prototype._isBuffer=!0;function fe(c,s,o){const p=c[s];c[s]=c[o],c[o]=p}h.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<s;o+=2)fe(this,o,o+1);return this},h.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<s;o+=4)fe(this,o,o+3),fe(this,o+1,o+2);return this},h.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<s;o+=8)fe(this,o,o+7),fe(this,o+1,o+6),fe(this,o+2,o+5),fe(this,o+3,o+4);return this},h.prototype.toString=function(){const s=this.length;return s===0?"":arguments.length===0?ge(this,0,s):x.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(s){if(!h.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:h.compare(this,s)===0},h.prototype.inspect=function(){let s="";const o=g.h2;return s=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(s+=" ... "),"<Buffer "+s+">"},K&&(h.prototype[K]=h.prototype.inspect),h.prototype.compare=function(s,o,p,v,W){if(st(s,Uint8Array)&&(s=h.from(s,s.offset,s.byteLength)),!h.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(o===void 0&&(o=0),p===void 0&&(p=s?s.length:0),v===void 0&&(v=0),W===void 0&&(W=this.length),o<0||p>s.length||v<0||W>this.length)throw new RangeError("out of range index");if(v>=W&&o>=p)return 0;if(v>=W)return-1;if(o>=p)return 1;if(o>>>=0,p>>>=0,v>>>=0,W>>>=0,this===s)return 0;let G=W-v,Se=p-o;const Ue=Math.min(G,Se),Re=this.slice(v,W),pe=s.slice(o,p);for(let Ae=0;Ae<Ue;++Ae)if(Re[Ae]!==pe[Ae]){G=Re[Ae],Se=pe[Ae];break}return G<Se?-1:Se<G?1:0};function q(c,s,o,p,v){if(c.length===0)return-1;if(typeof o=="string"?(p=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,er(o)&&(o=v?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(v)return-1;o=c.length-1}else if(o<0)if(v)o=0;else return-1;if(typeof s=="string"&&(s=h.from(s,p)),h.isBuffer(s))return s.length===0?-1:ce(c,s,o,p,v);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?v?Uint8Array.prototype.indexOf.call(c,s,o):Uint8Array.prototype.lastIndexOf.call(c,s,o):ce(c,[s],o,p,v);throw new TypeError("val must be string, number or Buffer")}function ce(c,s,o,p,v){let W=1,G=c.length,Se=s.length;if(p!==void 0&&(p=String(p).toLowerCase(),p==="ucs2"||p==="ucs-2"||p==="utf16le"||p==="utf-16le")){if(c.length<2||s.length<2)return-1;W=2,G/=2,Se/=2,o/=2}function Ue(pe,Ae){return W===1?pe[Ae]:pe.readUInt16BE(Ae*W)}let Re;if(v){let pe=-1;for(Re=o;Re<G;Re++)if(Ue(c,Re)===Ue(s,pe===-1?0:Re-pe)){if(pe===-1&&(pe=Re),Re-pe+1===Se)return pe*W}else pe!==-1&&(Re-=Re-pe),pe=-1}else for(o+Se>G&&(o=G-Se),Re=o;Re>=0;Re--){let pe=!0;for(let Ae=0;Ae<Se;Ae++)if(Ue(c,Re+Ae)!==Ue(s,Ae)){pe=!1;break}if(pe)return Re}return-1}h.prototype.includes=function(s,o,p){return this.indexOf(s,o,p)!==-1},h.prototype.indexOf=function(s,o,p){return q(this,s,o,p,!0)},h.prototype.lastIndexOf=function(s,o,p){return q(this,s,o,p,!1)};function re(c,s,o,p){o=Number(o)||0;const v=c.length-o;p?(p=Number(p),p>v&&(p=v)):p=v;const W=s.length;p>W/2&&(p=W/2);let G;for(G=0;G<p;++G){const Se=parseInt(s.substr(G*2,2),16);if(er(Se))return G;c[o+G]=Se}return G}function ae(c,s,o,p){return it(Pt(s,c.length-o),c,o,p)}function Y(c,s,o,p){return it(Q(s),c,o,p)}function $(c,s,o,p){return it(yt(s),c,o,p)}function ie(c,s,o,p){return it(Xe(s,c.length-o),c,o,p)}h.prototype.write=function(s,o,p,v){if(o===void 0)v="utf8",p=this.length,o=0;else if(p===void 0&&typeof o=="string")v=o,p=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(p)?(p=p>>>0,v===void 0&&(v="utf8")):(v=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const W=this.length-o;if((p===void 0||p>W)&&(p=W),s.length>0&&(p<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");v||(v="utf8");let G=!1;for(;;)switch(v){case"hex":return re(this,s,o,p);case"utf8":case"utf-8":return ae(this,s,o,p);case"ascii":case"latin1":case"binary":return Y(this,s,o,p);case"base64":return $(this,s,o,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,s,o,p);default:if(G)throw new TypeError("Unknown encoding: "+v);v=(""+v).toLowerCase(),G=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function oe(c,s,o){return s===0&&o===c.length?J.fromByteArray(c):J.fromByteArray(c.slice(s,o))}function ge(c,s,o){o=Math.min(c.length,o);const p=[];let v=s;for(;v<o;){const W=c[v];let G=null,Se=W>239?4:W>223?3:W>191?2:1;if(v+Se<=o){let Ue,Re,pe,Ae;switch(Se){case 1:W<128&&(G=W);break;case 2:Ue=c[v+1],(Ue&192)===128&&(Ae=(W&31)<<6|Ue&63,Ae>127&&(G=Ae));break;case 3:Ue=c[v+1],Re=c[v+2],(Ue&192)===128&&(Re&192)===128&&(Ae=(W&15)<<12|(Ue&63)<<6|Re&63,Ae>2047&&(Ae<55296||Ae>57343)&&(G=Ae));break;case 4:Ue=c[v+1],Re=c[v+2],pe=c[v+3],(Ue&192)===128&&(Re&192)===128&&(pe&192)===128&&(Ae=(W&15)<<18|(Ue&63)<<12|(Re&63)<<6|pe&63,Ae>65535&&Ae<1114112&&(G=Ae))}}G===null?(G=65533,Se=1):G>65535&&(G-=65536,p.push(G>>>10&1023|55296),G=56320|G&1023),p.push(G),v+=Se}return Oe(p)}const me=4096;function Oe(c){const s=c.length;if(s<=me)return String.fromCharCode.apply(String,c);let o="",p=0;for(;p<s;)o+=String.fromCharCode.apply(String,c.slice(p,p+=me));return o}function Ve(c,s,o){let p="";o=Math.min(c.length,o);for(let v=s;v<o;++v)p+=String.fromCharCode(c[v]&127);return p}function le(c,s,o){let p="";o=Math.min(c.length,o);for(let v=s;v<o;++v)p+=String.fromCharCode(c[v]);return p}function Je(c,s,o){const p=c.length;(!s||s<0)&&(s=0),(!o||o<0||o>p)&&(o=p);let v="";for(let W=s;W<o;++W)v+=jr[c[W]];return v}function Mt(c,s,o){const p=c.slice(s,o);let v="";for(let W=0;W<p.length-1;W+=2)v+=String.fromCharCode(p[W]+p[W+1]*256);return v}h.prototype.slice=function(s,o){const p=this.length;s=~~s,o=o===void 0?p:~~o,s<0?(s+=p,s<0&&(s=0)):s>p&&(s=p),o<0?(o+=p,o<0&&(o=0)):o>p&&(o=p),o<s&&(o=s);const v=this.subarray(s,o);return Object.setPrototypeOf(v,h.prototype),v};function De(c,s,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+s>o)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=this[s],W=1,G=0;for(;++G<o&&(W*=256);)v+=this[s+G]*W;return v},h.prototype.readUintBE=h.prototype.readUIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=this[s+--o],W=1;for(;o>0&&(W*=256);)v+=this[s+--o]*W;return v},h.prototype.readUint8=h.prototype.readUInt8=function(s,o){return s=s>>>0,o||De(s,1,this.length),this[s]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(s,o){return s=s>>>0,o||De(s,2,this.length),this[s]|this[s+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(s,o){return s=s>>>0,o||De(s,2,this.length),this[s]<<8|this[s+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(s,o){return s=s>>>0,o||De(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(s,o){return s=s>>>0,o||De(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},h.prototype.readBigUInt64LE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,W=this[++s]+this[++s]*2**8+this[++s]*2**16+p*2**24;return BigInt(v)+(BigInt(W)<<BigInt(32))}),h.prototype.readBigUInt64BE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=o*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],W=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p;return(BigInt(v)<<BigInt(32))+BigInt(W)}),h.prototype.readIntLE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=this[s],W=1,G=0;for(;++G<o&&(W*=256);)v+=this[s+G]*W;return W*=128,v>=W&&(v-=Math.pow(2,8*o)),v},h.prototype.readIntBE=function(s,o,p){s=s>>>0,o=o>>>0,p||De(s,o,this.length);let v=o,W=1,G=this[s+--v];for(;v>0&&(W*=256);)G+=this[s+--v]*W;return W*=128,G>=W&&(G-=Math.pow(2,8*o)),G},h.prototype.readInt8=function(s,o){return s=s>>>0,o||De(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},h.prototype.readInt16LE=function(s,o){s=s>>>0,o||De(s,2,this.length);const p=this[s]|this[s+1]<<8;return p&32768?p|4294901760:p},h.prototype.readInt16BE=function(s,o){s=s>>>0,o||De(s,2,this.length);const p=this[s+1]|this[s]<<8;return p&32768?p|4294901760:p},h.prototype.readInt32LE=function(s,o){return s=s>>>0,o||De(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},h.prototype.readInt32BE=function(s,o){return s=s>>>0,o||De(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},h.prototype.readBigInt64LE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(p<<24);return(BigInt(v)<<BigInt(32))+BigInt(o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),h.prototype.readBigInt64BE=gt(function(s){s=s>>>0,Ne(s,"offset");const o=this[s],p=this[s+7];(o===void 0||p===void 0)&&qe(s,this.length-8);const v=(o<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(v)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+p)}),h.prototype.readFloatLE=function(s,o){return s=s>>>0,o||De(s,4,this.length),B.read(this,s,!0,23,4)},h.prototype.readFloatBE=function(s,o){return s=s>>>0,o||De(s,4,this.length),B.read(this,s,!1,23,4)},h.prototype.readDoubleLE=function(s,o){return s=s>>>0,o||De(s,8,this.length),B.read(this,s,!0,52,8)},h.prototype.readDoubleBE=function(s,o){return s=s>>>0,o||De(s,8,this.length),B.read(this,s,!1,52,8)};function $e(c,s,o,p,v,W){if(!h.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>v||s<W)throw new RangeError('"value" argument is out of bounds');if(o+p>c.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(s,o,p,v){if(s=+s,o=o>>>0,p=p>>>0,!v){const Se=Math.pow(2,8*p)-1;$e(this,s,o,p,Se,0)}let W=1,G=0;for(this[o]=s&255;++G<p&&(W*=256);)this[o+G]=s/W&255;return o+p},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(s,o,p,v){if(s=+s,o=o>>>0,p=p>>>0,!v){const Se=Math.pow(2,8*p)-1;$e(this,s,o,p,Se,0)}let W=p-1,G=1;for(this[o+W]=s&255;--W>=0&&(G*=256);)this[o+W]=s/G&255;return o+p},h.prototype.writeUint8=h.prototype.writeUInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,255,0),this[o]=s&255,o+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,65535,0),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o+3]=s>>>24,this[o+2]=s>>>16,this[o+1]=s>>>8,this[o]=s&255,o+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,4294967295,0),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4};function w(c,s,o,p,v){be(s,p,v,c,o,7);let W=Number(s&BigInt(4294967295));c[o++]=W,W=W>>8,c[o++]=W,W=W>>8,c[o++]=W,W=W>>8,c[o++]=W;let G=Number(s>>BigInt(32)&BigInt(4294967295));return c[o++]=G,G=G>>8,c[o++]=G,G=G>>8,c[o++]=G,G=G>>8,c[o++]=G,o}function b(c,s,o,p,v){be(s,p,v,c,o,7);let W=Number(s&BigInt(4294967295));c[o+7]=W,W=W>>8,c[o+6]=W,W=W>>8,c[o+5]=W,W=W>>8,c[o+4]=W;let G=Number(s>>BigInt(32)&BigInt(4294967295));return c[o+3]=G,G=G>>8,c[o+2]=G,G=G>>8,c[o+1]=G,G=G>>8,c[o]=G,o+8}h.prototype.writeBigUInt64LE=gt(function(s,o=0){return w(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=gt(function(s,o=0){return b(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(s,o,p,v){if(s=+s,o=o>>>0,!v){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let W=0,G=1,Se=0;for(this[o]=s&255;++W<p&&(G*=256);)s<0&&Se===0&&this[o+W-1]!==0&&(Se=1),this[o+W]=(s/G>>0)-Se&255;return o+p},h.prototype.writeIntBE=function(s,o,p,v){if(s=+s,o=o>>>0,!v){const Ue=Math.pow(2,8*p-1);$e(this,s,o,p,Ue-1,-Ue)}let W=p-1,G=1,Se=0;for(this[o+W]=s&255;--W>=0&&(G*=256);)s<0&&Se===0&&this[o+W+1]!==0&&(Se=1),this[o+W]=(s/G>>0)-Se&255;return o+p},h.prototype.writeInt8=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,1,127,-128),s<0&&(s=255+s+1),this[o]=s&255,o+1},h.prototype.writeInt16LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s&255,this[o+1]=s>>>8,o+2},h.prototype.writeInt16BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,2,32767,-32768),this[o]=s>>>8,this[o+1]=s&255,o+2},h.prototype.writeInt32LE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),this[o]=s&255,this[o+1]=s>>>8,this[o+2]=s>>>16,this[o+3]=s>>>24,o+4},h.prototype.writeInt32BE=function(s,o,p){return s=+s,o=o>>>0,p||$e(this,s,o,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4},h.prototype.writeBigInt64LE=gt(function(s,o=0){return w(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=gt(function(s,o=0){return b(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function l(c,s,o,p,v,W){if(o+p>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function f(c,s,o,p,v){return s=+s,o=o>>>0,v||l(c,s,o,4,34028234663852886e22,-34028234663852886e22),B.write(c,s,o,p,23,4),o+4}h.prototype.writeFloatLE=function(s,o,p){return f(this,s,o,!0,p)},h.prototype.writeFloatBE=function(s,o,p){return f(this,s,o,!1,p)};function y(c,s,o,p,v){return s=+s,o=o>>>0,v||l(c,s,o,8,17976931348623157e292,-17976931348623157e292),B.write(c,s,o,p,52,8),o+8}h.prototype.writeDoubleLE=function(s,o,p){return y(this,s,o,!0,p)},h.prototype.writeDoubleBE=function(s,o,p){return y(this,s,o,!1,p)},h.prototype.copy=function(s,o,p,v){if(!h.isBuffer(s))throw new TypeError("argument should be a Buffer");if(p||(p=0),!v&&v!==0&&(v=this.length),o>=s.length&&(o=s.length),o||(o=0),v>0&&v<p&&(v=p),v===p||s.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(v<0)throw new RangeError("sourceEnd out of bounds");v>this.length&&(v=this.length),s.length-o<v-p&&(v=s.length-o+p);const W=v-p;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,p,v):Uint8Array.prototype.set.call(s,this.subarray(p,v),o),W},h.prototype.fill=function(s,o,p,v){if(typeof s=="string"){if(typeof o=="string"?(v=o,o=0,p=this.length):typeof p=="string"&&(v=p,p=this.length),v!==void 0&&typeof v!="string")throw new TypeError("encoding must be a string");if(typeof v=="string"&&!h.isEncoding(v))throw new TypeError("Unknown encoding: "+v);if(s.length===1){const G=s.charCodeAt(0);(v==="utf8"&&G<128||v==="latin1")&&(s=G)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));if(o<0||this.length<o||this.length<p)throw new RangeError("Out of range index");if(p<=o)return this;o=o>>>0,p=p===void 0?this.length:p>>>0,s||(s=0);let W;if(typeof s=="number")for(W=o;W<p;++W)this[W]=s;else{const G=h.isBuffer(s)?s:h.from(s,v),Se=G.length;if(Se===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(W=0;W<p-o;++W)this[W+o]=G[W%Se]}return this};const F={};function D(c,s,o){F[c]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${c}]`,this.stack,delete this.name}get code(){return c}set code(v){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:v,writable:!0})}toString(){return`${this.name} [${c}]: ${this.message}`}}}D("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),D("ERR_INVALID_ARG_TYPE",function(c,s){return`The "${c}" argument must be of type number. Received type ${typeof s}`},TypeError),D("ERR_OUT_OF_RANGE",function(c,s,o){let p=`The value of "${c}" is out of range.`,v=o;return Number.isInteger(o)&&Math.abs(o)>2**32?v=_(String(o)):typeof o=="bigint"&&(v=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(v=_(v)),v+="n"),p+=` It must be ${s}. Received ${v}`,p},RangeError);function _(c){let s="",o=c.length;const p=c[0]==="-"?1:0;for(;o>=p+4;o-=3)s=`_${c.slice(o-3,o)}${s}`;return`${c.slice(0,o)}${s}`}function _e(c,s,o){Ne(s,"offset"),(c[s]===void 0||c[s+o]===void 0)&&qe(s,c.length-(o+1))}function be(c,s,o,p,v,W){if(c>o||c<s){const G=typeof s=="bigint"?"n":"";let Se;throw W>3?s===0||s===BigInt(0)?Se=`>= 0${G} and < 2${G} ** ${(W+1)*8}${G}`:Se=`>= -(2${G} ** ${(W+1)*8-1}${G}) and < 2 ** ${(W+1)*8-1}${G}`:Se=`>= ${s}${G} and <= ${o}${G}`,new F.ERR_OUT_OF_RANGE("value",Se,c)}_e(p,v,W)}function Ne(c,s){if(typeof c!="number")throw new F.ERR_INVALID_ARG_TYPE(s,"number",c)}function qe(c,s,o){throw Math.floor(c)!==c?(Ne(c,o),new F.ERR_OUT_OF_RANGE(o||"offset","an integer",c)):s<0?new F.ERR_BUFFER_OUT_OF_BOUNDS:new F.ERR_OUT_OF_RANGE(o||"offset",`>= ${o?1:0} and <= ${s}`,c)}const $t=/[^+/0-9A-Za-z-_]/g;function ue(c){if(c=c.split("=")[0],c=c.trim().replace($t,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function Pt(c,s){s=s||1/0;let o;const p=c.length;let v=null;const W=[];for(let G=0;G<p;++G){if(o=c.charCodeAt(G),o>55295&&o<57344){if(!v){if(o>56319){(s-=3)>-1&&W.push(239,191,189);continue}else if(G+1===p){(s-=3)>-1&&W.push(239,191,189);continue}v=o;continue}if(o<56320){(s-=3)>-1&&W.push(239,191,189),v=o;continue}o=(v-55296<<10|o-56320)+65536}else v&&(s-=3)>-1&&W.push(239,191,189);if(v=null,o<128){if((s-=1)<0)break;W.push(o)}else if(o<2048){if((s-=2)<0)break;W.push(o>>6|192,o&63|128)}else if(o<65536){if((s-=3)<0)break;W.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((s-=4)<0)break;W.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return W}function Q(c){const s=[];for(let o=0;o<c.length;++o)s.push(c.charCodeAt(o)&255);return s}function Xe(c,s){let o,p,v;const W=[];for(let G=0;G<c.length&&!((s-=2)<0);++G)o=c.charCodeAt(G),p=o>>8,v=o%256,W.push(v),W.push(p);return W}function yt(c){return J.toByteArray(ue(c))}function it(c,s,o,p){let v;for(v=0;v<p&&!(v+o>=s.length||v>=c.length);++v)s[v+o]=c[v];return v}function st(c,s){return c instanceof s||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===s.name}function er(c){return c!==c}const jr=function(){const c="0123456789abcdef",s=new Array(256);for(let o=0;o<16;++o){const p=o*16;for(let v=0;v<16;++v)s[p+v]=c[o]+c[v]}return s}();function gt(c){return typeof BigInt>"u"?Vr:c}function Vr(){throw new Error("BigInt not supported")}},75134:function(Ee,g,L){Ee.exports=L(81003)(L(44027))},44027:function(Ee,g,L){const z=L(86266).ec,J=new z("secp256k1"),B=J.curve,K=B.n.constructor;function N(u,O){let k=new K(O);if(k.cmp(B.p)>=0)return null;k=k.toRed(B.red);let U=k.redSqr().redIMul(k).redIAdd(B.b).redSqrt();return u===3!==U.isOdd()&&(U=U.redNeg()),J.keyPair({pub:{x:k,y:U}})}function I(u,O,k){let U=new K(O),T=new K(k);if(U.cmp(B.p)>=0||T.cmp(B.p)>=0||(U=U.toRed(B.red),T=T.toRed(B.red),(u===6||u===7)&&T.isOdd()!==(u===7)))return null;const m=U.redSqr().redIMul(U);return T.redSqr().redISub(m.redIAdd(B.b)).isZero()?J.keyPair({pub:{x:U,y:T}}):null}function E(u){const O=u[0];switch(O){case 2:case 3:return u.length!==33?null:N(O,u.subarray(1,33));case 4:case 6:case 7:return u.length!==65?null:I(O,u.subarray(1,33),u.subarray(33,65));default:return null}}function h(u,O){const k=O.encode(null,u.length===33);for(let U=0;U<u.length;++U)u[U]=k[U]}Ee.exports={contextRandomize(){return 0},privateKeyVerify(u){const O=new K(u);return O.cmp(B.n)<0&&!O.isZero()?0:1},privateKeyNegate(u){const O=new K(u),k=B.n.sub(O).umod(B.n).toArrayLike(Uint8Array,"be",32);return u.set(k),0},privateKeyTweakAdd(u,O){const k=new K(O);if(k.cmp(B.n)>=0||(k.iadd(new K(u)),k.cmp(B.n)>=0&&k.isub(B.n),k.isZero()))return 1;const U=k.toArrayLike(Uint8Array,"be",32);return u.set(U),0},privateKeyTweakMul(u,O){let k=new K(O);if(k.cmp(B.n)>=0||k.isZero())return 1;k.imul(new K(u)),k.cmp(B.n)>=0&&(k=k.umod(B.n));const U=k.toArrayLike(Uint8Array,"be",32);return u.set(U),0},publicKeyVerify(u){return E(u)===null?1:0},publicKeyCreate(u,O){const k=new K(O);if(k.cmp(B.n)>=0||k.isZero())return 1;const U=J.keyFromPrivate(O).getPublic();return h(u,U),0},publicKeyConvert(u,O){const k=E(O);if(k===null)return 1;const U=k.getPublic();return h(u,U),0},publicKeyNegate(u,O){const k=E(O);if(k===null)return 1;const U=k.getPublic();return U.y=U.y.redNeg(),h(u,U),0},publicKeyCombine(u,O){const k=new Array(O.length);for(let T=0;T<O.length;++T)if(k[T]=E(O[T]),k[T]===null)return 1;let U=k[0].getPublic();for(let T=1;T<k.length;++T)U=U.add(k[T].pub);return U.isInfinity()?2:(h(u,U),0)},publicKeyTweakAdd(u,O,k){const U=E(O);if(U===null)return 1;if(k=new K(k),k.cmp(B.n)>=0)return 2;const T=U.getPublic().add(B.g.mul(k));return T.isInfinity()?2:(h(u,T),0)},publicKeyTweakMul(u,O,k){const U=E(O);if(U===null)return 1;if(k=new K(k),k.cmp(B.n)>=0||k.isZero())return 2;const T=U.getPublic().mul(k);return h(u,T),0},signatureNormalize(u){const O=new K(u.subarray(0,32)),k=new K(u.subarray(32,64));return O.cmp(B.n)>=0||k.cmp(B.n)>=0?1:(k.cmp(J.nh)===1&&u.set(B.n.sub(k).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(u,O){const k=O.subarray(0,32),U=O.subarray(32,64);if(new K(k).cmp(B.n)>=0||new K(U).cmp(B.n)>=0)return 1;const{output:T}=u;let m=T.subarray(4,4+33);m[0]=0,m.set(k,1);let C=33,A=0;for(;C>1&&m[A]===0&&!(m[A+1]&128);--C,++A);if(m=m.subarray(A),m[0]&128||C>1&&m[0]===0&&!(m[1]&128))return 1;let R=T.subarray(6+33,6+33+33);R[0]=0,R.set(U,1);let V=33,H=0;for(;V>1&&R[H]===0&&!(R[H+1]&128);--V,++H);return R=R.subarray(H),R[0]&128||V>1&&R[0]===0&&!(R[1]&128)?1:(u.outputlen=6+C+V,T[0]=48,T[1]=u.outputlen-2,T[2]=2,T[3]=m.length,T.set(m,4),T[4+C]=2,T[5+C]=R.length,T.set(R,6+C),0)},signatureImport(u,O){if(O.length<8||O.length>72||O[0]!==48||O[1]!==O.length-2||O[2]!==2)return 1;const k=O[3];if(k===0||5+k>=O.length||O[4+k]!==2)return 1;const U=O[5+k];if(U===0||6+k+U!==O.length||O[4]&128||k>1&&O[4]===0&&!(O[5]&128)||O[k+6]&128||U>1&&O[k+6]===0&&!(O[k+7]&128))return 1;let T=O.subarray(4,4+k);if(T.length===33&&T[0]===0&&(T=T.subarray(1)),T.length>32)return 1;let m=O.subarray(6+k);if(m.length===33&&m[0]===0&&(m=m.slice(1)),m.length>32)throw new Error("S length is too long");let C=new K(T);C.cmp(B.n)>=0&&(C=new K(0));let A=new K(O.subarray(6+k));return A.cmp(B.n)>=0&&(A=new K(0)),u.set(C.toArrayLike(Uint8Array,"be",32),0),u.set(A.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(u,O,k,U,T){if(T){const A=T;T=R=>{const V=A(O,k,null,U,R);if(!(V instanceof Uint8Array&&V.length===32))throw new Error("This is the way");return new K(V)}}const m=new K(k);if(m.cmp(B.n)>=0||m.isZero())return 1;let C;try{C=J.sign(O,k,{canonical:!0,k:T,pers:U})}catch{return 1}return u.signature.set(C.r.toArrayLike(Uint8Array,"be",32),0),u.signature.set(C.s.toArrayLike(Uint8Array,"be",32),32),u.recid=C.recoveryParam,0},ecdsaVerify(u,O,k){const U={r:u.subarray(0,32),s:u.subarray(32,64)},T=new K(U.r),m=new K(U.s);if(T.cmp(B.n)>=0||m.cmp(B.n)>=0)return 1;if(m.cmp(J.nh)===1||T.isZero()||m.isZero())return 3;const C=E(k);if(C===null)return 2;const A=C.getPublic();return J.verify(O,U,A)?0:3},ecdsaRecover(u,O,k,U){const T={r:O.slice(0,32),s:O.slice(32,64)},m=new K(T.r),C=new K(T.s);if(m.cmp(B.n)>=0||C.cmp(B.n)>=0)return 1;if(m.isZero()||C.isZero())return 2;let A;try{A=J.recoverPubKey(U,T,k)}catch{return 2}return h(u,A),0},ecdh(u,O,k,U,T,m,C){const A=E(O);if(A===null)return 1;const R=new K(k);if(R.cmp(B.n)>=0||R.isZero())return 2;const V=A.getPublic().mul(R);if(T===void 0){const H=V.encode(null,!0),ne=J.hash().update(H).digest();for(let x=0;x<32;++x)u[x]=ne[x]}else{m||(m=new Uint8Array(32));const H=V.getX().toArray("be",32);for(let q=0;q<32;++q)m[q]=H[q];C||(C=new Uint8Array(32));const ne=V.getY().toArray("be",32);for(let q=0;q<32;++q)C[q]=ne[q];const x=T(m,C,U);if(!(x instanceof Uint8Array&&x.length===u.length))return 2;u.set(x)}return 0}}},81003:function(Ee){const g={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function L(N,I){if(!N)throw new Error(I)}function z(N,I,E){if(L(I instanceof Uint8Array,`Expected ${N} to be an Uint8Array`),E!==void 0)if(Array.isArray(E)){const h=E.join(", "),u=`Expected ${N} to be an Uint8Array with length [${h}]`;L(E.includes(I.length),u)}else{const h=`Expected ${N} to be an Uint8Array with length ${E}`;L(I.length===E,h)}}function J(N){L(K(N)==="Boolean","Expected compressed to be a Boolean")}function B(N=E=>new Uint8Array(E),I){return typeof N=="function"&&(N=N(I)),z("output",N,I),N}function K(N){return Object.prototype.toString.call(N).slice(8,-1)}Ee.exports=N=>({contextRandomize(I){switch(L(I===null||I instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),I!==null&&z("seed",I,32),N.contextRandomize(I)){case 1:throw new Error(g.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(I){return z("private key",I,32),N.privateKeyVerify(I)===0},privateKeyNegate(I){switch(z("private key",I,32),N.privateKeyNegate(I)){case 0:return I;case 1:throw new Error(g.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(I,E){switch(z("private key",I,32),z("tweak",E,32),N.privateKeyTweakAdd(I,E)){case 0:return I;case 1:throw new Error(g.TWEAK_ADD)}},privateKeyTweakMul(I,E){switch(z("private key",I,32),z("tweak",E,32),N.privateKeyTweakMul(I,E)){case 0:return I;case 1:throw new Error(g.TWEAK_MUL)}},publicKeyVerify(I){return z("public key",I,[33,65]),N.publicKeyVerify(I)===0},publicKeyCreate(I,E=!0,h){switch(z("private key",I,32),J(E),h=B(h,E?33:65),N.publicKeyCreate(h,I)){case 0:return h;case 1:throw new Error(g.SECKEY_INVALID);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyConvert(I,E=!0,h){switch(z("public key",I,[33,65]),J(E),h=B(h,E?33:65),N.publicKeyConvert(h,I)){case 0:return h;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyNegate(I,E=!0,h){switch(z("public key",I,[33,65]),J(E),h=B(h,E?33:65),N.publicKeyNegate(h,I)){case 0:return h;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyCombine(I,E=!0,h){L(Array.isArray(I),"Expected public keys to be an Array"),L(I.length>0,"Expected public keys array will have more than zero items");for(const u of I)z("public key",u,[33,65]);switch(J(E),h=B(h,E?33:65),N.publicKeyCombine(h,I)){case 0:return h;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.PUBKEY_COMBINE);case 3:throw new Error(g.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(I,E,h=!0,u){switch(z("public key",I,[33,65]),z("tweak",E,32),J(h),u=B(u,h?33:65),N.publicKeyTweakAdd(u,I,E)){case 0:return u;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_ADD)}},publicKeyTweakMul(I,E,h=!0,u){switch(z("public key",I,[33,65]),z("tweak",E,32),J(h),u=B(u,h?33:65),N.publicKeyTweakMul(u,I,E)){case 0:return u;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.TWEAK_MUL)}},signatureNormalize(I){switch(z("signature",I,64),N.signatureNormalize(I)){case 0:return I;case 1:throw new Error(g.SIG_PARSE)}},signatureExport(I,E){z("signature",I,64),E=B(E,72);const h={output:E,outputlen:72};switch(N.signatureExport(h,I)){case 0:return E.slice(0,h.outputlen);case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},signatureImport(I,E){switch(z("signature",I),E=B(E,64),N.signatureImport(E,I)){case 0:return E;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaSign(I,E,h={},u){z("message",I,32),z("private key",E,32),L(K(h)==="Object","Expected options to be an Object"),h.data!==void 0&&z("options.data",h.data),h.noncefn!==void 0&&L(K(h.noncefn)==="Function","Expected options.noncefn to be a Function"),u=B(u,64);const O={signature:u,recid:null};switch(N.ecdsaSign(O,I,E,h.data,h.noncefn)){case 0:return O;case 1:throw new Error(g.SIGN);case 2:throw new Error(g.IMPOSSIBLE_CASE)}},ecdsaVerify(I,E,h){switch(z("signature",I,64),z("message",E,32),z("public key",h,[33,65]),N.ecdsaVerify(I,E,h)){case 0:return!0;case 3:return!1;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.PUBKEY_PARSE)}},ecdsaRecover(I,E,h,u=!0,O){switch(z("signature",I,64),L(K(E)==="Number"&&E>=0&&E<=3,"Expected recovery id to be a Number within interval [0, 3]"),z("message",h,32),J(u),O=B(O,u?33:65),N.ecdsaRecover(O,I,E,h)){case 0:return O;case 1:throw new Error(g.SIG_PARSE);case 2:throw new Error(g.RECOVER);case 3:throw new Error(g.IMPOSSIBLE_CASE)}},ecdh(I,E,h={},u){switch(z("public key",I,[33,65]),z("private key",E,32),L(K(h)==="Object","Expected options to be an Object"),h.data!==void 0&&z("options.data",h.data),h.hashfn!==void 0?(L(K(h.hashfn)==="Function","Expected options.hashfn to be a Function"),h.xbuf!==void 0&&z("options.xbuf",h.xbuf,32),h.ybuf!==void 0&&z("options.ybuf",h.ybuf,32),z("output",u)):u=B(u,32),N.ecdh(u,I,E,h.data,h.hashfn,h.xbuf,h.ybuf)){case 0:return u;case 1:throw new Error(g.PUBKEY_PARSE);case 2:throw new Error(g.ECDH)}}})},58162:function(Ee,g,L){"use strict";var z=L(89509).Buffer;function J(B){if(B.length>=255)throw new TypeError("Alphabet too long");for(var K=new Uint8Array(256),N=0;N<K.length;N++)K[N]=255;for(var I=0;I<B.length;I++){var E=B.charAt(I),h=E.charCodeAt(0);if(K[h]!==255)throw new TypeError(E+" is ambiguous");K[h]=I}var u=B.length,O=B.charAt(0),k=Math.log(u)/Math.log(256),U=Math.log(256)/Math.log(u);function T(A){if((Array.isArray(A)||A instanceof Uint8Array)&&(A=z.from(A)),!z.isBuffer(A))throw new TypeError("Expected Buffer");if(A.length===0)return"";for(var R=0,V=0,H=0,ne=A.length;H!==ne&&A[H]===0;)H++,R++;for(var x=(ne-H)*U+1>>>0,fe=new Uint8Array(x);H!==ne;){for(var q=A[H],ce=0,re=x-1;(q!==0||ce<V)&&re!==-1;re--,ce++)q+=256*fe[re]>>>0,fe[re]=q%u>>>0,q=q/u>>>0;if(q!==0)throw new Error("Non-zero carry");V=ce,H++}for(var ae=x-V;ae!==x&&fe[ae]===0;)ae++;for(var Y=O.repeat(R);ae<x;++ae)Y+=B.charAt(fe[ae]);return Y}function m(A){if(typeof A!="string")throw new TypeError("Expected String");if(A.length===0)return z.alloc(0);for(var R=0,V=0,H=0;A[R]===O;)V++,R++;for(var ne=(A.length-R)*k+1>>>0,x=new Uint8Array(ne);A[R];){var fe=K[A.charCodeAt(R)];if(fe===255)return;for(var q=0,ce=ne-1;(fe!==0||q<H)&&ce!==-1;ce--,q++)fe+=u*x[ce]>>>0,x[ce]=fe%256>>>0,fe=fe/256>>>0;if(fe!==0)throw new Error("Non-zero carry");H=q,R++}for(var re=ne-H;re!==ne&&x[re]===0;)re++;var ae=z.allocUnsafe(V+(ne-re));ae.fill(0,0,V);for(var Y=V;re!==ne;)ae[Y++]=x[re++];return ae}function C(A){var R=m(A);if(R)return R;throw new Error("Non-base"+u+" character")}return{encode:T,decodeUnsafe:m,decode:C}}Ee.exports=J},25532:function(Ee,g,L){"use strict";var z=L(48764).Buffer,J=this&&this.__createBinding||(Object.create?function(Y,$,ie,oe){oe===void 0&&(oe=ie),Object.defineProperty(Y,oe,{enumerable:!0,get:function(){return $[ie]}})}:function(Y,$,ie,oe){oe===void 0&&(oe=ie),Y[oe]=$[ie]}),B=this&&this.__setModuleDefault||(Object.create?function(Y,$){Object.defineProperty(Y,"default",{enumerable:!0,value:$})}:function(Y,$){Y.default=$}),K=this&&this.__decorate||function(Y,$,ie,oe){var ge=arguments.length,me=ge<3?$:oe===null?oe=Object.getOwnPropertyDescriptor($,ie):oe,Oe;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")me=Reflect.decorate(Y,$,ie,oe);else for(var Ve=Y.length-1;Ve>=0;Ve--)(Oe=Y[Ve])&&(me=(ge<3?Oe(me):ge>3?Oe($,ie,me):Oe($,ie))||me);return ge>3&&me&&Object.defineProperty($,ie,me),me},N=this&&this.__importStar||function(Y){if(Y&&Y.__esModule)return Y;var $={};if(Y!=null)for(var ie in Y)ie!=="default"&&Object.hasOwnProperty.call(Y,ie)&&J($,Y,ie);return B($,Y),$},I=this&&this.__importDefault||function(Y){return Y&&Y.__esModule?Y:{default:Y}};Object.defineProperty(g,"__esModule",{value:!0}),g.deserializeUnchecked=g.deserialize=g.serialize=g.BinaryReader=g.BinaryWriter=g.BorshError=g.baseDecode=g.baseEncode=void 0;const E=I(L(13550)),h=I(L(77191)),u=N(L(11379)),O=typeof L.g.TextDecoder!="function"?u.TextDecoder:L.g.TextDecoder,k=new O("utf-8",{fatal:!0});function U(Y){return typeof Y=="string"&&(Y=z.from(Y,"utf8")),h.default.encode(z.from(Y))}g.baseEncode=U;function T(Y){return z.from(h.default.decode(Y))}g.baseDecode=T;const m=1024;class C extends Error{constructor($){super($),this.fieldPath=[],this.originalMessage=$}addToFieldPath($){this.fieldPath.splice(0,0,$),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}g.BorshError=C;class A{constructor(){this.buf=z.alloc(m),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=z.concat([this.buf,z.alloc(m)]))}writeU8($){this.maybeResize(),this.buf.writeUInt8($,this.length),this.length+=1}writeU16($){this.maybeResize(),this.buf.writeUInt16LE($,this.length),this.length+=2}writeU32($){this.maybeResize(),this.buf.writeUInt32LE($,this.length),this.length+=4}writeU64($){this.maybeResize(),this.writeBuffer(z.from(new E.default($).toArray("le",8)))}writeU128($){this.maybeResize(),this.writeBuffer(z.from(new E.default($).toArray("le",16)))}writeU256($){this.maybeResize(),this.writeBuffer(z.from(new E.default($).toArray("le",32)))}writeU512($){this.maybeResize(),this.writeBuffer(z.from(new E.default($).toArray("le",64)))}writeBuffer($){this.buf=z.concat([z.from(this.buf.subarray(0,this.length)),$,z.alloc(m)]),this.length+=$.length}writeString($){this.maybeResize();const ie=z.from($,"utf8");this.writeU32(ie.length),this.writeBuffer(ie)}writeFixedArray($){this.writeBuffer(z.from($))}writeArray($,ie){this.maybeResize(),this.writeU32($.length);for(const oe of $)this.maybeResize(),ie(oe)}toArray(){return this.buf.subarray(0,this.length)}}g.BinaryWriter=A;function R(Y,$,ie){const oe=ie.value;ie.value=function(...ge){try{return oe.apply(this,ge)}catch(me){if(me instanceof RangeError){const Oe=me.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(Oe)>=0)throw new C("Reached the end of buffer when deserializing")}throw me}}}class V{constructor($){this.buf=$,this.offset=0}readU8(){const $=this.buf.readUInt8(this.offset);return this.offset+=1,$}readU16(){const $=this.buf.readUInt16LE(this.offset);return this.offset+=2,$}readU32(){const $=this.buf.readUInt32LE(this.offset);return this.offset+=4,$}readU64(){const $=this.readBuffer(8);return new E.default($,"le")}readU128(){const $=this.readBuffer(16);return new E.default($,"le")}readU256(){const $=this.readBuffer(32);return new E.default($,"le")}readU512(){const $=this.readBuffer(64);return new E.default($,"le")}readBuffer($){if(this.offset+$>this.buf.length)throw new C(`Expected buffer length ${$} isn't within bounds`);const ie=this.buf.slice(this.offset,this.offset+$);return this.offset+=$,ie}readString(){const $=this.readU32(),ie=this.readBuffer($);try{return k.decode(ie)}catch(oe){throw new C(`Error decoding UTF-8 string: ${oe}`)}}readFixedArray($){return new Uint8Array(this.readBuffer($))}readArray($){const ie=this.readU32(),oe=Array();for(let ge=0;ge<ie;++ge)oe.push($());return oe}}K([R],V.prototype,"readU8",null),K([R],V.prototype,"readU16",null),K([R],V.prototype,"readU32",null),K([R],V.prototype,"readU64",null),K([R],V.prototype,"readU128",null),K([R],V.prototype,"readU256",null),K([R],V.prototype,"readU512",null),K([R],V.prototype,"readString",null),K([R],V.prototype,"readFixedArray",null),K([R],V.prototype,"readArray",null),g.BinaryReader=V;function H(Y){return Y.charAt(0).toUpperCase()+Y.slice(1)}function ne(Y,$,ie,oe,ge){try{if(typeof oe=="string")ge[`write${H(oe)}`](ie);else if(oe instanceof Array)if(typeof oe[0]=="number"){if(ie.length!==oe[0])throw new C(`Expecting byte array of length ${oe[0]}, but got ${ie.length} bytes`);ge.writeFixedArray(ie)}else ge.writeArray(ie,me=>{ne(Y,$,me,oe[0],ge)});else if(oe.kind!==void 0)switch(oe.kind){case"option":{ie==null?ge.writeU8(0):(ge.writeU8(1),ne(Y,$,ie,oe.type,ge));break}default:throw new C(`FieldType ${oe} unrecognized`)}else x(Y,ie,ge)}catch(me){throw me instanceof C&&me.addToFieldPath($),me}}function x(Y,$,ie){const oe=Y.get($.constructor);if(!oe)throw new C(`Class ${$.constructor.name} is missing in schema`);if(oe.kind==="struct")oe.fields.map(([ge,me])=>{ne(Y,ge,$[ge],me,ie)});else if(oe.kind==="enum"){const ge=$[oe.field];for(let me=0;me<oe.values.length;++me){const[Oe,Ve]=oe.values[me];if(Oe===ge){ie.writeU8(me),ne(Y,Oe,$[Oe],Ve,ie);break}}}else throw new C(`Unexpected schema kind: ${oe.kind} for ${$.constructor.name}`)}function fe(Y,$){const ie=new A;return x(Y,$,ie),ie.toArray()}g.serialize=fe;function q(Y,$,ie,oe){try{return typeof ie=="string"?oe[`read${H(ie)}`]():ie instanceof Array?typeof ie[0]=="number"?oe.readFixedArray(ie[0]):oe.readArray(()=>q(Y,$,ie[0],oe)):ie.kind==="option"?oe.readU8()?q(Y,$,ie.type,oe):void 0:ce(Y,ie,oe)}catch(ge){throw ge instanceof C&&ge.addToFieldPath($),ge}}function ce(Y,$,ie){const oe=Y.get($);if(!oe)throw new C(`Class ${$.name} is missing in schema`);if(oe.kind==="struct"){const ge={};for(const[me,Oe]of Y.get($).fields)ge[me]=q(Y,me,Oe,ie);return new $(ge)}if(oe.kind==="enum"){const ge=ie.readU8();if(ge>=oe.values.length)throw new C(`Enum index: ${ge} is out of range`);const[me,Oe]=oe.values[ge],Ve=q(Y,me,Oe,ie);return new $({[me]:Ve})}throw new C(`Unexpected schema kind: ${oe.kind} for ${$.constructor.name}`)}function re(Y,$,ie){const oe=new V(ie),ge=ce(Y,$,oe);if(oe.offset<ie.length)throw new C(`Unexpected ${ie.length-oe.offset} bytes after deserialized data`);return ge}g.deserialize=re;function ae(Y,$,ie){const oe=new V(ie);return ce(Y,$,oe)}g.deserializeUnchecked=ae},77191:function(Ee,g,L){var z=L(58162),J="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Ee.exports=z(J)},37953:function(Ee){/*!
|
|
116
116
|
Copyright (C) 2013-2017 by Andrea Giammarchi - @WebReflection
|
|
117
117
|
|
|
118
118
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
@@ -133,4 +133,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
133
133
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
134
134
|
THE SOFTWARE.
|
|
135
135
|
|
|
136
|
-
*/var g="~",D="\\x"+("0"+g.charCodeAt(0).toString(16)).slice(-2),j="\\"+D,J=new RegExp(D,"g"),B=new RegExp(j,"g"),K=new RegExp("(?:^|([^\\\\]))"+j),N=[].indexOf||function(m){for(var T=this.length;T--&&this[T]!==m;);return T},I=String;function E(m,T,F){var U=!1,G=!!T,H=[],se=[m],A=[m],ye=[F?g:"[Circular]"],Y=m,ce=1,oe,ue;return G&&(ue=typeof T=="object"?function(Z,M){return Z!==""&&T.indexOf(Z)<0?void 0:M}:T),function(Z,M){return G&&(M=ue.call(this,Z,M)),U?(Y!==this&&(oe=ce-N.call(se,this)-1,ce-=oe,se.splice(ce,se.length),H.splice(ce-1,H.length),Y=this),typeof M=="object"&&M?(N.call(se,M)<0&&se.push(Y=M),ce=se.length,oe=N.call(A,M),oe<0?(oe=A.push(M)-1,F?(H.push((""+Z).replace(J,D)),ye[oe]=g+H.join(g)):ye[oe]=ye[0]):M=ye[oe]):typeof M=="string"&&F&&(M=M.replace(D,j).replace(g,D))):U=!0,M}}function h(m,T){for(var F=0,U=T.length;F<U;m=m[T[F++].replace(B,g)]);return m}function f(m){return function(T,F){var U=typeof F=="string";return U&&F.charAt(0)===g?new I(F.slice(1)):(T===""&&(F=P(F,F,{})),U&&(F=F.replace(K,"$1"+g).replace(j,D)),m?m.call(this,T,F):F)}}function O(m,T,F){for(var U=0,G=T.length;U<G;U++)T[U]=P(m,T[U],F);return T}function _(m,T,F){for(var U in T)T.hasOwnProperty(U)&&(T[U]=P(m,T[U],F));return T}function P(m,T,F){return T instanceof Array?O(m,T,F):T instanceof I?T.length?F.hasOwnProperty(T)?F[T]:F[T]=h(m,T.split(g)):m:T instanceof Object?_(m,T,F):T}var R={stringify:function(T,F,U,G){return R.parser.stringify(T,E(T,F,!G),U)},parse:function(T,F){return R.parser.parse(T,f(F))},parser:JSON};ve.exports=R},58355:function(ve,g,D){"use strict";var j=D(35717),J=D(51031),B=D(71027),K=D(89509).Buffer,N=D(78028),I=D(79785),E=D(89072),h=K.alloc(128);function f(O,_){B.call(this,"digest"),typeof _=="string"&&(_=K.from(_));var P=O==="sha512"||O==="sha384"?128:64;if(this._alg=O,this._key=_,_.length>P){var R=O==="rmd160"?new I:E(O);_=R.update(_).digest()}else _.length<P&&(_=K.concat([_,h],P));for(var m=this._ipad=K.allocUnsafe(P),T=this._opad=K.allocUnsafe(P),F=0;F<P;F++)m[F]=_[F]^54,T[F]=_[F]^92;this._hash=O==="rmd160"?new I:E(O),this._hash.update(m)}j(f,B),f.prototype._update=function(O){this._hash.update(O)},f.prototype._final=function(){var O=this._hash.digest(),_=this._alg==="rmd160"?new I:E(this._alg);return _.update(this._opad).update(O).digest()},ve.exports=function(_,P){return _=_.toLowerCase(),_==="rmd160"||_==="ripemd160"?new f("rmd160",P):_==="md5"?new J(N,P):new f(_,P)}},51031:function(ve,g,D){"use strict";var j=D(35717),J=D(89509).Buffer,B=D(71027),K=J.alloc(128),N=64;function I(E,h){B.call(this,"digest"),typeof h=="string"&&(h=J.from(h)),this._alg=E,this._key=h,h.length>N?h=E(h):h.length<N&&(h=J.concat([h,K],N));for(var f=this._ipad=J.allocUnsafe(N),O=this._opad=J.allocUnsafe(N),_=0;_<N;_++)f[_]=h[_]^54,O[_]=h[_]^92;this._hash=[f]}j(I,B),I.prototype._update=function(E){this._hash.push(E)},I.prototype._final=function(){var E=this._alg(J.concat(this._hash));return this._alg(J.concat([this._opad,E]))},ve.exports=I},62678:function(ve,g,D){"use strict";var j=D(48764).Buffer;Object.defineProperty(g,"__esModule",{value:!0}),g.derivePath=g.isValidPath=g.getPublicKey=g.CKDPriv=g.getMasterKeyFromSeed=void 0;const J=D(58355),B=D(50780),K=D(91110),N="ed25519 seed",I=2147483648;g.getMasterKeyFromSeed=E=>{const f=J("sha512",N).update(j.from(E,"hex")).digest(),O=f.slice(0,32),_=f.slice(32);return{key:O,chainCode:_}},g.CKDPriv=({key:E,chainCode:h},f)=>{const O=j.allocUnsafe(4);O.writeUInt32BE(f,0);const _=j.concat([j.alloc(1,0),E,O]),P=J("sha512",h).update(_).digest(),R=P.slice(0,32),m=P.slice(32);return{key:R,chainCode:m}},g.getPublicKey=(E,h=!0)=>{const O=B.sign.keyPair.fromSeed(E).secretKey.subarray(32),_=j.alloc(1,0);return h?j.concat([_,j.from(O)]):j.from(O)},g.isValidPath=E=>K.pathRegex.test(E)?!E.split("/").slice(1).map(K.replaceDerive).some(isNaN):!1,g.derivePath=(E,h,f=I)=>{if(!g.isValidPath(E))throw new Error("Invalid derivation path");const{key:O,chainCode:_}=g.getMasterKeyFromSeed(h);return E.split("/").slice(1).map(K.replaceDerive).map(R=>parseInt(R,10)).reduce((R,m)=>g.CKDPriv(R,m+f),{key:O,chainCode:_})}},91110:function(ve,g){"use strict";Object.defineProperty(g,"__esModule",{value:!0}),g.replaceDerive=g.pathRegex=void 0,g.pathRegex=new RegExp("^m(\\/[0-9]+')+$"),g.replaceDerive=D=>D.replace("'","")},26729:function(ve){"use strict";var g=Object.prototype.hasOwnProperty,D="~";function j(){}Object.create&&(j.prototype=Object.create(null),new j().__proto__||(D=!1));function J(I,E,h){this.fn=I,this.context=E,this.once=h||!1}function B(I,E,h,f,O){if(typeof h!="function")throw new TypeError("The listener must be a function");var _=new J(h,f||I,O),P=D?D+E:E;return I._events[P]?I._events[P].fn?I._events[P]=[I._events[P],_]:I._events[P].push(_):(I._events[P]=_,I._eventsCount++),I}function K(I,E){--I._eventsCount===0?I._events=new j:delete I._events[E]}function N(){this._events=new j,this._eventsCount=0}N.prototype.eventNames=function(){var E=[],h,f;if(this._eventsCount===0)return E;for(f in h=this._events)g.call(h,f)&&E.push(D?f.slice(1):f);return Object.getOwnPropertySymbols?E.concat(Object.getOwnPropertySymbols(h)):E},N.prototype.listeners=function(E){var h=D?D+E:E,f=this._events[h];if(!f)return[];if(f.fn)return[f.fn];for(var O=0,_=f.length,P=new Array(_);O<_;O++)P[O]=f[O].fn;return P},N.prototype.listenerCount=function(E){var h=D?D+E:E,f=this._events[h];return f?f.fn?1:f.length:0},N.prototype.emit=function(E,h,f,O,_,P){var R=D?D+E:E;if(!this._events[R])return!1;var m=this._events[R],T=arguments.length,F,U;if(m.fn){switch(m.once&&this.removeListener(E,m.fn,void 0,!0),T){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,h),!0;case 3:return m.fn.call(m.context,h,f),!0;case 4:return m.fn.call(m.context,h,f,O),!0;case 5:return m.fn.call(m.context,h,f,O,_),!0;case 6:return m.fn.call(m.context,h,f,O,_,P),!0}for(U=1,F=new Array(T-1);U<T;U++)F[U-1]=arguments[U];m.fn.apply(m.context,F)}else{var G=m.length,H;for(U=0;U<G;U++)switch(m[U].once&&this.removeListener(E,m[U].fn,void 0,!0),T){case 1:m[U].fn.call(m[U].context);break;case 2:m[U].fn.call(m[U].context,h);break;case 3:m[U].fn.call(m[U].context,h,f);break;case 4:m[U].fn.call(m[U].context,h,f,O);break;default:if(!F)for(H=1,F=new Array(T-1);H<T;H++)F[H-1]=arguments[H];m[U].fn.apply(m[U].context,F)}}return!0},N.prototype.on=function(E,h,f){return B(this,E,h,f,!1)},N.prototype.once=function(E,h,f){return B(this,E,h,f,!0)},N.prototype.removeListener=function(E,h,f,O){var _=D?D+E:E;if(!this._events[_])return this;if(!h)return K(this,_),this;var P=this._events[_];if(P.fn)P.fn===h&&(!O||P.once)&&(!f||P.context===f)&&K(this,_);else{for(var R=0,m=[],T=P.length;R<T;R++)(P[R].fn!==h||O&&!P[R].once||f&&P[R].context!==f)&&m.push(P[R]);m.length?this._events[_]=m.length===1?m[0]:m:K(this,_)}return this},N.prototype.removeAllListeners=function(E){var h;return E?(h=D?D+E:E,this._events[h]&&K(this,h)):(this._events=new j,this._eventsCount=0),this},N.prototype.off=N.prototype.removeListener,N.prototype.addListener=N.prototype.on,N.prefixed=D,N.EventEmitter=N,ve.exports=N},31198:function(ve,g,D){"use strict";const j=D(55877).v4,J=D(17741),B=function(K,N){if(!(this instanceof B))return new B(K,N);N||(N={}),this.options={reviver:typeof N.reviver<"u"?N.reviver:null,replacer:typeof N.replacer<"u"?N.replacer:null,generator:typeof N.generator<"u"?N.generator:function(){return j()},version:typeof N.version<"u"?N.version:2,notificationIdNull:typeof N.notificationIdNull=="boolean"?N.notificationIdNull:!1},this.callServer=K};ve.exports=B,B.prototype.request=function(K,N,I,E){const h=this;let f=null;const O=Array.isArray(K)&&typeof N=="function";if(this.options.version===1&&O)throw new TypeError("JSON-RPC 1.0 does not support batching");if(O||!O&&K&&typeof K=="object"&&typeof N=="function")E=N,f=K;else{typeof I=="function"&&(E=I,I=void 0);const R=typeof E=="function";try{f=J(K,N,I,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(m){if(R)return E(m);throw m}if(!R)return f}let P;try{P=JSON.stringify(f,this.options.replacer)}catch(R){return E(R)}return this.callServer(P,function(R,m){h._parseResponse(R,m,E)}),f},B.prototype._parseResponse=function(K,N,I){if(K){I(K);return}if(!N)return I();let E;try{E=JSON.parse(N,this.options.reviver)}catch(h){return I(h)}if(I.length===3)if(Array.isArray(E)){const h=function(O){return typeof O.error<"u"},f=function(O){return!h(O)};return I(null,E.filter(h),E.filter(f))}else return I(null,E.error,E.result);I(null,E)}},17741:function(ve,g,D){"use strict";const j=D(55877).v4,J=function(B,K,N,I){if(typeof B!="string")throw new TypeError(B+" must be a string");I=I||{};const E=typeof I.version=="number"?I.version:2;if(E!==1&&E!==2)throw new TypeError(E+" must be 1 or 2");const h={method:B};if(E===2&&(h.jsonrpc="2.0"),K){if(typeof K!="object"&&!Array.isArray(K))throw new TypeError(K+" must be an object, array or omitted");h.params=K}if(typeof N>"u"){const f=typeof I.generator=="function"?I.generator:function(){return j()};h.id=f(h,I)}else E===2&&N===null?I.notificationIdNull&&(h.id=null):h.id=N;return h};ve.exports=J},83937:function(ve,g,D){"use strict";var j,J=D(64836);j={value:!0},g.K=void 0;var B=J(D(56690)),K=J(D(61655)),N=J(D(94993)),I=J(D(73808)),E=J(D(89062)),h=J(D(66855));function f(P){var R=O();return function(){var T=(0,I.default)(P),F;if(R){var U=(0,I.default)(this).constructor;F=Reflect.construct(T,arguments,U)}else F=T.apply(this,arguments);return(0,N.default)(this,F)}}function O(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var _=function(P){(0,K.default)(m,P);var R=f(m);function m(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"ws://localhost:8080",F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=F.autoconnect,G=U===void 0?!0:U,H=F.reconnect,se=H===void 0?!0:H,A=F.reconnect_interval,ye=A===void 0?1e3:A,Y=F.max_reconnects,ce=Y===void 0?5:Y,oe=arguments.length>2?arguments[2]:void 0;return(0,B.default)(this,m),R.call(this,E.default,T,{autoconnect:G,reconnect:se,reconnect_interval:ye,max_reconnects:ce},oe)}return m}(h.default);g.K=_},66855:function(ve,g,D){"use strict";var j=D(48764).Buffer,J=D(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=void 0;var B=J(D(64687)),K=J(D(17156)),N=J(D(18698)),I=J(D(56690)),E=J(D(89728)),h=J(D(61655)),f=J(D(94993)),O=J(D(73808)),_=D(26729),P=J(D(37953));function R(U){var G=m();return function(){var se=(0,O.default)(U),A;if(G){var ye=(0,O.default)(this).constructor;A=Reflect.construct(se,arguments,ye)}else A=se.apply(this,arguments);return(0,f.default)(this,A)}}function m(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var T=function(U,G){var H={};for(var se in U)Object.prototype.hasOwnProperty.call(U,se)&&G.indexOf(se)<0&&(H[se]=U[se]);if(U!=null&&typeof Object.getOwnPropertySymbols=="function")for(var A=0,se=Object.getOwnPropertySymbols(U);A<se.length;A++)G.indexOf(se[A])<0&&Object.prototype.propertyIsEnumerable.call(U,se[A])&&(H[se[A]]=U[se[A]]);return H},F=function(U){(0,h.default)(H,U);var G=R(H);function H(se){var A,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ce=arguments.length>3?arguments[3]:void 0;(0,I.default)(this,H);var oe=Y.autoconnect,ue=oe===void 0?!0:oe,Z=Y.reconnect,M=Z===void 0?!0:Z,re=Y.reconnect_interval,ie=re===void 0?1e3:re,ge=Y.max_reconnects,me=ge===void 0?5:ge,Oe=T(Y,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return A=G.call(this),A.webSocketFactory=se,A.queue={},A.rpc_id=0,A.address=ye,A.autoconnect=ue,A.ready=!1,A.reconnect=M,A.reconnect_interval=ie,A.max_reconnects=me,A.rest_options=Oe,A.current_reconnects=0,A.generate_request_id=ce||function(){return++A.rpc_id},A.autoconnect&&A._connect(A.address,Object.assign({autoconnect:A.autoconnect,reconnect:A.reconnect,reconnect_interval:A.reconnect_interval,max_reconnects:A.max_reconnects},A.rest_options)),A}return(0,E.default)(H,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(A,ye,Y,ce){var oe=this;return!ce&&(0,N.default)(Y)==="object"&&(ce=Y,Y=null),new Promise(function(ue,Z){if(!oe.ready)return Z(new Error("socket not ready"));var M=oe.generate_request_id(A,ye),re={jsonrpc:"2.0",method:A,params:ye||null,id:M};oe.socket.send(JSON.stringify(re),ce,function(ie){if(ie)return Z(ie);oe.queue[M]={promise:[ue,Z]},Y&&(oe.queue[M].timeout=setTimeout(function(){delete oe.queue[M],Z(new Error("reply timeout"))},Y))})})}},{key:"login",value:function(){var se=(0,K.default)(B.default.mark(function ye(Y){var ce;return B.default.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return ue.next=2,this.call("rpc.login",Y);case 2:if(ce=ue.sent,ce){ue.next=5;break}throw new Error("authentication failed");case 5:return ue.abrupt("return",ce);case 6:case"end":return ue.stop()}},ye,this)}));function A(ye){return se.apply(this,arguments)}return A}()},{key:"listMethods",value:function(){var se=(0,K.default)(B.default.mark(function ye(){return B.default.wrap(function(ce){for(;;)switch(ce.prev=ce.next){case 0:return ce.next=2,this.call("__listMethods");case 2:return ce.abrupt("return",ce.sent);case 3:case"end":return ce.stop()}},ye,this)}));function A(){return se.apply(this,arguments)}return A}()},{key:"notify",value:function(A,ye){var Y=this;return new Promise(function(ce,oe){if(!Y.ready)return oe(new Error("socket not ready"));var ue={jsonrpc:"2.0",method:A,params:ye||null};Y.socket.send(JSON.stringify(ue),function(Z){if(Z)return oe(Z);ce()})})}},{key:"subscribe",value:function(){var se=(0,K.default)(B.default.mark(function ye(Y){var ce;return B.default.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return typeof Y=="string"&&(Y=[Y]),ue.next=3,this.call("rpc.on",Y);case 3:if(ce=ue.sent,!(typeof Y=="string"&&ce[Y]!=="ok")){ue.next=6;break}throw new Error("Failed subscribing to an event '"+Y+"' with: "+ce[Y]);case 6:return ue.abrupt("return",ce);case 7:case"end":return ue.stop()}},ye,this)}));function A(ye){return se.apply(this,arguments)}return A}()},{key:"unsubscribe",value:function(){var se=(0,K.default)(B.default.mark(function ye(Y){var ce;return B.default.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return typeof Y=="string"&&(Y=[Y]),ue.next=3,this.call("rpc.off",Y);case 3:if(ce=ue.sent,!(typeof Y=="string"&&ce[Y]!=="ok")){ue.next=6;break}throw new Error("Failed unsubscribing from an event with: "+ce);case 6:return ue.abrupt("return",ce);case 7:case"end":return ue.stop()}},ye,this)}));function A(ye){return se.apply(this,arguments)}return A}()},{key:"close",value:function(A,ye){this.socket.close(A||1e3,ye)}},{key:"_connect",value:function(A,ye){var Y=this;this.socket=this.webSocketFactory(A,ye),this.socket.addEventListener("open",function(){Y.ready=!0,Y.emit("open"),Y.current_reconnects=0}),this.socket.addEventListener("message",function(ce){var oe=ce.data;oe instanceof ArrayBuffer&&(oe=j.from(oe).toString());try{oe=P.default.parse(oe)}catch{return}if(oe.notification&&Y.listeners(oe.notification).length){if(!Object.keys(oe.params).length)return Y.emit(oe.notification);var ue=[oe.notification];if(oe.params.constructor===Object)ue.push(oe.params);else for(var Z=0;Z<oe.params.length;Z++)ue.push(oe.params[Z]);return Promise.resolve().then(function(){Y.emit.apply(Y,ue)})}if(!Y.queue[oe.id])return oe.method&&oe.params?Promise.resolve().then(function(){Y.emit(oe.method,oe.params)}):void 0;"error"in oe=="result"in oe&&Y.queue[oe.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),Y.queue[oe.id].timeout&&clearTimeout(Y.queue[oe.id].timeout),oe.error?Y.queue[oe.id].promise[1](oe.error):Y.queue[oe.id].promise[0](oe.result),delete Y.queue[oe.id]}),this.socket.addEventListener("error",function(ce){return Y.emit("error",ce)}),this.socket.addEventListener("close",function(ce){var oe=ce.code,ue=ce.reason;Y.ready&&setTimeout(function(){return Y.emit("close",oe,ue)},0),Y.ready=!1,Y.socket=void 0,oe!==1e3&&(Y.current_reconnects++,Y.reconnect&&(Y.max_reconnects>Y.current_reconnects||Y.max_reconnects===0)&&setTimeout(function(){return Y._connect(A,ye)},Y.reconnect_interval))})}}]),H}(_.EventEmitter);g.default=F},89062:function(ve,g,D){"use strict";var j=D(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=_;var J=j(D(56690)),B=j(D(89728)),K=j(D(61655)),N=j(D(94993)),I=j(D(73808)),E=D(26729);function h(P){var R=f();return function(){var T=(0,I.default)(P),F;if(R){var U=(0,I.default)(this).constructor;F=Reflect.construct(T,arguments,U)}else F=T.apply(this,arguments);return(0,N.default)(this,F)}}function f(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var O=function(P){(0,K.default)(m,P);var R=h(m);function m(T,F,U){var G;return(0,J.default)(this,m),G=R.call(this),G.socket=new window.WebSocket(T,U),G.socket.onopen=function(){return G.emit("open")},G.socket.onmessage=function(H){return G.emit("message",H.data)},G.socket.onerror=function(H){return G.emit("error",H)},G.socket.onclose=function(H){G.emit("close",H.code,H.reason)},G}return(0,B.default)(m,[{key:"send",value:function(F,U,G){var H=G||U;try{this.socket.send(F),H()}catch(se){H(se)}}},{key:"close",value:function(F,U){this.socket.close(F,U)}},{key:"addEventListener",value:function(F,U,G){this.socket.addEventListener(F,U,G)}}]),m}(E.EventEmitter);function _(P,R){return new O(P,R)}},11379:function(ve,g){"use strict";function D(R,m,T){return m<=R&&R<=T}function j(R){if(R===void 0)return{};if(R===Object(R))return R;throw TypeError("Could not convert argument to dictionary")}function J(R){for(var m=String(R),T=m.length,F=0,U=[];F<T;){var G=m.charCodeAt(F);if(G<55296||G>57343)U.push(G);else if(56320<=G&&G<=57343)U.push(65533);else if(55296<=G&&G<=56319)if(F===T-1)U.push(65533);else{var H=R.charCodeAt(F+1);if(56320<=H&&H<=57343){var se=G&1023,A=H&1023;U.push(65536+(se<<10)+A),F+=1}else U.push(65533)}F+=1}return U}function B(R){for(var m="",T=0;T<R.length;++T){var F=R[T];F<=65535?m+=String.fromCharCode(F):(F-=65536,m+=String.fromCharCode((F>>10)+55296,(F&1023)+56320))}return m}var K=-1;function N(R){this.tokens=[].slice.call(R)}N.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():K},prepend:function(R){if(Array.isArray(R))for(var m=R;m.length;)this.tokens.unshift(m.pop());else this.tokens.unshift(R)},push:function(R){if(Array.isArray(R))for(var m=R;m.length;)this.tokens.push(m.shift());else this.tokens.push(R)}};var I=-1;function E(R,m){if(R)throw TypeError("Decoder error");return m||65533}var h="utf-8";function f(R,m){if(!(this instanceof f))return new f(R,m);if(R=R!==void 0?String(R).toLowerCase():h,R!==h)throw new Error("Encoding not supported. Only utf-8 is supported");m=j(m),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(m.fatal),this._ignoreBOM=Boolean(m.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}f.prototype={decode:function(m,T){var F;typeof m=="object"&&m instanceof ArrayBuffer?F=new Uint8Array(m):typeof m=="object"&&"buffer"in m&&m.buffer instanceof ArrayBuffer?F=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):F=new Uint8Array(0),T=j(T),this._streaming||(this._decoder=new _({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(T.stream);for(var U=new N(F),G=[],H;!U.endOfStream()&&(H=this._decoder.handler(U,U.read()),H!==I);)H!==null&&(Array.isArray(H)?G.push.apply(G,H):G.push(H));if(!this._streaming){do{if(H=this._decoder.handler(U,U.read()),H===I)break;H!==null&&(Array.isArray(H)?G.push.apply(G,H):G.push(H))}while(!U.endOfStream());this._decoder=null}return G.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(G[0]===65279?(this._BOMseen=!0,G.shift()):this._BOMseen=!0),B(G)}};function O(R,m){if(!(this instanceof O))return new O(R,m);if(R=R!==void 0?String(R).toLowerCase():h,R!==h)throw new Error("Encoding not supported. Only utf-8 is supported");m=j(m),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(m.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}O.prototype={encode:function(m,T){m=m?String(m):"",T=j(T),this._streaming||(this._encoder=new P(this._options)),this._streaming=Boolean(T.stream);for(var F=[],U=new N(J(m)),G;!U.endOfStream()&&(G=this._encoder.handler(U,U.read()),G!==I);)Array.isArray(G)?F.push.apply(F,G):F.push(G);if(!this._streaming){for(;G=this._encoder.handler(U,U.read()),G!==I;)Array.isArray(G)?F.push.apply(F,G):F.push(G);this._encoder=null}return new Uint8Array(F)}};function _(R){var m=R.fatal,T=0,F=0,U=0,G=128,H=191;this.handler=function(se,A){if(A===K&&U!==0)return U=0,E(m);if(A===K)return I;if(U===0){if(D(A,0,127))return A;if(D(A,194,223))U=1,T=A-192;else if(D(A,224,239))A===224&&(G=160),A===237&&(H=159),U=2,T=A-224;else if(D(A,240,244))A===240&&(G=144),A===244&&(H=143),U=3,T=A-240;else return E(m);return T=T<<6*U,null}if(!D(A,G,H))return T=U=F=0,G=128,H=191,se.prepend(A),E(m);if(G=128,H=191,F+=1,T+=A-128<<6*(U-F),F!==U)return null;var ye=T;return T=U=F=0,ye}}function P(R){var m=R.fatal;this.handler=function(T,F){if(F===K)return I;if(D(F,0,127))return F;var U,G;D(F,128,2047)?(U=1,G=192):D(F,2048,65535)?(U=2,G=224):D(F,65536,1114111)&&(U=3,G=240);for(var H=[(F>>6*U)+G];U>0;){var se=F>>6*(U-1);H.push(128|se&63),U-=1}return H}}g.TextEncoder=O,g.TextDecoder=f},55877:function(ve,g,D){var j=D(23570),J=D(71171),B=J;B.v1=j,B.v4=J,ve.exports=B},23570:function(ve,g,D){var j=D(85217),J=D(45327),B,K,N=0,I=0;function E(h,f,O){var _=f&&O||0,P=f||[];h=h||{};var R=h.node||B,m=h.clockseq!==void 0?h.clockseq:K;if(R==null||m==null){var T=j();R==null&&(R=B=[T[0]|1,T[1],T[2],T[3],T[4],T[5]]),m==null&&(m=K=(T[6]<<8|T[7])&16383)}var F=h.msecs!==void 0?h.msecs:new Date().getTime(),U=h.nsecs!==void 0?h.nsecs:I+1,G=F-N+(U-I)/1e4;if(G<0&&h.clockseq===void 0&&(m=m+1&16383),(G<0||F>N)&&h.nsecs===void 0&&(U=0),U>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");N=F,I=U,K=m,F+=122192928e5;var H=((F&268435455)*1e4+U)%4294967296;P[_++]=H>>>24&255,P[_++]=H>>>16&255,P[_++]=H>>>8&255,P[_++]=H&255;var se=F/4294967296*1e4&268435455;P[_++]=se>>>8&255,P[_++]=se&255,P[_++]=se>>>24&15|16,P[_++]=se>>>16&255,P[_++]=m>>>8|128,P[_++]=m&255;for(var A=0;A<6;++A)P[_+A]=R[A];return f||J(P)}ve.exports=E},64836:function(ve){function g(D){return D&&D.__esModule?D:{default:D}}ve.exports=g,ve.exports.__esModule=!0,ve.exports.default=ve.exports}}]);
|
|
136
|
+
*/var g="~",L="\\x"+("0"+g.charCodeAt(0).toString(16)).slice(-2),z="\\"+L,J=new RegExp(L,"g"),B=new RegExp(z,"g"),K=new RegExp("(?:^|([^\\\\]))"+z),N=[].indexOf||function(m){for(var C=this.length;C--&&this[C]!==m;);return C},I=String;function E(m,C,A){var R=!1,V=!!C,H=[],ne=[m],x=[m],fe=[A?g:"[Circular]"],q=m,ce=1,re,ae;return V&&(ae=typeof C=="object"?function(Y,$){return Y!==""&&C.indexOf(Y)<0?void 0:$}:C),function(Y,$){return V&&($=ae.call(this,Y,$)),R?(q!==this&&(re=ce-N.call(ne,this)-1,ce-=re,ne.splice(ce,ne.length),H.splice(ce-1,H.length),q=this),typeof $=="object"&&$?(N.call(ne,$)<0&&ne.push(q=$),ce=ne.length,re=N.call(x,$),re<0?(re=x.push($)-1,A?(H.push((""+Y).replace(J,L)),fe[re]=g+H.join(g)):fe[re]=fe[0]):$=fe[re]):typeof $=="string"&&A&&($=$.replace(L,z).replace(g,L))):R=!0,$}}function h(m,C){for(var A=0,R=C.length;A<R;m=m[C[A++].replace(B,g)]);return m}function u(m){return function(C,A){var R=typeof A=="string";return R&&A.charAt(0)===g?new I(A.slice(1)):(C===""&&(A=U(A,A,{})),R&&(A=A.replace(K,"$1"+g).replace(z,L)),m?m.call(this,C,A):A)}}function O(m,C,A){for(var R=0,V=C.length;R<V;R++)C[R]=U(m,C[R],A);return C}function k(m,C,A){for(var R in C)C.hasOwnProperty(R)&&(C[R]=U(m,C[R],A));return C}function U(m,C,A){return C instanceof Array?O(m,C,A):C instanceof I?C.length?A.hasOwnProperty(C)?A[C]:A[C]=h(m,C.split(g)):m:C instanceof Object?k(m,C,A):C}var T={stringify:function(C,A,R,V){return T.parser.stringify(C,E(C,A,!V),R)},parse:function(C,A){return T.parser.parse(C,u(A))},parser:JSON};Ee.exports=T},58355:function(Ee,g,L){"use strict";var z=L(35717),J=L(51031),B=L(71027),K=L(89509).Buffer,N=L(78028),I=L(79785),E=L(89072),h=K.alloc(128);function u(O,k){B.call(this,"digest"),typeof k=="string"&&(k=K.from(k));var U=O==="sha512"||O==="sha384"?128:64;if(this._alg=O,this._key=k,k.length>U){var T=O==="rmd160"?new I:E(O);k=T.update(k).digest()}else k.length<U&&(k=K.concat([k,h],U));for(var m=this._ipad=K.allocUnsafe(U),C=this._opad=K.allocUnsafe(U),A=0;A<U;A++)m[A]=k[A]^54,C[A]=k[A]^92;this._hash=O==="rmd160"?new I:E(O),this._hash.update(m)}z(u,B),u.prototype._update=function(O){this._hash.update(O)},u.prototype._final=function(){var O=this._hash.digest(),k=this._alg==="rmd160"?new I:E(this._alg);return k.update(this._opad).update(O).digest()},Ee.exports=function(k,U){return k=k.toLowerCase(),k==="rmd160"||k==="ripemd160"?new u("rmd160",U):k==="md5"?new J(N,U):new u(k,U)}},51031:function(Ee,g,L){"use strict";var z=L(35717),J=L(89509).Buffer,B=L(71027),K=J.alloc(128),N=64;function I(E,h){B.call(this,"digest"),typeof h=="string"&&(h=J.from(h)),this._alg=E,this._key=h,h.length>N?h=E(h):h.length<N&&(h=J.concat([h,K],N));for(var u=this._ipad=J.allocUnsafe(N),O=this._opad=J.allocUnsafe(N),k=0;k<N;k++)u[k]=h[k]^54,O[k]=h[k]^92;this._hash=[u]}z(I,B),I.prototype._update=function(E){this._hash.push(E)},I.prototype._final=function(){var E=this._alg(J.concat(this._hash));return this._alg(J.concat([this._opad,E]))},Ee.exports=I},62678:function(Ee,g,L){"use strict";var z=L(48764).Buffer;Object.defineProperty(g,"__esModule",{value:!0}),g.derivePath=g.isValidPath=g.getPublicKey=g.CKDPriv=g.getMasterKeyFromSeed=void 0;const J=L(58355),B=L(50780),K=L(91110),N="ed25519 seed",I=2147483648;g.getMasterKeyFromSeed=E=>{const u=J("sha512",N).update(z.from(E,"hex")).digest(),O=u.slice(0,32),k=u.slice(32);return{key:O,chainCode:k}},g.CKDPriv=({key:E,chainCode:h},u)=>{const O=z.allocUnsafe(4);O.writeUInt32BE(u,0);const k=z.concat([z.alloc(1,0),E,O]),U=J("sha512",h).update(k).digest(),T=U.slice(0,32),m=U.slice(32);return{key:T,chainCode:m}},g.getPublicKey=(E,h=!0)=>{const O=B.sign.keyPair.fromSeed(E).secretKey.subarray(32),k=z.alloc(1,0);return h?z.concat([k,z.from(O)]):z.from(O)},g.isValidPath=E=>K.pathRegex.test(E)?!E.split("/").slice(1).map(K.replaceDerive).some(isNaN):!1,g.derivePath=(E,h,u=I)=>{if(!g.isValidPath(E))throw new Error("Invalid derivation path");const{key:O,chainCode:k}=g.getMasterKeyFromSeed(h);return E.split("/").slice(1).map(K.replaceDerive).map(T=>parseInt(T,10)).reduce((T,m)=>g.CKDPriv(T,m+u),{key:O,chainCode:k})}},91110:function(Ee,g){"use strict";Object.defineProperty(g,"__esModule",{value:!0}),g.replaceDerive=g.pathRegex=void 0,g.pathRegex=new RegExp("^m(\\/[0-9]+')+$"),g.replaceDerive=L=>L.replace("'","")},26729:function(Ee){"use strict";var g=Object.prototype.hasOwnProperty,L="~";function z(){}Object.create&&(z.prototype=Object.create(null),new z().__proto__||(L=!1));function J(I,E,h){this.fn=I,this.context=E,this.once=h||!1}function B(I,E,h,u,O){if(typeof h!="function")throw new TypeError("The listener must be a function");var k=new J(h,u||I,O),U=L?L+E:E;return I._events[U]?I._events[U].fn?I._events[U]=[I._events[U],k]:I._events[U].push(k):(I._events[U]=k,I._eventsCount++),I}function K(I,E){--I._eventsCount===0?I._events=new z:delete I._events[E]}function N(){this._events=new z,this._eventsCount=0}N.prototype.eventNames=function(){var E=[],h,u;if(this._eventsCount===0)return E;for(u in h=this._events)g.call(h,u)&&E.push(L?u.slice(1):u);return Object.getOwnPropertySymbols?E.concat(Object.getOwnPropertySymbols(h)):E},N.prototype.listeners=function(E){var h=L?L+E:E,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var O=0,k=u.length,U=new Array(k);O<k;O++)U[O]=u[O].fn;return U},N.prototype.listenerCount=function(E){var h=L?L+E:E,u=this._events[h];return u?u.fn?1:u.length:0},N.prototype.emit=function(E,h,u,O,k,U){var T=L?L+E:E;if(!this._events[T])return!1;var m=this._events[T],C=arguments.length,A,R;if(m.fn){switch(m.once&&this.removeListener(E,m.fn,void 0,!0),C){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,h),!0;case 3:return m.fn.call(m.context,h,u),!0;case 4:return m.fn.call(m.context,h,u,O),!0;case 5:return m.fn.call(m.context,h,u,O,k),!0;case 6:return m.fn.call(m.context,h,u,O,k,U),!0}for(R=1,A=new Array(C-1);R<C;R++)A[R-1]=arguments[R];m.fn.apply(m.context,A)}else{var V=m.length,H;for(R=0;R<V;R++)switch(m[R].once&&this.removeListener(E,m[R].fn,void 0,!0),C){case 1:m[R].fn.call(m[R].context);break;case 2:m[R].fn.call(m[R].context,h);break;case 3:m[R].fn.call(m[R].context,h,u);break;case 4:m[R].fn.call(m[R].context,h,u,O);break;default:if(!A)for(H=1,A=new Array(C-1);H<C;H++)A[H-1]=arguments[H];m[R].fn.apply(m[R].context,A)}}return!0},N.prototype.on=function(E,h,u){return B(this,E,h,u,!1)},N.prototype.once=function(E,h,u){return B(this,E,h,u,!0)},N.prototype.removeListener=function(E,h,u,O){var k=L?L+E:E;if(!this._events[k])return this;if(!h)return K(this,k),this;var U=this._events[k];if(U.fn)U.fn===h&&(!O||U.once)&&(!u||U.context===u)&&K(this,k);else{for(var T=0,m=[],C=U.length;T<C;T++)(U[T].fn!==h||O&&!U[T].once||u&&U[T].context!==u)&&m.push(U[T]);m.length?this._events[k]=m.length===1?m[0]:m:K(this,k)}return this},N.prototype.removeAllListeners=function(E){var h;return E?(h=L?L+E:E,this._events[h]&&K(this,h)):(this._events=new z,this._eventsCount=0),this},N.prototype.off=N.prototype.removeListener,N.prototype.addListener=N.prototype.on,N.prefixed=L,N.EventEmitter=N,Ee.exports=N},31198:function(Ee,g,L){"use strict";const z=L(55877).v4,J=L(17741),B=function(K,N){if(!(this instanceof B))return new B(K,N);N||(N={}),this.options={reviver:typeof N.reviver<"u"?N.reviver:null,replacer:typeof N.replacer<"u"?N.replacer:null,generator:typeof N.generator<"u"?N.generator:function(){return z()},version:typeof N.version<"u"?N.version:2,notificationIdNull:typeof N.notificationIdNull=="boolean"?N.notificationIdNull:!1},this.callServer=K};Ee.exports=B,B.prototype.request=function(K,N,I,E){const h=this;let u=null;const O=Array.isArray(K)&&typeof N=="function";if(this.options.version===1&&O)throw new TypeError("JSON-RPC 1.0 does not support batching");if(O||!O&&K&&typeof K=="object"&&typeof N=="function")E=N,u=K;else{typeof I=="function"&&(E=I,I=void 0);const T=typeof E=="function";try{u=J(K,N,I,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(m){if(T)return E(m);throw m}if(!T)return u}let U;try{U=JSON.stringify(u,this.options.replacer)}catch(T){return E(T)}return this.callServer(U,function(T,m){h._parseResponse(T,m,E)}),u},B.prototype._parseResponse=function(K,N,I){if(K){I(K);return}if(!N)return I();let E;try{E=JSON.parse(N,this.options.reviver)}catch(h){return I(h)}if(I.length===3)if(Array.isArray(E)){const h=function(O){return typeof O.error<"u"},u=function(O){return!h(O)};return I(null,E.filter(h),E.filter(u))}else return I(null,E.error,E.result);I(null,E)}},17741:function(Ee,g,L){"use strict";const z=L(55877).v4,J=function(B,K,N,I){if(typeof B!="string")throw new TypeError(B+" must be a string");I=I||{};const E=typeof I.version=="number"?I.version:2;if(E!==1&&E!==2)throw new TypeError(E+" must be 1 or 2");const h={method:B};if(E===2&&(h.jsonrpc="2.0"),K){if(typeof K!="object"&&!Array.isArray(K))throw new TypeError(K+" must be an object, array or omitted");h.params=K}if(typeof N>"u"){const u=typeof I.generator=="function"?I.generator:function(){return z()};h.id=u(h,I)}else E===2&&N===null?I.notificationIdNull&&(h.id=null):h.id=N;return h};Ee.exports=J},83937:function(Ee,g,L){"use strict";var z,J=L(64836);z={value:!0},g.K=void 0;var B=J(L(56690)),K=J(L(61655)),N=J(L(94993)),I=J(L(73808)),E=J(L(89062)),h=J(L(66855));function u(U){var T=O();return function(){var C=(0,I.default)(U),A;if(T){var R=(0,I.default)(this).constructor;A=Reflect.construct(C,arguments,R)}else A=C.apply(this,arguments);return(0,N.default)(this,A)}}function O(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var k=function(U){(0,K.default)(m,U);var T=u(m);function m(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"ws://localhost:8080",A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=A.autoconnect,V=R===void 0?!0:R,H=A.reconnect,ne=H===void 0?!0:H,x=A.reconnect_interval,fe=x===void 0?1e3:x,q=A.max_reconnects,ce=q===void 0?5:q,re=arguments.length>2?arguments[2]:void 0;return(0,B.default)(this,m),T.call(this,E.default,C,{autoconnect:V,reconnect:ne,reconnect_interval:fe,max_reconnects:ce},re)}return m}(h.default);g.K=k},66855:function(Ee,g,L){"use strict";var z=L(48764).Buffer,J=L(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=void 0;var B=J(L(64687)),K=J(L(17156)),N=J(L(18698)),I=J(L(56690)),E=J(L(89728)),h=J(L(61655)),u=J(L(94993)),O=J(L(73808)),k=L(26729),U=J(L(37953));function T(R){var V=m();return function(){var ne=(0,O.default)(R),x;if(V){var fe=(0,O.default)(this).constructor;x=Reflect.construct(ne,arguments,fe)}else x=ne.apply(this,arguments);return(0,u.default)(this,x)}}function m(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var C=function(R,V){var H={};for(var ne in R)Object.prototype.hasOwnProperty.call(R,ne)&&V.indexOf(ne)<0&&(H[ne]=R[ne]);if(R!=null&&typeof Object.getOwnPropertySymbols=="function")for(var x=0,ne=Object.getOwnPropertySymbols(R);x<ne.length;x++)V.indexOf(ne[x])<0&&Object.prototype.propertyIsEnumerable.call(R,ne[x])&&(H[ne[x]]=R[ne[x]]);return H},A=function(R){(0,h.default)(H,R);var V=T(H);function H(ne){var x,fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ce=arguments.length>3?arguments[3]:void 0;(0,I.default)(this,H);var re=q.autoconnect,ae=re===void 0?!0:re,Y=q.reconnect,$=Y===void 0?!0:Y,ie=q.reconnect_interval,oe=ie===void 0?1e3:ie,ge=q.max_reconnects,me=ge===void 0?5:ge,Oe=C(q,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return x=V.call(this),x.webSocketFactory=ne,x.queue={},x.rpc_id=0,x.address=fe,x.autoconnect=ae,x.ready=!1,x.reconnect=$,x.reconnect_interval=oe,x.max_reconnects=me,x.rest_options=Oe,x.current_reconnects=0,x.generate_request_id=ce||function(){return++x.rpc_id},x.autoconnect&&x._connect(x.address,Object.assign({autoconnect:x.autoconnect,reconnect:x.reconnect,reconnect_interval:x.reconnect_interval,max_reconnects:x.max_reconnects},x.rest_options)),x}return(0,E.default)(H,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(x,fe,q,ce){var re=this;return!ce&&(0,N.default)(q)==="object"&&(ce=q,q=null),new Promise(function(ae,Y){if(!re.ready)return Y(new Error("socket not ready"));var $=re.generate_request_id(x,fe),ie={jsonrpc:"2.0",method:x,params:fe||null,id:$};re.socket.send(JSON.stringify(ie),ce,function(oe){if(oe)return Y(oe);re.queue[$]={promise:[ae,Y]},q&&(re.queue[$].timeout=setTimeout(function(){delete re.queue[$],Y(new Error("reply timeout"))},q))})})}},{key:"login",value:function(){var ne=(0,K.default)(B.default.mark(function fe(q){var ce;return B.default.wrap(function(ae){for(;;)switch(ae.prev=ae.next){case 0:return ae.next=2,this.call("rpc.login",q);case 2:if(ce=ae.sent,ce){ae.next=5;break}throw new Error("authentication failed");case 5:return ae.abrupt("return",ce);case 6:case"end":return ae.stop()}},fe,this)}));function x(fe){return ne.apply(this,arguments)}return x}()},{key:"listMethods",value:function(){var ne=(0,K.default)(B.default.mark(function fe(){return B.default.wrap(function(ce){for(;;)switch(ce.prev=ce.next){case 0:return ce.next=2,this.call("__listMethods");case 2:return ce.abrupt("return",ce.sent);case 3:case"end":return ce.stop()}},fe,this)}));function x(){return ne.apply(this,arguments)}return x}()},{key:"notify",value:function(x,fe){var q=this;return new Promise(function(ce,re){if(!q.ready)return re(new Error("socket not ready"));var ae={jsonrpc:"2.0",method:x,params:fe||null};q.socket.send(JSON.stringify(ae),function(Y){if(Y)return re(Y);ce()})})}},{key:"subscribe",value:function(){var ne=(0,K.default)(B.default.mark(function fe(q){var ce;return B.default.wrap(function(ae){for(;;)switch(ae.prev=ae.next){case 0:return typeof q=="string"&&(q=[q]),ae.next=3,this.call("rpc.on",q);case 3:if(ce=ae.sent,!(typeof q=="string"&&ce[q]!=="ok")){ae.next=6;break}throw new Error("Failed subscribing to an event '"+q+"' with: "+ce[q]);case 6:return ae.abrupt("return",ce);case 7:case"end":return ae.stop()}},fe,this)}));function x(fe){return ne.apply(this,arguments)}return x}()},{key:"unsubscribe",value:function(){var ne=(0,K.default)(B.default.mark(function fe(q){var ce;return B.default.wrap(function(ae){for(;;)switch(ae.prev=ae.next){case 0:return typeof q=="string"&&(q=[q]),ae.next=3,this.call("rpc.off",q);case 3:if(ce=ae.sent,!(typeof q=="string"&&ce[q]!=="ok")){ae.next=6;break}throw new Error("Failed unsubscribing from an event with: "+ce);case 6:return ae.abrupt("return",ce);case 7:case"end":return ae.stop()}},fe,this)}));function x(fe){return ne.apply(this,arguments)}return x}()},{key:"close",value:function(x,fe){this.socket.close(x||1e3,fe)}},{key:"_connect",value:function(x,fe){var q=this;this.socket=this.webSocketFactory(x,fe),this.socket.addEventListener("open",function(){q.ready=!0,q.emit("open"),q.current_reconnects=0}),this.socket.addEventListener("message",function(ce){var re=ce.data;re instanceof ArrayBuffer&&(re=z.from(re).toString());try{re=U.default.parse(re)}catch{return}if(re.notification&&q.listeners(re.notification).length){if(!Object.keys(re.params).length)return q.emit(re.notification);var ae=[re.notification];if(re.params.constructor===Object)ae.push(re.params);else for(var Y=0;Y<re.params.length;Y++)ae.push(re.params[Y]);return Promise.resolve().then(function(){q.emit.apply(q,ae)})}if(!q.queue[re.id])return re.method&&re.params?Promise.resolve().then(function(){q.emit(re.method,re.params)}):void 0;"error"in re=="result"in re&&q.queue[re.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),q.queue[re.id].timeout&&clearTimeout(q.queue[re.id].timeout),re.error?q.queue[re.id].promise[1](re.error):q.queue[re.id].promise[0](re.result),delete q.queue[re.id]}),this.socket.addEventListener("error",function(ce){return q.emit("error",ce)}),this.socket.addEventListener("close",function(ce){var re=ce.code,ae=ce.reason;q.ready&&setTimeout(function(){return q.emit("close",re,ae)},0),q.ready=!1,q.socket=void 0,re!==1e3&&(q.current_reconnects++,q.reconnect&&(q.max_reconnects>q.current_reconnects||q.max_reconnects===0)&&setTimeout(function(){return q._connect(x,fe)},q.reconnect_interval))})}}]),H}(k.EventEmitter);g.default=A},89062:function(Ee,g,L){"use strict";var z=L(64836);Object.defineProperty(g,"__esModule",{value:!0}),g.default=k;var J=z(L(56690)),B=z(L(89728)),K=z(L(61655)),N=z(L(94993)),I=z(L(73808)),E=L(26729);function h(U){var T=u();return function(){var C=(0,I.default)(U),A;if(T){var R=(0,I.default)(this).constructor;A=Reflect.construct(C,arguments,R)}else A=C.apply(this,arguments);return(0,N.default)(this,A)}}function u(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}var O=function(U){(0,K.default)(m,U);var T=h(m);function m(C,A,R){var V;return(0,J.default)(this,m),V=T.call(this),V.socket=new window.WebSocket(C,R),V.socket.onopen=function(){return V.emit("open")},V.socket.onmessage=function(H){return V.emit("message",H.data)},V.socket.onerror=function(H){return V.emit("error",H)},V.socket.onclose=function(H){V.emit("close",H.code,H.reason)},V}return(0,B.default)(m,[{key:"send",value:function(A,R,V){var H=V||R;try{this.socket.send(A),H()}catch(ne){H(ne)}}},{key:"close",value:function(A,R){this.socket.close(A,R)}},{key:"addEventListener",value:function(A,R,V){this.socket.addEventListener(A,R,V)}}]),m}(E.EventEmitter);function k(U,T){return new O(U,T)}},11379:function(Ee,g){"use strict";function L(T,m,C){return m<=T&&T<=C}function z(T){if(T===void 0)return{};if(T===Object(T))return T;throw TypeError("Could not convert argument to dictionary")}function J(T){for(var m=String(T),C=m.length,A=0,R=[];A<C;){var V=m.charCodeAt(A);if(V<55296||V>57343)R.push(V);else if(56320<=V&&V<=57343)R.push(65533);else if(55296<=V&&V<=56319)if(A===C-1)R.push(65533);else{var H=T.charCodeAt(A+1);if(56320<=H&&H<=57343){var ne=V&1023,x=H&1023;R.push(65536+(ne<<10)+x),A+=1}else R.push(65533)}A+=1}return R}function B(T){for(var m="",C=0;C<T.length;++C){var A=T[C];A<=65535?m+=String.fromCharCode(A):(A-=65536,m+=String.fromCharCode((A>>10)+55296,(A&1023)+56320))}return m}var K=-1;function N(T){this.tokens=[].slice.call(T)}N.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():K},prepend:function(T){if(Array.isArray(T))for(var m=T;m.length;)this.tokens.unshift(m.pop());else this.tokens.unshift(T)},push:function(T){if(Array.isArray(T))for(var m=T;m.length;)this.tokens.push(m.shift());else this.tokens.push(T)}};var I=-1;function E(T,m){if(T)throw TypeError("Decoder error");return m||65533}var h="utf-8";function u(T,m){if(!(this instanceof u))return new u(T,m);if(T=T!==void 0?String(T).toLowerCase():h,T!==h)throw new Error("Encoding not supported. Only utf-8 is supported");m=z(m),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(m.fatal),this._ignoreBOM=Boolean(m.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}u.prototype={decode:function(m,C){var A;typeof m=="object"&&m instanceof ArrayBuffer?A=new Uint8Array(m):typeof m=="object"&&"buffer"in m&&m.buffer instanceof ArrayBuffer?A=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):A=new Uint8Array(0),C=z(C),this._streaming||(this._decoder=new k({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(C.stream);for(var R=new N(A),V=[],H;!R.endOfStream()&&(H=this._decoder.handler(R,R.read()),H!==I);)H!==null&&(Array.isArray(H)?V.push.apply(V,H):V.push(H));if(!this._streaming){do{if(H=this._decoder.handler(R,R.read()),H===I)break;H!==null&&(Array.isArray(H)?V.push.apply(V,H):V.push(H))}while(!R.endOfStream());this._decoder=null}return V.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(V[0]===65279?(this._BOMseen=!0,V.shift()):this._BOMseen=!0),B(V)}};function O(T,m){if(!(this instanceof O))return new O(T,m);if(T=T!==void 0?String(T).toLowerCase():h,T!==h)throw new Error("Encoding not supported. Only utf-8 is supported");m=z(m),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(m.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}O.prototype={encode:function(m,C){m=m?String(m):"",C=z(C),this._streaming||(this._encoder=new U(this._options)),this._streaming=Boolean(C.stream);for(var A=[],R=new N(J(m)),V;!R.endOfStream()&&(V=this._encoder.handler(R,R.read()),V!==I);)Array.isArray(V)?A.push.apply(A,V):A.push(V);if(!this._streaming){for(;V=this._encoder.handler(R,R.read()),V!==I;)Array.isArray(V)?A.push.apply(A,V):A.push(V);this._encoder=null}return new Uint8Array(A)}};function k(T){var m=T.fatal,C=0,A=0,R=0,V=128,H=191;this.handler=function(ne,x){if(x===K&&R!==0)return R=0,E(m);if(x===K)return I;if(R===0){if(L(x,0,127))return x;if(L(x,194,223))R=1,C=x-192;else if(L(x,224,239))x===224&&(V=160),x===237&&(H=159),R=2,C=x-224;else if(L(x,240,244))x===240&&(V=144),x===244&&(H=143),R=3,C=x-240;else return E(m);return C=C<<6*R,null}if(!L(x,V,H))return C=R=A=0,V=128,H=191,ne.prepend(x),E(m);if(V=128,H=191,A+=1,C+=x-128<<6*(R-A),A!==R)return null;var fe=C;return C=R=A=0,fe}}function U(T){var m=T.fatal;this.handler=function(C,A){if(A===K)return I;if(L(A,0,127))return A;var R,V;L(A,128,2047)?(R=1,V=192):L(A,2048,65535)?(R=2,V=224):L(A,65536,1114111)&&(R=3,V=240);for(var H=[(A>>6*R)+V];R>0;){var ne=A>>6*(R-1);H.push(128|ne&63),R-=1}return H}}g.TextEncoder=O,g.TextDecoder=u},55877:function(Ee,g,L){var z=L(23570),J=L(71171),B=J;B.v1=z,B.v4=J,Ee.exports=B},23570:function(Ee,g,L){var z=L(85217),J=L(45327),B,K,N=0,I=0;function E(h,u,O){var k=u&&O||0,U=u||[];h=h||{};var T=h.node||B,m=h.clockseq!==void 0?h.clockseq:K;if(T==null||m==null){var C=z();T==null&&(T=B=[C[0]|1,C[1],C[2],C[3],C[4],C[5]]),m==null&&(m=K=(C[6]<<8|C[7])&16383)}var A=h.msecs!==void 0?h.msecs:new Date().getTime(),R=h.nsecs!==void 0?h.nsecs:I+1,V=A-N+(R-I)/1e4;if(V<0&&h.clockseq===void 0&&(m=m+1&16383),(V<0||A>N)&&h.nsecs===void 0&&(R=0),R>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");N=A,I=R,K=m,A+=122192928e5;var H=((A&268435455)*1e4+R)%4294967296;U[k++]=H>>>24&255,U[k++]=H>>>16&255,U[k++]=H>>>8&255,U[k++]=H&255;var ne=A/4294967296*1e4&268435455;U[k++]=ne>>>8&255,U[k++]=ne&255,U[k++]=ne>>>24&15|16,U[k++]=ne>>>16&255,U[k++]=m>>>8|128,U[k++]=m&255;for(var x=0;x<6;++x)U[k+x]=T[x];return u||J(U)}Ee.exports=E},64836:function(Ee){function g(L){return L&&L.__esModule?L:{default:L}}Ee.exports=g,Ee.exports.__esModule=!0,Ee.exports.default=Ee.exports}}]);
|