@massalabs/wallet-provider 1.2.1-dev.20230810090154 → 1.2.1-dev.20230810130757

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/bundle.js CHANGED
@@ -7563,7 +7563,7 @@ async function providers(retry = true, timeout = 3000, pollInterval = 500) {
7563
7563
  // Look for Bearby
7564
7564
  let p;
7565
7565
  if ((0, BearbyConnect_1.detectBearby)()) {
7566
- const p = new BearbyProvider_1.BearbyProvider('Bearby');
7566
+ p = new BearbyProvider_1.BearbyProvider('Bearby');
7567
7567
  }
7568
7568
  return new Promise((resolve) => {
7569
7569
  let provider = [];
package/bundle.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see bundle.min.js.LICENSE.txt */
2
- (()=>{var e={"./node_modules/@noble/hashes/_assert.js":(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function s(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function i(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){s(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=void 0,t.number=r,t.bool=n,t.bytes=s,t.hash=o,t.exists=i,t.output=a;const c={number:r,bool:n,bytes:s,hash:o,exists:i,output:a};t.default=c},"./node_modules/@noble/hashes/_blake2.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLAKE2=t.SIGMA=void 0;const n=r("./node_modules/@noble/hashes/_assert.js"),s=r("./node_modules/@noble/hashes/utils.js");t.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class o extends s.Hash{constructor(e,t,r={},o,i,a){if(super(),this.blockLen=e,this.outputLen=t,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,n.default.number(e),n.default.number(t),n.default.number(o),t<0||t>o)throw new Error("outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>o))throw new Error(`key must be up 1..${o} byte long or undefined`);if(void 0!==r.salt&&r.salt.length!==i)throw new Error(`salt must be ${i} byte long or undefined`);if(void 0!==r.personalization&&r.personalization.length!==a)throw new Error(`personalization must be ${a} byte long or undefined`);this.buffer32=(0,s.u32)(this.buffer=new Uint8Array(e))}update(e){n.default.exists(this);const{blockLen:t,buffer:r,buffer32:o}=this,i=(e=(0,s.toBytes)(e)).length,a=e.byteOffset,c=e.buffer;for(let n=0;n<i;){this.pos===t&&(this.compress(o,0,!1),this.pos=0);const s=Math.min(t-this.pos,i-n),u=a+n;if(s!==t||u%4||!(n+s<i))r.set(e.subarray(n,n+s),this.pos),this.pos+=s,this.length+=s,n+=s;else{const e=new Uint32Array(c,u,Math.floor((i-n)/4));for(let r=0;n+t<i;r+=o.length,n+=t)this.length+=t,this.compress(e,r,!1)}}return this}digestInto(e){n.default.exists(this),n.default.output(e,this);const{pos:t,buffer32:r}=this;this.finished=!0,this.buffer.subarray(t).fill(0),this.compress(r,0,!0);const o=(0,s.u32)(e);this.get().forEach(((e,t)=>o[t]=e))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:n,destroyed:s,outputLen:o,pos:i}=this;return e||(e=new this.constructor({dkLen:o})),e.set(...this.get()),e.length=r,e.finished=n,e.destroyed=s,e.outputLen=o,e.buffer.set(t),e.pos=i,e}}t.BLAKE2=o},"./node_modules/@noble/hashes/_sha2.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r("./node_modules/@noble/hashes/_assert.js"),s=r("./node_modules/@noble/hashes/utils.js");class o extends s.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,s.createView)(this.buffer)}update(e){n.default.exists(this);const{view:t,buffer:r,blockLen:o}=this,i=(e=(0,s.toBytes)(e)).length;for(let n=0;n<i;){const a=Math.min(o-this.pos,i-n);if(a!==o)r.set(e.subarray(n,n+a),this.pos),this.pos+=a,n+=a,this.pos===o&&(this.process(t,0),this.pos=0);else{const t=(0,s.createView)(e);for(;o<=i-n;n+=o)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){n.default.exists(this),n.default.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:o,isLE:i}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(r,0),a=0);for(let e=a;e<o;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const s=BigInt(32),o=BigInt(4294967295),i=Number(r>>s&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,i,n),e.setUint32(t+u,a,n)}(r,o-8,BigInt(8*this.length),i),this.process(r,0);const c=(0,s.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)c.setUint32(4*e,d[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:o,pos:i}=this;return e.length=n,e.pos=i,e.finished=s,e.destroyed=o,n%t&&e.buffer.set(r),e}}t.SHA2=o},"./node_modules/@noble/hashes/_u64.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),n=BigInt(32);function s(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function o(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:a}=s(e[o],t);[r[o],n[o]]=[i,a]}return[r,n]}function i(e,t,r,n){const s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:0|s}}t.fromBig=s,t.split=o,t.toBig=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0),t.add=i;const a={fromBig:s,split:o,toBig:t.toBig,shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:i,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0,add5H:(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0,add5L:(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0)};t.default=a},"./node_modules/@noble/hashes/blake2s.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake2s=t.compress=t.IV=void 0;const n=r("./node_modules/@noble/hashes/_blake2.js"),s=r("./node_modules/@noble/hashes/_u64.js"),o=r("./node_modules/@noble/hashes/utils.js");function i(e,t,r,n,s){return e=e+t+s|0,r=r+(n=(0,o.rotr)(n^e,16))|0,{a:e,b:t=(0,o.rotr)(t^r,12),c:r,d:n}}function a(e,t,r,n,s){return e=e+t+s|0,r=r+(n=(0,o.rotr)(n^e,8))|0,{a:e,b:t=(0,o.rotr)(t^r,7),c:r,d:n}}function c(e,t,r,n,s,o,c,u,l,d,h,f,p,y,m,_,g,E,b,w){let v=0;for(let S=0;S<n;S++)({a:s,b:l,c:p,d:g}=i(s,l,p,g,r[t+e[v++]])),({a:s,b:l,c:p,d:g}=a(s,l,p,g,r[t+e[v++]])),({a:o,b:d,c:y,d:E}=i(o,d,y,E,r[t+e[v++]])),({a:o,b:d,c:y,d:E}=a(o,d,y,E,r[t+e[v++]])),({a:c,b:h,c:m,d:b}=i(c,h,m,b,r[t+e[v++]])),({a:c,b:h,c:m,d:b}=a(c,h,m,b,r[t+e[v++]])),({a:u,b:f,c:_,d:w}=i(u,f,_,w,r[t+e[v++]])),({a:u,b:f,c:_,d:w}=a(u,f,_,w,r[t+e[v++]])),({a:s,b:d,c:m,d:w}=i(s,d,m,w,r[t+e[v++]])),({a:s,b:d,c:m,d:w}=a(s,d,m,w,r[t+e[v++]])),({a:o,b:h,c:_,d:g}=i(o,h,_,g,r[t+e[v++]])),({a:o,b:h,c:_,d:g}=a(o,h,_,g,r[t+e[v++]])),({a:c,b:f,c:p,d:E}=i(c,f,p,E,r[t+e[v++]])),({a:c,b:f,c:p,d:E}=a(c,f,p,E,r[t+e[v++]])),({a:u,b:l,c:y,d:b}=i(u,l,y,b,r[t+e[v++]])),({a:u,b:l,c:y,d:b}=a(u,l,y,b,r[t+e[v++]]));return{v0:s,v1:o,v2:c,v3:u,v4:l,v5:d,v6:h,v7:f,v8:p,v9:y,v10:m,v11:_,v12:g,v13:E,v14:b,v15:w}}t.IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.compress=c;class u extends n.BLAKE2{constructor(e={}){super(64,void 0===e.dkLen?32:e.dkLen,e,32,8,8),this.v0=0|t.IV[0],this.v1=0|t.IV[1],this.v2=0|t.IV[2],this.v3=0|t.IV[3],this.v4=0|t.IV[4],this.v5=0|t.IV[5],this.v6=0|t.IV[6],this.v7=0|t.IV[7];const r=e.key?e.key.length:0;if(this.v0^=this.outputLen|r<<8|65536|1<<24,e.salt){const t=(0,o.u32)((0,o.toBytes)(e.salt));this.v4^=t[0],this.v5^=t[1]}if(e.personalization){const t=(0,o.u32)((0,o.toBytes)(e.personalization));this.v6^=t[0],this.v7^=t[1]}if(e.key){const t=new Uint8Array(this.blockLen);t.set((0,o.toBytes)(e.key)),this.update(t)}}get(){const{v0:e,v1:t,v2:r,v3:n,v4:s,v5:o,v6:i,v7:a}=this;return[e,t,r,n,s,o,i,a]}set(e,t,r,n,s,o,i,a){this.v0=0|e,this.v1=0|t,this.v2=0|r,this.v3=0|n,this.v4=0|s,this.v5=0|o,this.v6=0|i,this.v7=0|a}compress(e,r,o){const{h:i,l:a}=s.default.fromBig(BigInt(this.length)),{v0:u,v1:l,v2:d,v3:h,v4:f,v5:p,v6:y,v7:m,v8:_,v9:g,v10:E,v11:b,v12:w,v13:v,v14:S,v15:A}=c(n.SIGMA,r,e,10,this.v0,this.v1,this.v2,this.v3,this.v4,this.v5,this.v6,this.v7,t.IV[0],t.IV[1],t.IV[2],t.IV[3],a^t.IV[4],i^t.IV[5],o?~t.IV[6]:t.IV[6],t.IV[7]);this.v0^=u^_,this.v1^=l^g,this.v2^=d^E,this.v3^=h^b,this.v4^=f^w,this.v5^=p^v,this.v6^=y^S,this.v7^=m^A}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0)}}t.blake2s=(0,o.wrapConstructorWithOpts)((e=>new u(e)))},"./node_modules/@noble/hashes/blake3.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake3=void 0;const n=r("./node_modules/@noble/hashes/_assert.js"),s=r("./node_modules/@noble/hashes/_u64.js"),o=r("./node_modules/@noble/hashes/_blake2.js"),i=r("./node_modules/@noble/hashes/blake2s.js"),a=r("./node_modules/@noble/hashes/utils.js");var c;!function(e){e[e.CHUNK_START=1]="CHUNK_START",e[e.CHUNK_END=2]="CHUNK_END",e[e.PARENT=4]="PARENT",e[e.ROOT=8]="ROOT",e[e.KEYED_HASH=16]="KEYED_HASH",e[e.DERIVE_KEY_CONTEXT=32]="DERIVE_KEY_CONTEXT",e[e.DERIVE_KEY_MATERIAL=64]="DERIVE_KEY_MATERIAL"}(c||(c={}));const u=(()=>{const e=Array.from({length:16},((e,t)=>t)),t=e=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map((t=>e[t])),r=[];for(let n=0,s=e;n<7;n++,s=t(s))r.push(...s);return Uint8Array.from(r)})();class l extends o.BLAKE2{constructor(e={},t=0){if(super(64,void 0===e.dkLen?32:e.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=void 0===e.dkLen?32:e.dkLen,n.default.number(this.outputLen),void 0!==e.key&&void 0!==e.context)throw new Error("Blake3: only key or context can be specified at same time");if(void 0!==e.key){const r=(0,a.toBytes)(e.key).slice();if(32!==r.length)throw new Error("Blake3: key should be 32 byte");this.IV=(0,a.u32)(r),this.flags=t|c.KEYED_HASH}else if(void 0!==e.context){const r=new l({dkLen:32},c.DERIVE_KEY_CONTEXT).update(e.context).digest();this.IV=(0,a.u32)(r),this.flags=t|c.DERIVE_KEY_MATERIAL}else this.IV=i.IV.slice(),this.flags=t;this.state=this.IV.slice(),this.bufferOut=(0,a.u8)(this.bufferOut32)}get(){return[]}set(){}b2Compress(e,t,r,n=0){const{state:o,pos:a}=this,{h:c,l}=s.default.fromBig(BigInt(e),!0),{v0:d,v1:h,v2:f,v3:p,v4:y,v5:m,v6:_,v7:g,v8:E,v9:b,v10:w,v11:v,v12:S,v13:A,v14:T,v15:O}=(0,i.compress)(u,n,r,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],i.IV[0],i.IV[1],i.IV[2],i.IV[3],c,l,a,t);o[0]=d^E,o[1]=h^b,o[2]=f^w,o[3]=p^v,o[4]=y^S,o[5]=m^A,o[6]=_^T,o[7]=g^O}compress(e,t=0,r=!1){let n=this.flags;if(this.chunkPos||(n|=c.CHUNK_START),(15===this.chunkPos||r)&&(n|=c.CHUNK_END),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,n,e,t),this.chunkPos+=1,16===this.chunkPos||r){let e=this.state;this.state=this.IV.slice();for(let t,n=this.chunksDone+1;(r||!(1&n))&&(t=this.stack.pop());n>>=1)this.buffer32.set(t,0),this.buffer32.set(e,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|c.PARENT,this.buffer32,0),e=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(e)}this.pos=0}_cloneInto(e){e=super._cloneInto(e);const{IV:t,flags:r,state:n,chunkPos:s,posOut:o,chunkOut:i,stack:a,chunksDone:c}=this;return e.state.set(n.slice()),e.stack=a.map((e=>Uint32Array.from(e))),e.IV.set(t),e.flags=r,e.chunkPos=s,e.chunksDone=c,e.posOut=o,e.chunkOut=i,e.enableXOF=this.enableXOF,e.bufferOut32.set(this.bufferOut32),e}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let e of this.stack)e.fill(0)}b2CompressOut(){const{state:e,pos:t,flags:r,buffer32:n,bufferOut32:o}=this,{h:a,l:c}=s.default.fromBig(BigInt(this.chunkOut++)),{v0:l,v1:d,v2:h,v3:f,v4:p,v5:y,v6:m,v7:_,v8:g,v9:E,v10:b,v11:w,v12:v,v13:S,v14:A,v15:T}=(0,i.compress)(u,0,n,7,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],i.IV[0],i.IV[1],i.IV[2],i.IV[3],c,a,t,r);o[0]=l^g,o[1]=d^E,o[2]=h^b,o[3]=f^w,o[4]=p^v,o[5]=y^S,o[6]=m^A,o[7]=_^T,o[8]=e[0]^g,o[9]=e[1]^E,o[10]=e[2]^b,o[11]=e[3]^w,o[12]=e[4]^v,o[13]=e[5]^S,o[14]=e[6]^A,o[15]=e[7]^T,this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let e=this.flags|c.ROOT;this.stack.length?(e|=c.PARENT,this.compress(this.buffer32,0,!0),this.chunksDone=0,this.pos=this.blockLen):e|=(this.chunkPos?0:c.CHUNK_START)|c.CHUNK_END,this.flags=e,this.b2CompressOut()}writeInto(e){n.default.exists(this,!1),n.default.bytes(e),this.finish();const{blockLen:t,bufferOut:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=t&&this.b2CompressOut();const o=Math.min(t-this.posOut,s-n);e.set(r.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(e)}xof(e){return n.default.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(n.default.output(e,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}t.blake3=(0,a.wrapXOFConstructorWithOpts)((e=>new l(e)))},"./node_modules/@noble/hashes/crypto.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},"./node_modules/@noble/hashes/sha256.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r("./node_modules/@noble/hashes/_sha2.js"),s=r("./node_modules/@noble/hashes/utils.js"),o=(e,t,r)=>e&t^e&r^t&r,i=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class u extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:s,F:o,G:i,H:a}=this;return[e,t,r,n,s,o,i,a]}set(e,t,r,n,s,o,i,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],r=c[e-2],n=(0,s.rotr)(t,7)^(0,s.rotr)(t,18)^t>>>3,o=(0,s.rotr)(r,17)^(0,s.rotr)(r,19)^r>>>10;c[e]=o+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:a,D:u,E:l,F:d,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,s.rotr)(l,6)^(0,s.rotr)(l,11)^(0,s.rotr)(l,25))+((p=l)&d^~p&h)+i[e]+c[e]|0,y=((0,s.rotr)(r,2)^(0,s.rotr)(r,13)^(0,s.rotr)(r,22))+o(r,n,a)|0;f=h,h=d,d=l,l=u+t|0,u=a,a=n,n=r,r=t+y|0}var p;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,d=d+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(r,n,a,u,l,d,h,f)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}t.sha256=(0,s.wrapConstructor)((()=>new u)),t.sha224=(0,s.wrapConstructor)((()=>new l))},"./node_modules/@noble/hashes/utils.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r("./node_modules/@noble/hashes/crypto.js"),s=e=>e instanceof Uint8Array;if(t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function i(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function a(e){if("string"==typeof e&&(e=i(e)),!s(e))throw new Error("expected Uint8Array, got "+typeof e);return e}t.bytesToHex=function(e){if(!s(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=o[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,s=e.slice(n,n+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[t]=o}return r},t.nextTick=async()=>{},t.asyncLoop=async function(e,r,n){let s=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-s;e>=0&&e<r||(await(0,t.nextTick)(),s+=e)}},t.utf8ToBytes=i,t.toBytes=a,t.concatBytes=function(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!s(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t},t.Hash=class{clone(){return this._cloneInto()}},t.checkOpts=function(e,t){if(void 0!==t&&("object"!=typeof t||(r=t,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new Error("Options should be object or undefined");var r;return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(a(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(a(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(a(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},"./node_modules/axios/index.js":(e,t,r)=>{e.exports=r("./node_modules/axios/lib/axios.js")},"./node_modules/axios/lib/adapters/xhr.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/core/settle.js"),o=r("./node_modules/axios/lib/helpers/cookies.js"),i=r("./node_modules/axios/lib/helpers/buildURL.js"),a=r("./node_modules/axios/lib/core/buildFullPath.js"),c=r("./node_modules/axios/lib/helpers/parseHeaders.js"),u=r("./node_modules/axios/lib/helpers/isURLSameOrigin.js"),l=r("./node_modules/axios/lib/core/createError.js"),d=r("./node_modules/axios/lib/defaults/transitional.js"),h=r("./node_modules/axios/lib/cancel/Cancel.js");e.exports=function(e){return new Promise((function(t,r){var f,p=e.data,y=e.headers,m=e.responseType;function _(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}n.isFormData(p)&&delete y["Content-Type"];var g=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",b=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";y.Authorization="Basic "+btoa(E+":"+b)}var w=a(e.baseURL,e.url);function v(){if(g){var n="getAllResponseHeaders"in g?c(g.getAllResponseHeaders()):null,o={data:m&&"text"!==m&&"json"!==m?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:n,config:e,request:g};s((function(e){t(e),_()}),(function(e){r(e),_()}),o),g=null}}if(g.open(e.method.toUpperCase(),i(w,e.params,e.paramsSerializer),!0),g.timeout=e.timeout,"onloadend"in g?g.onloadend=v:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(v)},g.onabort=function(){g&&(r(l("Request aborted",e,"ECONNABORTED",g)),g=null)},g.onerror=function(){r(l("Network Error",e,null,g)),g=null},g.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||d;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",g)),g=null},n.isStandardBrowserEnv()){var S=(e.withCredentials||u(w))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;S&&(y[e.xsrfHeaderName]=S)}"setRequestHeader"in g&&n.forEach(y,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete y[t]:g.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(g.withCredentials=!!e.withCredentials),m&&"json"!==m&&(g.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&g.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&g.upload&&g.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(e){g&&(r(!e||e&&e.type?new h("canceled"):e),g.abort(),g=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),p||(p=null),g.send(p)}))}},"./node_modules/axios/lib/axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/helpers/bind.js"),o=r("./node_modules/axios/lib/core/Axios.js"),i=r("./node_modules/axios/lib/core/mergeConfig.js"),a=function e(t){var r=new o(t),a=s(o.prototype.request,r);return n.extend(a,o.prototype,r),n.extend(a,r),a.create=function(r){return e(i(t,r))},a}(r("./node_modules/axios/lib/defaults/index.js"));a.Axios=o,a.Cancel=r("./node_modules/axios/lib/cancel/Cancel.js"),a.CancelToken=r("./node_modules/axios/lib/cancel/CancelToken.js"),a.isCancel=r("./node_modules/axios/lib/cancel/isCancel.js"),a.VERSION=r("./node_modules/axios/lib/env/data.js").version,a.all=function(e){return Promise.all(e)},a.spread=r("./node_modules/axios/lib/helpers/spread.js"),a.isAxiosError=r("./node_modules/axios/lib/helpers/isAxiosError.js"),e.exports=a,e.exports.default=a},"./node_modules/axios/lib/cancel/Cancel.js":e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},"./node_modules/axios/lib/cancel/CancelToken.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/cancel/Cancel.js");function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},s.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},"./node_modules/axios/lib/cancel/isCancel.js":e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},"./node_modules/axios/lib/core/Axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/helpers/buildURL.js"),o=r("./node_modules/axios/lib/core/InterceptorManager.js"),i=r("./node_modules/axios/lib/core/dispatchRequest.js"),a=r("./node_modules/axios/lib/core/mergeConfig.js"),c=r("./node_modules/axios/lib/helpers/validator.js"),u=c.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&c.assertOptions(r,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var n=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!s){var d=[i,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(l),o=Promise.resolve(t);d.length;)o=o.then(d.shift(),d.shift());return o}for(var h=t;n.length;){var f=n.shift(),p=n.shift();try{h=f(h)}catch(e){p(e);break}}try{o=i(h)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=l},"./node_modules/axios/lib/core/InterceptorManager.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function s(){this.handlers=[]}s.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},"./node_modules/axios/lib/core/buildFullPath.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/isAbsoluteURL.js"),s=r("./node_modules/axios/lib/helpers/combineURLs.js");e.exports=function(e,t){return e&&!n(t)?s(e,t):t}},"./node_modules/axios/lib/core/createError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/enhanceError.js");e.exports=function(e,t,r,s,o){var i=new Error(e);return n(i,t,r,s,o)}},"./node_modules/axios/lib/core/dispatchRequest.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/core/transformData.js"),o=r("./node_modules/axios/lib/cancel/isCancel.js"),i=r("./node_modules/axios/lib/defaults/index.js"),a=r("./node_modules/axios/lib/cancel/Cancel.js");function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=s.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},"./node_modules/axios/lib/core/enhanceError.js":e=>{"use strict";e.exports=function(e,t,r,n,s){return e.config=t,r&&(e.code=r),e.request=n,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},"./node_modules/axios/lib/core/mergeConfig.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){t=t||{};var r={};function s(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function o(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:s(void 0,e[r]):s(e[r],t[r])}function i(e){if(!n.isUndefined(t[e]))return s(void 0,t[e])}function a(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:s(void 0,e[r]):s(void 0,t[r])}function c(r){return r in t?s(e[r],t[r]):r in e?s(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return n.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,s=t(e);n.isUndefined(s)&&t!==c||(r[e]=s)})),r}},"./node_modules/axios/lib/core/settle.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/createError.js");e.exports=function(e,t,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},"./node_modules/axios/lib/core/transformData.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/defaults/index.js");e.exports=function(e,t,r){var o=this||s;return n.forEach(r,(function(r){e=r.call(o,e,t)})),e}},"./node_modules/axios/lib/defaults/index.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/helpers/normalizeHeaderName.js"),o=r("./node_modules/axios/lib/core/enhanceError.js"),i=r("./node_modules/axios/lib/defaults/transitional.js"),a={"Content-Type":"application/x-www-form-urlencoded"};function c(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,l={transitional:i,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r("./node_modules/axios/lib/adapters/xhr.js")),u),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(c(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(c(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||l.transitional,r=t&&t.silentJSONParsing,s=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||s&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){l.headers[e]=n.merge(a)})),e.exports=l},"./node_modules/axios/lib/defaults/transitional.js":e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},"./node_modules/axios/lib/env/data.js":e=>{e.exports={version:"0.26.1"}},"./node_modules/axios/lib/helpers/bind.js":e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},"./node_modules/axios/lib/helpers/buildURL.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function s(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(s(t)+"="+s(e))})))})),o=i.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},"./node_modules/axios/lib/helpers/combineURLs.js":e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},"./node_modules/axios/lib/helpers/cookies.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,s,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(s)&&a.push("path="+s),n.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},"./node_modules/axios/lib/helpers/isAbsoluteURL.js":e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},"./node_modules/axios/lib/helpers/isAxiosError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e){return n.isObject(e)&&!0===e.isAxiosError}},"./node_modules/axios/lib/helpers/isURLSameOrigin.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function s(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=s(window.location.href),function(t){var r=n.isString(t)?s(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},"./node_modules/axios/lib/helpers/normalizeHeaderName.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},"./node_modules/axios/lib/helpers/parseHeaders.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,i={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(i[t]&&s.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},"./node_modules/axios/lib/helpers/spread.js":e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},"./node_modules/axios/lib/helpers/validator.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/env/data.js").version,s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var o={};s.transitional=function(e,t,r){function s(e,t){return"[Axios v"+n+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,i){if(!1===e)throw new Error(s(n," has been removed"+(t?" in "+t:"")));return t&&!o[n]&&(o[n]=!0,console.warn(s(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,i)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),s=n.length;s-- >0;){var o=n[s],i=t[o];if(i){var a=e[o],c=void 0===a||i(a,o,e);if(!0!==c)throw new TypeError("option "+o+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:s}},"./node_modules/axios/lib/utils.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/bind.js"),s=Object.prototype.toString;function o(e){return Array.isArray(e)}function i(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===s.call(e)}function c(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==s.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===s.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}e.exports={isArray:o,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===s.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:c,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:l,isStream:function(e){return c(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===s.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:d,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):o(r)?t[n]=r.slice():t[n]=r}for(var n=0,s=arguments.length;n<s;n++)d(arguments[n],r);return t},extend:function(e,t,r){return d(t,(function(t,s){e[s]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},"./node_modules/base-x/src/index.js":e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw new TypeError(s+" is ambiguous");t[o]=n}var i=e.length,a=e.charAt(0),c=Math.log(i)/Math.log(256),u=Math.log(256)/Math.log(i);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,s=0;e[r]===a;)n++,r++;for(var o=(e.length-r)*c+1>>>0,u=new Uint8Array(o);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var d=0,h=o-1;(0!==l||d<s)&&-1!==h;h--,d++)l+=i*u[h]>>>0,u[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");s=d,r++}for(var f=o-s;f!==o&&0===u[f];)f++;for(var p=new Uint8Array(n+(o-f)),y=n;f!==o;)p[y++]=u[f++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var c=(o-s)*u+1>>>0,l=new Uint8Array(c);s!==o;){for(var d=t[s],h=0,f=c-1;(0!==d||h<n)&&-1!==f;f--,h++)d+=256*l[f]>>>0,l[f]=d%i>>>0,d=d/i>>>0;if(0!==d)throw new Error("Non-zero carry");n=h,s++}for(var p=c-n;p!==c&&0===l[p];)p++;for(var y=a.repeat(r);p<c;++p)y+=e.charAt(l[p]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+i+" character")}}}},"./node_modules/base64-js/index.js":(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),i=o[0],c=o[1],u=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,c)),l=0,d=c>0?i-4:i;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,s=n%3,o=[],i=16383,a=0,u=n-s;a<u;a+=i)o.push(c(e,a,a+i>u?u:a+i));return 1===s?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===s&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)r[i]=o[i],n[o.charCodeAt(i)]=i;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var s,o,i=[],a=t;a<n;a+=3)s=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(r[(o=s)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},"./node_modules/bs58/index.js":(e,t,r)=>{const n=r("./node_modules/base-x/src/index.js");e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},"./node_modules/bs58check/base.js":(e,t,r)=>{"use strict";var n=r("./node_modules/bs58/index.js");e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),s=e(r);if(!(n[0]^s[0]|n[1]^s[1]|n[2]^s[2]|n[3]^s[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),s=e(r),o=r.length+4,i=new Uint8Array(o);return i.set(r,0),i.set(s.subarray(0,4),r.length),n.encode(i,o)},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},"./node_modules/bs58check/index.js":(e,t,r)=>{"use strict";var{sha256:n}=r("./node_modules/@noble/hashes/sha256.js"),s=r("./node_modules/bs58check/base.js");e.exports=s((function(e){return n(n(e))}))},"./node_modules/buffer/index.js":(e,t,r)=>{"use strict";const n=r("./node_modules/base64-js/index.js"),s=r("./node_modules/ieee754/index.js"),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=a(r);const s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const s=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let s=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(e).length;default:if(s)return n?-1:F(e).length;t=(""+t).toLowerCase(),s=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function _(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,s){let o,i=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i=2,a/=2,c/=2,r/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(s){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*i}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function b(e,t,r,n){r=Number(r)||0;const s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;const o=t.length;let i;for(n>o/2&&(n=o/2),i=0;i<n;++i){const n=parseInt(t.substr(2*i,2),16);if(X(n))return i;e[r+i]=n}return i}function w(e,t,r,n){return J(F(t,e.length-r),e,r,n)}function v(e,t,r,n){return J(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return J(K(t),e,r,n)}function A(e,t,r,n){return J(function(e,t){let r,n,s;const o=[];for(let i=0;i<e.length&&!((t-=2)<0);++i)r=e.charCodeAt(i),n=r>>8,s=r%256,o.push(s),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);const n=[];let s=t;for(;s<r;){const t=e[s];let o=null,i=t>239?4:t>223?3:t>191?2:1;if(s+i<=r){let r,n,a,c;switch(i){case 1:t<128&&(o=t);break;case 2:r=e[s+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[s+1],n=e[s+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[s+1],n=e[s+2],a=e[s+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,i=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),s+=i}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N));return r}(n)}t.kMaxLength=i,c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let s=0,o=Math.min(r,n);s<o;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let s=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))s+t.length>n.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,s)):Uint8Array.prototype.set.call(n,t,s);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,s)}s+=t.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)_(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,s){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(s>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0);const a=Math.min(o,i),u=this.slice(n,s),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){o=u[e],i=l[e];break}return o<i?-1:i<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return v(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function R(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}function C(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}function I(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let s="";for(let n=t;n<r;++n)s+=z[e[n]];return s}function x(e,t,r){const n=e.slice(t,r);let s="";for(let e=0;e<n.length-1;e+=2)s+=String.fromCharCode(n[e]+256*n[e+1]);return s}function U(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,r,n,s,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function L(e,t,r,n,s){$(t,n,s,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,r}function P(e,t,r,n,s){$(t,n,s,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=i,i>>=8,e[r+2]=i,i>>=8,e[r+1]=i,i>>=8,e[r]=i,r+8}function M(e,t,r,n,s,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,4),s.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,8),s.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],s=1,o=0;for(;++o<t&&(s*=256);)n+=this[e+o]*s;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,s=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))})),c.prototype.readBigUInt64BE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],s=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(s)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],s=1,o=0;for(;++o<t&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||U(e,4,this.length),s.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||U(e,4,this.length),s.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||U(e,8,this.length),s.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||U(e,8,this.length),s.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);let s=1,o=0;for(this[t]=255&e;++o<r&&(s*=256);)this[t+o]=e/s&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);let s=r-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,e,t,r,n-1,-n)}let s=0,o=1,i=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===i&&0!==this[t+s-1]&&(i=1),this[t+s]=(e/o>>0)-i&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,e,t,r,n-1,-n)}let s=r-1,o=1,i=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===i&&0!==this[t+s+1]&&(i=1),this[t+s]=(e/o>>0)-i&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const s=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),s},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{const o=c.isBuffer(e)?e:c.from(e,n),i=o.length;if(0===i)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=o[s%i]}return this};const k={};function G(e,t,r){k[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function H(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,s,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let s;throw s=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new k.ERR_OUT_OF_RANGE("value",s,e)}!function(e,t,r){V(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,s,o)}function V(e,t){if("number"!=typeof e)throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw V(e,r),new k.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new k.ERR_BUFFER_OUT_OF_BOUNDS;throw new k.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),G("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),G("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,s=r;return Number.isInteger(r)&&Math.abs(r)>2**32?s=H(String(r)):"bigint"==typeof r&&(s=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(s=H(s)),s+="n"),n+=` It must be ${t}. Received ${s}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function F(e,t){let r;t=t||1/0;const n=e.length;let s=null;const o=[];for(let i=0;i<n;++i){if(r=e.charCodeAt(i),r>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&o.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(t-=3)>-1&&o.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,r,n){let s;for(s=0;s<n&&!(s+r>=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let s=0;s<16;++s)t[n+s]=e[r]+e[s]}return t}();function Q(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},"./node_modules/events/events.js":e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function s(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,s)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var s,o,i,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),i=o[t]),void 0===i)i=o[t]=r,++e._eventsCount;else if("function"==typeof i?i=o[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(s=c(e))>0&&i.length>s&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=i.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=l.bind(n);return s.listener=r,n.wrapFn=s,s}function h(e,t,r){var n=e._events;if(void 0===n)return[];var s=n[t];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(s):p(s,s.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function s(o){n.once&&e.removeEventListener(t,s),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,o=this._events;if(void 0!==o)s=s&&void 0===o.error;else if(!s)return!1;if(s){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,s,o,i;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){i=r[o].listener,s=o;break}if(s<0)return this;0===s?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,s),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var s,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(s=o[n])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},"./node_modules/ieee754/index.js":(e,t)=>{t.read=function(e,t,r,n,s){var o,i,a=8*s-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?s-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=h,l-=8);for(i=o&(1<<-l)-1,o>>=-l,l+=n;l>0;i=256*i+e[t+d],d+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return i?NaN:1/0*(f?-1:1);i+=Math.pow(2,n),o-=u}return(f?-1:1)*i*Math.pow(2,o-n)},t.write=function(e,t,r,n,s,o){var i,a,c,u=8*o-s-1,l=(1<<u)-1,d=l>>1,h=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),(t+=i+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(i++,c/=2),i+d>=l?(a=0,i=l):i+d>=1?(a=(t*c-1)*Math.pow(2,s),i+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,s),i=0));s>=8;e[r+f]=255&a,f+=p,a/=256,s-=8);for(i=i<<s|a,u+=s;u>0;e[r+f]=255&i,f+=p,i/=256,u-=8);e[r+f-p]|=128*y}},"./src/account/Account.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const n=r("./src/connector/Connector.ts"),s=r("./src/index.ts");t.Account=class{constructor({address:e,name:t},r){this._address=e,this._name=t??"",this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountBalance,{address:this._address},((r,n)=>n?t(n):e(r)))}))}async sign(e){return new Promise(((t,r)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountSign,{address:this._address,data:e},((e,n)=>n?r(n):t(e)))}))}async buyRolls(e,t){return new Promise(((r,o)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountBuyRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?o(t):r(e)))}))}async sellRolls(e,t){return new Promise(((r,o)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountSellRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?o(t):r(e)))}))}async sendTransaction(e,t,r){return new Promise(((o,i)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountSendTransaction,{amount:e.toString(),recipientAddress:t,fee:r.toString()},((e,t)=>t?i(t):o(e)))}))}async callSC(e,t,r,o,i,a,c=!1){return new Promise(((u,l)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountCallSC,{nickname:this._name,name:t,at:e,args:r,coins:o,fee:i,maxGas:a,nonPersistentExecution:c},((e,t)=>t?l(t):u(e)))}))}}},"./src/account/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;var n=r("./src/account/Account.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return n.Account}})},"./src/bearbyWallet/BearbyAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBytesPublicKey=t.BearbyAccount=t.requestHeaders=t.OperationTypeId=t.OperationsType=t.PUBLIC_NODE_RPC=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),s=r("./src/massaStation/RequestHandler.ts"),o=r("./src/bearbyWallet/jsonRpcMethods.ts"),i=r("./node_modules/axios/index.js"),a=r("./src/bearbyWallet/BearbyProvider.ts"),c=r("./src/bearbyWallet/Xbqcrypto.ts"),u=BigInt(4294967295);var l,d;t.PUBLIC_NODE_RPC="https://buildnet.massa.net/api/v2",function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(l=t.OperationsType||(t.OperationsType={})),(d=t.OperationTypeId||(t.OperationTypeId={}))[d.Transaction=0]="Transaction",d[d.RollBuy=1]="RollBuy",d[d.RollSell=2]="RollSell",d[d.ExecuteSC=3]="ExecuteSC",d[d.CallSC=4]="CallSC",t.requestHeaders={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":!0,"Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS"},t.BearbyAccount=class{constructor({address:e,name:r},n){this._nodeUrl=t.PUBLIC_NODE_RPC,this._address=e,this._name=r??"Bearby_account",this._providerName=n}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){const e={jsonrpc:"2.0",method:"get_addresses",params:[[this._address]],id:0},r=await(0,s.postRequest)(t.PUBLIC_NODE_RPC,e);if(r.isError||r.error)throw r.error.message;return{finalBalance:r.result.result[0].final_balance,candidateBalance:r.result.result[0].candidate_balance}}async sign(e){const t=new TextEncoder;if("string"==typeof e){const r=await n.web3.wallet.signMessage(e);return{publicKey:r.publicKey,signature:t.encode(r.signature)}}const r=(new TextDecoder).decode(e);return{publicKey:(await n.web3.wallet.signMessage(r)).publicKey,signature:t.encode((await n.web3.wallet.signMessage(r)).signature)}}async buyRolls(e,t){throw await n.web3.wallet.signTransaction({type:l.RollBuy,amount:e.toString(),fee:t.toString(),payload:""}),new Error("Method not implemented.")}async sellRolls(e,t){throw await n.web3.wallet.signTransaction({type:l.RollSell,amount:e.toString(),fee:t.toString(),payload:""}),new Error("Method not implemented.")}async sendTransaction(e,t,r){const s=await n.web3.wallet.signTransaction({type:l.Payment,amount:e.toString(),recipient:t,fee:r.toString(),payload:""});return console.log(s),{operationId:"00"}}async callSC(e,t,r,s,o,i,a=!1){if(a)return this.nonPersistentCallSC(e,t,r,s,o,i);if(r instanceof Uint8Array)throw new Error("Protobuf serialization is not supported by bearby wallet. To use it switch to MassaStation");let c=[];try{c=r.getArgsList().map((e=>({type:e.type,value:e.value})))}catch(e){throw new Error("Bearby wallet does not support Uint8Array, serializable and serializableObjectArray. To use them switch to MassaStation")}return await n.web3.contract.call({maxGas:Number(i),coins:Number(s),fee:Number(o),targetAddress:e,functionName:t,parameters:c})}async getNodeStatus(){const e=o.JSON_RPC_REQUEST_METHOD.GET_STATUS;return await this.sendJsonRPCRequest(e,[])}async sendJsonRPCRequest(e,t){let r=null;if(r=await this.promisifyJsonRpcCall(e,t),r.isError||r.error)throw r.error;return r.result}async promisifyJsonRpcCall(e,r){let n=null;const s={jsonrpc:"2.0",method:e,params:r,id:0};try{n=await i.default.post(this._nodeUrl,s,t.requestHeaders)}catch(e){return{isError:!0,result:null,error:new Error("JSON.parse error: "+String(e))}}const o=n.data;return o.error?{isError:!0,result:null,error:new Error(o.error.message)}:{isError:!1,result:o.result,error:null}}getProviderForRpcMethod(e){switch(e){case o.JSON_RPC_REQUEST_METHOD.GET_ADDRESSES:case o.JSON_RPC_REQUEST_METHOD.GET_STATUS:case o.JSON_RPC_REQUEST_METHOD.SEND_OPERATIONS:case o.JSON_RPC_REQUEST_METHOD.GET_OPERATIONS:case o.JSON_RPC_REQUEST_METHOD.GET_BLOCKS:case o.JSON_RPC_REQUEST_METHOD.GET_ENDORSEMENTS:case o.JSON_RPC_REQUEST_METHOD.GET_CLIQUES:case o.JSON_RPC_REQUEST_METHOD.GET_STAKERS:case o.JSON_RPC_REQUEST_METHOD.GET_FILTERED_SC_OUTPUT_EVENT:case o.JSON_RPC_REQUEST_METHOD.EXECUTE_READ_ONLY_BYTECODE:case o.JSON_RPC_REQUEST_METHOD.EXECUTE_READ_ONLY_CALL:case o.JSON_RPC_REQUEST_METHOD.GET_DATASTORE_ENTRIES:case o.JSON_RPC_REQUEST_METHOD.GET_BLOCKCLIQUE_BLOCK_BY_SLOT:case o.JSON_RPC_REQUEST_METHOD.GET_GRAPH_INTERVAL:case o.JSON_RPC_REQUEST_METHOD.STOP_NODE:case o.JSON_RPC_REQUEST_METHOD.NODE_BAN_BY_ID:case o.JSON_RPC_REQUEST_METHOD.NODE_BAN_BY_IP:case o.JSON_RPC_REQUEST_METHOD.NODE_UNBAN_BY_ID:case o.JSON_RPC_REQUEST_METHOD.NODE_UNBAN_BY_IP:case o.JSON_RPC_REQUEST_METHOD.GET_STAKING_ADDRESSES:case o.JSON_RPC_REQUEST_METHOD.REMOVE_STAKING_ADDRESSES:case o.JSON_RPC_REQUEST_METHOD.ADD_STAKING_PRIVATE_KEYS:case o.JSON_RPC_REQUEST_METHOD.NODE_SIGN_MESSAGE:case o.JSON_RPC_REQUEST_METHOD.NODE_REMOVE_FROM_WHITELIST:return new a.BearbyProvider("Bearby");default:throw new Error(`Unknown Json rpc method: ${e}`)}}async nonPersistentCallSC(e,r,n,o,i,a){const c=t.PUBLIC_NODE_RPC;if(a>u)throw new Error(`\n The gas submitted ${a.toString()} exceeds the max. allowed block gas of \n ${u.toString()}\n `);let l=[];l=n instanceof Uint8Array?Array.from(n):Array.from(n.serialize());const d=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(a),target_address:e,target_function:r,parameter:l,caller_address:this._address,coins:Number(o),fee:Number(i)}]],id:0}];let h=[];try{let e=await(0,s.postRequest)(c,d);if(e.isError||e.error)throw e.error.message;h=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(h.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(h[0].result.Error)throw new Error(h[0].result.Error);return{returnValue:new Uint8Array(h[0].result[0].result.Ok),info:h[0]}}},t.getBytesPublicKey=function(e){if("P"!=e[0])throw new Error(`Invalid public key prefix: ${e[0]} should be P`);return(0,c.base58Decode)(e.slice(1))}},"./src/bearbyWallet/BearbyConnect.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disconnectBearby=t.connectBearby=t.detectBearby=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js");t.detectBearby=async function(){return!(!globalThis.window||!globalThis.window.bearby)},t.connectBearby=async function(){try{await n.web3.wallet.connect()}catch(e){console.log(e)}},t.disconnectBearby=async function(){await n.web3.wallet.diconnect(),console.log("Bearby disconnected")}},"./src/bearbyWallet/BearbyProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BearbyProvider=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),s=r("./src/bearbyWallet/BearbyAccount.ts");t.BearbyProvider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){n.web3.wallet.enabled||await n.web3.wallet.connect();const e={address:await n.web3.wallet.account.base58,name:"Bearby"};return[new s.BearbyAccount(e,this.providerName)]}async importAccount(e,t){throw new Error("Method not implemented.")}async deleteAccount(e){throw new Error("Method not implemented.")}async getNodesUrls(){return["https://buildnet.massa.net/api/v2"]}async generateNewAccount(e){throw new Error("Method not implemented.")}}},"./src/bearbyWallet/Xbqcrypto.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.varintDecode=t.varintEncode=t.base58Decode=t.base58Encode=t.hashBlake3=void 0;const n=r("./node_modules/varint/index.js"),s=r("./node_modules/@noble/hashes/blake3.js"),o=r("./src/bearbyWallet/unsignedBigIntUtils.ts"),i=r("./node_modules/bs58check/index.js");t.hashBlake3=function(e){return(0,s.blake3)(e)},t.base58Encode=function(e){return(0,i.encode)(e)},t.base58Decode=function(e){const t=(0,i.decode)(e);return Buffer.from(t)},t.varintEncode=function(e){return"bigint"==typeof e?o.encode(e):n.encode(e)},t.varintDecode=function(e){return{value:n.decode(e),bytes:n.decode.bytes}}},"./src/bearbyWallet/jsonRpcMethods.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.JSON_RPC_REQUEST_METHOD=void 0,(r=t.JSON_RPC_REQUEST_METHOD||(t.JSON_RPC_REQUEST_METHOD={})).GET_STATUS="get_status",r.GET_ADDRESSES="get_addresses",r.SEND_OPERATIONS="send_operations",r.GET_BLOCKS="get_blocks",r.GET_ENDORSEMENTS="get_endorsements",r.GET_OPERATIONS="get_operations",r.GET_CLIQUES="get_cliques",r.GET_STAKERS="get_stakers",r.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",r.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",r.EXECUTE_READ_ONLY_CALL="execute_read_only_call",r.GET_DATASTORE_ENTRIES="get_datastore_entries",r.GET_BLOCKCLIQUE_BLOCK_BY_SLOT="get_blockclique_block_by_slot",r.GET_GRAPH_INTERVAL="get_graph_interval",r.STOP_NODE="stop_node",r.NODE_BAN_BY_IP="node_ban_by_ip",r.NODE_BAN_BY_ID="node_ban_by_id",r.NODE_UNBAN_BY_IP="node_unban_by_ip",r.NODE_UNBAN_BY_ID="node_unban_by_id",r.GET_STAKING_ADDRESSES="get_staking_addresses",r.REMOVE_STAKING_ADDRESSES="remove_staking_addresses",r.ADD_STAKING_PRIVATE_KEYS="add_staking_private_keys",r.NODE_SIGN_MESSAGE="node_sign_message",r.NODE_REMOVE_FROM_WHITELIST="node_remove_from_whitelist",r.NODE_ADD_TO_PEERS_WHITELIST="node_add_to_peers_whitelist"},"./src/bearbyWallet/unsignedBigIntUtils.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodingLength=void 0;const r=BigInt(127),n=BigInt(0),s=BigInt(7);function o(e){let t=0;for(;e>=BigInt(128);t++)e>>=s;return t+1}t.encodingLength=o,t.encode=function(e,t,i){if(e<n)throw new RangeError("value must be unsigned");const a=o(e);if(i=i||0,(t=t||new ArrayBuffer(a)).byteLength<i+a)throw new RangeError("the buffer is too small to encode the number at the offset");const c=new Uint8Array(t,i);let u=0;for(;r<e;)c[u++]=128|Number(e&r),e>>=s;return c[u]=Number(e),c},t.decode=function(e,t=0){let r,s=n,o=0;do{if(r=e[t+o],void 0===r)throw new RangeError("offset out of range");s+=BigInt(127&r)<<BigInt(7*o),o++}while(128<=r);return s}},"./src/connector/Connector.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connector=t.MASSA_WINDOW_OBJECT=void 0;const n=r("./node_modules/uid/dist/index.js"),s=r("./src/index.ts"),o=r("./src/massaStation/MassaStationDiscovery.ts"),i=r("./src/massaStation/MassaStationProvider.ts");t.MASSA_WINDOW_OBJECT="massaWalletProvider",t.connector=new class{constructor(){this.registeredProviders={},this.pendingRequests=new Map,this.massaStationListener=new o.MassaStationDiscovery,this.initMassaStationListener(),this.register(),document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("message",this.handleResponseFromContentScript.bind(this))}register(){if(!document.getElementById(t.MASSA_WINDOW_OBJECT)){const e=document.createElement("p");e.id=t.MASSA_WINDOW_OBJECT,e.setAttribute("style","display:none"),document.body.appendChild(e)}document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("register",(e=>{const r=e.detail,n=`${t.MASSA_WINDOW_OBJECT}_${r.providerName}`;this.registeredProviders[r.providerName]=n}))}initMassaStationListener(){this.massaStationListener.on(o.ON_MASSA_STATION_DISCOVERED,(()=>{this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]=`${t.MASSA_WINDOW_OBJECT}_${i.MASSA_STATION_PROVIDER_NAME}`})),this.massaStationListener.on(o.ON_MASSA_STATION_DISCONNECTED,(()=>{delete this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]}))}async startMassaStationDiscovery(){try{await this.massaStationListener.startListening()}catch(e){console.log("MassaStation is not detected")}}sendMessageToContentScript(e,t,r,o){if(!Object.values(s.AvailableCommands).includes(t))throw new Error(`Unknown command ${t}`);const i=(0,n.uid)(),a={params:r,requestId:i};this.pendingRequests.set(i,o);const c=document.getElementById(`${this.registeredProviders[e]}`);if(!c)throw new Error(`Registered provider with name ${e} does not exist`);if(!c.dispatchEvent(new CustomEvent(t,{detail:a})))throw new Error(`Could not dispatch a message to ${this.registeredProviders[e]}`)}getWalletProviders(){return this.registeredProviders}handleResponseFromContentScript(e){const{result:t,error:r,requestId:n}=e.detail,s=this.pendingRequests.get(n);s?(r?s(null,new Error(r.message)):s(t,null),this.pendingRequests.delete(n)||console.error(`Error deleting a pending request with id ${n}`)):console.error(`Request Id ${n} not found in response callback map`)}}},"./src/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationAccount=t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=t.Account=t.registerProvider=t.providers=t.AvailableCommands=void 0;const n=r("./node_modules/buffer/index.js");"undefined"!=typeof window&&(window.Buffer=n.Buffer);const s=r("./src/connector/Connector.ts"),o=r("./src/provider/Provider.ts"),i=r("./src/massaStation/MassaStationProvider.ts"),a=r("./src/bearbyWallet/BearbyConnect.ts"),c=r("./src/bearbyWallet/BearbyProvider.ts");var u;(u=t.AvailableCommands||(t.AvailableCommands={})).ProviderListAccounts="LIST_ACCOUNTS",u.ProviderDeleteAccount="DELETE_ACCOUNT",u.ProviderImportAccount="IMPORT_ACCOUNT",u.ProviderGetNodesUrls="GET_NODES_URLS",u.AccountBalance="ACCOUNT_BALANCE",u.AccountSign="ACCOUNT_SIGN",u.ProviderGenerateNewAccount="GENERATE_NEW_ACCOUNT",u.AccountSellRolls="ACCOUNT_SELL_ROLLS",u.AccountBuyRolls="ACCOUNT_BUY_ROLLS",u.AccountSendTransaction="ACCOUNT_SEND_TRANSACTION",u.AccountCallSC="ACCOUNT_CALL_SC",t.providers=async function e(t=!0,r=3e3,n=500){return r<=0?[]:(await s.connector.startMassaStationDiscovery(),(0,a.detectBearby)()&&new c.BearbyProvider("Bearby"),new Promise((a=>{let c=[];for(const e of Object.keys(s.connector.getWalletProviders()))if(e===i.MASSA_STATION_PROVIDER_NAME){const e=new i.MassaStationProvider;c.push(e)}else{const t=new o.Provider(e);c.push(t)}t&&0===c.length?setTimeout((()=>{e(t,r-n,n).then(a)}),n):a(c)})))},t.registerProvider=function(e,t=s.MASSA_WINDOW_OBJECT){const r=new CustomEvent("register",{detail:{providerName:e}}),n=document.getElementById(t);n&&n.dispatchEvent(r)};var l=r("./src/account/index.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return l.Account}});var d=r("./src/provider/index.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return d.EAccountDeletionResponse}}),Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return d.EAccountImportResponse}}),Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return d.Provider}});var h=r("./src/massaStation/MassaStationAccount.ts");Object.defineProperty(t,"MassaStationAccount",{enumerable:!0,get:function(){return h.MassaStationAccount}})},"./src/massaStation/MassaStationAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationAccount=void 0;const n=r("./src/massaStation/RequestHandler.ts"),s=r("./src/massaStation/MassaStationProvider.ts"),o=r("./src/utils/argsToBase64.ts"),i=BigInt(4294967295);t.MassaStationAccount=class{constructor({address:e,name:t},r){this._address=e,this._name=t,this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){let e=null;try{e=await(0,n.getRequest)(`${s.MASSA_STATION_URL}massa/addresses?attributes=balance&addresses=${this._address}`)}catch(e){throw console.error("MassaStation account balance error"),e}if(e.isError||e.error)throw e.error;const t=e.result.addressesAttributes[this._address].balance;return{finalBalance:t.final,candidateBalance:t.pending}}async sign(e){let t=null;try{t=await(0,n.postRequest)(`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/sign`,{operation:e,batch:!1})}catch(e){throw console.error("MassaStation account signing error"),e}if(t.isError||t.error)throw t.error;return t.result}async buyRolls(e,t){let r=null;const o=`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"buy"};try{r=await(0,n.postRequest)(o,i)}catch(e){throw console.error(`MassaStation account: error while buying rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sellRolls(e,t){let r=null;const o=`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"sell"};try{r=await(0,n.postRequest)(o,i)}catch(e){throw console.error(`MassaStation account: error while selling rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sendTransaction(e,t,r){let o=null;const i=`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/transfer`,a={fee:r.toString(),amount:e.toString(),recipientAddress:t};try{o=await(0,n.postRequest)(i,a)}catch(e){throw console.error(`MassaStation account: error while sending transaction: ${e}`),e}if(o.isError||o.error)throw o.error;return o.result}async callSC(e,t,r,i,a,c,u=!1){if(u)return this.nonPersistentCallSC(e,t,r,i,a,c);let l="";l=r instanceof Uint8Array?(0,o.uint8ArrayToBase64)(r):(0,o.argsToBase64)(r);let d=null;const h=`${s.MASSA_STATION_URL}cmd/executeFunction`,f={nickname:this._name,name:t,at:e,args:l,coins:Number(i)};try{d=await(0,n.postRequest)(h,f)}catch(e){throw console.log(`MassaStation account: error while interacting with smart contract: ${e}`),e}if(d.isError||d.error)throw d.error;return d.result}async getNodeUrlFromMassaStation(){let e=null,t="";try{if(e=await(0,n.getRequest)(`${s.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;t=e.result.url}catch(e){throw new Error(`MassaStation nodes retrieval error: ${e}`)}return t}async nonPersistentCallSC(e,t,r,s,o,a){const c=await this.getNodeUrlFromMassaStation();if(a>i)throw new Error(`\n The gas submitted ${a.toString()} exceeds the max. allowed block gas of \n ${i.toString()}\n `);let u=[];u=r instanceof Uint8Array?Array.from(r):Array.from(r.serialize());const l=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(a),target_address:e,target_function:t,parameter:u,caller_address:this._address}]],id:0}];let d=[];try{let e=await(0,n.postRequest)(c,l);if(e.isError||e.error)throw e.error.message;d=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(d.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(d[0].result.Error)throw new Error(d[0].result.Error);return{returnValue:new Uint8Array(d[0].result[0].result.Ok),info:d[0]}}}},"./src/massaStation/MassaStationDiscovery.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationDiscovery=t.ON_MASSA_STATION_DISCONNECTED=t.ON_MASSA_STATION_DISCOVERED=t.MASSA_STATION_DISCOVERY_URL=void 0;const n=r("./node_modules/events/events.js"),s=r("./src/massaStation/RequestHandler.ts");t.MASSA_STATION_DISCOVERY_URL="https://station.massa/web/index",t.ON_MASSA_STATION_DISCOVERED="ON_MASSA_STATION_DISCOVERED",t.ON_MASSA_STATION_DISCONNECTED="ON_MASSA_STATION_DISCONNECTED";class o extends n.EventEmitter{constructor(){super(),this.isDiscovered=!1,this.startListening=this.startListening.bind(this)}async startListening(){let e=null;try{e=await(0,s.getRequest)(t.MASSA_STATION_DISCOVERY_URL)}catch(e){console.error(`Error calling ${t.MASSA_STATION_DISCOVERY_URL}`)}e.isError||e.error||(this.isDiscovered=!0,this.emit(t.ON_MASSA_STATION_DISCOVERED)),(e.isError||e.error)&&this.isDiscovered&&(this.isDiscovered=!1,this.emit(t.ON_MASSA_STATION_DISCONNECTED))}}t.MassaStationDiscovery=o},"./src/massaStation/MassaStationProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationProvider=t.MASSA_STATION_PROVIDER_NAME=t.MASSA_STATION_IMPORT_ACCOUNTS_URL=t.MASSA_STATION_ACCOUNTS_URL=t.MASSA_STATION_URL=void 0;const n=r("./src/provider/AccountDeletion.ts"),s=r("./src/provider/AccountImport.ts"),o=r("./src/massaStation/RequestHandler.ts"),i=r("./src/massaStation/MassaStationAccount.ts");t.MASSA_STATION_URL="https://station.massa/",t.MASSA_STATION_ACCOUNTS_URL=`${t.MASSA_STATION_URL}plugin/massa-labs/massa-wallet/api/accounts`,t.MASSA_STATION_IMPORT_ACCOUNTS_URL=`${t.MASSA_STATION_ACCOUNTS_URL}/import/`,t.MASSA_STATION_PROVIDER_NAME="MASSASTATION",t.MassaStationProvider=class{constructor(){this.providerName=t.MASSA_STATION_PROVIDER_NAME}name(){return this.providerName}async accounts(){let e=null;try{e=await(0,o.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.error("MassaStation accounts retrieval error"),e}if(e.isError||e.error)throw e.error.message;return e.result.map((e=>new i.MassaStationAccount({address:e.address,name:e.nickname},this.providerName)))}async importAccount(e,r){const n={publicKey:e,privateKey:r};let i=null;try{i=await(0,o.putRequest)(t.MASSA_STATION_ACCOUNTS_URL,n)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(i.isError||i.error)throw i.error.message;return{response:s.EAccountImportResponse.OK,message:"Account imported successfully"}}async deleteAccount(e){let r=null;try{r=await(0,o.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(r.isError||r.error)throw r.error.message;const s=r.result.find((t=>t.address.toLowerCase()===e.toLowerCase()));let i=null;try{i=await(0,o.deleteRequest)(`${t.MASSA_STATION_ACCOUNTS_URL}/${s.nickname}`)}catch(e){return console.log("MassaStation accounts deletion error",e),{response:n.EAccountDeletionResponse.ERROR}}return i.isError||i.error?(console.log("MassaStation accounts deletion error",i.error.message),{response:n.EAccountDeletionResponse.ERROR}):{response:n.EAccountDeletionResponse.OK}}async getNodesUrls(){let e=null;try{if(e=await(0,o.getRequest)(`${t.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;const r=e.result;return Array(r.url)}catch(e){throw console.error("MassaStation nodes retrieval error",e),e}}async generateNewAccount(e){let r=null;console.log(t.MASSA_STATION_ACCOUNTS_URL+"/"+e);try{if(r=await(0,o.postRequest)(t.MASSA_STATION_ACCOUNTS_URL+"/"+e,{}),r.isError||r.error)throw r.error.message;return{address:r.result.address,name:r.result.nickname}}catch(e){throw console.error(`Error while generating account: ${e}`),e}}}},"./src/massaStation/RequestHandler.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.putRequest=t.deleteRequest=t.postRequest=t.getRequest=void 0;const n=r("./node_modules/axios/index.js"),s={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":!0,"Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-Type":"application/json","Access-Control-Allow-Headers":"Accept,authorization,Authorization,Content-Type"};t.getRequest=async function(e){let t=null;try{t=await n.default.get(e,s)}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:t.data,error:null}},t.postRequest=async function(e,t){try{return{isError:!1,result:(await n.default.post(e,t,s)).data,error:null}}catch(e){return{isError:!0,result:null,error:e.response?.data?.message?new Error(String(e.response.data.message)):new Error("Axios error: "+String(e))}}},t.deleteRequest=async function(e){let t=null;try{t=await n.default.delete(e,s)}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:t.data,error:null}},t.putRequest=async function(e,t){let r=null;try{r=await n.default.put(e,t,s)}catch(e){return{isError:!0,result:null,error:new Error("Axios error: "+String(e))}}return{isError:!1,result:r.data,error:null}}},"./src/provider/AccountDeletion.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountDeletionResponse=void 0,(r=t.EAccountDeletionResponse||(t.EAccountDeletionResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/AccountImport.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountImportResponse=void 0,(r=t.EAccountImportResponse||(t.EAccountImportResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/Provider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=void 0;const n=r("./src/connector/Connector.ts"),s=r("./src/account/Account.ts"),o=r("./src/index.ts");t.Provider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){const e=new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderListAccounts,{},((r,n)=>n?t(n):e(r)))})),t=await e;let r=[];for(const e of t){const t=new s.Account(e,this.providerName);r.push(t)}return r}async importAccount(e,t){const r={publicKey:e,privateKey:t};return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderImportAccount,r,((r,n)=>n?t(n):e(r)))}))}async deleteAccount(e){const t={address:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderDeleteAccount,t,((t,n)=>n?r(n):e(t)))}))}async getNodesUrls(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderGetNodesUrls,{},((r,n)=>n?t(n):e(r)))}))}async generateNewAccount(e){const t={name:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderGenerateNewAccount,t,((t,n)=>n?r(n):e(t)))}))}}},"./src/provider/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=void 0;var n=r("./src/provider/AccountDeletion.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return n.EAccountDeletionResponse}});var s=r("./src/provider/AccountImport.ts");Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return s.EAccountImportResponse}});var o=r("./src/provider/Provider.ts");Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return o.Provider}})},"./src/utils/argsToBase64.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint8ArrayToBase64=t.argsToBase64=void 0,t.argsToBase64=function(e){const t=e.serialize();return Buffer.from(t).toString("base64")},t.uint8ArrayToBase64=function(e){return Buffer.from(e).toString("base64")}},"./node_modules/uid/dist/index.js":(e,t)=>{for(var r,n=256,s=[];n--;)s[n]=(n+256).toString(16).substring(1);t.uid=function(e){var t=0,o=e||11;if(!r||n+o>512)for(r="",n=0;t<256;t++)r+=s[256*Math.random()|0];return r.substring(n,n+++o)}},"./node_modules/varint/decode.js":e=>{e.exports=function e(n,s){var o,i=0,a=0,c=s=s||0,u=n.length;do{if(c>=u||a>49)throw e.bytes=0,new RangeError("Could not decode varint");o=n[c++],i+=a<28?(o&r)<<a:(o&r)*Math.pow(2,a),a+=7}while(o>=t);return e.bytes=c-s,i};var t=128,r=127},"./node_modules/varint/encode.js":e=>{e.exports=function e(s,o,i){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");o=o||[];for(var a=i=i||0;s>=n;)o[i++]=255&s|t,s/=128;for(;s&r;)o[i++]=255&s|t,s>>>=7;return o[i]=0|s,e.bytes=i-a+1,o};var t=128,r=-128,n=Math.pow(2,31)},"./node_modules/varint/index.js":(e,t,r)=>{e.exports={encode:r("./node_modules/varint/encode.js"),decode:r("./node_modules/varint/decode.js"),encodingLength:r("./node_modules/varint/length.js")}},"./node_modules/varint/length.js":e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),s=Math.pow(2,28),o=Math.pow(2,35),i=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<s?4:e<o?5:e<i?6:e<a?7:e<c?8:e<u?9:10}},"./node_modules/@hicaru/bearby.js/dist/index.js":(e,t,r)=>{"use strict";function n(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function s(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}r.r(t),r.d(t,{ArgTypes:()=>u,ContentProvider:()=>J,Contract:()=>f,Massa:()=>Y,Wallet:()=>te,Web3:()=>re,web3:()=>ne});const o="Wallet is not connected";class i{get payload(){return JSON.parse(JSON.stringify({type:this.type,amount:this.amount,fee:this.fee,gasPrice:this.gasPrice,gasLimit:this.gasLimit,coins:this.coins,maxCoins:this.maxCoins,code:this.contract,func:this.functionName,params:this.parameters,toAddr:this.recipient||this.contract,deployer:this.deployer}))}constructor(e,t,r,n,s,o){this.type=e,this.amount=String(t),this.recipient=r,this.parameters=n||[],this.contract=s,this.functionName=o}}var a,c,u,l,d;function h(e){let t=new Uint8Array(e.length);return Array.prototype.forEach.call(t,((t,r,n)=>{n[r]=e.charCodeAt(r)})),t}!function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(a||(a={})),function(e){e.GET_STATUS="get_status",e.GET_ADDRESSES="get_addresses",e.GET_GRAPH_INTERVAL="get_graph_interval",e.GET_BLOCKS="get_blocks",e.GET_ENDORSEMENTS="get_endorsements",e.GET_OPERATIONS="get_operations",e.GET_CLIQUES="get_cliques",e.GET_STAKERS="get_stakers",e.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",e.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",e.EXECUTE_READ_ONLY_CALL="execute_read_only_call",e.GET_DATASTORE_ENTRIES="get_datastore_entries"}(c||(c={})),function(e){e[e.STRING=0]="STRING",e[e.BOOL=1]="BOOL",e[e.U8=2]="U8",e[e.U32=3]="U32",e[e.U64=4]="U64",e[e.U128=5]="U128",e[e.U256=6]="U256",e[e.I32=7]="I32",e[e.I64=8]="I64",e[e.F32=9]="F32",e[e.F64=10]="F64"}(u||(u={}));class f{constructor(e,t){l.set(this,void 0),d.set(this,void 0),this.types=u,s(this,l,e,"f"),s(this,d,t,"f")}async deploy(e){const t=new i(a.ExecuteSC,"0",void 0,e.parameters,e.contractDataBase64,void 0);return t.deployer=e.deployerBase64,t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.gasPrice=String(e.gasPrice),t.maxCoins=String(e.maxCoins),t.coins=String(e.coins),n(this,d,"f").signTransaction(t)}async call(e){const t=new i(a.CallSC,"0",void 0,e.parameters,e.targetAddress,e.functionName);return t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.coins=String(e.coins||0),n(this,d,"f").signTransaction(t)}async getFilteredSCOutputEvent(...e){const t=c.GET_FILTERED_SC_OUTPUT_EVENT,r=await n(this,l,"f").send(e.map((e=>({method:t,params:[e]}))));return 1===e.length?r[0]:r}async getDatastoreEntries(...e){const t=c.GET_DATASTORE_ENTRIES,r=[];for(const{key:t,address:n}of e)r.push({address:n,key:Array.from(h(t))});return await n(this,l,"f").send([{method:t,params:[r]}])}async executeReadOlyBytecode(e){const t=c.EXECUTE_READ_ONLY_BYTECODE;return n(this,l,"f").send([{method:t,params:[e]}])}async readSmartContract(...e){const t=c.EXECUTE_READ_ONLY_CALL,r=await n(this,l,"f").send([{method:t,params:[e.map((e=>({max_gas:e.maxGas,simulated_gas_price:String(e.simulatedGasPrice),target_address:e.targetAddress,target_function:e.targetFunction,parameters:e.parameters,caller_address:e.callerAddress||n(this,d,"f").account.base58})))]}]);return 1===e.length?r[0]:r}}l=new WeakMap,d=new WeakMap;const p="BearBy",y={CONTENT:`@/${p}/content-script`,INJECTED:`@/${p}/injected-script`},m={GET_DATA:`@/${p}/get-wallet-data`,NEW_SLOT:`@/${p}/new-slot-emited`,ACCOUNT_CHANGED:`@/${p}/accounts-just-changed`,CONTENT_PROXY_MEHTOD:`@/${p}/proxy-method`,CONTENT_PROXY_RESULT:`@/${p}/response-from-content`,CONNECT_APP:`@/${p}/connect-app`,RESPONSE_CONNECT_APP:`@/${p}/respoonse-connect-app`,NETWORK_CHANGED:`@/${p}/network-just-changed`,DISCONNECT_APP:`@/${p}/disconnect_app`,DISCONNECT_APP_RESULT:`@/${p}/disconnect_app_result`,LOCKED:`@/${p}/guard-just-lock`,TX_TO_SEND:`@/${p}/add-tx-to-send`,TX_TO_SEND_RESULT:`@/${p}/response-tx-result`,CHECK_MASSA_ADDRESS:`@/${p}/check-massa-address`,CHECK_MASSA_ADDRESS_RES:`@/${p}/check-massa-address-response`,SIGN_MESSAGE:`@/${p}/sign-message-call`,SING_MESSAGE_RESULT:`@/${p}/sign-message-response`};var _,g,E,b,w;const{document:v}=globalThis;class S{constructor(e){_.add(this),g.set(this,void 0),s(this,g,e,"f")}listen(e){v.addEventListener(n(this,g,"f"),(t=>{t&&t.detail&&e(JSON.parse(t.detail))}))}send(e,t){e.from=n(this,g,"f"),Object.values(y).includes(t)&&n(this,_,"m",E).call(this,JSON.stringify(e),t)}}var A,T,O,N,R,C,I,x,U,B,L,P,M,j,D,k,G,H,$,V;g=new WeakMap,_=new WeakSet,E=function(e,t){v.dispatchEvent(n(this,_,"m",w).call(this,e,t))},b=function(e){return{detail:e}},w=function(e,t){return new CustomEvent(t,n(this,_,"m",b).call(this,e))};class W{constructor(){A.set(this,[])}on(e){return n(this,A,"f").push(e),()=>this.removeListener(e)}removeListener(e){const t=n(this,A,"f").indexOf(e);t>-1&&n(this,A,"f").splice(t,1)}removeAllListeners(){n(this,A,"f").splice(0,n(this,A,"f").length)}emit(...e){n(this,A,"f").forEach((t=>t.apply(this,e)))}once(e){const t=this.on(((...r)=>{t(),e.apply(this,r)}))}}A=new WeakMap;class q{get type(){return n(this,T,"f").type}get payload(){return n(this,T,"f").payload}constructor(e){T.set(this,void 0),s(this,T,e,"f")}send(e,t){const r=JSON.stringify(n(this,T,"f")),s=JSON.parse(r);e.send(s,t)}}T=new WeakMap;class F{constructor(){this.stream=new S(y.INJECTED),this.subject=new W,globalThis.document&&this.stream.listen((e=>{this.subject.emit(e)}))}initialized(){const e=y.CONTENT;new q({type:m.GET_DATA,payload:{}}).send(this.stream,e)}}function K(){return[...Array(20)].map((()=>Math.floor(16*Math.random()).toString(16))).join("")}class J{constructor(e,t){O.set(this,void 0),N.set(this,void 0),s(this,O,e,"f"),s(this,N,t,"f")}async send(e){const t=m.CONTENT_PROXY_MEHTOD,r=y.CONTENT,s=K();let o;new q({type:t,payload:{body:e,uuid:s}}).send(n(this,O,"f"),r);const i=new Promise(((e,t)=>{o=n(this,N,"f").on((r=>{if(r.type===m.CONTENT_PROXY_RESULT&&r.payload&&r.payload.uuid&&r.payload.uuid===s)return r.payload&&r.payload.reject?(o(),t(new Error(r.payload.reject))):(delete r.payload.uuid,o(),e(r.payload.resolve))}))})),a=new Promise(((e,t)=>{setTimeout((()=>{o&&o(),t(new Error("Request failed by timeout"))}),5e3)}));return Promise.race([i,a])}}O=new WeakMap,N=new WeakMap;class Y{constructor(e,t){R.set(this,void 0),C.set(this,void 0),s(this,R,e,"f"),s(this,C,t,"f")}async getNodesStatus(){const e=c.GET_STATUS,[t]=await n(this,R,"f").send([{method:e,params:[]}]);return t}async getAddresses(...e){const t=c.GET_ADDRESSES,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getBlocks(...e){const t=c.GET_BLOCKS,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getGraphInterval(e,t){const r=c.GET_GRAPH_INTERVAL,[s]=await n(this,R,"f").send([{method:r,params:[{start:e,end:t}]}]);return s}async getOperations(...e){const t=c.GET_OPERATIONS,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getStakers(){const e=c.GET_STAKERS,[t]=await n(this,R,"f").send([{method:e,params:[]}]);return t}async getEndorsements(...e){const t=c.GET_ENDORSEMENTS,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getCliques(){const e=c.GET_CLIQUES,[t]=await n(this,R,"f").send([{method:e,params:[]}]);return t}async payment(e,t){const r=new i(a.Payment,e,t);return n(this,C,"f").signTransaction(r)}async buyRolls(e="1"){const t=new i(a.RollBuy,e);return n(this,C,"f").signTransaction(t)}async sellRolls(e="1"){const t=new i(a.RollSell,e);return n(this,C,"f").signTransaction(t)}}function X(e,t){if(!e)throw new Error(t)}function z(){let e=globalThis.document.querySelector("link[rel*='icon']");if(!e)throw new Error("website favicon is required");return e.href}R=new WeakMap,C=new WeakMap;class Q{constructor(e){I.set(this,void 0),s(this,I,e,"f")}subscribe(e){if(!e)throw new Error("Missing callback arg. use subscribe(cb => /do something/)");this.base58&&e(this.base58);const t=n(this,I,"f").on((t=>{switch(t.type){case m.DISCONNECT_APP_RESULT:this.base58=void 0;break;case m.ACCOUNT_CHANGED:case m.RESPONSE_CONNECT_APP:case m.GET_DATA:this.base58=t.payload.base58;break;default:return}e(this.base58)}));return{unsubscribe:()=>t()}}}I=new WeakMap;class Z{constructor(e){x.set(this,void 0),s(this,x,e,"f")}subscribe(e){e(this.net);const t=n(this,x,"f").on((t=>{switch(t.type){case m.RESPONSE_CONNECT_APP:case m.GET_DATA:case m.NETWORK_CHANGED:this.net=t.payload.net;break;default:return}e(this.net)}));return{unsubscribe:()=>t()}}}x=new WeakMap;class ee{constructor(e){U.set(this,void 0),this.period=-1,s(this,U,e,"f")}subscribe(e){const t=n(this,U,"f").on((t=>{switch(t.type){case m.NEW_SLOT:this.period=t.payload,e(this.period);break;case m.GET_DATA:case m.NETWORK_CHANGED:this.period=t.payload.period,e(this.period)}}));return{unsubscribe:()=>t()}}}U=new WeakMap;class te{get account(){return n(this,L,"f")}get network(){return n(this,P,"f")}get blockchain(){return n(this,M,"f")}get connected(){return n(this,k,"f")}get enabled(){return n(this,G,"f")}constructor(e,t){B.add(this),L.set(this,void 0),P.set(this,void 0),M.set(this,void 0),j.set(this,void 0),D.set(this,void 0),k.set(this,!1),G.set(this,!1),s(this,j,e,"f"),s(this,D,t,"f"),s(this,L,new Q(t),"f"),s(this,P,new Z(t),"f"),s(this,M,new ee(t),"f"),n(this,B,"m",H).call(this)}async diconnect(){const e=m.DISCONNECT_APP,t=y.CONTENT,r=window.document.title,o=z(),i=K();return new q({type:e,payload:{title:r,icon:o,uuid:i}}).send(n(this,j,"f"),t),new Promise(((e,t)=>{const r=n(this,D,"f").on((o=>{if(o.type===m.DISCONNECT_APP_RESULT&&o.payload.uuid===i)return o.payload.reject?(r(),t(new Error(o.payload.reject))):(s(this,k,!1,"f"),n(this,L,"f").base58=void 0,n(this,P,"f").net=o.payload.net,r(),e(this.connected))}))}))}async isMassaAddress(e){const t=m.CHECK_MASSA_ADDRESS,r=y.CONTENT,s=K();return new q({type:t,payload:{uuid:s,addr:e}}).send(n(this,j,"f"),r),new Promise((e=>{const t=n(this,D,"f").on((r=>{if(r.type===m.CHECK_MASSA_ADDRESS_RES&&r.payload.uuid===s)return t(),e(r.payload.resolve)}))}))}async connect(){const e=m.CONNECT_APP,t=y.CONTENT,r=K(),o=window.document.title,i=z();return new q({type:e,payload:{title:o,icon:i,uuid:r}}).send(n(this,j,"f"),t),new Promise(((e,t)=>{const o=n(this,D,"f").on((i=>{if(i.type===m.RESPONSE_CONNECT_APP&&i.payload.uuid===r)return i.payload.reject?(o(),t(new Error(i.payload.reject))):(s(this,k,Boolean(i.payload.resolve),"f"),n(this,L,"f").base58=i.payload.base58,n(this,P,"f").net=i.payload.net,o(),e(this.connected))}))}))}async signMessage(e){X(this.connected,o);const t=m.SIGN_MESSAGE,r=y.CONTENT,s=K(),i=window.document.title,a=z();return new q({type:t,payload:{message:e,uuid:s,title:i,icon:a}}).send(n(this,j,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===m.SING_MESSAGE_RESULT&&n.payload.uuid===s)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}async signTransaction(e){X(this.connected,o),X(e instanceof i,"Invalid sign params");const t=m.TX_TO_SEND,r=y.CONTENT,s=K(),a={...e.payload,uuid:s,title:window.document.title,icon:z()};return new q({type:t,payload:a}).send(n(this,j,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===m.TX_TO_SEND_RESULT&&n.payload.uuid===s)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}}L=new WeakMap,P=new WeakMap,M=new WeakMap,j=new WeakMap,D=new WeakMap,k=new WeakMap,G=new WeakMap,B=new WeakSet,H=function(){globalThis.window&&n(this,D,"f").on((e=>{switch(e.type){case m.NEW_SLOT:n(this,M,"f").period=e.payload;break;case m.LOCKED:s(this,G,e.payload.enabled,"f");break;case m.ACCOUNT_CHANGED:n(this,L,"f").base58=e.payload.base58;break;case m.GET_DATA:n(this,M,"f").period=e.payload.period,n(this,L,"f").base58=e.payload.base58,s(this,G,e.payload.enabled,"f"),s(this,k,e.payload.connected,"f"),n(this,P,"f").net=e.payload.net;break;case m.NETWORK_CHANGED:n(this,P,"f").net=e.payload.net,n(this,M,"f").period=e.payload.period}}))};class re{constructor(){if($.set(this,new F),V.set(this,new J(n(this,$,"f").stream,n(this,$,"f").subject)),this.wallet=new te(n(this,$,"f").stream,n(this,$,"f").subject),this.contract=new f(n(this,V,"f"),this.wallet),this.massa=new Y(n(this,V,"f"),this.wallet),globalThis.window){if(globalThis.window.bearby)throw new Error("bearby Web3 instance already created!");try{n(this,$,"f").initialized(),globalThis.window.bearby=Object.freeze(this)}catch{console.debug("bearby-web3 available only browser")}}}}$=new WeakMap,V=new WeakMap;const ne=globalThis.window&&globalThis.window.bearby?globalThis.window.bearby:new re}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r("./src/index.ts");window.massa=n})();
2
+ (()=>{var e={"./node_modules/@noble/hashes/_assert.js":(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function s(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function i(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){s(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=void 0,t.number=r,t.bool=n,t.bytes=s,t.hash=o,t.exists=i,t.output=a;const c={number:r,bool:n,bytes:s,hash:o,exists:i,output:a};t.default=c},"./node_modules/@noble/hashes/_blake2.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLAKE2=t.SIGMA=void 0;const n=r("./node_modules/@noble/hashes/_assert.js"),s=r("./node_modules/@noble/hashes/utils.js");t.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class o extends s.Hash{constructor(e,t,r={},o,i,a){if(super(),this.blockLen=e,this.outputLen=t,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,n.default.number(e),n.default.number(t),n.default.number(o),t<0||t>o)throw new Error("outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>o))throw new Error(`key must be up 1..${o} byte long or undefined`);if(void 0!==r.salt&&r.salt.length!==i)throw new Error(`salt must be ${i} byte long or undefined`);if(void 0!==r.personalization&&r.personalization.length!==a)throw new Error(`personalization must be ${a} byte long or undefined`);this.buffer32=(0,s.u32)(this.buffer=new Uint8Array(e))}update(e){n.default.exists(this);const{blockLen:t,buffer:r,buffer32:o}=this,i=(e=(0,s.toBytes)(e)).length,a=e.byteOffset,c=e.buffer;for(let n=0;n<i;){this.pos===t&&(this.compress(o,0,!1),this.pos=0);const s=Math.min(t-this.pos,i-n),u=a+n;if(s!==t||u%4||!(n+s<i))r.set(e.subarray(n,n+s),this.pos),this.pos+=s,this.length+=s,n+=s;else{const e=new Uint32Array(c,u,Math.floor((i-n)/4));for(let r=0;n+t<i;r+=o.length,n+=t)this.length+=t,this.compress(e,r,!1)}}return this}digestInto(e){n.default.exists(this),n.default.output(e,this);const{pos:t,buffer32:r}=this;this.finished=!0,this.buffer.subarray(t).fill(0),this.compress(r,0,!0);const o=(0,s.u32)(e);this.get().forEach(((e,t)=>o[t]=e))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:n,destroyed:s,outputLen:o,pos:i}=this;return e||(e=new this.constructor({dkLen:o})),e.set(...this.get()),e.length=r,e.finished=n,e.destroyed=s,e.outputLen=o,e.buffer.set(t),e.pos=i,e}}t.BLAKE2=o},"./node_modules/@noble/hashes/_sha2.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r("./node_modules/@noble/hashes/_assert.js"),s=r("./node_modules/@noble/hashes/utils.js");class o extends s.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,s.createView)(this.buffer)}update(e){n.default.exists(this);const{view:t,buffer:r,blockLen:o}=this,i=(e=(0,s.toBytes)(e)).length;for(let n=0;n<i;){const a=Math.min(o-this.pos,i-n);if(a!==o)r.set(e.subarray(n,n+a),this.pos),this.pos+=a,n+=a,this.pos===o&&(this.process(t,0),this.pos=0);else{const t=(0,s.createView)(e);for(;o<=i-n;n+=o)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){n.default.exists(this),n.default.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:o,isLE:i}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(r,0),a=0);for(let e=a;e<o;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const s=BigInt(32),o=BigInt(4294967295),i=Number(r>>s&o),a=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,i,n),e.setUint32(t+u,a,n)}(r,o-8,BigInt(8*this.length),i),this.process(r,0);const c=(0,s.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)c.setUint32(4*e,d[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:o,pos:i}=this;return e.length=n,e.pos=i,e.finished=s,e.destroyed=o,n%t&&e.buffer.set(r),e}}t.SHA2=o},"./node_modules/@noble/hashes/_u64.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),n=BigInt(32);function s(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function o(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:a}=s(e[o],t);[r[o],n[o]]=[i,a]}return[r,n]}function i(e,t,r,n){const s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:0|s}}t.fromBig=s,t.split=o,t.toBig=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0),t.add=i;const a={fromBig:s,split:o,toBig:t.toBig,shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:i,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0,add5H:(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0,add5L:(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0)};t.default=a},"./node_modules/@noble/hashes/blake2s.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake2s=t.compress=t.IV=void 0;const n=r("./node_modules/@noble/hashes/_blake2.js"),s=r("./node_modules/@noble/hashes/_u64.js"),o=r("./node_modules/@noble/hashes/utils.js");function i(e,t,r,n,s){return e=e+t+s|0,r=r+(n=(0,o.rotr)(n^e,16))|0,{a:e,b:t=(0,o.rotr)(t^r,12),c:r,d:n}}function a(e,t,r,n,s){return e=e+t+s|0,r=r+(n=(0,o.rotr)(n^e,8))|0,{a:e,b:t=(0,o.rotr)(t^r,7),c:r,d:n}}function c(e,t,r,n,s,o,c,u,l,d,h,f,p,y,m,_,g,E,b,w){let v=0;for(let S=0;S<n;S++)({a:s,b:l,c:p,d:g}=i(s,l,p,g,r[t+e[v++]])),({a:s,b:l,c:p,d:g}=a(s,l,p,g,r[t+e[v++]])),({a:o,b:d,c:y,d:E}=i(o,d,y,E,r[t+e[v++]])),({a:o,b:d,c:y,d:E}=a(o,d,y,E,r[t+e[v++]])),({a:c,b:h,c:m,d:b}=i(c,h,m,b,r[t+e[v++]])),({a:c,b:h,c:m,d:b}=a(c,h,m,b,r[t+e[v++]])),({a:u,b:f,c:_,d:w}=i(u,f,_,w,r[t+e[v++]])),({a:u,b:f,c:_,d:w}=a(u,f,_,w,r[t+e[v++]])),({a:s,b:d,c:m,d:w}=i(s,d,m,w,r[t+e[v++]])),({a:s,b:d,c:m,d:w}=a(s,d,m,w,r[t+e[v++]])),({a:o,b:h,c:_,d:g}=i(o,h,_,g,r[t+e[v++]])),({a:o,b:h,c:_,d:g}=a(o,h,_,g,r[t+e[v++]])),({a:c,b:f,c:p,d:E}=i(c,f,p,E,r[t+e[v++]])),({a:c,b:f,c:p,d:E}=a(c,f,p,E,r[t+e[v++]])),({a:u,b:l,c:y,d:b}=i(u,l,y,b,r[t+e[v++]])),({a:u,b:l,c:y,d:b}=a(u,l,y,b,r[t+e[v++]]));return{v0:s,v1:o,v2:c,v3:u,v4:l,v5:d,v6:h,v7:f,v8:p,v9:y,v10:m,v11:_,v12:g,v13:E,v14:b,v15:w}}t.IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.compress=c;class u extends n.BLAKE2{constructor(e={}){super(64,void 0===e.dkLen?32:e.dkLen,e,32,8,8),this.v0=0|t.IV[0],this.v1=0|t.IV[1],this.v2=0|t.IV[2],this.v3=0|t.IV[3],this.v4=0|t.IV[4],this.v5=0|t.IV[5],this.v6=0|t.IV[6],this.v7=0|t.IV[7];const r=e.key?e.key.length:0;if(this.v0^=this.outputLen|r<<8|65536|1<<24,e.salt){const t=(0,o.u32)((0,o.toBytes)(e.salt));this.v4^=t[0],this.v5^=t[1]}if(e.personalization){const t=(0,o.u32)((0,o.toBytes)(e.personalization));this.v6^=t[0],this.v7^=t[1]}if(e.key){const t=new Uint8Array(this.blockLen);t.set((0,o.toBytes)(e.key)),this.update(t)}}get(){const{v0:e,v1:t,v2:r,v3:n,v4:s,v5:o,v6:i,v7:a}=this;return[e,t,r,n,s,o,i,a]}set(e,t,r,n,s,o,i,a){this.v0=0|e,this.v1=0|t,this.v2=0|r,this.v3=0|n,this.v4=0|s,this.v5=0|o,this.v6=0|i,this.v7=0|a}compress(e,r,o){const{h:i,l:a}=s.default.fromBig(BigInt(this.length)),{v0:u,v1:l,v2:d,v3:h,v4:f,v5:p,v6:y,v7:m,v8:_,v9:g,v10:E,v11:b,v12:w,v13:v,v14:S,v15:A}=c(n.SIGMA,r,e,10,this.v0,this.v1,this.v2,this.v3,this.v4,this.v5,this.v6,this.v7,t.IV[0],t.IV[1],t.IV[2],t.IV[3],a^t.IV[4],i^t.IV[5],o?~t.IV[6]:t.IV[6],t.IV[7]);this.v0^=u^_,this.v1^=l^g,this.v2^=d^E,this.v3^=h^b,this.v4^=f^w,this.v5^=p^v,this.v6^=y^S,this.v7^=m^A}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0)}}t.blake2s=(0,o.wrapConstructorWithOpts)((e=>new u(e)))},"./node_modules/@noble/hashes/blake3.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake3=void 0;const n=r("./node_modules/@noble/hashes/_assert.js"),s=r("./node_modules/@noble/hashes/_u64.js"),o=r("./node_modules/@noble/hashes/_blake2.js"),i=r("./node_modules/@noble/hashes/blake2s.js"),a=r("./node_modules/@noble/hashes/utils.js");var c;!function(e){e[e.CHUNK_START=1]="CHUNK_START",e[e.CHUNK_END=2]="CHUNK_END",e[e.PARENT=4]="PARENT",e[e.ROOT=8]="ROOT",e[e.KEYED_HASH=16]="KEYED_HASH",e[e.DERIVE_KEY_CONTEXT=32]="DERIVE_KEY_CONTEXT",e[e.DERIVE_KEY_MATERIAL=64]="DERIVE_KEY_MATERIAL"}(c||(c={}));const u=(()=>{const e=Array.from({length:16},((e,t)=>t)),t=e=>[2,6,3,10,7,0,4,13,1,11,12,5,9,14,15,8].map((t=>e[t])),r=[];for(let n=0,s=e;n<7;n++,s=t(s))r.push(...s);return Uint8Array.from(r)})();class l extends o.BLAKE2{constructor(e={},t=0){if(super(64,void 0===e.dkLen?32:e.dkLen,{},Number.MAX_SAFE_INTEGER,0,0),this.flags=0,this.chunkPos=0,this.chunksDone=0,this.stack=[],this.posOut=0,this.bufferOut32=new Uint32Array(16),this.chunkOut=0,this.enableXOF=!0,this.outputLen=void 0===e.dkLen?32:e.dkLen,n.default.number(this.outputLen),void 0!==e.key&&void 0!==e.context)throw new Error("Blake3: only key or context can be specified at same time");if(void 0!==e.key){const r=(0,a.toBytes)(e.key).slice();if(32!==r.length)throw new Error("Blake3: key should be 32 byte");this.IV=(0,a.u32)(r),this.flags=t|c.KEYED_HASH}else if(void 0!==e.context){const r=new l({dkLen:32},c.DERIVE_KEY_CONTEXT).update(e.context).digest();this.IV=(0,a.u32)(r),this.flags=t|c.DERIVE_KEY_MATERIAL}else this.IV=i.IV.slice(),this.flags=t;this.state=this.IV.slice(),this.bufferOut=(0,a.u8)(this.bufferOut32)}get(){return[]}set(){}b2Compress(e,t,r,n=0){const{state:o,pos:a}=this,{h:c,l}=s.default.fromBig(BigInt(e),!0),{v0:d,v1:h,v2:f,v3:p,v4:y,v5:m,v6:_,v7:g,v8:E,v9:b,v10:w,v11:v,v12:S,v13:A,v14:T,v15:O}=(0,i.compress)(u,n,r,7,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],i.IV[0],i.IV[1],i.IV[2],i.IV[3],c,l,a,t);o[0]=d^E,o[1]=h^b,o[2]=f^w,o[3]=p^v,o[4]=y^S,o[5]=m^A,o[6]=_^T,o[7]=g^O}compress(e,t=0,r=!1){let n=this.flags;if(this.chunkPos||(n|=c.CHUNK_START),(15===this.chunkPos||r)&&(n|=c.CHUNK_END),r||(this.pos=this.blockLen),this.b2Compress(this.chunksDone,n,e,t),this.chunkPos+=1,16===this.chunkPos||r){let e=this.state;this.state=this.IV.slice();for(let t,n=this.chunksDone+1;(r||!(1&n))&&(t=this.stack.pop());n>>=1)this.buffer32.set(t,0),this.buffer32.set(e,8),this.pos=this.blockLen,this.b2Compress(0,this.flags|c.PARENT,this.buffer32,0),e=this.state,this.state=this.IV.slice();this.chunksDone++,this.chunkPos=0,this.stack.push(e)}this.pos=0}_cloneInto(e){e=super._cloneInto(e);const{IV:t,flags:r,state:n,chunkPos:s,posOut:o,chunkOut:i,stack:a,chunksDone:c}=this;return e.state.set(n.slice()),e.stack=a.map((e=>Uint32Array.from(e))),e.IV.set(t),e.flags=r,e.chunkPos=s,e.chunksDone=c,e.posOut=o,e.chunkOut=i,e.enableXOF=this.enableXOF,e.bufferOut32.set(this.bufferOut32),e}destroy(){this.destroyed=!0,this.state.fill(0),this.buffer32.fill(0),this.IV.fill(0),this.bufferOut32.fill(0);for(let e of this.stack)e.fill(0)}b2CompressOut(){const{state:e,pos:t,flags:r,buffer32:n,bufferOut32:o}=this,{h:a,l:c}=s.default.fromBig(BigInt(this.chunkOut++)),{v0:l,v1:d,v2:h,v3:f,v4:p,v5:y,v6:m,v7:_,v8:g,v9:E,v10:b,v11:w,v12:v,v13:S,v14:A,v15:T}=(0,i.compress)(u,0,n,7,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],i.IV[0],i.IV[1],i.IV[2],i.IV[3],c,a,t,r);o[0]=l^g,o[1]=d^E,o[2]=h^b,o[3]=f^w,o[4]=p^v,o[5]=y^S,o[6]=m^A,o[7]=_^T,o[8]=e[0]^g,o[9]=e[1]^E,o[10]=e[2]^b,o[11]=e[3]^w,o[12]=e[4]^v,o[13]=e[5]^S,o[14]=e[6]^A,o[15]=e[7]^T,this.posOut=0}finish(){if(this.finished)return;this.finished=!0,this.buffer.fill(0,this.pos);let e=this.flags|c.ROOT;this.stack.length?(e|=c.PARENT,this.compress(this.buffer32,0,!0),this.chunksDone=0,this.pos=this.blockLen):e|=(this.chunkPos?0:c.CHUNK_START)|c.CHUNK_END,this.flags=e,this.b2CompressOut()}writeInto(e){n.default.exists(this,!1),n.default.bytes(e),this.finish();const{blockLen:t,bufferOut:r}=this;for(let n=0,s=e.length;n<s;){this.posOut>=t&&this.b2CompressOut();const o=Math.min(t-this.posOut,s-n);e.set(r.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible after digest call");return this.writeInto(e)}xof(e){return n.default.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(n.default.output(e,this),this.finished)throw new Error("digest() was already called");return this.enableXOF=!1,this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}}t.blake3=(0,a.wrapXOFConstructorWithOpts)((e=>new l(e)))},"./node_modules/@noble/hashes/crypto.js":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},"./node_modules/@noble/hashes/sha256.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r("./node_modules/@noble/hashes/_sha2.js"),s=r("./node_modules/@noble/hashes/utils.js"),o=(e,t,r)=>e&t^e&r^t&r,i=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class u extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:s,F:o,G:i,H:a}=this;return[e,t,r,n,s,o,i,a]}set(e,t,r,n,s,o,i,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|s,this.F=0|o,this.G=0|i,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],r=c[e-2],n=(0,s.rotr)(t,7)^(0,s.rotr)(t,18)^t>>>3,o=(0,s.rotr)(r,17)^(0,s.rotr)(r,19)^r>>>10;c[e]=o+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:a,D:u,E:l,F:d,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,s.rotr)(l,6)^(0,s.rotr)(l,11)^(0,s.rotr)(l,25))+((p=l)&d^~p&h)+i[e]+c[e]|0,y=((0,s.rotr)(r,2)^(0,s.rotr)(r,13)^(0,s.rotr)(r,22))+o(r,n,a)|0;f=h,h=d,d=l,l=u+t|0,u=a,a=n,n=r,r=t+y|0}var p;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,d=d+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(r,n,a,u,l,d,h,f)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class l extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}t.sha256=(0,s.wrapConstructor)((()=>new u)),t.sha224=(0,s.wrapConstructor)((()=>new l))},"./node_modules/@noble/hashes/utils.js":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r("./node_modules/@noble/hashes/crypto.js"),s=e=>e instanceof Uint8Array;if(t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function i(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function a(e){if("string"==typeof e&&(e=i(e)),!s(e))throw new Error("expected Uint8Array, got "+typeof e);return e}t.bytesToHex=function(e){if(!s(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=o[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,s=e.slice(n,n+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[t]=o}return r},t.nextTick=async()=>{},t.asyncLoop=async function(e,r,n){let s=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-s;e>=0&&e<r||(await(0,t.nextTick)(),s+=e)}},t.utf8ToBytes=i,t.toBytes=a,t.concatBytes=function(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!s(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t},t.Hash=class{clone(){return this._cloneInto()}},t.checkOpts=function(e,t){if(void 0!==t&&("object"!=typeof t||(r=t,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new Error("Options should be object or undefined");var r;return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(a(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(a(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(a(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},"./node_modules/axios/index.js":(e,t,r)=>{e.exports=r("./node_modules/axios/lib/axios.js")},"./node_modules/axios/lib/adapters/xhr.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/core/settle.js"),o=r("./node_modules/axios/lib/helpers/cookies.js"),i=r("./node_modules/axios/lib/helpers/buildURL.js"),a=r("./node_modules/axios/lib/core/buildFullPath.js"),c=r("./node_modules/axios/lib/helpers/parseHeaders.js"),u=r("./node_modules/axios/lib/helpers/isURLSameOrigin.js"),l=r("./node_modules/axios/lib/core/createError.js"),d=r("./node_modules/axios/lib/defaults/transitional.js"),h=r("./node_modules/axios/lib/cancel/Cancel.js");e.exports=function(e){return new Promise((function(t,r){var f,p=e.data,y=e.headers,m=e.responseType;function _(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}n.isFormData(p)&&delete y["Content-Type"];var g=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",b=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";y.Authorization="Basic "+btoa(E+":"+b)}var w=a(e.baseURL,e.url);function v(){if(g){var n="getAllResponseHeaders"in g?c(g.getAllResponseHeaders()):null,o={data:m&&"text"!==m&&"json"!==m?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:n,config:e,request:g};s((function(e){t(e),_()}),(function(e){r(e),_()}),o),g=null}}if(g.open(e.method.toUpperCase(),i(w,e.params,e.paramsSerializer),!0),g.timeout=e.timeout,"onloadend"in g?g.onloadend=v:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(v)},g.onabort=function(){g&&(r(l("Request aborted",e,"ECONNABORTED",g)),g=null)},g.onerror=function(){r(l("Network Error",e,null,g)),g=null},g.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||d;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",g)),g=null},n.isStandardBrowserEnv()){var S=(e.withCredentials||u(w))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;S&&(y[e.xsrfHeaderName]=S)}"setRequestHeader"in g&&n.forEach(y,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete y[t]:g.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(g.withCredentials=!!e.withCredentials),m&&"json"!==m&&(g.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&g.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&g.upload&&g.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(e){g&&(r(!e||e&&e.type?new h("canceled"):e),g.abort(),g=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),p||(p=null),g.send(p)}))}},"./node_modules/axios/lib/axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/helpers/bind.js"),o=r("./node_modules/axios/lib/core/Axios.js"),i=r("./node_modules/axios/lib/core/mergeConfig.js"),a=function e(t){var r=new o(t),a=s(o.prototype.request,r);return n.extend(a,o.prototype,r),n.extend(a,r),a.create=function(r){return e(i(t,r))},a}(r("./node_modules/axios/lib/defaults/index.js"));a.Axios=o,a.Cancel=r("./node_modules/axios/lib/cancel/Cancel.js"),a.CancelToken=r("./node_modules/axios/lib/cancel/CancelToken.js"),a.isCancel=r("./node_modules/axios/lib/cancel/isCancel.js"),a.VERSION=r("./node_modules/axios/lib/env/data.js").version,a.all=function(e){return Promise.all(e)},a.spread=r("./node_modules/axios/lib/helpers/spread.js"),a.isAxiosError=r("./node_modules/axios/lib/helpers/isAxiosError.js"),e.exports=a,e.exports.default=a},"./node_modules/axios/lib/cancel/Cancel.js":e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},"./node_modules/axios/lib/cancel/CancelToken.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/cancel/Cancel.js");function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},s.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},"./node_modules/axios/lib/cancel/isCancel.js":e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},"./node_modules/axios/lib/core/Axios.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/helpers/buildURL.js"),o=r("./node_modules/axios/lib/core/InterceptorManager.js"),i=r("./node_modules/axios/lib/core/dispatchRequest.js"),a=r("./node_modules/axios/lib/core/mergeConfig.js"),c=r("./node_modules/axios/lib/helpers/validator.js"),u=c.validators;function l(e){this.defaults=e,this.interceptors={request:new o,response:new o}}l.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&c.assertOptions(r,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var n=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,l=[];if(this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)})),!s){var d=[i,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(l),o=Promise.resolve(t);d.length;)o=o.then(d.shift(),d.shift());return o}for(var h=t;n.length;){var f=n.shift(),p=n.shift();try{h=f(h)}catch(e){p(e);break}}try{o=i(h)}catch(e){return Promise.reject(e)}for(;l.length;)o=o.then(l.shift(),l.shift());return o},l.prototype.getUri=function(e){return e=a(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=l},"./node_modules/axios/lib/core/InterceptorManager.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function s(){this.handlers=[]}s.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},"./node_modules/axios/lib/core/buildFullPath.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/isAbsoluteURL.js"),s=r("./node_modules/axios/lib/helpers/combineURLs.js");e.exports=function(e,t){return e&&!n(t)?s(e,t):t}},"./node_modules/axios/lib/core/createError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/enhanceError.js");e.exports=function(e,t,r,s,o){var i=new Error(e);return n(i,t,r,s,o)}},"./node_modules/axios/lib/core/dispatchRequest.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/core/transformData.js"),o=r("./node_modules/axios/lib/cancel/isCancel.js"),i=r("./node_modules/axios/lib/defaults/index.js"),a=r("./node_modules/axios/lib/cancel/Cancel.js");function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=s.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},"./node_modules/axios/lib/core/enhanceError.js":e=>{"use strict";e.exports=function(e,t,r,n,s){return e.config=t,r&&(e.code=r),e.request=n,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},"./node_modules/axios/lib/core/mergeConfig.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){t=t||{};var r={};function s(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function o(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:s(void 0,e[r]):s(e[r],t[r])}function i(e){if(!n.isUndefined(t[e]))return s(void 0,t[e])}function a(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:s(void 0,e[r]):s(void 0,t[r])}function c(r){return r in t?s(e[r],t[r]):r in e?s(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return n.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,s=t(e);n.isUndefined(s)&&t!==c||(r[e]=s)})),r}},"./node_modules/axios/lib/core/settle.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/core/createError.js");e.exports=function(e,t,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},"./node_modules/axios/lib/core/transformData.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/defaults/index.js");e.exports=function(e,t,r){var o=this||s;return n.forEach(r,(function(r){e=r.call(o,e,t)})),e}},"./node_modules/axios/lib/defaults/index.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=r("./node_modules/axios/lib/helpers/normalizeHeaderName.js"),o=r("./node_modules/axios/lib/core/enhanceError.js"),i=r("./node_modules/axios/lib/defaults/transitional.js"),a={"Content-Type":"application/x-www-form-urlencoded"};function c(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,l={transitional:i,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r("./node_modules/axios/lib/adapters/xhr.js")),u),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(c(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(c(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||l.transitional,r=t&&t.silentJSONParsing,s=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||s&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){l.headers[e]=n.merge(a)})),e.exports=l},"./node_modules/axios/lib/defaults/transitional.js":e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},"./node_modules/axios/lib/env/data.js":e=>{e.exports={version:"0.26.1"}},"./node_modules/axios/lib/helpers/bind.js":e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},"./node_modules/axios/lib/helpers/buildURL.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");function s(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(s(t)+"="+s(e))})))})),o=i.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},"./node_modules/axios/lib/helpers/combineURLs.js":e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},"./node_modules/axios/lib/helpers/cookies.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,s,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(s)&&a.push("path="+s),n.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},"./node_modules/axios/lib/helpers/isAbsoluteURL.js":e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},"./node_modules/axios/lib/helpers/isAxiosError.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e){return n.isObject(e)&&!0===e.isAxiosError}},"./node_modules/axios/lib/helpers/isURLSameOrigin.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function s(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=s(window.location.href),function(t){var r=n.isString(t)?s(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},"./node_modules/axios/lib/helpers/normalizeHeaderName.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js");e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},"./node_modules/axios/lib/helpers/parseHeaders.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/utils.js"),s=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,i={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(i[t]&&s.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},"./node_modules/axios/lib/helpers/spread.js":e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},"./node_modules/axios/lib/helpers/validator.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/env/data.js").version,s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var o={};s.transitional=function(e,t,r){function s(e,t){return"[Axios v"+n+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,i){if(!1===e)throw new Error(s(n," has been removed"+(t?" in "+t:"")));return t&&!o[n]&&(o[n]=!0,console.warn(s(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,i)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),s=n.length;s-- >0;){var o=n[s],i=t[o];if(i){var a=e[o],c=void 0===a||i(a,o,e);if(!0!==c)throw new TypeError("option "+o+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:s}},"./node_modules/axios/lib/utils.js":(e,t,r)=>{"use strict";var n=r("./node_modules/axios/lib/helpers/bind.js"),s=Object.prototype.toString;function o(e){return Array.isArray(e)}function i(e){return void 0===e}function a(e){return"[object ArrayBuffer]"===s.call(e)}function c(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==s.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===s.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}e.exports={isArray:o,isArrayBuffer:a,isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===s.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&a(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:c,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:l,isStream:function(e){return c(e)&&l(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===s.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:d,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):o(r)?t[n]=r.slice():t[n]=r}for(var n=0,s=arguments.length;n<s;n++)d(arguments[n],r);return t},extend:function(e,t,r){return d(t,(function(t,s){e[s]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},"./node_modules/base-x/src/index.js":e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw new TypeError(s+" is ambiguous");t[o]=n}var i=e.length,a=e.charAt(0),c=Math.log(i)/Math.log(256),u=Math.log(256)/Math.log(i);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,s=0;e[r]===a;)n++,r++;for(var o=(e.length-r)*c+1>>>0,u=new Uint8Array(o);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var d=0,h=o-1;(0!==l||d<s)&&-1!==h;h--,d++)l+=i*u[h]>>>0,u[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");s=d,r++}for(var f=o-s;f!==o&&0===u[f];)f++;for(var p=new Uint8Array(n+(o-f)),y=n;f!==o;)p[y++]=u[f++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var c=(o-s)*u+1>>>0,l=new Uint8Array(c);s!==o;){for(var d=t[s],h=0,f=c-1;(0!==d||h<n)&&-1!==f;f--,h++)d+=256*l[f]>>>0,l[f]=d%i>>>0,d=d/i>>>0;if(0!==d)throw new Error("Non-zero carry");n=h,s++}for(var p=c-n;p!==c&&0===l[p];)p++;for(var y=a.repeat(r);p<c;++p)y+=e.charAt(l[p]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+i+" character")}}}},"./node_modules/base64-js/index.js":(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),i=o[0],c=o[1],u=new s(function(e,t,r){return 3*(t+r)/4-r}(0,i,c)),l=0,d=c>0?i-4:i;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,s=n%3,o=[],i=16383,a=0,u=n-s;a<u;a+=i)o.push(c(e,a,a+i>u?u:a+i));return 1===s?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===s&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)r[i]=o[i],n[o.charCodeAt(i)]=i;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var s,o,i=[],a=t;a<n;a+=3)s=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(r[(o=s)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},"./node_modules/bs58/index.js":(e,t,r)=>{const n=r("./node_modules/base-x/src/index.js");e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},"./node_modules/bs58check/base.js":(e,t,r)=>{"use strict";var n=r("./node_modules/bs58/index.js");e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),s=e(r);if(!(n[0]^s[0]|n[1]^s[1]|n[2]^s[2]|n[3]^s[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),s=e(r),o=r.length+4,i=new Uint8Array(o);return i.set(r,0),i.set(s.subarray(0,4),r.length),n.encode(i,o)},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},"./node_modules/bs58check/index.js":(e,t,r)=>{"use strict";var{sha256:n}=r("./node_modules/@noble/hashes/sha256.js"),s=r("./node_modules/bs58check/base.js");e.exports=s((function(e){return n(n(e))}))},"./node_modules/buffer/index.js":(e,t,r)=>{"use strict";const n=r("./node_modules/base64-js/index.js"),s=r("./node_modules/ieee754/index.js"),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=a(r);const s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const s=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let s=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(e).length;default:if(s)return n?-1:F(e).length;t=(""+t).toLowerCase(),s=!0}}function m(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function _(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,s){let o,i=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i=2,a/=2,c/=2,r/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(s){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*i}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function b(e,t,r,n){r=Number(r)||0;const s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;const o=t.length;let i;for(n>o/2&&(n=o/2),i=0;i<n;++i){const n=parseInt(t.substr(2*i,2),16);if(X(n))return i;e[r+i]=n}return i}function w(e,t,r,n){return J(F(t,e.length-r),e,r,n)}function v(e,t,r,n){return J(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return J(K(t),e,r,n)}function A(e,t,r,n){return J(function(e,t){let r,n,s;const o=[];for(let i=0;i<e.length&&!((t-=2)<0);++i)r=e.charCodeAt(i),n=r>>8,s=r%256,o.push(s),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);const n=[];let s=t;for(;s<r;){const t=e[s];let o=null,i=t>239?4:t>223?3:t>191?2:1;if(s+i<=r){let r,n,a,c;switch(i){case 1:t<128&&(o=t);break;case 2:r=e[s+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[s+1],n=e[s+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[s+1],n=e[s+2],a=e[s+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,i=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),s+=i}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N));return r}(n)}t.kMaxLength=i,c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let s=0,o=Math.min(r,n);s<o;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let s=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))s+t.length>n.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,s)):Uint8Array.prototype.set.call(n,t,s);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,s)}s+=t.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)_(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):m.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,s){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(s>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0);const a=Math.min(o,i),u=this.slice(n,s),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){o=u[e],i=l[e];break}return o<i?-1:i<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return v(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function R(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}function C(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}function I(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let s="";for(let n=t;n<r;++n)s+=z[e[n]];return s}function x(e,t,r){const n=e.slice(t,r);let s="";for(let e=0;e<n.length-1;e+=2)s+=String.fromCharCode(n[e]+256*n[e+1]);return s}function U(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,r,n,s,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function L(e,t,r,n,s){$(t,n,s,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,r}function P(e,t,r,n,s){$(t,n,s,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=i,i>>=8,e[r+2]=i,i>>=8,e[r+1]=i,i>>=8,e[r]=i,r+8}function M(e,t,r,n,s,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,4),s.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,8),s.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],s=1,o=0;for(;++o<t&&(s*=256);)n+=this[e+o]*s;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||U(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,s=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))})),c.prototype.readBigUInt64BE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],s=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(s)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=this[e],s=1,o=0;for(;++o<t&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||U(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||U(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||U(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=Q((function(e){V(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||U(e,4,this.length),s.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||U(e,4,this.length),s.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||U(e,8,this.length),s.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||U(e,8,this.length),s.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);let s=1,o=0;for(this[t]=255&e;++o<r&&(s*=256);)this[t+o]=e/s&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(this,e,t,r,Math.pow(2,8*r)-1,0);let s=r-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,e,t,r,n-1,-n)}let s=0,o=1,i=0;for(this[t]=255&e;++s<r&&(o*=256);)e<0&&0===i&&0!==this[t+s-1]&&(i=1),this[t+s]=(e/o>>0)-i&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,e,t,r,n-1,-n)}let s=r-1,o=1,i=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===i&&0!==this[t+s+1]&&(i=1),this[t+s]=(e/o>>0)-i&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const s=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),s},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{const o=c.isBuffer(e)?e:c.from(e,n),i=o.length;if(0===i)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=o[s%i]}return this};const k={};function G(e,t,r){k[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function H(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,s,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let s;throw s=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new k.ERR_OUT_OF_RANGE("value",s,e)}!function(e,t,r){V(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,s,o)}function V(e,t){if("number"!=typeof e)throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw V(e,r),new k.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new k.ERR_BUFFER_OUT_OF_BOUNDS;throw new k.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),G("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),G("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,s=r;return Number.isInteger(r)&&Math.abs(r)>2**32?s=H(String(r)):"bigint"==typeof r&&(s=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(s=H(s)),s+="n"),n+=` It must be ${t}. Received ${s}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function F(e,t){let r;t=t||1/0;const n=e.length;let s=null;const o=[];for(let i=0;i<n;++i){if(r=e.charCodeAt(i),r>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(i+1===n){(t-=3)>-1&&o.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(t-=3)>-1&&o.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function J(e,t,r,n){let s;for(s=0;s<n&&!(s+r>=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let s=0;s<16;++s)t[n+s]=e[r]+e[s]}return t}();function Q(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},"./node_modules/events/events.js":e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function s(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,s)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var s,o,i,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),i=o[t]),void 0===i)i=o[t]=r,++e._eventsCount;else if("function"==typeof i?i=o[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(s=c(e))>0&&i.length>s&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=i.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=l.bind(n);return s.listener=r,n.wrapFn=s,s}function h(e,t,r){var n=e._events;if(void 0===n)return[];var s=n[t];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(s):p(s,s.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function s(o){n.once&&e.removeEventListener(t,s),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,o=this._events;if(void 0!==o)s=s&&void 0===o.error;else if(!s)return!1;if(s){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,s,o,i;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){i=r[o].listener,s=o;break}if(s<0)return this;0===s?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,s),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var s,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(s=o[n])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},"./node_modules/ieee754/index.js":(e,t)=>{t.read=function(e,t,r,n,s){var o,i,a=8*s-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?s-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=h,l-=8);for(i=o&(1<<-l)-1,o>>=-l,l+=n;l>0;i=256*i+e[t+d],d+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return i?NaN:1/0*(f?-1:1);i+=Math.pow(2,n),o-=u}return(f?-1:1)*i*Math.pow(2,o-n)},t.write=function(e,t,r,n,s,o){var i,a,c,u=8*o-s-1,l=(1<<u)-1,d=l>>1,h=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),(t+=i+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(i++,c/=2),i+d>=l?(a=0,i=l):i+d>=1?(a=(t*c-1)*Math.pow(2,s),i+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,s),i=0));s>=8;e[r+f]=255&a,f+=p,a/=256,s-=8);for(i=i<<s|a,u+=s;u>0;e[r+f]=255&i,f+=p,i/=256,u-=8);e[r+f-p]|=128*y}},"./src/account/Account.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const n=r("./src/connector/Connector.ts"),s=r("./src/index.ts");t.Account=class{constructor({address:e,name:t},r){this._address=e,this._name=t??"",this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountBalance,{address:this._address},((r,n)=>n?t(n):e(r)))}))}async sign(e){return new Promise(((t,r)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountSign,{address:this._address,data:e},((e,n)=>n?r(n):t(e)))}))}async buyRolls(e,t){return new Promise(((r,o)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountBuyRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?o(t):r(e)))}))}async sellRolls(e,t){return new Promise(((r,o)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountSellRolls,{amount:e.toString(),fee:t.toString()},((e,t)=>t?o(t):r(e)))}))}async sendTransaction(e,t,r){return new Promise(((o,i)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountSendTransaction,{amount:e.toString(),recipientAddress:t,fee:r.toString()},((e,t)=>t?i(t):o(e)))}))}async callSC(e,t,r,o,i,a,c=!1){return new Promise(((u,l)=>{n.connector.sendMessageToContentScript(this._providerName,s.AvailableCommands.AccountCallSC,{nickname:this._name,name:t,at:e,args:r,coins:o,fee:i,maxGas:a,nonPersistentExecution:c},((e,t)=>t?l(t):u(e)))}))}}},"./src/account/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;var n=r("./src/account/Account.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return n.Account}})},"./src/bearbyWallet/BearbyAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBytesPublicKey=t.BearbyAccount=t.requestHeaders=t.OperationTypeId=t.OperationsType=t.PUBLIC_NODE_RPC=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),s=r("./src/massaStation/RequestHandler.ts"),o=r("./src/bearbyWallet/jsonRpcMethods.ts"),i=r("./node_modules/axios/index.js"),a=r("./src/bearbyWallet/BearbyProvider.ts"),c=r("./src/bearbyWallet/Xbqcrypto.ts"),u=BigInt(4294967295);var l,d;t.PUBLIC_NODE_RPC="https://buildnet.massa.net/api/v2",function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(l=t.OperationsType||(t.OperationsType={})),(d=t.OperationTypeId||(t.OperationTypeId={}))[d.Transaction=0]="Transaction",d[d.RollBuy=1]="RollBuy",d[d.RollSell=2]="RollSell",d[d.ExecuteSC=3]="ExecuteSC",d[d.CallSC=4]="CallSC",t.requestHeaders={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":!0,"Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS"},t.BearbyAccount=class{constructor({address:e,name:r},n){this._nodeUrl=t.PUBLIC_NODE_RPC,this._address=e,this._name=r??"Bearby_account",this._providerName=n}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){const e={jsonrpc:"2.0",method:"get_addresses",params:[[this._address]],id:0},r=await(0,s.postRequest)(t.PUBLIC_NODE_RPC,e);if(r.isError||r.error)throw r.error.message;return{finalBalance:r.result.result[0].final_balance,candidateBalance:r.result.result[0].candidate_balance}}async sign(e){const t=new TextEncoder;if("string"==typeof e){const r=await n.web3.wallet.signMessage(e);return{publicKey:r.publicKey,signature:t.encode(r.signature)}}const r=(new TextDecoder).decode(e);return{publicKey:(await n.web3.wallet.signMessage(r)).publicKey,signature:t.encode((await n.web3.wallet.signMessage(r)).signature)}}async buyRolls(e,t){throw await n.web3.wallet.signTransaction({type:l.RollBuy,amount:e.toString(),fee:t.toString(),payload:""}),new Error("Method not implemented.")}async sellRolls(e,t){throw await n.web3.wallet.signTransaction({type:l.RollSell,amount:e.toString(),fee:t.toString(),payload:""}),new Error("Method not implemented.")}async sendTransaction(e,t,r){const s=await n.web3.wallet.signTransaction({type:l.Payment,amount:e.toString(),recipient:t,fee:r.toString(),payload:""});return console.log(s),{operationId:"00"}}async callSC(e,t,r,s,o,i,a=!1){if(a)return this.nonPersistentCallSC(e,t,r,s,o,i);if(r instanceof Uint8Array)throw new Error("Protobuf serialization is not supported by bearby wallet. To use it switch to MassaStation");let c=[];try{c=r.getArgsList().map((e=>({type:e.type,value:e.value})))}catch(e){throw new Error("Bearby wallet does not support Uint8Array, serializable and serializableObjectArray. To use them switch to MassaStation")}return await n.web3.contract.call({maxGas:Number(i),coins:Number(s),fee:Number(o),targetAddress:e,functionName:t,parameters:c})}async getNodeStatus(){const e=o.JSON_RPC_REQUEST_METHOD.GET_STATUS;return await this.sendJsonRPCRequest(e,[])}async sendJsonRPCRequest(e,t){let r=null;if(r=await this.promisifyJsonRpcCall(e,t),r.isError||r.error)throw r.error;return r.result}async promisifyJsonRpcCall(e,r){let n=null;const s={jsonrpc:"2.0",method:e,params:r,id:0};try{n=await i.default.post(this._nodeUrl,s,t.requestHeaders)}catch(e){return{isError:!0,result:null,error:new Error("JSON.parse error: "+String(e))}}const o=n.data;return o.error?{isError:!0,result:null,error:new Error(o.error.message)}:{isError:!1,result:o.result,error:null}}getProviderForRpcMethod(e){switch(e){case o.JSON_RPC_REQUEST_METHOD.GET_ADDRESSES:case o.JSON_RPC_REQUEST_METHOD.GET_STATUS:case o.JSON_RPC_REQUEST_METHOD.SEND_OPERATIONS:case o.JSON_RPC_REQUEST_METHOD.GET_OPERATIONS:case o.JSON_RPC_REQUEST_METHOD.GET_BLOCKS:case o.JSON_RPC_REQUEST_METHOD.GET_ENDORSEMENTS:case o.JSON_RPC_REQUEST_METHOD.GET_CLIQUES:case o.JSON_RPC_REQUEST_METHOD.GET_STAKERS:case o.JSON_RPC_REQUEST_METHOD.GET_FILTERED_SC_OUTPUT_EVENT:case o.JSON_RPC_REQUEST_METHOD.EXECUTE_READ_ONLY_BYTECODE:case o.JSON_RPC_REQUEST_METHOD.EXECUTE_READ_ONLY_CALL:case o.JSON_RPC_REQUEST_METHOD.GET_DATASTORE_ENTRIES:case o.JSON_RPC_REQUEST_METHOD.GET_BLOCKCLIQUE_BLOCK_BY_SLOT:case o.JSON_RPC_REQUEST_METHOD.GET_GRAPH_INTERVAL:case o.JSON_RPC_REQUEST_METHOD.STOP_NODE:case o.JSON_RPC_REQUEST_METHOD.NODE_BAN_BY_ID:case o.JSON_RPC_REQUEST_METHOD.NODE_BAN_BY_IP:case o.JSON_RPC_REQUEST_METHOD.NODE_UNBAN_BY_ID:case o.JSON_RPC_REQUEST_METHOD.NODE_UNBAN_BY_IP:case o.JSON_RPC_REQUEST_METHOD.GET_STAKING_ADDRESSES:case o.JSON_RPC_REQUEST_METHOD.REMOVE_STAKING_ADDRESSES:case o.JSON_RPC_REQUEST_METHOD.ADD_STAKING_PRIVATE_KEYS:case o.JSON_RPC_REQUEST_METHOD.NODE_SIGN_MESSAGE:case o.JSON_RPC_REQUEST_METHOD.NODE_REMOVE_FROM_WHITELIST:return new a.BearbyProvider("Bearby");default:throw new Error(`Unknown Json rpc method: ${e}`)}}async nonPersistentCallSC(e,r,n,o,i,a){const c=t.PUBLIC_NODE_RPC;if(a>u)throw new Error(`\n The gas submitted ${a.toString()} exceeds the max. allowed block gas of \n ${u.toString()}\n `);let l=[];l=n instanceof Uint8Array?Array.from(n):Array.from(n.serialize());const d=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(a),target_address:e,target_function:r,parameter:l,caller_address:this._address,coins:Number(o),fee:Number(i)}]],id:0}];let h=[];try{let e=await(0,s.postRequest)(c,d);if(e.isError||e.error)throw e.error.message;h=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(h.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(h[0].result.Error)throw new Error(h[0].result.Error);return{returnValue:new Uint8Array(h[0].result[0].result.Ok),info:h[0]}}},t.getBytesPublicKey=function(e){if("P"!=e[0])throw new Error(`Invalid public key prefix: ${e[0]} should be P`);return(0,c.base58Decode)(e.slice(1))}},"./src/bearbyWallet/BearbyConnect.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.disconnectBearby=t.connectBearby=t.detectBearby=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js");t.detectBearby=async function(){return!(!globalThis.window||!globalThis.window.bearby)},t.connectBearby=async function(){try{await n.web3.wallet.connect()}catch(e){console.log(e)}},t.disconnectBearby=async function(){await n.web3.wallet.diconnect(),console.log("Bearby disconnected")}},"./src/bearbyWallet/BearbyProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BearbyProvider=void 0;const n=r("./node_modules/@hicaru/bearby.js/dist/index.js"),s=r("./src/bearbyWallet/BearbyAccount.ts");t.BearbyProvider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){n.web3.wallet.enabled||await n.web3.wallet.connect();const e={address:await n.web3.wallet.account.base58,name:"Bearby"};return[new s.BearbyAccount(e,this.providerName)]}async importAccount(e,t){throw new Error("Method not implemented.")}async deleteAccount(e){throw new Error("Method not implemented.")}async getNodesUrls(){return["https://buildnet.massa.net/api/v2"]}async generateNewAccount(e){throw new Error("Method not implemented.")}}},"./src/bearbyWallet/Xbqcrypto.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.varintDecode=t.varintEncode=t.base58Decode=t.base58Encode=t.hashBlake3=void 0;const n=r("./node_modules/varint/index.js"),s=r("./node_modules/@noble/hashes/blake3.js"),o=r("./src/bearbyWallet/unsignedBigIntUtils.ts"),i=r("./node_modules/bs58check/index.js");t.hashBlake3=function(e){return(0,s.blake3)(e)},t.base58Encode=function(e){return(0,i.encode)(e)},t.base58Decode=function(e){const t=(0,i.decode)(e);return Buffer.from(t)},t.varintEncode=function(e){return"bigint"==typeof e?o.encode(e):n.encode(e)},t.varintDecode=function(e){return{value:n.decode(e),bytes:n.decode.bytes}}},"./src/bearbyWallet/jsonRpcMethods.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.JSON_RPC_REQUEST_METHOD=void 0,(r=t.JSON_RPC_REQUEST_METHOD||(t.JSON_RPC_REQUEST_METHOD={})).GET_STATUS="get_status",r.GET_ADDRESSES="get_addresses",r.SEND_OPERATIONS="send_operations",r.GET_BLOCKS="get_blocks",r.GET_ENDORSEMENTS="get_endorsements",r.GET_OPERATIONS="get_operations",r.GET_CLIQUES="get_cliques",r.GET_STAKERS="get_stakers",r.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",r.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",r.EXECUTE_READ_ONLY_CALL="execute_read_only_call",r.GET_DATASTORE_ENTRIES="get_datastore_entries",r.GET_BLOCKCLIQUE_BLOCK_BY_SLOT="get_blockclique_block_by_slot",r.GET_GRAPH_INTERVAL="get_graph_interval",r.STOP_NODE="stop_node",r.NODE_BAN_BY_IP="node_ban_by_ip",r.NODE_BAN_BY_ID="node_ban_by_id",r.NODE_UNBAN_BY_IP="node_unban_by_ip",r.NODE_UNBAN_BY_ID="node_unban_by_id",r.GET_STAKING_ADDRESSES="get_staking_addresses",r.REMOVE_STAKING_ADDRESSES="remove_staking_addresses",r.ADD_STAKING_PRIVATE_KEYS="add_staking_private_keys",r.NODE_SIGN_MESSAGE="node_sign_message",r.NODE_REMOVE_FROM_WHITELIST="node_remove_from_whitelist",r.NODE_ADD_TO_PEERS_WHITELIST="node_add_to_peers_whitelist"},"./src/bearbyWallet/unsignedBigIntUtils.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodingLength=void 0;const r=BigInt(127),n=BigInt(0),s=BigInt(7);function o(e){let t=0;for(;e>=BigInt(128);t++)e>>=s;return t+1}t.encodingLength=o,t.encode=function(e,t,i){if(e<n)throw new RangeError("value must be unsigned");const a=o(e);if(i=i||0,(t=t||new ArrayBuffer(a)).byteLength<i+a)throw new RangeError("the buffer is too small to encode the number at the offset");const c=new Uint8Array(t,i);let u=0;for(;r<e;)c[u++]=128|Number(e&r),e>>=s;return c[u]=Number(e),c},t.decode=function(e,t=0){let r,s=n,o=0;do{if(r=e[t+o],void 0===r)throw new RangeError("offset out of range");s+=BigInt(127&r)<<BigInt(7*o),o++}while(128<=r);return s}},"./src/connector/Connector.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connector=t.MASSA_WINDOW_OBJECT=void 0;const n=r("./node_modules/uid/dist/index.js"),s=r("./src/index.ts"),o=r("./src/massaStation/MassaStationDiscovery.ts"),i=r("./src/massaStation/MassaStationProvider.ts");t.MASSA_WINDOW_OBJECT="massaWalletProvider",t.connector=new class{constructor(){this.registeredProviders={},this.pendingRequests=new Map,this.massaStationListener=new o.MassaStationDiscovery,this.initMassaStationListener(),this.register(),document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("message",this.handleResponseFromContentScript.bind(this))}register(){if(!document.getElementById(t.MASSA_WINDOW_OBJECT)){const e=document.createElement("p");e.id=t.MASSA_WINDOW_OBJECT,e.setAttribute("style","display:none"),document.body.appendChild(e)}document.getElementById(t.MASSA_WINDOW_OBJECT).addEventListener("register",(e=>{const r=e.detail,n=`${t.MASSA_WINDOW_OBJECT}_${r.providerName}`;this.registeredProviders[r.providerName]=n}))}initMassaStationListener(){this.massaStationListener.on(o.ON_MASSA_STATION_DISCOVERED,(()=>{this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]=`${t.MASSA_WINDOW_OBJECT}_${i.MASSA_STATION_PROVIDER_NAME}`})),this.massaStationListener.on(o.ON_MASSA_STATION_DISCONNECTED,(()=>{delete this.registeredProviders[i.MASSA_STATION_PROVIDER_NAME]}))}async startMassaStationDiscovery(){try{await this.massaStationListener.startListening()}catch(e){console.log("MassaStation is not detected")}}sendMessageToContentScript(e,t,r,o){if(!Object.values(s.AvailableCommands).includes(t))throw new Error(`Unknown command ${t}`);const i=(0,n.uid)(),a={params:r,requestId:i};this.pendingRequests.set(i,o);const c=document.getElementById(`${this.registeredProviders[e]}`);if(!c)throw new Error(`Registered provider with name ${e} does not exist`);if(!c.dispatchEvent(new CustomEvent(t,{detail:a})))throw new Error(`Could not dispatch a message to ${this.registeredProviders[e]}`)}getWalletProviders(){return this.registeredProviders}handleResponseFromContentScript(e){const{result:t,error:r,requestId:n}=e.detail,s=this.pendingRequests.get(n);s?(r?s(null,new Error(r.message)):s(t,null),this.pendingRequests.delete(n)||console.error(`Error deleting a pending request with id ${n}`)):console.error(`Request Id ${n} not found in response callback map`)}}},"./src/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationAccount=t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=t.Account=t.registerProvider=t.providers=t.AvailableCommands=void 0;const n=r("./node_modules/buffer/index.js");"undefined"!=typeof window&&(window.Buffer=n.Buffer);const s=r("./src/connector/Connector.ts"),o=r("./src/provider/Provider.ts"),i=r("./src/massaStation/MassaStationProvider.ts"),a=r("./src/bearbyWallet/BearbyConnect.ts"),c=r("./src/bearbyWallet/BearbyProvider.ts");var u;(u=t.AvailableCommands||(t.AvailableCommands={})).ProviderListAccounts="LIST_ACCOUNTS",u.ProviderDeleteAccount="DELETE_ACCOUNT",u.ProviderImportAccount="IMPORT_ACCOUNT",u.ProviderGetNodesUrls="GET_NODES_URLS",u.AccountBalance="ACCOUNT_BALANCE",u.AccountSign="ACCOUNT_SIGN",u.ProviderGenerateNewAccount="GENERATE_NEW_ACCOUNT",u.AccountSellRolls="ACCOUNT_SELL_ROLLS",u.AccountBuyRolls="ACCOUNT_BUY_ROLLS",u.AccountSendTransaction="ACCOUNT_SEND_TRANSACTION",u.AccountCallSC="ACCOUNT_CALL_SC",t.providers=async function e(t=!0,r=3e3,n=500){if(r<=0)return[];let u;return await s.connector.startMassaStationDiscovery(),(0,a.detectBearby)()&&(u=new c.BearbyProvider("Bearby")),new Promise((a=>{let c=[];for(const e of Object.keys(s.connector.getWalletProviders()))if(e===i.MASSA_STATION_PROVIDER_NAME){const e=new i.MassaStationProvider;c.push(e)}else{const t=new o.Provider(e);c.push(t)}u&&c.push(u),t&&0===c.length?setTimeout((()=>{e(t,r-n,n).then(a)}),n):a(c)}))},t.registerProvider=function(e,t=s.MASSA_WINDOW_OBJECT){const r=new CustomEvent("register",{detail:{providerName:e}}),n=document.getElementById(t);n&&n.dispatchEvent(r)};var l=r("./src/account/index.ts");Object.defineProperty(t,"Account",{enumerable:!0,get:function(){return l.Account}});var d=r("./src/provider/index.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return d.EAccountDeletionResponse}}),Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return d.EAccountImportResponse}}),Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return d.Provider}});var h=r("./src/massaStation/MassaStationAccount.ts");Object.defineProperty(t,"MassaStationAccount",{enumerable:!0,get:function(){return h.MassaStationAccount}})},"./src/massaStation/MassaStationAccount.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationAccount=void 0;const n=r("./src/massaStation/RequestHandler.ts"),s=r("./src/massaStation/MassaStationProvider.ts"),o=r("./src/utils/argsToBase64.ts"),i=BigInt(4294967295);t.MassaStationAccount=class{constructor({address:e,name:t},r){this._address=e,this._name=t,this._providerName=r}address(){return this._address}name(){return this._name}providerName(){return this._providerName}async balance(){let e=null;try{e=await(0,n.getRequest)(`${s.MASSA_STATION_URL}massa/addresses?attributes=balance&addresses=${this._address}`)}catch(e){throw console.error("MassaStation account balance error"),e}if(e.isError||e.error)throw e.error;const t=e.result.addressesAttributes[this._address].balance;return{finalBalance:t.final,candidateBalance:t.pending}}async sign(e){let t=null;try{t=await(0,n.postRequest)(`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/sign`,{operation:e,batch:!1})}catch(e){throw console.error("MassaStation account signing error"),e}if(t.isError||t.error)throw t.error;return t.result}async buyRolls(e,t){let r=null;const o=`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"buy"};try{r=await(0,n.postRequest)(o,i)}catch(e){throw console.error(`MassaStation account: error while buying rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sellRolls(e,t){let r=null;const o=`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/rolls`,i={fee:t.toString(),amount:e.toString(),side:"sell"};try{r=await(0,n.postRequest)(o,i)}catch(e){throw console.error(`MassaStation account: error while selling rolls: ${e}`),e}if(r.isError||r.error)throw r.error;return r.result}async sendTransaction(e,t,r){let o=null;const i=`${s.MASSA_STATION_ACCOUNTS_URL}/${this._name}/transfer`,a={fee:r.toString(),amount:e.toString(),recipientAddress:t};try{o=await(0,n.postRequest)(i,a)}catch(e){throw console.error(`MassaStation account: error while sending transaction: ${e}`),e}if(o.isError||o.error)throw o.error;return o.result}async callSC(e,t,r,i,a,c,u=!1){if(u)return this.nonPersistentCallSC(e,t,r,i,a,c);let l="";l=r instanceof Uint8Array?(0,o.uint8ArrayToBase64)(r):(0,o.argsToBase64)(r);let d=null;const h=`${s.MASSA_STATION_URL}cmd/executeFunction`,f={nickname:this._name,name:t,at:e,args:l,coins:Number(i)};try{d=await(0,n.postRequest)(h,f)}catch(e){throw console.log(`MassaStation account: error while interacting with smart contract: ${e}`),e}if(d.isError||d.error)throw d.error;return d.result}async getNodeUrlFromMassaStation(){let e=null,t="";try{if(e=await(0,n.getRequest)(`${s.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;t=e.result.url}catch(e){throw new Error(`MassaStation nodes retrieval error: ${e}`)}return t}async nonPersistentCallSC(e,t,r,s,o,a){const c=await this.getNodeUrlFromMassaStation();if(a>i)throw new Error(`\n The gas submitted ${a.toString()} exceeds the max. allowed block gas of \n ${i.toString()}\n `);let u=[];u=r instanceof Uint8Array?Array.from(r):Array.from(r.serialize());const l=[{jsonrpc:"2.0",method:"execute_read_only_call",params:[[{max_gas:Number(a),target_address:e,target_function:t,parameter:u,caller_address:this._address}]],id:0}];let d=[];try{let e=await(0,n.postRequest)(c,l);if(e.isError||e.error)throw e.error.message;d=e.result}catch(e){throw new Error(`MassaStation account: error while interacting with smart contract: ${e}`)}if(d.length<=0)throw new Error("Read operation bad response. No results array in json rpc response. Inspect smart contract");if(d[0].result.Error)throw new Error(d[0].result.Error);return{returnValue:new Uint8Array(d[0].result[0].result.Ok),info:d[0]}}}},"./src/massaStation/MassaStationDiscovery.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationDiscovery=t.ON_MASSA_STATION_DISCONNECTED=t.ON_MASSA_STATION_DISCOVERED=t.MASSA_STATION_DISCOVERY_URL=void 0;const n=r("./node_modules/events/events.js"),s=r("./src/massaStation/RequestHandler.ts");t.MASSA_STATION_DISCOVERY_URL="https://station.massa/web/index",t.ON_MASSA_STATION_DISCOVERED="ON_MASSA_STATION_DISCOVERED",t.ON_MASSA_STATION_DISCONNECTED="ON_MASSA_STATION_DISCONNECTED";class o extends n.EventEmitter{constructor(){super(),this.isDiscovered=!1,this.startListening=this.startListening.bind(this)}async startListening(){let e=null;try{e=await(0,s.getRequest)(t.MASSA_STATION_DISCOVERY_URL)}catch(e){console.error(`Error calling ${t.MASSA_STATION_DISCOVERY_URL}`)}e.isError||e.error||(this.isDiscovered=!0,this.emit(t.ON_MASSA_STATION_DISCOVERED)),(e.isError||e.error)&&this.isDiscovered&&(this.isDiscovered=!1,this.emit(t.ON_MASSA_STATION_DISCONNECTED))}}t.MassaStationDiscovery=o},"./src/massaStation/MassaStationProvider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MassaStationProvider=t.MASSA_STATION_PROVIDER_NAME=t.MASSA_STATION_IMPORT_ACCOUNTS_URL=t.MASSA_STATION_ACCOUNTS_URL=t.MASSA_STATION_URL=void 0;const n=r("./src/provider/AccountDeletion.ts"),s=r("./src/provider/AccountImport.ts"),o=r("./src/massaStation/RequestHandler.ts"),i=r("./src/massaStation/MassaStationAccount.ts");t.MASSA_STATION_URL="https://station.massa/",t.MASSA_STATION_ACCOUNTS_URL=`${t.MASSA_STATION_URL}plugin/massa-labs/massa-wallet/api/accounts`,t.MASSA_STATION_IMPORT_ACCOUNTS_URL=`${t.MASSA_STATION_ACCOUNTS_URL}/import/`,t.MASSA_STATION_PROVIDER_NAME="MASSASTATION",t.MassaStationProvider=class{constructor(){this.providerName=t.MASSA_STATION_PROVIDER_NAME}name(){return this.providerName}async accounts(){let e=null;try{e=await(0,o.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.error("MassaStation accounts retrieval error"),e}if(e.isError||e.error)throw e.error.message;return e.result.map((e=>new i.MassaStationAccount({address:e.address,name:e.nickname},this.providerName)))}async importAccount(e,r){const n={publicKey:e,privateKey:r};let i=null;try{i=await(0,o.putRequest)(t.MASSA_STATION_ACCOUNTS_URL,n)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(i.isError||i.error)throw i.error.message;return{response:s.EAccountImportResponse.OK,message:"Account imported successfully"}}async deleteAccount(e){let r=null;try{r=await(0,o.getRequest)(t.MASSA_STATION_ACCOUNTS_URL)}catch(e){throw console.log(`MassaStation accounts retrieval error: ${e}`),e}if(r.isError||r.error)throw r.error.message;const s=r.result.find((t=>t.address.toLowerCase()===e.toLowerCase()));let i=null;try{i=await(0,o.deleteRequest)(`${t.MASSA_STATION_ACCOUNTS_URL}/${s.nickname}`)}catch(e){return console.log("MassaStation accounts deletion error",e),{response:n.EAccountDeletionResponse.ERROR}}return i.isError||i.error?(console.log("MassaStation accounts deletion error",i.error.message),{response:n.EAccountDeletionResponse.ERROR}):{response:n.EAccountDeletionResponse.OK}}async getNodesUrls(){let e=null;try{if(e=await(0,o.getRequest)(`${t.MASSA_STATION_URL}massa/node`),e.isError||e.error)throw e.error.message;const r=e.result;return Array(r.url)}catch(e){throw console.error("MassaStation nodes retrieval error",e),e}}async generateNewAccount(e){let r=null;console.log(t.MASSA_STATION_ACCOUNTS_URL+"/"+e);try{if(r=await(0,o.postRequest)(t.MASSA_STATION_ACCOUNTS_URL+"/"+e,{}),r.isError||r.error)throw r.error.message;return{address:r.result.address,name:r.result.nickname}}catch(e){throw console.error(`Error while generating account: ${e}`),e}}}},"./src/massaStation/RequestHandler.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.putRequest=t.deleteRequest=t.postRequest=t.getRequest=void 0;const n=r("./node_modules/axios/index.js"),s={Accept:"application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":!0,"Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-Type":"application/json","Access-Control-Allow-Headers":"Accept,authorization,Authorization,Content-Type"};t.getRequest=async function(e){let t=null;try{t=await n.default.get(e,s)}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:t.data,error:null}},t.postRequest=async function(e,t){try{return{isError:!1,result:(await n.default.post(e,t,s)).data,error:null}}catch(e){return{isError:!0,result:null,error:e.response?.data?.message?new Error(String(e.response.data.message)):new Error("Axios error: "+String(e))}}},t.deleteRequest=async function(e){let t=null;try{t=await n.default.delete(e,s)}catch(e){return{isError:!0,result:null,error:new Error("Axios Error: "+String(e))}}return{isError:!1,result:t.data,error:null}},t.putRequest=async function(e,t){let r=null;try{r=await n.default.put(e,t,s)}catch(e){return{isError:!0,result:null,error:new Error("Axios error: "+String(e))}}return{isError:!1,result:r.data,error:null}}},"./src/provider/AccountDeletion.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountDeletionResponse=void 0,(r=t.EAccountDeletionResponse||(t.EAccountDeletionResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/AccountImport.ts":(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EAccountImportResponse=void 0,(r=t.EAccountImportResponse||(t.EAccountImportResponse={}))[r.OK=0]="OK",r[r.REFUSED=1]="REFUSED",r[r.ERROR=2]="ERROR"},"./src/provider/Provider.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=void 0;const n=r("./src/connector/Connector.ts"),s=r("./src/account/Account.ts"),o=r("./src/index.ts");t.Provider=class{constructor(e){this.providerName=e}name(){return this.providerName}async accounts(){const e=new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderListAccounts,{},((r,n)=>n?t(n):e(r)))})),t=await e;let r=[];for(const e of t){const t=new s.Account(e,this.providerName);r.push(t)}return r}async importAccount(e,t){const r={publicKey:e,privateKey:t};return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderImportAccount,r,((r,n)=>n?t(n):e(r)))}))}async deleteAccount(e){const t={address:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderDeleteAccount,t,((t,n)=>n?r(n):e(t)))}))}async getNodesUrls(){return new Promise(((e,t)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderGetNodesUrls,{},((r,n)=>n?t(n):e(r)))}))}async generateNewAccount(e){const t={name:e};return new Promise(((e,r)=>{n.connector.sendMessageToContentScript(this.providerName,o.AvailableCommands.ProviderGenerateNewAccount,t,((t,n)=>n?r(n):e(t)))}))}}},"./src/provider/index.ts":(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=t.EAccountImportResponse=t.EAccountDeletionResponse=void 0;var n=r("./src/provider/AccountDeletion.ts");Object.defineProperty(t,"EAccountDeletionResponse",{enumerable:!0,get:function(){return n.EAccountDeletionResponse}});var s=r("./src/provider/AccountImport.ts");Object.defineProperty(t,"EAccountImportResponse",{enumerable:!0,get:function(){return s.EAccountImportResponse}});var o=r("./src/provider/Provider.ts");Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return o.Provider}})},"./src/utils/argsToBase64.ts":(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint8ArrayToBase64=t.argsToBase64=void 0,t.argsToBase64=function(e){const t=e.serialize();return Buffer.from(t).toString("base64")},t.uint8ArrayToBase64=function(e){return Buffer.from(e).toString("base64")}},"./node_modules/uid/dist/index.js":(e,t)=>{for(var r,n=256,s=[];n--;)s[n]=(n+256).toString(16).substring(1);t.uid=function(e){var t=0,o=e||11;if(!r||n+o>512)for(r="",n=0;t<256;t++)r+=s[256*Math.random()|0];return r.substring(n,n+++o)}},"./node_modules/varint/decode.js":e=>{e.exports=function e(n,s){var o,i=0,a=0,c=s=s||0,u=n.length;do{if(c>=u||a>49)throw e.bytes=0,new RangeError("Could not decode varint");o=n[c++],i+=a<28?(o&r)<<a:(o&r)*Math.pow(2,a),a+=7}while(o>=t);return e.bytes=c-s,i};var t=128,r=127},"./node_modules/varint/encode.js":e=>{e.exports=function e(s,o,i){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");o=o||[];for(var a=i=i||0;s>=n;)o[i++]=255&s|t,s/=128;for(;s&r;)o[i++]=255&s|t,s>>>=7;return o[i]=0|s,e.bytes=i-a+1,o};var t=128,r=-128,n=Math.pow(2,31)},"./node_modules/varint/index.js":(e,t,r)=>{e.exports={encode:r("./node_modules/varint/encode.js"),decode:r("./node_modules/varint/decode.js"),encodingLength:r("./node_modules/varint/length.js")}},"./node_modules/varint/length.js":e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),s=Math.pow(2,28),o=Math.pow(2,35),i=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<s?4:e<o?5:e<i?6:e<a?7:e<c?8:e<u?9:10}},"./node_modules/@hicaru/bearby.js/dist/index.js":(e,t,r)=>{"use strict";function n(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function s(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}r.r(t),r.d(t,{ArgTypes:()=>u,ContentProvider:()=>J,Contract:()=>f,Massa:()=>Y,Wallet:()=>te,Web3:()=>re,web3:()=>ne});const o="Wallet is not connected";class i{get payload(){return JSON.parse(JSON.stringify({type:this.type,amount:this.amount,fee:this.fee,gasPrice:this.gasPrice,gasLimit:this.gasLimit,coins:this.coins,maxCoins:this.maxCoins,code:this.contract,func:this.functionName,params:this.parameters,toAddr:this.recipient||this.contract,deployer:this.deployer}))}constructor(e,t,r,n,s,o){this.type=e,this.amount=String(t),this.recipient=r,this.parameters=n||[],this.contract=s,this.functionName=o}}var a,c,u,l,d;function h(e){let t=new Uint8Array(e.length);return Array.prototype.forEach.call(t,((t,r,n)=>{n[r]=e.charCodeAt(r)})),t}!function(e){e[e.Payment=0]="Payment",e[e.RollBuy=1]="RollBuy",e[e.RollSell=2]="RollSell",e[e.ExecuteSC=3]="ExecuteSC",e[e.CallSC=4]="CallSC"}(a||(a={})),function(e){e.GET_STATUS="get_status",e.GET_ADDRESSES="get_addresses",e.GET_GRAPH_INTERVAL="get_graph_interval",e.GET_BLOCKS="get_blocks",e.GET_ENDORSEMENTS="get_endorsements",e.GET_OPERATIONS="get_operations",e.GET_CLIQUES="get_cliques",e.GET_STAKERS="get_stakers",e.GET_FILTERED_SC_OUTPUT_EVENT="get_filtered_sc_output_event",e.EXECUTE_READ_ONLY_BYTECODE="execute_read_only_bytecode",e.EXECUTE_READ_ONLY_CALL="execute_read_only_call",e.GET_DATASTORE_ENTRIES="get_datastore_entries"}(c||(c={})),function(e){e[e.STRING=0]="STRING",e[e.BOOL=1]="BOOL",e[e.U8=2]="U8",e[e.U32=3]="U32",e[e.U64=4]="U64",e[e.U128=5]="U128",e[e.U256=6]="U256",e[e.I32=7]="I32",e[e.I64=8]="I64",e[e.F32=9]="F32",e[e.F64=10]="F64"}(u||(u={}));class f{constructor(e,t){l.set(this,void 0),d.set(this,void 0),this.types=u,s(this,l,e,"f"),s(this,d,t,"f")}async deploy(e){const t=new i(a.ExecuteSC,"0",void 0,e.parameters,e.contractDataBase64,void 0);return t.deployer=e.deployerBase64,t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.gasPrice=String(e.gasPrice),t.maxCoins=String(e.maxCoins),t.coins=String(e.coins),n(this,d,"f").signTransaction(t)}async call(e){const t=new i(a.CallSC,"0",void 0,e.parameters,e.targetAddress,e.functionName);return t.fee=String(e.fee),t.gasLimit=String(e.maxGas),t.coins=String(e.coins||0),n(this,d,"f").signTransaction(t)}async getFilteredSCOutputEvent(...e){const t=c.GET_FILTERED_SC_OUTPUT_EVENT,r=await n(this,l,"f").send(e.map((e=>({method:t,params:[e]}))));return 1===e.length?r[0]:r}async getDatastoreEntries(...e){const t=c.GET_DATASTORE_ENTRIES,r=[];for(const{key:t,address:n}of e)r.push({address:n,key:Array.from(h(t))});return await n(this,l,"f").send([{method:t,params:[r]}])}async executeReadOlyBytecode(e){const t=c.EXECUTE_READ_ONLY_BYTECODE;return n(this,l,"f").send([{method:t,params:[e]}])}async readSmartContract(...e){const t=c.EXECUTE_READ_ONLY_CALL,r=await n(this,l,"f").send([{method:t,params:[e.map((e=>({max_gas:e.maxGas,simulated_gas_price:String(e.simulatedGasPrice),target_address:e.targetAddress,target_function:e.targetFunction,parameters:e.parameters,caller_address:e.callerAddress||n(this,d,"f").account.base58})))]}]);return 1===e.length?r[0]:r}}l=new WeakMap,d=new WeakMap;const p="BearBy",y={CONTENT:`@/${p}/content-script`,INJECTED:`@/${p}/injected-script`},m={GET_DATA:`@/${p}/get-wallet-data`,NEW_SLOT:`@/${p}/new-slot-emited`,ACCOUNT_CHANGED:`@/${p}/accounts-just-changed`,CONTENT_PROXY_MEHTOD:`@/${p}/proxy-method`,CONTENT_PROXY_RESULT:`@/${p}/response-from-content`,CONNECT_APP:`@/${p}/connect-app`,RESPONSE_CONNECT_APP:`@/${p}/respoonse-connect-app`,NETWORK_CHANGED:`@/${p}/network-just-changed`,DISCONNECT_APP:`@/${p}/disconnect_app`,DISCONNECT_APP_RESULT:`@/${p}/disconnect_app_result`,LOCKED:`@/${p}/guard-just-lock`,TX_TO_SEND:`@/${p}/add-tx-to-send`,TX_TO_SEND_RESULT:`@/${p}/response-tx-result`,CHECK_MASSA_ADDRESS:`@/${p}/check-massa-address`,CHECK_MASSA_ADDRESS_RES:`@/${p}/check-massa-address-response`,SIGN_MESSAGE:`@/${p}/sign-message-call`,SING_MESSAGE_RESULT:`@/${p}/sign-message-response`};var _,g,E,b,w;const{document:v}=globalThis;class S{constructor(e){_.add(this),g.set(this,void 0),s(this,g,e,"f")}listen(e){v.addEventListener(n(this,g,"f"),(t=>{t&&t.detail&&e(JSON.parse(t.detail))}))}send(e,t){e.from=n(this,g,"f"),Object.values(y).includes(t)&&n(this,_,"m",E).call(this,JSON.stringify(e),t)}}var A,T,O,N,R,C,I,x,U,B,L,P,M,j,D,k,G,H,$,V;g=new WeakMap,_=new WeakSet,E=function(e,t){v.dispatchEvent(n(this,_,"m",w).call(this,e,t))},b=function(e){return{detail:e}},w=function(e,t){return new CustomEvent(t,n(this,_,"m",b).call(this,e))};class W{constructor(){A.set(this,[])}on(e){return n(this,A,"f").push(e),()=>this.removeListener(e)}removeListener(e){const t=n(this,A,"f").indexOf(e);t>-1&&n(this,A,"f").splice(t,1)}removeAllListeners(){n(this,A,"f").splice(0,n(this,A,"f").length)}emit(...e){n(this,A,"f").forEach((t=>t.apply(this,e)))}once(e){const t=this.on(((...r)=>{t(),e.apply(this,r)}))}}A=new WeakMap;class q{get type(){return n(this,T,"f").type}get payload(){return n(this,T,"f").payload}constructor(e){T.set(this,void 0),s(this,T,e,"f")}send(e,t){const r=JSON.stringify(n(this,T,"f")),s=JSON.parse(r);e.send(s,t)}}T=new WeakMap;class F{constructor(){this.stream=new S(y.INJECTED),this.subject=new W,globalThis.document&&this.stream.listen((e=>{this.subject.emit(e)}))}initialized(){const e=y.CONTENT;new q({type:m.GET_DATA,payload:{}}).send(this.stream,e)}}function K(){return[...Array(20)].map((()=>Math.floor(16*Math.random()).toString(16))).join("")}class J{constructor(e,t){O.set(this,void 0),N.set(this,void 0),s(this,O,e,"f"),s(this,N,t,"f")}async send(e){const t=m.CONTENT_PROXY_MEHTOD,r=y.CONTENT,s=K();let o;new q({type:t,payload:{body:e,uuid:s}}).send(n(this,O,"f"),r);const i=new Promise(((e,t)=>{o=n(this,N,"f").on((r=>{if(r.type===m.CONTENT_PROXY_RESULT&&r.payload&&r.payload.uuid&&r.payload.uuid===s)return r.payload&&r.payload.reject?(o(),t(new Error(r.payload.reject))):(delete r.payload.uuid,o(),e(r.payload.resolve))}))})),a=new Promise(((e,t)=>{setTimeout((()=>{o&&o(),t(new Error("Request failed by timeout"))}),5e3)}));return Promise.race([i,a])}}O=new WeakMap,N=new WeakMap;class Y{constructor(e,t){R.set(this,void 0),C.set(this,void 0),s(this,R,e,"f"),s(this,C,t,"f")}async getNodesStatus(){const e=c.GET_STATUS,[t]=await n(this,R,"f").send([{method:e,params:[]}]);return t}async getAddresses(...e){const t=c.GET_ADDRESSES,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getBlocks(...e){const t=c.GET_BLOCKS,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getGraphInterval(e,t){const r=c.GET_GRAPH_INTERVAL,[s]=await n(this,R,"f").send([{method:r,params:[{start:e,end:t}]}]);return s}async getOperations(...e){const t=c.GET_OPERATIONS,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getStakers(){const e=c.GET_STAKERS,[t]=await n(this,R,"f").send([{method:e,params:[]}]);return t}async getEndorsements(...e){const t=c.GET_ENDORSEMENTS,[r]=await n(this,R,"f").send([{method:t,params:[e]}]);return r}async getCliques(){const e=c.GET_CLIQUES,[t]=await n(this,R,"f").send([{method:e,params:[]}]);return t}async payment(e,t){const r=new i(a.Payment,e,t);return n(this,C,"f").signTransaction(r)}async buyRolls(e="1"){const t=new i(a.RollBuy,e);return n(this,C,"f").signTransaction(t)}async sellRolls(e="1"){const t=new i(a.RollSell,e);return n(this,C,"f").signTransaction(t)}}function X(e,t){if(!e)throw new Error(t)}function z(){let e=globalThis.document.querySelector("link[rel*='icon']");if(!e)throw new Error("website favicon is required");return e.href}R=new WeakMap,C=new WeakMap;class Q{constructor(e){I.set(this,void 0),s(this,I,e,"f")}subscribe(e){if(!e)throw new Error("Missing callback arg. use subscribe(cb => /do something/)");this.base58&&e(this.base58);const t=n(this,I,"f").on((t=>{switch(t.type){case m.DISCONNECT_APP_RESULT:this.base58=void 0;break;case m.ACCOUNT_CHANGED:case m.RESPONSE_CONNECT_APP:case m.GET_DATA:this.base58=t.payload.base58;break;default:return}e(this.base58)}));return{unsubscribe:()=>t()}}}I=new WeakMap;class Z{constructor(e){x.set(this,void 0),s(this,x,e,"f")}subscribe(e){e(this.net);const t=n(this,x,"f").on((t=>{switch(t.type){case m.RESPONSE_CONNECT_APP:case m.GET_DATA:case m.NETWORK_CHANGED:this.net=t.payload.net;break;default:return}e(this.net)}));return{unsubscribe:()=>t()}}}x=new WeakMap;class ee{constructor(e){U.set(this,void 0),this.period=-1,s(this,U,e,"f")}subscribe(e){const t=n(this,U,"f").on((t=>{switch(t.type){case m.NEW_SLOT:this.period=t.payload,e(this.period);break;case m.GET_DATA:case m.NETWORK_CHANGED:this.period=t.payload.period,e(this.period)}}));return{unsubscribe:()=>t()}}}U=new WeakMap;class te{get account(){return n(this,L,"f")}get network(){return n(this,P,"f")}get blockchain(){return n(this,M,"f")}get connected(){return n(this,k,"f")}get enabled(){return n(this,G,"f")}constructor(e,t){B.add(this),L.set(this,void 0),P.set(this,void 0),M.set(this,void 0),j.set(this,void 0),D.set(this,void 0),k.set(this,!1),G.set(this,!1),s(this,j,e,"f"),s(this,D,t,"f"),s(this,L,new Q(t),"f"),s(this,P,new Z(t),"f"),s(this,M,new ee(t),"f"),n(this,B,"m",H).call(this)}async diconnect(){const e=m.DISCONNECT_APP,t=y.CONTENT,r=window.document.title,o=z(),i=K();return new q({type:e,payload:{title:r,icon:o,uuid:i}}).send(n(this,j,"f"),t),new Promise(((e,t)=>{const r=n(this,D,"f").on((o=>{if(o.type===m.DISCONNECT_APP_RESULT&&o.payload.uuid===i)return o.payload.reject?(r(),t(new Error(o.payload.reject))):(s(this,k,!1,"f"),n(this,L,"f").base58=void 0,n(this,P,"f").net=o.payload.net,r(),e(this.connected))}))}))}async isMassaAddress(e){const t=m.CHECK_MASSA_ADDRESS,r=y.CONTENT,s=K();return new q({type:t,payload:{uuid:s,addr:e}}).send(n(this,j,"f"),r),new Promise((e=>{const t=n(this,D,"f").on((r=>{if(r.type===m.CHECK_MASSA_ADDRESS_RES&&r.payload.uuid===s)return t(),e(r.payload.resolve)}))}))}async connect(){const e=m.CONNECT_APP,t=y.CONTENT,r=K(),o=window.document.title,i=z();return new q({type:e,payload:{title:o,icon:i,uuid:r}}).send(n(this,j,"f"),t),new Promise(((e,t)=>{const o=n(this,D,"f").on((i=>{if(i.type===m.RESPONSE_CONNECT_APP&&i.payload.uuid===r)return i.payload.reject?(o(),t(new Error(i.payload.reject))):(s(this,k,Boolean(i.payload.resolve),"f"),n(this,L,"f").base58=i.payload.base58,n(this,P,"f").net=i.payload.net,o(),e(this.connected))}))}))}async signMessage(e){X(this.connected,o);const t=m.SIGN_MESSAGE,r=y.CONTENT,s=K(),i=window.document.title,a=z();return new q({type:t,payload:{message:e,uuid:s,title:i,icon:a}}).send(n(this,j,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===m.SING_MESSAGE_RESULT&&n.payload.uuid===s)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}async signTransaction(e){X(this.connected,o),X(e instanceof i,"Invalid sign params");const t=m.TX_TO_SEND,r=y.CONTENT,s=K(),a={...e.payload,uuid:s,title:window.document.title,icon:z()};return new q({type:t,payload:a}).send(n(this,j,"f"),r),new Promise(((e,t)=>{const r=n(this,D,"f").on((n=>{if(n.type===m.TX_TO_SEND_RESULT&&n.payload.uuid===s)return n.payload&&n.payload.reject?(r(),t(new Error(n.payload.reject))):(r(),e(n.payload.resolve))}))}))}}L=new WeakMap,P=new WeakMap,M=new WeakMap,j=new WeakMap,D=new WeakMap,k=new WeakMap,G=new WeakMap,B=new WeakSet,H=function(){globalThis.window&&n(this,D,"f").on((e=>{switch(e.type){case m.NEW_SLOT:n(this,M,"f").period=e.payload;break;case m.LOCKED:s(this,G,e.payload.enabled,"f");break;case m.ACCOUNT_CHANGED:n(this,L,"f").base58=e.payload.base58;break;case m.GET_DATA:n(this,M,"f").period=e.payload.period,n(this,L,"f").base58=e.payload.base58,s(this,G,e.payload.enabled,"f"),s(this,k,e.payload.connected,"f"),n(this,P,"f").net=e.payload.net;break;case m.NETWORK_CHANGED:n(this,P,"f").net=e.payload.net,n(this,M,"f").period=e.payload.period}}))};class re{constructor(){if($.set(this,new F),V.set(this,new J(n(this,$,"f").stream,n(this,$,"f").subject)),this.wallet=new te(n(this,$,"f").stream,n(this,$,"f").subject),this.contract=new f(n(this,V,"f"),this.wallet),this.massa=new Y(n(this,V,"f"),this.wallet),globalThis.window){if(globalThis.window.bearby)throw new Error("bearby Web3 instance already created!");try{n(this,$,"f").initialized(),globalThis.window.bearby=Object.freeze(this)}catch{console.debug("bearby-web3 available only browser")}}}}$=new WeakMap,V=new WeakMap;const ne=globalThis.window&&globalThis.window.bearby?globalThis.window.bearby:new re}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r("./src/index.ts");window.massa=n})();
3
3
  //# sourceMappingURL=bundle.min.js.map
package/dist/cmd/index.js CHANGED
@@ -43,7 +43,7 @@ async function providers(retry = true, timeout = 3000, pollInterval = 500) {
43
43
  // Look for Bearby
44
44
  let p;
45
45
  if ((0, BearbyConnect_1.detectBearby)()) {
46
- const p = new BearbyProvider_1.BearbyProvider('Bearby');
46
+ p = new BearbyProvider_1.BearbyProvider('Bearby');
47
47
  }
48
48
  return new Promise((resolve) => {
49
49
  let provider = [];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gBAAgB;AAChB,mCAAgC;AAQhC,6BAA6B;AAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,MAAM,GAAG,eAAM,CAAC;CACxB;AAED,qDAAuE;AAEvE,kDAA+C;AAC/C,8EAG6C;AAC7C,gEAA4D;AAC5D,kEAA+D;AAE/D,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC3B,2DAAsC,CAAA;IACtC,6DAAwC,CAAA;IACxC,6DAAwC,CAAA;IACxC,4DAAuC,CAAA;IACvC,uDAAkC,CAAA;IAClC,iDAA4B,CAAA;IAC5B,wEAAmD,CAAA;IACnD,4DAAuC,CAAA;IACvC,0DAAqC,CAAA;IACrC,wEAAmD,CAAA;IACnD,sDAAiC,CAAA;AACnC,CAAC,EAZW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAY5B;AAMD;;;;;;;;GAQG;AACI,KAAK,UAAU,SAAS,CAC7B,KAAK,GAAG,IAAI,EACZ,OAAO,GAAG,IAAI,EACd,YAAY,GAAG,GAAG;IAElB,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,qBAAS,CAAC,0BAA0B,EAAE,CAAC;IAE7C,kBAAkB;IAClB,IAAI,CAAiB,CAAC;IACtB,IAAI,IAAA,4BAAY,GAAE,EAAE;QAClB,MAAM,CAAC,GAAG,IAAI,+BAAc,CAAC,QAAQ,CAAC,CAAC;KACxC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,QAAQ,GAAgB,EAAE,CAAC;QAE/B,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,qBAAS,CAAC,kBAAkB,EAAE,CAAC,EAAE;YACtE,IAAI,YAAY,KAAK,kDAA2B,EAAE;gBAChD,MAAM,CAAC,GAAG,IAAI,2CAAoB,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;iBAAM;gBACL,MAAM,CAAC,GAAG,IAAI,mBAAQ,CAAC,YAAY,CAAC,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;SACF;QAED,kBAAkB;QAClB,IAAI,CAAC,EAAE;YACL,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAClB;QAED,oDAAoD;QACpD,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,UAAU,CAAC,GAAG,EAAE;gBACd,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvE,CAAC,EAAE,YAAY,CAAC,CAAC;SAClB;aAAM;YACL,OAAO,CAAC,QAAQ,CAAC,CAAC;SACnB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,8BA4CC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAY,EAAE,EAAE,GAAG,+BAAmB;IACrE,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC,UAAU,EAAE;QAChD,MAAM,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KAC/B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;KACtC;AACH,CAAC;AARD,4CAQC;AAID,qCAWmB;AAJjB,kGAAA,OAAO,OAAA;AAMT,uCASoB;AARlB,oHAAA,wBAAwB,OAAA;AACxB,kHAAA,sBAAsB,OAAA;AAMtB,oGAAA,QAAQ,OAAA;AAKV,0EAAyE;AAAhE,0HAAA,mBAAmB,OAAA","sourcesContent":["/** Polyfills */\nimport { Buffer } from 'buffer';\n\ndeclare global {\n interface Window {\n Buffer: typeof Buffer;\n }\n}\n\n// Check if we are on browser\nif (typeof window !== 'undefined') {\n window.Buffer = Buffer;\n}\n\nimport { MASSA_WINDOW_OBJECT, connector } from './connector/Connector';\nimport { IProvider } from './provider/IProvider';\nimport { Provider } from './provider/Provider';\nimport {\n MASSA_STATION_PROVIDER_NAME,\n MassaStationProvider,\n} from './massaStation/MassaStationProvider';\nimport { detectBearby } from './bearbyWallet/BearbyConnect';\nimport { BearbyProvider } from './bearbyWallet/BearbyProvider';\n\nexport enum AvailableCommands {\n ProviderListAccounts = 'LIST_ACCOUNTS',\n ProviderDeleteAccount = 'DELETE_ACCOUNT',\n ProviderImportAccount = 'IMPORT_ACCOUNT',\n ProviderGetNodesUrls = 'GET_NODES_URLS',\n AccountBalance = 'ACCOUNT_BALANCE',\n AccountSign = 'ACCOUNT_SIGN',\n ProviderGenerateNewAccount = 'GENERATE_NEW_ACCOUNT',\n AccountSellRolls = 'ACCOUNT_SELL_ROLLS',\n AccountBuyRolls = 'ACCOUNT_BUY_ROLLS',\n AccountSendTransaction = 'ACCOUNT_SEND_TRANSACTION',\n AccountCallSC = 'ACCOUNT_CALL_SC',\n}\n\nexport interface ITransactionDetails {\n operationId: string;\n}\n\n/**\n * Get the list of providers that are available to interact with.\n *\n * @param retry - If true, will retry to get the list of providers if none are available.\n * @param pollInterval - The timeout in milliseconds to wait between retries. default is 2000ms.\n * @param timeout - The timeout in milliseconds to wait before giving up. default is 3000ms.\n *\n * @returns An array of providers.\n */\nexport async function providers(\n retry = true,\n timeout = 3000,\n pollInterval = 500,\n): Promise<IProvider[]> {\n if (timeout <= 0) {\n return [];\n }\n\n await connector.startMassaStationDiscovery();\n\n // Look for Bearby\n let p: BearbyProvider;\n if (detectBearby()) {\n const p = new BearbyProvider('Bearby');\n }\n\n return new Promise((resolve) => {\n let provider: IProvider[] = [];\n\n for (const providerName of Object.keys(connector.getWalletProviders())) {\n if (providerName === MASSA_STATION_PROVIDER_NAME) {\n const p = new MassaStationProvider();\n provider.push(p);\n } else {\n const p = new Provider(providerName);\n provider.push(p);\n }\n }\n\n // Look for Bearby\n if (p) {\n provider.push(p);\n }\n\n // If no providers are available, wait and try again\n if (retry && provider.length === 0) {\n setTimeout(() => {\n providers(retry, timeout - pollInterval, pollInterval).then(resolve);\n }, pollInterval);\n } else {\n resolve(provider);\n }\n });\n}\n\n/**\n * Manually register a provider to interact with.\n *\n * @param name - The name of the provider.\n * @param id - The id of the HTML element that is used to communicate with the provider.\n */\nexport function registerProvider(name: string, id = MASSA_WINDOW_OBJECT): void {\n const registerEvent = new CustomEvent('register', {\n detail: { providerName: name },\n });\n const element = document.getElementById(id);\n if (element) {\n element.dispatchEvent(registerEvent);\n }\n}\n\nexport { AllowedRequests, AllowedResponses } from './connector';\n\nexport {\n IAccountDetails,\n IAccountBalanceRequest,\n IAccountBalanceResponse,\n IAccountSignRequest,\n IAccountSignResponse,\n IAccount,\n Account,\n IAccountRollsRequest,\n IAccountSendTransactionRequest,\n IAccountCallSCRequest,\n} from './account';\n\nexport {\n EAccountDeletionResponse,\n EAccountImportResponse,\n IAccountDeletionRequest,\n IAccountDeletionResponse,\n IAccountImportRequest,\n IAccountImportResponse,\n IProvider,\n Provider,\n} from './provider';\n\nexport { IMassaStationWallet } from './massaStation/MassaStationProvider';\n\nexport { MassaStationAccount } from './massaStation/MassaStationAccount';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gBAAgB;AAChB,mCAAgC;AAQhC,6BAA6B;AAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,MAAM,GAAG,eAAM,CAAC;CACxB;AAED,qDAAuE;AAEvE,kDAA+C;AAC/C,8EAG6C;AAC7C,gEAA4D;AAC5D,kEAA+D;AAE/D,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC3B,2DAAsC,CAAA;IACtC,6DAAwC,CAAA;IACxC,6DAAwC,CAAA;IACxC,4DAAuC,CAAA;IACvC,uDAAkC,CAAA;IAClC,iDAA4B,CAAA;IAC5B,wEAAmD,CAAA;IACnD,4DAAuC,CAAA;IACvC,0DAAqC,CAAA;IACrC,wEAAmD,CAAA;IACnD,sDAAiC,CAAA;AACnC,CAAC,EAZW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAY5B;AAMD;;;;;;;;GAQG;AACI,KAAK,UAAU,SAAS,CAC7B,KAAK,GAAG,IAAI,EACZ,OAAO,GAAG,IAAI,EACd,YAAY,GAAG,GAAG;IAElB,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,qBAAS,CAAC,0BAA0B,EAAE,CAAC;IAE7C,kBAAkB;IAClB,IAAI,CAAiB,CAAC;IACtB,IAAI,IAAA,4BAAY,GAAE,EAAE;QAClB,CAAC,GAAG,IAAI,+BAAc,CAAC,QAAQ,CAAC,CAAC;KAClC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,QAAQ,GAAgB,EAAE,CAAC;QAE/B,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,qBAAS,CAAC,kBAAkB,EAAE,CAAC,EAAE;YACtE,IAAI,YAAY,KAAK,kDAA2B,EAAE;gBAChD,MAAM,CAAC,GAAG,IAAI,2CAAoB,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;iBAAM;gBACL,MAAM,CAAC,GAAG,IAAI,mBAAQ,CAAC,YAAY,CAAC,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;SACF;QAED,kBAAkB;QAClB,IAAI,CAAC,EAAE;YACL,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAClB;QAED,oDAAoD;QACpD,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,UAAU,CAAC,GAAG,EAAE;gBACd,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvE,CAAC,EAAE,YAAY,CAAC,CAAC;SAClB;aAAM;YACL,OAAO,CAAC,QAAQ,CAAC,CAAC;SACnB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,8BA4CC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,IAAY,EAAE,EAAE,GAAG,+BAAmB;IACrE,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC,UAAU,EAAE;QAChD,MAAM,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KAC/B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;KACtC;AACH,CAAC;AARD,4CAQC;AAID,qCAWmB;AAJjB,kGAAA,OAAO,OAAA;AAMT,uCASoB;AARlB,oHAAA,wBAAwB,OAAA;AACxB,kHAAA,sBAAsB,OAAA;AAMtB,oGAAA,QAAQ,OAAA;AAKV,0EAAyE;AAAhE,0HAAA,mBAAmB,OAAA","sourcesContent":["/** Polyfills */\nimport { Buffer } from 'buffer';\n\ndeclare global {\n interface Window {\n Buffer: typeof Buffer;\n }\n}\n\n// Check if we are on browser\nif (typeof window !== 'undefined') {\n window.Buffer = Buffer;\n}\n\nimport { MASSA_WINDOW_OBJECT, connector } from './connector/Connector';\nimport { IProvider } from './provider/IProvider';\nimport { Provider } from './provider/Provider';\nimport {\n MASSA_STATION_PROVIDER_NAME,\n MassaStationProvider,\n} from './massaStation/MassaStationProvider';\nimport { detectBearby } from './bearbyWallet/BearbyConnect';\nimport { BearbyProvider } from './bearbyWallet/BearbyProvider';\n\nexport enum AvailableCommands {\n ProviderListAccounts = 'LIST_ACCOUNTS',\n ProviderDeleteAccount = 'DELETE_ACCOUNT',\n ProviderImportAccount = 'IMPORT_ACCOUNT',\n ProviderGetNodesUrls = 'GET_NODES_URLS',\n AccountBalance = 'ACCOUNT_BALANCE',\n AccountSign = 'ACCOUNT_SIGN',\n ProviderGenerateNewAccount = 'GENERATE_NEW_ACCOUNT',\n AccountSellRolls = 'ACCOUNT_SELL_ROLLS',\n AccountBuyRolls = 'ACCOUNT_BUY_ROLLS',\n AccountSendTransaction = 'ACCOUNT_SEND_TRANSACTION',\n AccountCallSC = 'ACCOUNT_CALL_SC',\n}\n\nexport interface ITransactionDetails {\n operationId: string;\n}\n\n/**\n * Get the list of providers that are available to interact with.\n *\n * @param retry - If true, will retry to get the list of providers if none are available.\n * @param pollInterval - The timeout in milliseconds to wait between retries. default is 2000ms.\n * @param timeout - The timeout in milliseconds to wait before giving up. default is 3000ms.\n *\n * @returns An array of providers.\n */\nexport async function providers(\n retry = true,\n timeout = 3000,\n pollInterval = 500,\n): Promise<IProvider[]> {\n if (timeout <= 0) {\n return [];\n }\n\n await connector.startMassaStationDiscovery();\n\n // Look for Bearby\n let p: BearbyProvider;\n if (detectBearby()) {\n p = new BearbyProvider('Bearby');\n }\n\n return new Promise((resolve) => {\n let provider: IProvider[] = [];\n\n for (const providerName of Object.keys(connector.getWalletProviders())) {\n if (providerName === MASSA_STATION_PROVIDER_NAME) {\n const p = new MassaStationProvider();\n provider.push(p);\n } else {\n const p = new Provider(providerName);\n provider.push(p);\n }\n }\n\n // Look for Bearby\n if (p) {\n provider.push(p);\n }\n\n // If no providers are available, wait and try again\n if (retry && provider.length === 0) {\n setTimeout(() => {\n providers(retry, timeout - pollInterval, pollInterval).then(resolve);\n }, pollInterval);\n } else {\n resolve(provider);\n }\n });\n}\n\n/**\n * Manually register a provider to interact with.\n *\n * @param name - The name of the provider.\n * @param id - The id of the HTML element that is used to communicate with the provider.\n */\nexport function registerProvider(name: string, id = MASSA_WINDOW_OBJECT): void {\n const registerEvent = new CustomEvent('register', {\n detail: { providerName: name },\n });\n const element = document.getElementById(id);\n if (element) {\n element.dispatchEvent(registerEvent);\n }\n}\n\nexport { AllowedRequests, AllowedResponses } from './connector';\n\nexport {\n IAccountDetails,\n IAccountBalanceRequest,\n IAccountBalanceResponse,\n IAccountSignRequest,\n IAccountSignResponse,\n IAccount,\n Account,\n IAccountRollsRequest,\n IAccountSendTransactionRequest,\n IAccountCallSCRequest,\n} from './account';\n\nexport {\n EAccountDeletionResponse,\n EAccountImportResponse,\n IAccountDeletionRequest,\n IAccountDeletionResponse,\n IAccountImportRequest,\n IAccountImportResponse,\n IProvider,\n Provider,\n} from './provider';\n\nexport { IMassaStationWallet } from './massaStation/MassaStationProvider';\n\nexport { MassaStationAccount } from './massaStation/MassaStationAccount';\n"]}
package/dist/esm/index.js CHANGED
@@ -40,7 +40,7 @@ export async function providers(retry = true, timeout = 3000, pollInterval = 500
40
40
  // Look for Bearby
41
41
  let p;
42
42
  if (detectBearby()) {
43
- const p = new BearbyProvider('Bearby');
43
+ p = new BearbyProvider('Bearby');
44
44
  }
45
45
  return new Promise((resolve) => {
46
46
  let provider = [];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,6BAA6B;AAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAN,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC3B,2DAAsC,CAAA;IACtC,6DAAwC,CAAA;IACxC,6DAAwC,CAAA;IACxC,4DAAuC,CAAA;IACvC,uDAAkC,CAAA;IAClC,iDAA4B,CAAA;IAC5B,wEAAmD,CAAA;IACnD,4DAAuC,CAAA;IACvC,0DAAqC,CAAA;IACrC,wEAAmD,CAAA;IACnD,sDAAiC,CAAA;AACnC,CAAC,EAZW,iBAAiB,KAAjB,iBAAiB,QAY5B;AAMD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAK,GAAG,IAAI,EACZ,OAAO,GAAG,IAAI,EACd,YAAY,GAAG,GAAG;IAElB,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,SAAS,CAAC,0BAA0B,EAAE,CAAC;IAE7C,kBAAkB;IAClB,IAAI,CAAiB,CAAC;IACtB,IAAI,YAAY,EAAE,EAAE;QAClB,MAAM,CAAC,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;KACxC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,QAAQ,GAAgB,EAAE,CAAC;QAE/B,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC,EAAE;YACtE,IAAI,YAAY,KAAK,2BAA2B,EAAE;gBAChD,MAAM,CAAC,GAAG,IAAI,oBAAoB,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;iBAAM;gBACL,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;SACF;QAED,kBAAkB;QAClB,IAAI,CAAC,EAAE;YACL,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAClB;QAED,oDAAoD;QACpD,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,UAAU,CAAC,GAAG,EAAE;gBACd,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvE,CAAC,EAAE,YAAY,CAAC,CAAC;SAClB;aAAM;YACL,OAAO,CAAC,QAAQ,CAAC,CAAC;SACnB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,EAAE,GAAG,mBAAmB;IACrE,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC,UAAU,EAAE;QAChD,MAAM,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KAC/B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;KACtC;AACH,CAAC;AAID,OAAO,EAOL,OAAO,GAIR,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EAMtB,QAAQ,GACT,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["/** Polyfills */\nimport { Buffer } from 'buffer';\n\ndeclare global {\n interface Window {\n Buffer: typeof Buffer;\n }\n}\n\n// Check if we are on browser\nif (typeof window !== 'undefined') {\n window.Buffer = Buffer;\n}\n\nimport { MASSA_WINDOW_OBJECT, connector } from './connector/Connector';\nimport { IProvider } from './provider/IProvider';\nimport { Provider } from './provider/Provider';\nimport {\n MASSA_STATION_PROVIDER_NAME,\n MassaStationProvider,\n} from './massaStation/MassaStationProvider';\nimport { detectBearby } from './bearbyWallet/BearbyConnect';\nimport { BearbyProvider } from './bearbyWallet/BearbyProvider';\n\nexport enum AvailableCommands {\n ProviderListAccounts = 'LIST_ACCOUNTS',\n ProviderDeleteAccount = 'DELETE_ACCOUNT',\n ProviderImportAccount = 'IMPORT_ACCOUNT',\n ProviderGetNodesUrls = 'GET_NODES_URLS',\n AccountBalance = 'ACCOUNT_BALANCE',\n AccountSign = 'ACCOUNT_SIGN',\n ProviderGenerateNewAccount = 'GENERATE_NEW_ACCOUNT',\n AccountSellRolls = 'ACCOUNT_SELL_ROLLS',\n AccountBuyRolls = 'ACCOUNT_BUY_ROLLS',\n AccountSendTransaction = 'ACCOUNT_SEND_TRANSACTION',\n AccountCallSC = 'ACCOUNT_CALL_SC',\n}\n\nexport interface ITransactionDetails {\n operationId: string;\n}\n\n/**\n * Get the list of providers that are available to interact with.\n *\n * @param retry - If true, will retry to get the list of providers if none are available.\n * @param pollInterval - The timeout in milliseconds to wait between retries. default is 2000ms.\n * @param timeout - The timeout in milliseconds to wait before giving up. default is 3000ms.\n *\n * @returns An array of providers.\n */\nexport async function providers(\n retry = true,\n timeout = 3000,\n pollInterval = 500,\n): Promise<IProvider[]> {\n if (timeout <= 0) {\n return [];\n }\n\n await connector.startMassaStationDiscovery();\n\n // Look for Bearby\n let p: BearbyProvider;\n if (detectBearby()) {\n const p = new BearbyProvider('Bearby');\n }\n\n return new Promise((resolve) => {\n let provider: IProvider[] = [];\n\n for (const providerName of Object.keys(connector.getWalletProviders())) {\n if (providerName === MASSA_STATION_PROVIDER_NAME) {\n const p = new MassaStationProvider();\n provider.push(p);\n } else {\n const p = new Provider(providerName);\n provider.push(p);\n }\n }\n\n // Look for Bearby\n if (p) {\n provider.push(p);\n }\n\n // If no providers are available, wait and try again\n if (retry && provider.length === 0) {\n setTimeout(() => {\n providers(retry, timeout - pollInterval, pollInterval).then(resolve);\n }, pollInterval);\n } else {\n resolve(provider);\n }\n });\n}\n\n/**\n * Manually register a provider to interact with.\n *\n * @param name - The name of the provider.\n * @param id - The id of the HTML element that is used to communicate with the provider.\n */\nexport function registerProvider(name: string, id = MASSA_WINDOW_OBJECT): void {\n const registerEvent = new CustomEvent('register', {\n detail: { providerName: name },\n });\n const element = document.getElementById(id);\n if (element) {\n element.dispatchEvent(registerEvent);\n }\n}\n\nexport { AllowedRequests, AllowedResponses } from './connector';\n\nexport {\n IAccountDetails,\n IAccountBalanceRequest,\n IAccountBalanceResponse,\n IAccountSignRequest,\n IAccountSignResponse,\n IAccount,\n Account,\n IAccountRollsRequest,\n IAccountSendTransactionRequest,\n IAccountCallSCRequest,\n} from './account';\n\nexport {\n EAccountDeletionResponse,\n EAccountImportResponse,\n IAccountDeletionRequest,\n IAccountDeletionResponse,\n IAccountImportRequest,\n IAccountImportResponse,\n IProvider,\n Provider,\n} from './provider';\n\nexport { IMassaStationWallet } from './massaStation/MassaStationProvider';\n\nexport { MassaStationAccount } from './massaStation/MassaStationAccount';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,6BAA6B;AAC7B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAN,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC3B,2DAAsC,CAAA;IACtC,6DAAwC,CAAA;IACxC,6DAAwC,CAAA;IACxC,4DAAuC,CAAA;IACvC,uDAAkC,CAAA;IAClC,iDAA4B,CAAA;IAC5B,wEAAmD,CAAA;IACnD,4DAAuC,CAAA;IACvC,0DAAqC,CAAA;IACrC,wEAAmD,CAAA;IACnD,sDAAiC,CAAA;AACnC,CAAC,EAZW,iBAAiB,KAAjB,iBAAiB,QAY5B;AAMD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAK,GAAG,IAAI,EACZ,OAAO,GAAG,IAAI,EACd,YAAY,GAAG,GAAG;IAElB,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,SAAS,CAAC,0BAA0B,EAAE,CAAC;IAE7C,kBAAkB;IAClB,IAAI,CAAiB,CAAC;IACtB,IAAI,YAAY,EAAE,EAAE;QAClB,CAAC,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;KAClC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,QAAQ,GAAgB,EAAE,CAAC;QAE/B,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC,EAAE;YACtE,IAAI,YAAY,KAAK,2BAA2B,EAAE;gBAChD,MAAM,CAAC,GAAG,IAAI,oBAAoB,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;iBAAM;gBACL,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAClB;SACF;QAED,kBAAkB;QAClB,IAAI,CAAC,EAAE;YACL,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAClB;QAED,oDAAoD;QACpD,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,UAAU,CAAC,GAAG,EAAE;gBACd,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvE,CAAC,EAAE,YAAY,CAAC,CAAC;SAClB;aAAM;YACL,OAAO,CAAC,QAAQ,CAAC,CAAC;SACnB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,EAAE,GAAG,mBAAmB;IACrE,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC,UAAU,EAAE;QAChD,MAAM,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KAC/B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;KACtC;AACH,CAAC;AAID,OAAO,EAOL,OAAO,GAIR,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EAMtB,QAAQ,GACT,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["/** Polyfills */\nimport { Buffer } from 'buffer';\n\ndeclare global {\n interface Window {\n Buffer: typeof Buffer;\n }\n}\n\n// Check if we are on browser\nif (typeof window !== 'undefined') {\n window.Buffer = Buffer;\n}\n\nimport { MASSA_WINDOW_OBJECT, connector } from './connector/Connector';\nimport { IProvider } from './provider/IProvider';\nimport { Provider } from './provider/Provider';\nimport {\n MASSA_STATION_PROVIDER_NAME,\n MassaStationProvider,\n} from './massaStation/MassaStationProvider';\nimport { detectBearby } from './bearbyWallet/BearbyConnect';\nimport { BearbyProvider } from './bearbyWallet/BearbyProvider';\n\nexport enum AvailableCommands {\n ProviderListAccounts = 'LIST_ACCOUNTS',\n ProviderDeleteAccount = 'DELETE_ACCOUNT',\n ProviderImportAccount = 'IMPORT_ACCOUNT',\n ProviderGetNodesUrls = 'GET_NODES_URLS',\n AccountBalance = 'ACCOUNT_BALANCE',\n AccountSign = 'ACCOUNT_SIGN',\n ProviderGenerateNewAccount = 'GENERATE_NEW_ACCOUNT',\n AccountSellRolls = 'ACCOUNT_SELL_ROLLS',\n AccountBuyRolls = 'ACCOUNT_BUY_ROLLS',\n AccountSendTransaction = 'ACCOUNT_SEND_TRANSACTION',\n AccountCallSC = 'ACCOUNT_CALL_SC',\n}\n\nexport interface ITransactionDetails {\n operationId: string;\n}\n\n/**\n * Get the list of providers that are available to interact with.\n *\n * @param retry - If true, will retry to get the list of providers if none are available.\n * @param pollInterval - The timeout in milliseconds to wait between retries. default is 2000ms.\n * @param timeout - The timeout in milliseconds to wait before giving up. default is 3000ms.\n *\n * @returns An array of providers.\n */\nexport async function providers(\n retry = true,\n timeout = 3000,\n pollInterval = 500,\n): Promise<IProvider[]> {\n if (timeout <= 0) {\n return [];\n }\n\n await connector.startMassaStationDiscovery();\n\n // Look for Bearby\n let p: BearbyProvider;\n if (detectBearby()) {\n p = new BearbyProvider('Bearby');\n }\n\n return new Promise((resolve) => {\n let provider: IProvider[] = [];\n\n for (const providerName of Object.keys(connector.getWalletProviders())) {\n if (providerName === MASSA_STATION_PROVIDER_NAME) {\n const p = new MassaStationProvider();\n provider.push(p);\n } else {\n const p = new Provider(providerName);\n provider.push(p);\n }\n }\n\n // Look for Bearby\n if (p) {\n provider.push(p);\n }\n\n // If no providers are available, wait and try again\n if (retry && provider.length === 0) {\n setTimeout(() => {\n providers(retry, timeout - pollInterval, pollInterval).then(resolve);\n }, pollInterval);\n } else {\n resolve(provider);\n }\n });\n}\n\n/**\n * Manually register a provider to interact with.\n *\n * @param name - The name of the provider.\n * @param id - The id of the HTML element that is used to communicate with the provider.\n */\nexport function registerProvider(name: string, id = MASSA_WINDOW_OBJECT): void {\n const registerEvent = new CustomEvent('register', {\n detail: { providerName: name },\n });\n const element = document.getElementById(id);\n if (element) {\n element.dispatchEvent(registerEvent);\n }\n}\n\nexport { AllowedRequests, AllowedResponses } from './connector';\n\nexport {\n IAccountDetails,\n IAccountBalanceRequest,\n IAccountBalanceResponse,\n IAccountSignRequest,\n IAccountSignResponse,\n IAccount,\n Account,\n IAccountRollsRequest,\n IAccountSendTransactionRequest,\n IAccountCallSCRequest,\n} from './account';\n\nexport {\n EAccountDeletionResponse,\n EAccountImportResponse,\n IAccountDeletionRequest,\n IAccountDeletionResponse,\n IAccountImportRequest,\n IAccountImportResponse,\n IProvider,\n Provider,\n} from './provider';\n\nexport { IMassaStationWallet } from './massaStation/MassaStationProvider';\n\nexport { MassaStationAccount } from './massaStation/MassaStationAccount';\n"]}
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ async function providers(retry = true, timeout = 3000, pollInterval = 500) {
43
43
  // Look for Bearby
44
44
  let p;
45
45
  if ((0, BearbyConnect_1.detectBearby)()) {
46
- const p = new BearbyProvider_1.BearbyProvider('Bearby');
46
+ p = new BearbyProvider_1.BearbyProvider('Bearby');
47
47
  }
48
48
  return new Promise((resolve) => {
49
49
  let provider = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massalabs/wallet-provider",
3
- "version": "1.2.1-dev.20230810090154",
3
+ "version": "1.2.1-dev.20230810130757",
4
4
  "description": "massa's wallet provider",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",